@payloadcms/ui 3.79.0 → 3.80.0-internal.cee0ccf

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.
@@ -50,7 +50,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
50
50
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qs(t){return qS(t)||QS(t)||Kf(t)||KS()}import*as Ct from"react";import{useMemo as Du,Fragment as Rv,useRef as Ll,useCallback as ei,useEffect as Y_,Component as HM}from"react";import*as Yr from"react";import{useContext as $B,forwardRef as BB}from"react";var iB=!1;function aB(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function lB(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var eI=(function(){function t(o){var n=this;this._insertTag=function(r){var s;n.tags.length===0?n.insertionPoint?s=n.insertionPoint.nextSibling:n.prepend?s=n.container.firstChild:s=n.before:s=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(r,s),n.tags.push(r)},this.isSpeedy=o.speedy===void 0?!iB:o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(n){n.forEach(this._insertTag)},e.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(lB(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var s=aB(r);try{s.insertRule(n,s.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(n));this.ctr++},e.flush=function(){this.tags.forEach(function(n){var r;return(r=n.parentNode)==null?void 0:r.removeChild(n)}),this.tags=[],this.ctr=0},t})();var ko="-ms-",Cu="-moz-",dt="-webkit-",op="comm",xl="rule",wl="decl";var tI="@import";var rp="@keyframes";var oI="@layer";var rI=Math.abs,ea=String.fromCharCode,nI=Object.assign;function sI(t,e){return io(t,0)^45?(((e<<2^io(t,0))<<2^io(t,1))<<2^io(t,2))<<2^io(t,3):0}function np(t){return t.trim()}function av(t,e){return(t=e.exec(t))?t[0]:t}function lt(t,e,o){return t.replace(e,o)}function xu(t,e){return t.indexOf(e)}function io(t,e){return t.charCodeAt(e)|0}function Ks(t,e,o){return t.slice(e,o)}function qo(t){return t.length}function Sl(t){return t.length}function Il(t,e){return e.push(t),t}function lv(t,e){return t.map(e).join("")}var sp=1,_l=1,iI=0,Qo=0,bo=0,Fl="";function wu(t,e,o,n,r,s,i){return{value:t,root:e,parent:o,type:n,props:r,children:s,line:sp,column:_l,length:i,return:""}}function Dl(t,e){return nI(wu("",null,null,"",null,null,0),t,{length:-t.length},e)}function aI(){return bo}function lI(){return bo=Qo>0?io(Fl,--Qo):0,_l--,bo===10&&(_l=1,sp--),bo}function Ko(){return bo=Qo<iI?io(Fl,Qo++):0,_l++,bo===10&&(_l=1,sp++),bo}function Xr(){return io(Fl,Qo)}function Su(){return Qo}function Rl(t,e){return Ks(Fl,t,e)}function Tl(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ip(t){return sp=_l=1,iI=qo(Fl=t),Qo=0,[]}function ap(t){return Fl="",t}function Al(t){return np(Rl(Qo-1,cv(t===91?t+2:t===40?t+1:t)))}function cI(t){for(;(bo=Xr())&&bo<33;)Ko();return Tl(t)>2||Tl(bo)>3?"":" "}function uI(t,e){for(;--e&&Ko()&&!(bo<48||bo>102||bo>57&&bo<65||bo>70&&bo<97););return Rl(t,Su()+(e<6&&Xr()==32&&Ko()==32))}function cv(t){for(;Ko();)switch(bo){case t:return Qo;case 34:case 39:t!==34&&t!==39&&cv(bo);break;case 40:t===41&&cv(t);break;case 92:Ko();break}return Qo}function dI(t,e){for(;Ko()&&t+bo!==57;)if(t+bo===84&&Xr()===47)break;return"/*"+Rl(e,Qo-1)+"*"+ea(t===47?t:Ko())}function mI(t){for(;!Tl(Xr());)Ko();return Rl(t,Qo)}function hI(t){return ap(lp("",null,null,null,[""],t=ip(t),0,[0],t))}function lp(t,e,o,n,r,s,i,a,l){for(var c=0,u=0,d=i,f=0,m=0,p=0,h=1,g=1,b=1,C=0,y="",v=r,x=s,I=n,w=y;g;)switch(p=C,C=Ko()){case 40:if(p!=108&&io(w,d-1)==58){xu(w+=lt(Al(C),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:w+=Al(C);break;case 9:case 10:case 13:case 32:w+=cI(p);break;case 92:w+=uI(Su()-1,7);continue;case 47:switch(Xr()){case 42:case 47:Il(cB(dI(Ko(),Su()),e,o),l);break;default:w+="/"}break;case 123*h:a[c++]=qo(w)*b;case 125*h:case 59:case 0:switch(C){case 0:case 125:g=0;case 59+u:b==-1&&(w=lt(w,/\f/g,"")),m>0&&qo(w)-d&&Il(m>32?pI(w+";",n,o,d-1):pI(lt(w," ","")+";",n,o,d-2),l);break;case 59:w+=";";default:if(Il(I=fI(w,e,o,c,u,r,a,y,v=[],x=[],d),s),C===123)if(u===0)lp(w,e,I,I,v,s,d,a,x);else switch(f===99&&io(w,3)===110?100:f){case 100:case 108:case 109:case 115:lp(t,I,I,n&&Il(fI(t,I,I,0,0,r,a,y,r,v=[],d),x),r,x,d,a,n?v:x);break;default:lp(w,I,I,I,[""],x,0,a,x)}}c=u=m=0,h=b=1,y=w="",d=i;break;case 58:d=1+qo(w),m=p;default:if(h<1){if(C==123)--h;else if(C==125&&h++==0&&lI()==125)continue}switch(w+=ea(C),C*h){case 38:b=u>0?1:(w+="\f",-1);break;case 44:a[c++]=(qo(w)-1)*b,b=1;break;case 64:Xr()===45&&(w+=Al(Ko())),f=Xr(),u=d=qo(y=w+=mI(Su())),C++;break;case 45:p===45&&qo(w)==2&&(h=0)}}return s}function fI(t,e,o,n,r,s,i,a,l,c,u){for(var d=r-1,f=r===0?s:[""],m=Sl(f),p=0,h=0,g=0;p<n;++p)for(var b=0,C=Ks(t,d+1,d=rI(h=i[p])),y=t;b<m;++b)(y=np(h>0?f[b]+" "+C:lt(C,/&\f/g,f[b])))&&(l[g++]=y);return wu(t,e,o,r===0?xl:a,l,c,u)}function cB(t,e,o){return wu(t,e,o,op,ea(aI()),Ks(t,2,-2),0)}function pI(t,e,o,n){return wu(t,e,o,wl,Ks(t,0,n),Ks(t,n+1,-1),n)}function ta(t,e){for(var o="",n=Sl(t),r=0;r<n;r++)o+=e(t[r],r,t,e)||"";return o}function gI(t,e,o,n){switch(t.type){case oI:if(t.children.length)break;case tI:case wl:return t.return=t.return||t.value;case op:return"";case rp:return t.return=t.value+"{"+ta(t.children,n)+"}";case xl:t.value=t.props.join(",")}return qo(o=ta(t.children,n))?t.return=t.value+"{"+o+"}":""}function bI(t){var e=Sl(t);return function(o,n,r,s){for(var i="",a=0;a<e;a++)i+=t[a](o,n,r,s)||"";return i}}function vI(t){return function(e){e.root||(e=e.return)&&t(e)}}function yI(t){var e=Object.create(null);return function(o){return e[o]===void 0&&(e[o]=t(o)),e[o]}}var uB=function(e,o,n){for(var r=0,s=0;r=s,s=Xr(),r===38&&s===12&&(o[n]=1),!Tl(s);)Ko();return Rl(e,Qo)},dB=function(e,o){var n=-1,r=44;do switch(Tl(r)){case 0:r===38&&Xr()===12&&(o[n]=1),e[n]+=uB(Qo-1,o,n);break;case 2:e[n]+=Al(r);break;case 4:if(r===44){e[++n]=Xr()===58?"&\f":"",o[n]=e[n].length;break}default:e[n]+=ea(r)}while(r=Ko());return e},mB=function(e,o){return ap(dB(ip(e),o))},CI=new WeakMap,fB=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var o=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(e.props.length===1&&o.charCodeAt(0)!==58&&!CI.get(n))&&!r){CI.set(e,!0);for(var s=[],i=mB(o,s),a=n.props,l=0,c=0;l<i.length;l++)for(var u=0;u<a.length;u++,c++)e.props[c]=s[l]?i[l].replace(/&\f/g,a[u]):a[u]+" "+i[l]}}},pB=function(e){if(e.type==="decl"){var o=e.value;o.charCodeAt(0)===108&&o.charCodeAt(2)===98&&(e.return="",e.value="")}};function xI(t,e){switch(sI(t,e)){case 5103:return dt+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return dt+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return dt+t+Cu+t+ko+t+t;case 6828:case 4268:return dt+t+ko+t+t;case 6165:return dt+t+ko+"flex-"+t+t;case 5187:return dt+t+lt(t,/(\w+).+(:[^]+)/,dt+"box-$1$2"+ko+"flex-$1$2")+t;case 5443:return dt+t+ko+"flex-item-"+lt(t,/flex-|-self/,"")+t;case 4675:return dt+t+ko+"flex-line-pack"+lt(t,/align-content|flex-|-self/,"")+t;case 5548:return dt+t+ko+lt(t,"shrink","negative")+t;case 5292:return dt+t+ko+lt(t,"basis","preferred-size")+t;case 6060:return dt+"box-"+lt(t,"-grow","")+dt+t+ko+lt(t,"grow","positive")+t;case 4554:return dt+lt(t,/([^-])(transform)/g,"$1"+dt+"$2")+t;case 6187:return lt(lt(lt(t,/(zoom-|grab)/,dt+"$1"),/(image-set)/,dt+"$1"),t,"")+t;case 5495:case 3959:return lt(t,/(image-set\([^]*)/,dt+"$1$`$1");case 4968:return lt(lt(t,/(.+:)(flex-)?(.*)/,dt+"box-pack:$3"+ko+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+dt+t+t;case 4095:case 3583:case 4068:case 2532:return lt(t,/(.+)-inline(.+)/,dt+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(qo(t)-1-e>6)switch(io(t,e+1)){case 109:if(io(t,e+4)!==45)break;case 102:return lt(t,/(.+:)(.+)-([^]+)/,"$1"+dt+"$2-$3$1"+Cu+(io(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~xu(t,"stretch")?xI(lt(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(io(t,e+1)!==115)break;case 6444:switch(io(t,qo(t)-3-(~xu(t,"!important")&&10))){case 107:return lt(t,":",":"+dt)+t;case 101:return lt(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+dt+(io(t,14)===45?"inline-":"")+"box$3$1"+dt+"$2$3$1"+ko+"$2box$3")+t}break;case 5936:switch(io(t,e+11)){case 114:return dt+t+ko+lt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return dt+t+ko+lt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return dt+t+ko+lt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return dt+t+ko+t+t}return t}var hB=function(e,o,n,r){if(e.length>-1&&!e.return)switch(e.type){case wl:e.return=xI(e.value,e.length);break;case rp:return ta([Dl(e,{value:lt(e.value,"@","@"+dt)})],r);case xl:if(e.length)return lv(e.props,function(s){switch(av(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ta([Dl(e,{props:[lt(s,/:(read-\w+)/,":"+Cu+"$1")]})],r);case"::placeholder":return ta([Dl(e,{props:[lt(s,/:(plac\w+)/,":"+dt+"input-$1")]}),Dl(e,{props:[lt(s,/:(plac\w+)/,":"+Cu+"$1")]}),Dl(e,{props:[lt(s,/:(plac\w+)/,ko+"input-$1")]})],r)}return""})}},gB=[hB],uv=function(e){var o=e.key;if(o==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(h){var g=h.getAttribute("data-emotion");g.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var r=e.stylisPlugins||gB,s={},i,a=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+o+' "]'),function(h){for(var g=h.getAttribute("data-emotion").split(" "),b=1;b<g.length;b++)s[g[b]]=!0;a.push(h)});var l,c=[fB,pB];{var u,d=[gI,vI(function(h){u.insert(h)})],f=bI(c.concat(r,d)),m=function(g){return ta(hI(g),f)};l=function(g,b,C,y){u=C,m(g?g+"{"+b.styles+"}":b.styles),y&&(p.inserted[b.name]=!0)}}var p={key:o,sheet:new eI({key:o,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:l};return p.sheet.hydrate(a),p};var RB=!0;function gv(t,e,o){var n="";return o.split(" ").forEach(function(r){t[r]!==void 0?e.push(t[r]+";"):r&&(n+=r+" ")}),n}var yp=function(e,o,n){var r=e.key+"-"+o.name;(n===!1||RB===!1)&&e.registered[r]===void 0&&(e.registered[r]=o.styles)},bv=function(e,o,n){yp(e,o,n);var r=e.key+"-"+o.name;if(e.inserted[o.name]===void 0){var s=o;do e.insert(o===s?"."+r:"",s,e.sheet,!0),s=s.next;while(s!==void 0)}};function NI(t){for(var e=0,o,n=0,r=t.length;r>=4;++n,r-=4)o=t.charCodeAt(n)&255|(t.charCodeAt(++n)&255)<<8|(t.charCodeAt(++n)&255)<<16|(t.charCodeAt(++n)&255)<<24,o=(o&65535)*1540483477+((o>>>16)*59797<<16),o^=o>>>24,e=(o&65535)*1540483477+((o>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(r){case 3:e^=(t.charCodeAt(n+2)&255)<<16;case 2:e^=(t.charCodeAt(n+1)&255)<<8;case 1:e^=t.charCodeAt(n)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var LI={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var AB=!1,PB=/[A-Z]|^ms/g,EB=/_EMO_([^_]+?)_([^]*?)_EMO_/g,BI=function(e){return e.charCodeAt(1)===45},kI=function(e){return e!=null&&typeof e!="boolean"},vv=yI(function(t){return BI(t)?t:t.replace(PB,"-$&").toLowerCase()}),jI=function(e,o){switch(e){case"animation":case"animationName":if(typeof o=="string")return o.replace(EB,function(n,r,s){return Bn={name:r,styles:s,next:Bn},r})}return LI[e]!==1&&!BI(e)&&typeof o=="number"&&o!==0?o+"px":o},NB="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function Iu(t,e,o){if(o==null)return"";var n=o;if(n.__emotion_styles!==void 0)return n;switch(typeof o){case"boolean":return"";case"object":{var r=o;if(r.anim===1)return Bn={name:r.name,styles:r.styles,next:Bn},r.name;var s=o;if(s.styles!==void 0){var i=s.next;if(i!==void 0)for(;i!==void 0;)Bn={name:i.name,styles:i.styles,next:Bn},i=i.next;var a=s.styles+";";return a}return LB(t,e,o)}case"function":{if(t!==void 0){var l=Bn,c=o(t);return Bn=l,Iu(t,e,c)}break}}var u=o;if(e==null)return u;var d=e[u];return d!==void 0?d:u}function LB(t,e,o){var n="";if(Array.isArray(o))for(var r=0;r<o.length;r++)n+=Iu(t,e,o[r])+";";else for(var s in o){var i=o[s];if(typeof i!="object"){var a=i;e!=null&&e[a]!==void 0?n+=s+"{"+e[a]+"}":kI(a)&&(n+=vv(s)+":"+jI(s,a)+";")}else{if(s==="NO_COMPONENT_SELECTOR"&&AB)throw new Error(NB);if(Array.isArray(i)&&typeof i[0]=="string"&&(e==null||e[i[0]]===void 0))for(var l=0;l<i.length;l++)kI(i[l])&&(n+=vv(s)+":"+jI(s,i[l])+";");else{var c=Iu(t,e,i);switch(s){case"animation":case"animationName":{n+=vv(s)+":"+c+";";break}default:n+=s+"{"+c+"}"}}}}return n}var $I=/label:\s*([^\s;{]+)\s*(;|$)/g,Bn;function Cp(t,e,o){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var n=!0,r="";Bn=void 0;var s=t[0];if(s==null||s.raw===void 0)n=!1,r+=Iu(o,e,s);else{var i=s;r+=i[0]}for(var a=1;a<t.length;a++)if(r+=Iu(o,e,t[a]),n){var l=s;r+=l[a]}$I.lastIndex=0;for(var c="",u;(u=$I.exec(r))!==null;)c+="-"+u[1];var d=NI(r)+c;return{name:d,styles:r,next:Bn}}import*as xp from"react";var kB=function(e){return e()},jB=xp.useInsertionEffect?xp.useInsertionEffect:!1,yv=jB||kB;var MI=!1,OI=Yr.createContext(typeof HTMLElement<"u"?uv({key:"css"}):null),Jve=OI.Provider;var VI=function(e){return BB(function(o,n){var r=$B(OI);return e(o,r,n)})},GI=Yr.createContext({});var wp={}.hasOwnProperty,Cv="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",zI=function(e,o){var n={};for(var r in o)wp.call(o,r)&&(n[r]=o[r]);return n[Cv]=e,n},MB=function(e){var o=e.cache,n=e.serialized,r=e.isStringTag;return yp(o,n,r),yv(function(){return bv(o,n,r)}),null},OB=VI(function(t,e,o){var n=t.css;typeof n=="string"&&e.registered[n]!==void 0&&(n=e.registered[n]);var r=t[Cv],s=[n],i="";typeof t.className=="string"?i=gv(e.registered,s,t.className):t.className!=null&&(i=t.className+" ");var a=Cp(s,void 0,Yr.useContext(GI));i+=e.key+"-"+a.name;var l={};for(var c in t)wp.call(t,c)&&c!=="css"&&c!==Cv&&!MI&&(l[c]=t[c]);return l.className=i,o&&(l.ref=o),Yr.createElement(Yr.Fragment,null,Yr.createElement(MB,{cache:e,serialized:a,isStringTag:typeof r=="string"}),Yr.createElement(r,l))}),WI=OB;import*as Pl from"react";var i0e=Ri(EI()),Le=function(e,o){var n=arguments;if(o==null||!wp.call(o,"css"))return Pl.createElement.apply(void 0,n);var r=n.length,s=new Array(r);s[0]=WI,s[1]=zI(e,o);for(var i=2;i<r;i++)s[i]=n[i];return Pl.createElement.apply(null,s)};(function(t){var e;e||(e=t.JSX||(t.JSX={}))})(Le||(Le={}));function _u(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return Cp(e)}function HI(){var t=_u.apply(void 0,arguments),e="animation-"+t.name;return{name:e,styles:"@keyframes "+e+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function UI(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}mN();import{useContext as GB,useRef as Sv,useState as Tp,useMemo as zB,useCallback as xv,createContext as WB}from"react";import{createPortal as HB}from"react-dom";import{useLayoutEffect as VB}from"react";var Sp=VB;var UB=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],Tu=function(){};function XB(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function YI(t,e){for(var o=arguments.length,n=new Array(o>2?o-2:0),r=2;r<o;r++)n[r-2]=arguments[r];var s=[].concat(n);if(e&&t)for(var i in e)e.hasOwnProperty(i)&&e[i]&&s.push("".concat(XB(t,i)));return s.filter(function(a){return a}).map(function(a){return String(a).trim()}).join(" ")}var El=function(e){return KB(e)?e.filter(Boolean):hn(e)==="object"&&e!==null?[e]:[]},ZI=function(e){e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme;var o=lr(e,UB);return Ne({},o)},eo=function(e,o,n){var r=e.cx,s=e.getStyles,i=e.getClassNames,a=e.className;return{css:s(o,e),className:r(n??{},i(o,e),a)}};function Fu(t){return[document.documentElement,document.body,window].indexOf(t)>-1}function YB(t){return Fu(t)?window.innerHeight:t.clientHeight}function JI(t){return Fu(t)?window.pageYOffset:t.scrollTop}function Fp(t,e){if(Fu(t)){window.scrollTo(0,e);return}t.scrollTop=e}function ZB(t){var e=getComputedStyle(t),o=e.position==="absolute",n=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var r=t;r=r.parentElement;)if(e=getComputedStyle(r),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return r;return document.documentElement}function JB(t,e,o,n){return o*((t=t/n-1)*t*t+1)+e}function Ip(t,e){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Tu,r=JI(t),s=e-r,i=10,a=0;function l(){a+=i;var c=JB(a,r,s,o);Fp(t,c),a<o?window.requestAnimationFrame(l):n(t)}l()}function Iv(t,e){var o=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=e.offsetHeight/3;n.bottom+r>o.bottom?Fp(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+r,t.scrollHeight)):n.top-r<o.top&&Fp(t,Math.max(e.offsetTop-r,0))}function qB(t){var e=t.getBoundingClientRect();return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width}}function _v(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function qI(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var QI=!1,QB={get passive(){return QI=!0}},_p=typeof window<"u"?window:{};_p.addEventListener&&_p.removeEventListener&&(_p.addEventListener("p",Tu,QB),_p.removeEventListener("p",Tu,!1));var KI=QI;function e_(t){return t!=null}function KB(t){return Array.isArray(t)}function oa(t,e,o){return t?e:o}var t_=function(e){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];var s=Object.entries(e).filter(function(i){var a=gn(i,1),l=a[0];return!n.includes(l)});return s.reduce(function(i,a){var l=gn(a,2),c=l[0],u=l[1];return i[c]=u,i},{})},eM=["children","innerProps"],tM=["children","innerProps"];function oM(t){var e=t.maxHeight,o=t.menuEl,n=t.minHeight,r=t.placement,s=t.shouldScroll,i=t.isFixedPosition,a=t.controlHeight,l=ZB(o),c={placement:"bottom",maxHeight:e};if(!o||!o.offsetParent)return c;var u=l.getBoundingClientRect(),d=u.height,f=o.getBoundingClientRect(),m=f.bottom,p=f.height,h=f.top,g=o.offsetParent.getBoundingClientRect(),b=g.top,C=i?window.innerHeight:YB(l),y=JI(l),v=parseInt(getComputedStyle(o).marginBottom,10),x=parseInt(getComputedStyle(o).marginTop,10),I=b-x,w=C-h,F=I+y,S=d-y-h,R=m-C+y+v,D=y+h-x,_=160;switch(r){case"auto":case"bottom":if(w>=p)return{placement:"bottom",maxHeight:e};if(S>=p&&!i)return s&&Ip(l,R,_),{placement:"bottom",maxHeight:e};if(!i&&S>=n||i&&w>=n){s&&Ip(l,R,_);var T=i?w-v:S-v;return{placement:"bottom",maxHeight:T}}if(r==="auto"||i){var A=e,L=i?I:F;return L>=n&&(A=Math.min(L-v-a,e)),{placement:"top",maxHeight:A}}if(r==="bottom")return s&&Fp(l,R),{placement:"bottom",maxHeight:e};break;case"top":if(I>=p)return{placement:"top",maxHeight:e};if(F>=p&&!i)return s&&Ip(l,D,_),{placement:"top",maxHeight:e};if(!i&&F>=n||i&&I>=n){var P=e;return(!i&&F>=n||i&&I>=n)&&(P=i?I-x:F-x),s&&Ip(l,D,_),{placement:"top",maxHeight:P}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(r,'".'))}return c}function rM(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var o_=function(e){return e==="auto"?"bottom":e},r_=function(e,o){var n,r=e.placement,s=e.theme,i=s.borderRadius,a=s.spacing,l=s.colors;return Ne((n={label:"menu"},Ki(n,rM(r),"100%"),Ki(n,"position","absolute"),Ki(n,"width","100%"),Ki(n,"zIndex",1),n),o?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},n_=WB(null),s_=function(e){var o=e.children,n=e.minMenuHeight,r=e.maxMenuHeight,s=e.menuPlacement,i=e.menuPosition,a=e.menuShouldScrollIntoView,l=e.theme,c=GB(n_)||{},u=c.setPortalPlacement,d=Sv(null),f=Tp(r),m=gn(f,2),p=m[0],h=m[1],g=Tp(null),b=gn(g,2),C=b[0],y=b[1],v=l.spacing.controlHeight;return Sp(function(){var x=d.current;if(x){var I=i==="fixed",w=a&&!I,F=oM({maxHeight:r,menuEl:x,minHeight:n,placement:s,shouldScroll:w,isFixedPosition:I,controlHeight:v});h(F.maxHeight),y(F.placement),u?.(F.placement)}},[r,s,i,a,n,u,v]),o({ref:d,placerProps:Ne(Ne({},e),{},{placement:C||o_(s),maxHeight:p})})},nM=function(e){var o=e.children,n=e.innerRef,r=e.innerProps;return Le("div",Ee({},eo(e,"menu",{menu:!0}),{ref:n},r),o)},sM=nM,i_=function(e,o){var n=e.maxHeight,r=e.theme.spacing.baseUnit;return Ne({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},o?{}:{paddingBottom:r,paddingTop:r})},iM=function(e){var o=e.children,n=e.innerProps,r=e.innerRef,s=e.isMulti;return Le("div",Ee({},eo(e,"menuList",{"menu-list":!0,"menu-list--is-multi":s}),{ref:r},n),o)},a_=function(e,o){var n=e.theme,r=n.spacing.baseUnit,s=n.colors;return Ne({textAlign:"center"},o?{}:{color:s.neutral40,padding:"".concat(r*2,"px ").concat(r*3,"px")})},l_=a_,c_=a_,aM=function(e){var o=e.children,n=o===void 0?"No options":o,r=e.innerProps,s=lr(e,eM);return Le("div",Ee({},eo(Ne(Ne({},s),{},{children:n,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),n)},lM=function(e){var o=e.children,n=o===void 0?"Loading...":o,r=e.innerProps,s=lr(e,tM);return Le("div",Ee({},eo(Ne(Ne({},s),{},{children:n,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),n)},u_=function(e){var o=e.rect,n=e.offset,r=e.position;return{left:o.left,position:r,top:n,width:o.width,zIndex:1}},cM=function(e){var o=e.appendTo,n=e.children,r=e.controlElement,s=e.innerProps,i=e.menuPlacement,a=e.menuPosition,l=Sv(null),c=Sv(null),u=Tp(o_(i)),d=gn(u,2),f=d[0],m=d[1],p=zB(function(){return{setPortalPlacement:m}},[]),h=Tp(null),g=gn(h,2),b=g[0],C=g[1],y=xv(function(){if(r){var w=qB(r),F=a==="fixed"?0:window.pageYOffset,S=w[f]+F;(S!==b?.offset||w.left!==b?.rect.left||w.width!==b?.rect.width)&&C({offset:S,rect:w})}},[r,a,f,b?.offset,b?.rect.left,b?.rect.width]);Sp(function(){y()},[y]);var v=xv(function(){typeof c.current=="function"&&(c.current(),c.current=null),r&&l.current&&(c.current=mw(r,l.current,y,{elementResize:"ResizeObserver"in window}))},[r,y]);Sp(function(){v()},[v]);var x=xv(function(w){l.current=w,v()},[v]);if(!o&&a!=="fixed"||!b)return null;var I=Le("div",Ee({ref:x},eo(Ne(Ne({},e),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),s),n);return Le(n_.Provider,{value:p},o?HB(I,o):I)},d_=function(e){var o=e.isDisabled,n=e.isRtl;return{label:"container",direction:n?"rtl":void 0,pointerEvents:o?"none":void 0,position:"relative"}},uM=function(e){var o=e.children,n=e.innerProps,r=e.isDisabled,s=e.isRtl;return Le("div",Ee({},eo(e,"container",{"--is-disabled":r,"--is-rtl":s}),n),o)},m_=function(e,o){var n=e.theme.spacing,r=e.isMulti,s=e.hasValue,i=e.selectProps.controlShouldRenderValue;return Ne({alignItems:"center",display:r&&s&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},o?{}:{padding:"".concat(n.baseUnit/2,"px ").concat(n.baseUnit*2,"px")})},dM=function(e){var o=e.children,n=e.innerProps,r=e.isMulti,s=e.hasValue;return Le("div",Ee({},eo(e,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":s}),n),o)},f_=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},mM=function(e){var o=e.children,n=e.innerProps;return Le("div",Ee({},eo(e,"indicatorsContainer",{indicators:!0}),n),o)},XI,fM=["size"],pM=["innerProps","isRtl","size"];var hM={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},p_=function(e){var o=e.size,n=lr(e,fM);return Le("svg",Ee({height:o,width:o,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:hM},n))},Tv=function(e){return Le(p_,Ee({size:20},e),Le("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},h_=function(e){return Le(p_,Ee({size:20},e),Le("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},g_=function(e,o){var n=e.isFocused,r=e.theme,s=r.spacing.baseUnit,i=r.colors;return Ne({label:"indicatorContainer",display:"flex",transition:"color 150ms"},o?{}:{color:n?i.neutral60:i.neutral20,padding:s*2,":hover":{color:n?i.neutral80:i.neutral40}})},b_=g_,gM=function(e){var o=e.children,n=e.innerProps;return Le("div",Ee({},eo(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),o||Le(h_,null))},v_=g_,bM=function(e){var o=e.children,n=e.innerProps;return Le("div",Ee({},eo(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),o||Le(Tv,null))},y_=function(e,o){var n=e.isDisabled,r=e.theme,s=r.spacing.baseUnit,i=r.colors;return Ne({label:"indicatorSeparator",alignSelf:"stretch",width:1},o?{}:{backgroundColor:n?i.neutral10:i.neutral20,marginBottom:s*2,marginTop:s*2})},vM=function(e){var o=e.innerProps;return Le("span",Ee({},o,eo(e,"indicatorSeparator",{"indicator-separator":!0})))},yM=HI(XI||(XI=UI([`
51
51
  0%, 80%, 100% { opacity: 0; }
52
52
  40% { opacity: 1; }
53
- `]))),C_=function(e,o){var n=e.isFocused,r=e.size,s=e.theme,i=s.colors,a=s.spacing.baseUnit;return Ne({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},o?{}:{color:n?i.neutral60:i.neutral20,padding:a*2})},wv=function(e){var o=e.delay,n=e.offset;return Le("span",{css:_u({animation:"".concat(yM," 1s ease-in-out ").concat(o,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},CM=function(e){var o=e.innerProps,n=e.isRtl,r=e.size,s=r===void 0?4:r,i=lr(e,pM);return Le("div",Ee({},eo(Ne(Ne({},i),{},{innerProps:o,isRtl:n,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),o),Le(wv,{delay:0,offset:n}),Le(wv,{delay:160,offset:!0}),Le(wv,{delay:320,offset:!n}))},x_=function(e,o){var n=e.isDisabled,r=e.isFocused,s=e.theme,i=s.colors,a=s.borderRadius,l=s.spacing;return Ne({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},o?{}:{backgroundColor:n?i.neutral5:i.neutral0,borderColor:n?i.neutral10:r?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:r?i.primary:i.neutral30}})},xM=function(e){var o=e.children,n=e.isDisabled,r=e.isFocused,s=e.innerRef,i=e.innerProps,a=e.menuIsOpen;return Le("div",Ee({ref:s},eo(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":r,"control--menu-is-open":a}),i,{"aria-disabled":n||void 0}),o)},wM=xM,SM=["data"],w_=function(e,o){var n=e.theme.spacing;return o?{}:{paddingBottom:n.baseUnit*2,paddingTop:n.baseUnit*2}},IM=function(e){var o=e.children,n=e.cx,r=e.getStyles,s=e.getClassNames,i=e.Heading,a=e.headingProps,l=e.innerProps,c=e.label,u=e.theme,d=e.selectProps;return Le("div",Ee({},eo(e,"group",{group:!0}),l),Le(i,Ee({},a,{selectProps:d,theme:u,getStyles:r,getClassNames:s,cx:n}),c),Le("div",null,o))},S_=function(e,o){var n=e.theme,r=n.colors,s=n.spacing;return Ne({label:"group",cursor:"default",display:"block"},o?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},_M=function(e){var o=ZI(e);o.data;var n=lr(o,SM);return Le("div",Ee({},eo(e,"groupHeading",{"group-heading":!0}),n))},TM=IM,FM=["innerRef","isDisabled","isHidden","inputClassName"],I_=function(e,o){var n=e.isDisabled,r=e.value,s=e.theme,i=s.spacing,a=s.colors;return Ne(Ne({visibility:n?"hidden":"visible",transform:r?"translateZ(0)":""},DM),o?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},__={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},DM={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Ne({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},__)},RM=function(e){return Ne({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},__)},AM=function(e){var o=e.cx,n=e.value,r=ZI(e),s=r.innerRef,i=r.isDisabled,a=r.isHidden,l=r.inputClassName,c=lr(r,FM);return Le("div",Ee({},eo(e,"input",{"input-container":!0}),{"data-value":n||""}),Le("input",Ee({className:o({input:!0},l),ref:s,style:RM(a),disabled:i},c)))},PM=AM,T_=function(e,o){var n=e.theme,r=n.spacing,s=n.borderRadius,i=n.colors;return Ne({label:"multiValue",display:"flex",minWidth:0},o?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:r.baseUnit/2})},F_=function(e,o){var n=e.theme,r=n.borderRadius,s=n.colors,i=e.cropWithEllipsis;return Ne({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},o?{}:{borderRadius:r/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},D_=function(e,o){var n=e.theme,r=n.spacing,s=n.borderRadius,i=n.colors,a=e.isFocused;return Ne({alignItems:"center",display:"flex"},o?{}:{borderRadius:s/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},R_=function(e){var o=e.children,n=e.innerProps;return Le("div",n,o)},EM=R_,NM=R_;function LM(t){var e=t.children,o=t.innerProps;return Le("div",Ee({role:"button"},o),e||Le(Tv,{size:14}))}var kM=function(e){var o=e.children,n=e.components,r=e.data,s=e.innerProps,i=e.isDisabled,a=e.removeProps,l=e.selectProps,c=n.Container,u=n.Label,d=n.Remove;return Le(c,{data:r,innerProps:Ne(Ne({},eo(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:l},Le(u,{data:r,innerProps:Ne({},eo(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},o),Le(d,{data:r,innerProps:Ne(Ne({},eo(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(o||"option")},a),selectProps:l}))},jM=kM,A_=function(e,o){var n=e.isDisabled,r=e.isFocused,s=e.isSelected,i=e.theme,a=i.spacing,l=i.colors;return Ne({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},o?{}:{backgroundColor:s?l.primary:r?l.primary25:"transparent",color:n?l.neutral20:s?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:n?void 0:s?l.primary:l.primary50}})},$M=function(e){var o=e.children,n=e.isDisabled,r=e.isFocused,s=e.isSelected,i=e.innerRef,a=e.innerProps;return Le("div",Ee({},eo(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":r,"option--is-selected":s}),{ref:i,"aria-disabled":n},a),o)},BM=$M,P_=function(e,o){var n=e.theme,r=n.spacing,s=n.colors;return Ne({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},o?{}:{color:s.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},MM=function(e){var o=e.children,n=e.innerProps;return Le("div",Ee({},eo(e,"placeholder",{placeholder:!0}),n),o)},OM=MM,E_=function(e,o){var n=e.isDisabled,r=e.theme,s=r.spacing,i=r.colors;return Ne({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o?{}:{color:n?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},VM=function(e){var o=e.children,n=e.isDisabled,r=e.innerProps;return Le("div",Ee({},eo(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),r),o)},GM=VM,Fo={ClearIndicator:bM,Control:wM,DropdownIndicator:gM,DownChevron:h_,CrossIcon:Tv,Group:TM,GroupHeading:_M,IndicatorsContainer:mM,IndicatorSeparator:vM,Input:PM,LoadingIndicator:CM,Menu:sM,MenuList:iM,MenuPortal:cM,LoadingMessage:lM,NoOptionsMessage:aM,MultiValue:jM,MultiValueContainer:EM,MultiValueLabel:NM,MultiValueRemove:LM,Option:BM,Placeholder:OM,SelectContainer:uM,SingleValue:GM,ValueContainer:dM},N_=function(e){return Ne(Ne({},Fo),e.components)};var L_=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function zM(t,e){return!!(t===e||L_(t)&&L_(e))}function WM(t,e){if(t.length!==e.length)return!1;for(var o=0;o<t.length;o++)if(!zM(t[o],e[o]))return!1;return!0}function k_(t,e){e===void 0&&(e=WM);var o=null;function n(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];if(o&&o.lastThis===this&&e(r,o.lastArgs))return o.lastResult;var i=t.apply(this,r);return o={lastResult:i,lastArgs:r,lastThis:this},i}return n.clear=function(){o=null},n}var UM={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},XM=function(e){return Le("span",Ee({css:UM},e))},j_=XM,YM={guidance:function(e){var o=e.isSearchable,n=e.isMulti,r=e.tabSelectsValue,s=e.context,i=e.isInitialFocus;switch(s){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(r?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(e["aria-label"]||"Select"," is focused ").concat(o?",type to refine list":"",", press Down to open the menu, ").concat(n?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var o=e.action,n=e.label,r=n===void 0?"":n,s=e.labels,i=e.isDisabled;switch(o){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(e){var o=e.context,n=e.focused,r=e.options,s=e.label,i=s===void 0?"":s,a=e.selectValue,l=e.isDisabled,c=e.isSelected,u=e.isAppleDevice,d=function(h,g){return h&&h.length?"".concat(h.indexOf(g)+1," of ").concat(h.length):""};if(o==="value"&&a)return"value ".concat(i," focused, ").concat(d(a,n),".");if(o==="menu"&&u){var f=l?" disabled":"",m="".concat(c?" selected":"").concat(f);return"".concat(i).concat(m,", ").concat(d(r,n),".")}return""},onFilter:function(e){var o=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(o?" for search term "+o:"",".")}},ZM=function(e){var o=e.ariaSelection,n=e.focusedOption,r=e.focusedValue,s=e.focusableOptions,i=e.isFocused,a=e.selectValue,l=e.selectProps,c=e.id,u=e.isAppleDevice,d=l.ariaLiveMessages,f=l.getOptionLabel,m=l.inputValue,p=l.isMulti,h=l.isOptionDisabled,g=l.isSearchable,b=l.menuIsOpen,C=l.options,y=l.screenReaderStatus,v=l.tabSelectsValue,x=l.isLoading,I=l["aria-label"],w=l["aria-live"],F=Du(function(){return Ne(Ne({},YM),d||{})},[d]),S=Du(function(){var L="";if(o&&F.onChange){var P=o.option,E=o.options,B=o.removedValue,k=o.removedValues,$=o.value,j=function(K){return Array.isArray(K)?null:K},M=B||P||j($),O=M?f(M):"",V=E||k||void 0,W=V?V.map(f):[],Y=Ne({isDisabled:M&&h(M,a),label:O,labels:W},o);L=F.onChange(Y)}return L},[o,F,h,a,f]),R=Du(function(){var L="",P=n||r,E=!!(n&&a&&a.includes(n));if(P&&F.onFocus){var B={focused:P,label:f(P),isDisabled:h(P,a),isSelected:E,options:s,context:P===n?"menu":"value",selectValue:a,isAppleDevice:u};L=F.onFocus(B)}return L},[n,r,f,h,F,s,a,u]),D=Du(function(){var L="";if(b&&C.length&&!x&&F.onFilter){var P=y({count:s.length});L=F.onFilter({inputValue:m,resultsMessage:P})}return L},[s,m,b,F,C,y,x]),_=o?.action==="initial-input-focus",T=Du(function(){var L="";if(F.guidance){var P=r?"value":b?"menu":"input";L=F.guidance({"aria-label":I,context:P,isDisabled:n&&h(n,a),isMulti:p,isSearchable:g,tabSelectsValue:v,isInitialFocus:_})}return L},[I,n,r,p,h,g,b,F,a,v,_]),A=Le(Rv,null,Le("span",{id:"aria-selection"},S),Le("span",{id:"aria-focused"},R),Le("span",{id:"aria-results"},D),Le("span",{id:"aria-guidance"},T));return Le(Rv,null,Le(j_,{id:c},_&&A),Le(j_,{"aria-live":w,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!_&&A))},JM=ZM,Av=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}],qM=new RegExp("["+Av.map(function(t){return t.letters}).join("")+"]","g"),Z_={};for(Dp=0;Dp<Av.length;Dp++)for(Rp=Av[Dp],Ap=0;Ap<Rp.letters.length;Ap++)Z_[Rp.letters[Ap]]=Rp.base;var Rp,Ap,Dp,J_=function(e){return e.replace(qM,function(o){return Z_[o]})},QM=k_(J_),$_=function(e){return e.replace(/^\s+|\s+$/g,"")},KM=function(e){return"".concat(e.label," ").concat(e.value)},eO=function(e){return function(o,n){if(o.data.__isNew__)return!0;var r=Ne({ignoreCase:!0,ignoreAccents:!0,stringify:KM,trim:!0,matchFrom:"any"},e),s=r.ignoreCase,i=r.ignoreAccents,a=r.stringify,l=r.trim,c=r.matchFrom,u=l?$_(n):n,d=l?$_(a(o)):a(o);return s&&(u=u.toLowerCase(),d=d.toLowerCase()),i&&(u=QM(u),d=J_(d)),c==="start"?d.substr(0,u.length)===u:d.indexOf(u)>-1}},tO=["innerRef"];function oO(t){var e=t.innerRef,o=lr(t,tO),n=t_(o,"onExited","in","enter","exit","appear");return Le("input",Ee({ref:e},n,{css:_u({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var rO=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function nO(t){var e=t.isEnabled,o=t.onBottomArrive,n=t.onBottomLeave,r=t.onTopArrive,s=t.onTopLeave,i=Ll(!1),a=Ll(!1),l=Ll(0),c=Ll(null),u=ei(function(g,b){if(c.current!==null){var C=c.current,y=C.scrollTop,v=C.scrollHeight,x=C.clientHeight,I=c.current,w=b>0,F=v-x-y,S=!1;F>b&&i.current&&(n&&n(g),i.current=!1),w&&a.current&&(s&&s(g),a.current=!1),w&&b>F?(o&&!i.current&&o(g),I.scrollTop=v,S=!0,i.current=!0):!w&&-b>y&&(r&&!a.current&&r(g),I.scrollTop=0,S=!0,a.current=!0),S&&rO(g)}},[o,n,r,s]),d=ei(function(g){u(g,g.deltaY)},[u]),f=ei(function(g){l.current=g.changedTouches[0].clientY},[]),m=ei(function(g){var b=l.current-g.changedTouches[0].clientY;u(g,b)},[u]),p=ei(function(g){if(g){var b=KI?{passive:!1}:!1;g.addEventListener("wheel",d,b),g.addEventListener("touchstart",f,b),g.addEventListener("touchmove",m,b)}},[m,f,d]),h=ei(function(g){g&&(g.removeEventListener("wheel",d,!1),g.removeEventListener("touchstart",f,!1),g.removeEventListener("touchmove",m,!1))},[m,f,d]);return Y_(function(){if(e){var g=c.current;return p(g),function(){h(g)}}},[e,p,h]),function(g){c.current=g}}var B_=["boxSizing","height","overflow","paddingRight","position"],M_={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function O_(t){t.cancelable&&t.preventDefault()}function V_(t){t.stopPropagation()}function G_(){var t=this.scrollTop,e=this.scrollHeight,o=t+this.offsetHeight;t===0?this.scrollTop=1:o===e&&(this.scrollTop=t-1)}function z_(){return"ontouchstart"in window||navigator.maxTouchPoints}var W_=!!(typeof window<"u"&&window.document&&window.document.createElement),Ru=0,Nl={capture:!1,passive:!1};function sO(t){var e=t.isEnabled,o=t.accountForScrollbars,n=o===void 0?!0:o,r=Ll({}),s=Ll(null),i=ei(function(l){if(W_){var c=document.body,u=c&&c.style;if(n&&B_.forEach(function(p){var h=u&&u[p];r.current[p]=h}),n&&Ru<1){var d=parseInt(r.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,m=window.innerWidth-f+d||0;Object.keys(M_).forEach(function(p){var h=M_[p];u&&(u[p]=h)}),u&&(u.paddingRight="".concat(m,"px"))}c&&z_()&&(c.addEventListener("touchmove",O_,Nl),l&&(l.addEventListener("touchstart",G_,Nl),l.addEventListener("touchmove",V_,Nl))),Ru+=1}},[n]),a=ei(function(l){if(W_){var c=document.body,u=c&&c.style;Ru=Math.max(Ru-1,0),n&&Ru<1&&B_.forEach(function(d){var f=r.current[d];u&&(u[d]=f)}),c&&z_()&&(c.removeEventListener("touchmove",O_,Nl),l&&(l.removeEventListener("touchstart",G_,Nl),l.removeEventListener("touchmove",V_,Nl)))}},[n]);return Y_(function(){if(e){var l=s.current;return i(l),function(){a(l)}}},[e,i,a]),function(l){s.current=l}}var iO=function(e){var o=e.target;return o.ownerDocument.activeElement&&o.ownerDocument.activeElement.blur()},aO={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function lO(t){var e=t.children,o=t.lockEnabled,n=t.captureEnabled,r=n===void 0?!0:n,s=t.onBottomArrive,i=t.onBottomLeave,a=t.onTopArrive,l=t.onTopLeave,c=nO({isEnabled:r,onBottomArrive:s,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),u=sO({isEnabled:o}),d=function(m){c(m),u(m)};return Le(Rv,null,o&&Le("div",{onClick:iO,css:aO}),e(d))}var cO={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},uO=function(e){var o=e.name,n=e.onFocus;return Le("input",{required:!0,name:o,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:cO,value:"",onChange:function(){}})},dO=uO;function Pv(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function mO(){return Pv(/^iPhone/i)}function q_(){return Pv(/^Mac/i)}function fO(){return Pv(/^iPad/i)||q_()&&navigator.maxTouchPoints>1}function pO(){return mO()||fO()}function hO(){return q_()||pO()}var gO=function(e){return e.label},Ev=function(e){return e.label},Nv=function(e){return e.value},bO=function(e){return!!e.isDisabled},vO={clearIndicator:v_,container:d_,control:x_,dropdownIndicator:b_,group:w_,groupHeading:S_,indicatorsContainer:f_,indicatorSeparator:y_,input:I_,loadingIndicator:C_,loadingMessage:c_,menu:r_,menuList:i_,menuPortal:u_,multiValue:T_,multiValueLabel:F_,multiValueRemove:D_,noOptionsMessage:l_,option:A_,placeholder:P_,singleValue:E_,valueContainer:m_};var yO={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},CO=4,Q_=4,xO=38,wO=Q_*2,SO={baseUnit:Q_,controlHeight:xO,menuGutter:wO},Fv={borderRadius:CO,colors:yO,spacing:SO},IO={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:_v(),captureMenuScroll:!_v(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:eO(),formatGroupLabel:gO,getOptionLabel:Ev,getOptionValue:Nv,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:bO,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!qI(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var o=e.count;return"".concat(o," result").concat(o!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function H_(t,e,o,n){var r=tT(t,e,o),s=oT(t,e,o),i=eT(t,e),a=Ep(t,e);return{type:"option",data:e,isDisabled:r,isSelected:s,label:i,value:a,index:n}}function Pp(t,e){return t.options.map(function(o,n){if("options"in o){var r=o.options.map(function(i,a){return H_(t,i,e,a)}).filter(function(i){return X_(t,i)});return r.length>0?{type:"group",data:o,options:r,index:n}:void 0}var s=H_(t,o,e,n);return X_(t,s)?s:void 0}).filter(e_)}function K_(t){return t.reduce(function(e,o){return o.type==="group"?e.push.apply(e,Qs(o.options.map(function(n){return n.data}))):e.push(o.data),e},[])}function U_(t,e){return t.reduce(function(o,n){return n.type==="group"?o.push.apply(o,Qs(n.options.map(function(r){return{data:r.data,id:"".concat(e,"-").concat(n.index,"-").concat(r.index)}}))):o.push({data:n.data,id:"".concat(e,"-").concat(n.index)}),o},[])}function _O(t,e){return K_(Pp(t,e))}function X_(t,e){var o=t.inputValue,n=o===void 0?"":o,r=e.data,s=e.isSelected,i=e.label,a=e.value;return(!nT(t)||!s)&&rT(t,{label:i,value:a,data:r},n)}function TO(t,e){var o=t.focusedValue,n=t.selectValue,r=n.indexOf(o);if(r>-1){var s=e.indexOf(o);if(s>-1)return o;if(r<e.length)return e[r]}return null}function FO(t,e){var o=t.focusedOption;return o&&e.indexOf(o)>-1?o:e[0]}var Dv=function(e,o){var n,r=(n=e.find(function(s){return s.data===o}))===null||n===void 0?void 0:n.id;return r||null},eT=function(e,o){return e.getOptionLabel(o)},Ep=function(e,o){return e.getOptionValue(o)};function tT(t,e,o){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,o):!1}function oT(t,e,o){if(o.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,o);var n=Ep(t,e);return o.some(function(r){return Ep(t,r)===n})}function rT(t,e,o){return t.filterOption?t.filterOption(e,o):!0}var nT=function(e){var o=e.hideSelectedOptions,n=e.isMulti;return o===void 0?n:o},DO=1,Au=(function(t){YS(o,t);var e=JS(o);function o(n){var r;if(HS(this,o),r=e.call(this,n),r.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.isAppleDevice=hO(),r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,c){var u=r.props,d=u.onChange,f=u.name;c.name=f,r.ariaOnChange(l,c),d(l,c)},r.setValue=function(l,c,u){var d=r.props,f=d.closeMenuOnSelect,m=d.isMulti,p=d.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:p}),f&&(r.setState({inputIsHiddenAfterUpdate:!m}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:c,option:u})},r.selectOption=function(l){var c=r.props,u=c.blurInputOnSelect,d=c.isMulti,f=c.name,m=r.state.selectValue,p=d&&r.isOptionSelected(l,m),h=r.isOptionDisabled(l,m);if(p){var g=r.getOptionValue(l);r.setValue(m.filter(function(b){return r.getOptionValue(b)!==g}),"deselect-option",l)}else if(!h)d?r.setValue([].concat(Qs(m),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:f});return}u&&r.blurInput()},r.removeValue=function(l){var c=r.props.isMulti,u=r.state.selectValue,d=r.getOptionValue(l),f=u.filter(function(p){return r.getOptionValue(p)!==d}),m=oa(c,f,f[0]||null);r.onChange(m,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(oa(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,c=r.state.selectValue,u=c[c.length-1],d=c.slice(0,c.length-1),f=oa(l,d,d[0]||null);u&&r.onChange(f,{action:"pop-value",removedValue:u})},r.getFocusedOptionId=function(l){return Dv(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return U_(Pp(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];return YI.apply(void 0,[r.props.classNamePrefix].concat(c))},r.getOptionLabel=function(l){return eT(r.props,l)},r.getOptionValue=function(l){return Ep(r.props,l)},r.getStyles=function(l,c){var u=r.props.unstyled,d=vO[l](c,u);d.boxSizing="border-box";var f=r.props.styles[l];return f?f(d,c):d},r.getClassNames=function(l,c){var u,d;return(u=(d=r.props.classNames)[l])===null||u===void 0?void 0:u.call(d,c)},r.getElementId=function(l){return"".concat(r.state.instancePrefix,"-").concat(l)},r.getComponents=function(){return N_(r.props)},r.buildCategorizedOptions=function(){return Pp(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return K_(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(l,c){r.setState({ariaSelection:Ne({value:l},c)})},r.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(l){r.blockOptionHover=!1},r.onControlMouseDown=function(l){if(!l.defaultPrevented){var c=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&r.onMenuClose():c&&r.openMenu("first"):(c&&(r.openAfterFocus=!0),r.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},r.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!r.props.isDisabled){var c=r.props,u=c.isMulti,d=c.menuIsOpen;r.focusInput(),d?(r.setState({inputIsHiddenAfterUpdate:!u}),r.onMenuClose()):r.openMenu("first"),l.preventDefault()}},r.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(r.clearValue(),l.preventDefault(),r.openAfterFocus=!1,l.type==="touchend"?r.focusInput():setTimeout(function(){return r.focusInput()}))},r.onScroll=function(l){typeof r.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&Fu(l.target)&&r.props.onMenuClose():typeof r.props.closeMenuOnScroll=="function"&&r.props.closeMenuOnScroll(l)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(l){var c=l.touches,u=c&&c.item(0);u&&(r.initialTouchX=u.clientX,r.initialTouchY=u.clientY,r.userIsDragging=!1)},r.onTouchMove=function(l){var c=l.touches,u=c&&c.item(0);if(u){var d=Math.abs(u.clientX-r.initialTouchX),f=Math.abs(u.clientY-r.initialTouchY),m=5;r.userIsDragging=d>m||f>m}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var c=r.props.inputValue,u=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(u,{action:"input-change",prevInputValue:c}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var c=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:c}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var c=r.getFocusableOptions(),u=c.indexOf(l);r.setState({focusedOption:l,focusedOptionId:u>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return nT(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var c=r.props,u=c.isMulti,d=c.backspaceRemovesValue,f=c.escapeClearsValue,m=c.inputValue,p=c.isClearable,h=c.isDisabled,g=c.menuIsOpen,b=c.onKeyDown,C=c.tabSelectsValue,y=c.openMenuOnFocus,v=r.state,x=v.focusedOption,I=v.focusedValue,w=v.selectValue;if(!h&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!u||m)return;r.focusValue("previous");break;case"ArrowRight":if(!u||m)return;r.focusValue("next");break;case"Delete":case"Backspace":if(m)return;if(I)r.removeValue(I);else{if(!d)return;u?r.popValue():p&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!g||!C||!x||y&&r.isOptionSelected(x,w))return;r.selectOption(x);break;case"Enter":if(l.keyCode===229)break;if(g){if(!x||r.isComposing)return;r.selectOption(x);break}return;case"Escape":g?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:m}),r.onMenuClose()):p&&f&&r.clearValue();break;case" ":if(m)return;if(!g){r.openMenu("first");break}if(!x)return;r.selectOption(x);break;case"ArrowUp":g?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":g?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!g)return;r.focusOption("pageup");break;case"PageDown":if(!g)return;r.focusOption("pagedown");break;case"Home":if(!g)return;r.focusOption("first");break;case"End":if(!g)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++DO),r.state.selectValue=El(n.value),n.menuIsOpen&&r.state.selectValue.length){var s=r.getFocusableOptionsWithIds(),i=r.buildFocusableOptions(),a=i.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=s,r.state.focusedOption=i[a],r.state.focusedOptionId=Dv(s,i[a])}return r}return XS(o,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Iv(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(r){var s=this.props,i=s.isDisabled,a=s.menuIsOpen,l=this.state.isFocused;(l&&!i&&r.isDisabled||l&&a&&!r.menuIsOpen)&&this.focusInput(),l&&i&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Iv(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(r,s){this.props.onInputChange(r,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var s=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),u=r==="first"?0:c.length-1;if(!this.props.isMulti){var d=c.indexOf(a[0]);d>-1&&(u=d)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[u],focusedOptionId:this.getFocusedOptionId(c[u])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(r){var s=this.state,i=s.selectValue,a=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,u=-1;if(i.length){switch(r){case"previous":l===0?u=0:l===-1?u=c:u=l-1;break;case"next":l>-1&&l<c&&(u=l+1);break}this.setState({inputIsHidden:u!==-1,focusedValue:i[u]})}}}},{key:"focusOption",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),r==="up"?l=c>0?c-1:a.length-1:r==="down"?l=(c+1)%a.length:r==="pageup"?(l=c-s,l<0&&(l=0)):r==="pagedown"?(l=c+s,l>a.length-1&&(l=a.length-1)):r==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Fv):Ne(Ne({},Fv),this.props.theme):Fv}},{key:"getCommonProps",value:function(){var r=this.clearValue,s=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,u=this.setValue,d=this.props,f=d.isMulti,m=d.isRtl,p=d.options,h=this.hasValue();return{clearValue:r,cx:s,getStyles:i,getClassNames:a,getValue:l,hasValue:h,isMulti:f,isRtl:m,options:p,selectOption:c,selectProps:d,setValue:u,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,s=r.isClearable,i=r.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(r,s){return tT(this.props,r,s)}},{key:"isOptionSelected",value:function(r,s){return oT(this.props,r,s)}},{key:"filterOption",value:function(r,s){return rT(this.props,r,s)}},{key:"formatOptionLabel",value:function(r,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(r,{context:s,inputValue:i,selectValue:a})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var r=this.props,s=r.isDisabled,i=r.isSearchable,a=r.inputId,l=r.inputValue,c=r.tabIndex,u=r.form,d=r.menuIsOpen,f=r.required,m=this.getComponents(),p=m.Input,h=this.state,g=h.inputIsHidden,b=h.ariaSelection,C=this.commonProps,y=a||this.getElementId("input"),v=Ne(Ne(Ne({"aria-autocomplete":"list","aria-expanded":d,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},d&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?Ct.createElement(p,Ee({},C,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:y,innerRef:this.getInputRef,isDisabled:s,isHidden:g,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:u,type:"text",value:l},v)):Ct.createElement(oO,Ee({id:y,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:Tu,onFocus:this.onInputFocus,disabled:s,tabIndex:c,inputMode:"none",form:u,value:""},v))}},{key:"renderPlaceholderOrValue",value:function(){var r=this,s=this.getComponents(),i=s.MultiValue,a=s.MultiValueContainer,l=s.MultiValueLabel,c=s.MultiValueRemove,u=s.SingleValue,d=s.Placeholder,f=this.commonProps,m=this.props,p=m.controlShouldRenderValue,h=m.isDisabled,g=m.isMulti,b=m.inputValue,C=m.placeholder,y=this.state,v=y.selectValue,x=y.focusedValue,I=y.isFocused;if(!this.hasValue()||!p)return b?null:Ct.createElement(d,Ee({},f,{key:"placeholder",isDisabled:h,isFocused:I,innerProps:{id:this.getElementId("placeholder")}}),C);if(g)return v.map(function(F,S){var R=F===x,D="".concat(r.getOptionLabel(F),"-").concat(r.getOptionValue(F));return Ct.createElement(i,Ee({},f,{components:{Container:a,Label:l,Remove:c},isFocused:R,isDisabled:h,key:D,index:S,removeProps:{onClick:function(){return r.removeValue(F)},onTouchEnd:function(){return r.removeValue(F)},onMouseDown:function(T){T.preventDefault()}},data:F}),r.formatOptionLabel(F,"value"))});if(b)return null;var w=v[0];return Ct.createElement(u,Ee({},f,{data:w,isDisabled:h}),this.formatOptionLabel(w,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),s=r.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,u=this.state.isFocused;if(!this.isClearable()||!s||l||!this.hasValue()||c)return null;var d={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return Ct.createElement(s,Ee({},i,{innerProps:d,isFocused:u}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),s=r.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,u=this.state.isFocused;if(!s||!c)return null;var d={"aria-hidden":"true"};return Ct.createElement(s,Ee({},i,{innerProps:d,isDisabled:l,isFocused:u}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator,i=r.IndicatorSeparator;if(!s||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return Ct.createElement(i,Ee({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator;if(!s)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return Ct.createElement(s,Ee({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,s=this.getComponents(),i=s.Group,a=s.GroupHeading,l=s.Menu,c=s.MenuList,u=s.MenuPortal,d=s.LoadingMessage,f=s.NoOptionsMessage,m=s.Option,p=this.commonProps,h=this.state.focusedOption,g=this.props,b=g.captureMenuScroll,C=g.inputValue,y=g.isLoading,v=g.loadingMessage,x=g.minMenuHeight,I=g.maxMenuHeight,w=g.menuIsOpen,F=g.menuPlacement,S=g.menuPosition,R=g.menuPortalTarget,D=g.menuShouldBlockScroll,_=g.menuShouldScrollIntoView,T=g.noOptionsMessage,A=g.onMenuScrollToTop,L=g.onMenuScrollToBottom;if(!w)return null;var P=function(O,V){var W=O.type,Y=O.data,z=O.isDisabled,K=O.isSelected,U=O.label,X=O.value,ne=h===Y,Z=z?void 0:function(){return r.onOptionHover(Y)},J=z?void 0:function(){return r.selectOption(Y)},re="".concat(r.getElementId("option"),"-").concat(V),me={id:re,onClick:J,onMouseMove:Z,onMouseOver:Z,tabIndex:-1,role:"option","aria-selected":r.isAppleDevice?void 0:K};return Ct.createElement(m,Ee({},p,{innerProps:me,data:Y,isDisabled:z,isSelected:K,key:re,label:U,type:W,value:X,isFocused:ne,innerRef:ne?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(O.data,"menu"))},E;if(this.hasOptions())E=this.getCategorizedOptions().map(function(M){if(M.type==="group"){var O=M.data,V=M.options,W=M.index,Y="".concat(r.getElementId("group"),"-").concat(W),z="".concat(Y,"-heading");return Ct.createElement(i,Ee({},p,{key:Y,data:O,options:V,Heading:a,headingProps:{id:z,data:M.data},label:r.formatGroupLabel(M.data)}),M.options.map(function(K){return P(K,"".concat(W,"-").concat(K.index))}))}else if(M.type==="option")return P(M,"".concat(M.index))});else if(y){var B=v({inputValue:C});if(B===null)return null;E=Ct.createElement(d,p,B)}else{var k=T({inputValue:C});if(k===null)return null;E=Ct.createElement(f,p,k)}var $={minMenuHeight:x,maxMenuHeight:I,menuPlacement:F,menuPosition:S,menuShouldScrollIntoView:_},j=Ct.createElement(s_,Ee({},p,$),function(M){var O=M.ref,V=M.placerProps,W=V.placement,Y=V.maxHeight;return Ct.createElement(l,Ee({},p,$,{innerRef:O,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:y,placement:W}),Ct.createElement(lO,{captureEnabled:b,onTopArrive:A,onBottomArrive:L,lockEnabled:D},function(z){return Ct.createElement(c,Ee({},p,{innerRef:function(U){r.getMenuListRef(U),z(U)},innerProps:{role:"listbox","aria-multiselectable":p.isMulti,id:r.getElementId("listbox")},isLoading:y,maxHeight:Y,focusedOption:h}),E)}))});return R||S==="fixed"?Ct.createElement(u,Ee({},p,{appendTo:R,controlElement:this.controlRef,menuPlacement:F,menuPosition:S}),j):j}},{key:"renderFormField",value:function(){var r=this,s=this.props,i=s.delimiter,a=s.isDisabled,l=s.isMulti,c=s.name,u=s.required,d=this.state.selectValue;if(u&&!this.hasValue()&&!a)return Ct.createElement(dO,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=d.map(function(h){return r.getOptionValue(h)}).join(i);return Ct.createElement("input",{name:c,type:"hidden",value:f})}else{var m=d.length>0?d.map(function(h,g){return Ct.createElement("input",{key:"i-".concat(g),name:c,type:"hidden",value:r.getOptionValue(h)})}):Ct.createElement("input",{name:c,type:"hidden",value:""});return Ct.createElement("div",null,m)}else{var p=d[0]?this.getOptionValue(d[0]):"";return Ct.createElement("input",{name:c,type:"hidden",value:p})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,s=this.state,i=s.ariaSelection,a=s.focusedOption,l=s.focusedValue,c=s.isFocused,u=s.selectValue,d=this.getFocusableOptions();return Ct.createElement(JM,Ee({},r,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:u,focusableOptions:d,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),s=r.Control,i=r.IndicatorsContainer,a=r.SelectContainer,l=r.ValueContainer,c=this.props,u=c.className,d=c.id,f=c.isDisabled,m=c.menuIsOpen,p=this.state.isFocused,h=this.commonProps=this.getCommonProps();return Ct.createElement(a,Ee({},h,{className:u,innerProps:{id:d,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:p}),this.renderLiveRegion(),Ct.createElement(s,Ee({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:p,menuIsOpen:m}),Ct.createElement(l,Ee({},h,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),Ct.createElement(i,Ee({},h,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,s){var i=s.prevProps,a=s.clearFocusValueOnUpdate,l=s.inputIsHiddenAfterUpdate,c=s.ariaSelection,u=s.isFocused,d=s.prevWasFocused,f=s.instancePrefix,m=r.options,p=r.value,h=r.menuIsOpen,g=r.inputValue,b=r.isMulti,C=El(p),y={};if(i&&(p!==i.value||m!==i.options||h!==i.menuIsOpen||g!==i.inputValue)){var v=h?_O(r,C):[],x=h?U_(Pp(r,C),"".concat(f,"-option")):[],I=a?TO(s,C):null,w=FO(s,v),F=Dv(x,w);y={selectValue:C,focusedOption:w,focusedOptionId:F,focusableOptionsWithIds:x,focusedValue:I,clearFocusValueOnUpdate:!1}}var S=l!=null&&r!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},R=c,D=u&&d;return u&&!D&&(R={value:oa(b,C,C[0]||null),options:C,action:"initial-input-focus"},D=!d),c?.action==="initial-input-focus"&&(R=null),Ne(Ne(Ne({},y),S),{},{prevProps:r,ariaSelection:R,prevWasFocused:D})}}]),o})(HM);Au.defaultProps=IO;import"react-dom";var AO=RO(function(t,e){var o=tp(t);return sT.createElement(Au,Ee({ref:e},o))}),iT=AO;import*as uT from"react";import{forwardRef as NO}from"react";import{useMemo as aT,useCallback as PO}from"react";var EO=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],lT=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=String(e).toLowerCase(),s=String(n.getOptionValue(o)).toLowerCase(),i=String(n.getOptionLabel(o)).toLowerCase();return s===r||i===r},Lv={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,o,n,r){return!(!e||o.some(function(s){return lT(e,s,r)})||n.some(function(s){return lT(e,s,r)}))},getNewOptionData:function(e,o){return{label:o,value:e,__isNew__:!0}}};function cT(t){var e=t.allowCreateWhileLoading,o=e===void 0?!1:e,n=t.createOptionPosition,r=n===void 0?"last":n,s=t.formatCreateLabel,i=s===void 0?Lv.formatCreateLabel:s,a=t.isValidNewOption,l=a===void 0?Lv.isValidNewOption:a,c=t.getNewOptionData,u=c===void 0?Lv.getNewOptionData:c,d=t.onCreateOption,f=t.options,m=f===void 0?[]:f,p=t.onChange,h=lr(t,EO),g=h.getOptionValue,b=g===void 0?Nv:g,C=h.getOptionLabel,y=C===void 0?Ev:C,v=h.inputValue,x=h.isLoading,I=h.isMulti,w=h.value,F=h.name,S=aT(function(){return l(v,El(w),m,{getOptionValue:b,getOptionLabel:y})?u(v,i(v)):void 0},[i,u,y,b,v,l,m,w]),R=aT(function(){return(o||!x)&&S?r==="first"?[S].concat(Qs(m)):[].concat(Qs(m),[S]):m},[o,r,x,S,m]),D=PO(function(_,T){if(T.action!=="select-option")return p(_,T);var A=Array.isArray(_)?_:[_];if(A[A.length-1]===S){if(d)d(v);else{var L=u(v,v),P={action:"create-option",name:F,option:L};p(oa(I,[].concat(Qs(El(w)),[L]),L),P)}return}p(_,T)},[u,v,I,F,S,d,p,w]);return Ne(Ne({},h),{},{options:R,onChange:D})}import"react-dom";var LO=NO(function(t,e){var o=tp(t),n=cT(o);return uT.createElement(Au,Ee({ref:e},n))}),dT=LO;import{jsx as mT}from"react/jsx-runtime";import"react";var fT="clear-indicator",kv=t=>{let{clearValue:e,innerProps:{ref:o,...n}}=t;return mT("div",{className:fT,ref:typeof o=="string"?null:o,...n,onKeyDown:r=>{r.key==="Enter"&&(e(),r.stopPropagation())},role:"button",tabIndex:0,children:mT(vt,{className:`${fT}__icon`})})};import{jsx as pT}from"react/jsx-runtime";import kO from"react";var jv=t=>{let{children:e,innerProps:o,selectProps:{customProps:{disableKeyDown:n,disableMouseDown:r}={}}={}}=t;return pT(kO.Fragment,{children:pT(Fo.Control,{...t,innerProps:{...o,onKeyDown:s=>{if(n){s.stopPropagation();let i=new CustomEvent("bypassKeyDown",{detail:s});document.dispatchEvent(i)}},onMouseDown:s=>{r||o.onMouseDown(s)}},children:e})})};import{jsx as hT}from"react/jsx-runtime";import"react";var gT="dropdown-indicator",$v=t=>{let{innerProps:{ref:e,...o}}=t;return hT("button",{className:gT,ref:e,...o,onKeyDown:n=>{n.key==="Enter"&&(n.key=" ")},type:"button",children:hT(He,{className:`${gT}__icon`})})};import{jsx as bT}from"react/jsx-runtime";import jO from"react";var Bv=t=>bT(jO.Fragment,{children:bT(Fo.Input,{...t,"aria-activedescendant":void 0})});import{c as $O}from"react/compiler-runtime";import{jsx as vT}from"react/jsx-runtime";import BO from"react";var yT="multi-value";function Mv(t,e){return typeof e=="function"?e(t):t?.value}var Ov=t=>{let e=$O(24),{className:o,data:n,innerProps:r,isDisabled:s,selectProps:i}=t,a;e[0]!==i?(a=i===void 0?{}:i,e[0]=i,e[1]=a):a=e[1];let{customProps:l,getOptionValue:c,isSortable:u}=a,d;e[2]!==l?(d=l===void 0?{}:l,e[2]=l,e[3]=d):d=e[3];let{disableMouseDown:f}=d,m;e[4]!==n||e[5]!==c?(m=Mv(n,c),e[4]=n,e[5]=c,e[6]=m):m=e[6];let p=m,h=!u,g;e[7]!==p||e[8]!==h?(g={id:p,disabled:h},e[7]=p,e[8]=h,e[9]=g):g=e[9];let{attributes:b,isDragging:C,listeners:y,setNodeRef:v,transform:x}=il(g),I=!s&&u&&"draggable",w=C&&`${yT}--is-dragging`,F;e[10]!==o||e[11]!==I||e[12]!==w?(F=[yT,o,I,w].filter(Boolean),e[10]=o,e[11]=I,e[12]=w,e[13]=F):F=e[13];let S=F.join(" "),R;if(e[14]!==b||e[15]!==S||e[16]!==f||e[17]!==r||e[18]!==u||e[19]!==y||e[20]!==t||e[21]!==v||e[22]!==x){let{onMouseDown:D,..._}=y||{};R=vT(BO.Fragment,{children:vT(Fo.MultiValue,{...t,className:S,innerProps:{...u?{...b,..._}:{},...r,onMouseDown:T=>{u&&D&&D(T),f||T.stopPropagation()},ref:v,style:u?{transform:x,...b?.style}:{}}})}),e[14]=b,e[15]=S,e[16]=f,e[17]=r,e[18]=u,e[19]=y,e[20]=t,e[21]=v,e[22]=x,e[23]=R}else R=e[23];return R};import{jsx as CT}from"react/jsx-runtime";import{getTranslation as MO}from"@payloadcms/translations";import"react";var xT="multi-value-label",Vv=t=>{let{data:e,selectProps:o}=t,{customProps:n}=o===void 0?{}:o,{draggableProps:r,editableProps:s}=n===void 0?{}:n,{i18n:i}=N(),a=`${xT}__text`,l=e.label?MO(e.label,i):"";return CT("div",{className:xT,title:typeof l=="string"?l:"",children:CT(Fo.MultiValueLabel,{...t,innerProps:{className:a,...s&&s(e,a,t.selectProps)||{},...r||{}}})})};import{c as OO}from"react/compiler-runtime";import{jsx as wT,jsxs as VO}from"react/jsx-runtime";import GO from"react";var Gv="multi-value-remove",zv=t=>{let e=OO(12),{innerProps:o}=t,{className:n,onClick:r,onTouchEnd:s}=o,[i,a]=GO.useState(!1),{t:l}=N(),c;if(e[0]!==n||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==l){let u=l("general:remove"),d;e[6]!==n?(d=[Gv,n].filter(Boolean),e[6]=n,e[7]=d):d=e[7];let f;e[8]!==r?(f=h=>{a(!1),r(h)},e[8]=r,e[9]=f):f=e[9];let m,p;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),p=()=>a(!1),e[10]=m,e[11]=p):(m=e[10],p=e[11]),c=VO("button",{"aria-label":u,className:d.join(" "),onClick:f,onKeyDown:zO,onMouseDown:WO,onMouseEnter:m,onMouseLeave:p,onTouchEnd:s,type:"button",children:[wT(Ao,{className:`${Gv}__tooltip`,show:i,children:l("general:remove")}),wT(vt,{className:`${Gv}__icon`})]}),e[0]=n,e[1]=r,e[2]=s,e[3]=i,e[4]=l,e[5]=c}else c=e[5];return c};function zO(t){t.key==="Enter"&&t.stopPropagation()}function WO(t){return t.stopPropagation()}import{jsx as ST}from"react/jsx-runtime";import HO from"react";var UO="react-select--single-value",Wv=t=>{let{children:e,className:o}=t;return ST(HO.Fragment,{children:ST(Fo.SingleValue,{...t,className:[UO,o].filter(Boolean).join(" "),children:e})})};import{jsx as IT,jsxs as XO}from"react/jsx-runtime";import{getTranslation as YO}from"@payloadcms/translations";import"react";var _T="value-container",Hv=t=>{let{selectProps:e}=t,{customProps:o,value:n}=e===void 0?{}:e,{i18n:r}=N(),s="";if(n&&!Array.isArray(n)&&typeof n=="object"&&"label"in n){let i=n.label?YO(n.label,r):"";s=typeof i=="string"?i:""}return XO("div",{className:_T,ref:o?.droppableRef,title:s,children:[o?.valueContainerLabel&&IT("span",{className:`${_T}__label`,children:o?.valueContainerLabel}),IT(Fo.ValueContainer,{...t})]})};var qO=t=>({label:t,value:t}),DT=t=>{let{i18n:e,t:o}=N(),[n,r]=FT.useState(""),s=JO(),[i,a]=FT.useState(!1);ZO(()=>{a(!0)},[]);let{className:l,components:c,customProps:u,disabled:d=!1,filterOption:f=void 0,getOptionValue:m,isClearable:p=!0,isCreatable:h,isLoading:g,isSearchable:b=!0,noOptionsMessage:C=()=>o("general:noOptions"),numberOnly:y=!1,onChange:v,onMenuClose:x,onMenuOpen:I,options:w,placeholder:F=o("general:selectValue"),showError:S,value:R}=t,D=()=>o("general:loading")+"...",_=[l,"react-select",S&&"react-select--error"].filter(Boolean).join(" "),T={menu:L=>({...L,zIndex:void 0})};if(!i)return ra(Et,{height:"calc(var(--base) * 2 + 2px)"});if(!h)return ra(iT,{captureMenuScroll:!0,customProps:u,isLoading:g,...t,className:_,classNamePrefix:"rs",components:{ClearIndicator:kv,Control:jv,DropdownIndicator:$v,Input:Bv,MultiValue:Ov,MultiValueLabel:Vv,MultiValueRemove:zv,SingleValue:Wv,ValueContainer:Hv,...c},filterOption:f,getOptionValue:m,instanceId:s,isClearable:p,isDisabled:d,isSearchable:b,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:C,onChange:v,onMenuClose:x,onMenuOpen:I,options:w,placeholder:TT(F,e),styles:T,unstyled:!0,value:R});let A=L=>{if(y===!0){let P=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],E=!/\D/.test(L.key),B=P.includes(L.key);if(!E&&!B){L.preventDefault();return}}if(!(!R||!n||n.trim()==="")&&!(f&&!f(null,n))&&!L.nativeEvent.isComposing)switch(L.key){case"Enter":case"Tab":v([...R,qO(n)]),r(""),L.preventDefault();break;default:break}};return ra(dT,{captureMenuScroll:!0,isLoading:g,...t,className:_,classNamePrefix:"rs",components:{ClearIndicator:kv,Control:jv,DropdownIndicator:$v,Input:Bv,MultiValue:Ov,MultiValueLabel:Vv,MultiValueRemove:zv,SingleValue:Wv,ValueContainer:Hv,...c},filterOption:f,inputValue:n,instanceId:s,isClearable:p,isDisabled:d,isSearchable:b,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:C,onChange:v,onInputChange:L=>r(L),onKeyDown:A,onMenuClose:x,onMenuOpen:I,options:w,placeholder:TT(F,e),styles:T,unstyled:!0,value:R})},QO=t=>{let{getOptionValue:e,onChange:o,value:n}=t,r=[];return n&&(r=(Array.isArray(n)?n:[n]).map(s=>Mv(s,e))),ra(Vr,{className:"react-select-container",ids:r,onDragEnd:({moveFromIndex:s,moveToIndex:i})=>{let a=n;n&&Array.isArray(n)&&(a=pf(n,s,i)),o(a)},children:ra(DT,{...t})})},pt=t=>{let{isMulti:e,isSortable:o}=t;return e&&o?ra(QO,{...t}):ra(DT,{...t})};var Pu=t=>t.map(e=>typeof e=="object"&&(e.value||e.value==="")?e:{label:e,value:e});var Eu=t=>{let{id:e,onChange:o,options:n,readOnly:r,required:s,selectedTimezone:i}=t,{t:a}=N(),l=Pu(n),c=e7(()=>l.find(d=>(typeof d=="string"?d:d.value)===(i||"UTC")),[l,i]),u=!!r||l.length===1;return KO("div",{className:"timezone-picker-wrapper",children:[RT(Ce,{htmlFor:e,label:`${a("general:timezone")} ${s?"*":""}`,required:s,unstyled:!0}),RT(pt,{className:"timezone-picker",disabled:u,inputId:e,isClearable:!s,isCreatable:!1,onChange:d=>{o&&o(d?.value||"")},options:l,value:c})]})};var PT="date-time-field",o7=t=>{let{field:e,field:{admin:{className:o,date:n,description:r,placeholder:s}={},label:i,localized:a,required:l,timezone:c},path:u,readOnly:d,validate:f}=t,m=n?.pickerAppearance||"default",p=Intl.DateTimeFormat().resolvedOptions().timeZone,{config:h}=H(),{i18n:g}=N(),{dispatchFields:b,setModified:C}=$e(),y=Uv((V,W)=>{if(typeof f=="function")return f(V,{...W,required:l})},[f,l]),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Error:w,Label:F}={},disabled:S,path:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:u,validate:y}),A=R+"_tz",L=Vt(([V,W])=>V?.[A]),P=Xv(()=>c&&typeof c=="object"&&c.supportedTimezones?c.supportedTimezones:h.admin.timezones.supportedTimezones,[h.admin.timezones.supportedTimezones,c]),E=["dayOnly","default","monthOnly"].includes(m),B=L?.value,k=l||c&&typeof c=="object"&&c.required,$=Xv(()=>{if(c&&B&&p&&T){let V=no.tz(B),W=no.tz(p),Y=new no(T).withTimeZone(B),z=un(Y,V);return un(z,W).toISOString()}return T},[c,B,T,p]),j=Xv(()=>et(e),[e]),M=Uv(V=>{if(!(d||S))if(c&&B&&V){let W=no.tz(B);if(E){let Y=V.getTimezoneOffset()/60,z=V.getHours()+Y;V.setHours(z);let K=un(V,W);D(K.toISOString()||null)}else{let Y=new no(V),z=un(Y,W);D(z.toISOString()||null)}}else D(V?.toISOString()||null)},[d,S,c,B,E,D]),O=Uv(V=>{A&&(b({type:"UPDATE",path:A,value:V}),C(!0))},[b,C,A]);return AT("div",{className:[Ae,PT,o,_&&`${PT}--has-error`,(d||S)&&"read-only"].filter(Boolean).join(" "),style:j,children:[ti(ue,{CustomComponent:F,Fallback:ti(Ce,{label:i,localized:a,path:R,required:l})}),AT("div",{className:`${Ae}__wrap`,id:`field-${R.replace(/\./g,"__")}`,children:[ti(ue,{CustomComponent:w,Fallback:ti(Ze,{path:R,showError:_})}),x,ti(Cl,{...n,onChange:M,overrides:{...n?.overrides},placeholder:t7(s,g),readOnly:d||S,value:$}),c&&P.length>0&&ti(Eu,{id:`${R}-timezone-picker`,onChange:O,options:P,readOnly:d||S,required:k,selectedTimezone:B}),v]}),ti(ue,{CustomComponent:I,Fallback:ti(Xe,{description:r,path:R})})]})},Nu=ze(o7);import{jsx as na,jsxs as ET}from"react/jsx-runtime";import{getTranslation as r7}from"@payloadcms/translations";import{useCallback as n7,useMemo as s7}from"react";var i7=t=>{let{field:e,field:{admin:{autoComplete:o,className:n,description:r,placeholder:s}={},label:i,localized:a,required:l}={},path:c,readOnly:u,validate:d}=t,{i18n:f}=N(),m=n7((S,R)=>{if(typeof d=="function")return d(S,{...R,required:l})},[d,l]),{customComponents:{AfterInput:p,BeforeInput:h,Description:g,Error:b,Label:C}={},disabled:y,path:v,setValue:x,showError:I,value:w}=Te({potentiallyStalePath:c,validate:m}),F=s7(()=>et(e),[e]);return ET("div",{className:[Ae,"email",n,I&&"error",(u||y)&&"read-only"].filter(Boolean).join(" "),style:F,children:[na(ue,{CustomComponent:C,Fallback:na(Ce,{label:i,localized:a,path:v,required:l})}),ET("div",{className:`${Ae}__wrap`,children:[na(ue,{CustomComponent:b,Fallback:na(Ze,{path:v,showError:I})}),h,na("input",{autoComplete:o,disabled:u||y,id:`field-${v.replace(/\./g,"__")}`,name:v,onChange:x,placeholder:r7(s,f),required:l,type:"email",value:w||""}),p]}),na(ue,{CustomComponent:g,Fallback:na(Xe,{description:r,path:v})})]})},sa=ze(i7);import{jsx as hs,jsxs as Np}from"react/jsx-runtime";import{getTranslation as g7}from"@payloadcms/translations";import{groupHasName as VT}from"payload/shared";import{useMemo as b7}from"react";import{jsx as a7}from"react/jsx-runtime";import{createContext as l7,use as c7}from"react";var NT=l7(!1),LT=({children:t,withinRow:e=!0})=>a7(NT,{value:e,children:t}),kT=()=>c7(NT);import{jsx as u7}from"react/jsx-runtime";import{createContext as d7,use as m7}from"react";var jT=d7(!1),Yv=({children:t,withinTab:e=!0})=>u7(jT,{value:e,children:t}),$T=()=>m7(jT);import{jsx as f7}from"react/jsx-runtime";import{createContext as p7,use as h7}from"react";var BT=p7(!1),MT=({children:t,withinGroup:e=!0})=>f7(BT,{value:e,children:t}),OT=()=>h7(BT);var bn="group-field",v7=t=>{let{field:e,field:{admin:{className:o,description:n,hideGutter:r}={},fields:s,label:i},indexPath:a,parentPath:l,parentSchemaPath:c,path:u,permissions:d,readOnly:f,schemaPath:m}=t,p=m??(e.type==="group"&&VT(e)?e.name:u),{i18n:h}=N(),{isWithinCollapsible:g}=Zs(),b=OT(),C=kT(),y=$T(),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Label:w}={},errorPaths:F}=Te({path:u}),S=fo(),R=F.length,D=S&&R>0,_=!(g||b||C),T=b7(()=>et(e),[e]);return Np("div",{className:[Ae,bn,_&&`${bn}--top-level`,g&&`${bn}--within-collapsible`,b&&`${bn}--within-group`,C&&`${bn}--within-row`,y&&`${bn}--within-tab`,!r&&b&&`${bn}--gutter`,D&&`${bn}--has-error`,o].filter(Boolean).join(" "),id:`field-${u?.replace(/\./g,"__")}`,style:T,children:[hs(MT,{children:Np("div",{className:`${bn}__wrap`,children:[!!(w||I||i||D)&&Np("div",{className:`${bn}__header`,children:[!!(w||I||i)&&Np("header",{children:[hs(ue,{CustomComponent:w,Fallback:hs("h3",{className:`${bn}__title`,children:hs(Ce,{as:"span",label:g7(i,h),localized:!1,path:u,required:!1})})}),hs(ue,{CustomComponent:I,Fallback:hs(Xe,{description:n,path:u})})]}),D&&hs(Io,{count:R,i18n:h,withMessage:!0})]}),x,VT(e)?hs(Lo,{fields:s,margins:"small",parentIndexPath:"",parentPath:u,parentSchemaPath:p,permissions:d===!0?d:d?.fields,readOnly:f}):hs(Lo,{fields:s,margins:"small",parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:d,readOnly:f})]})}),v]})};var Lu=ze(v7);import{c as y7}from"react/compiler-runtime";import{jsx as C7}from"react/jsx-runtime";import{useEffect as x7}from"react";var w7=t=>{let e=y7(13),{disableModifyingForm:o,path:n,value:r}=t,s=o===void 0?!0:o,i;e[0]!==n?(i={potentiallyStalePath:n},e[0]=n,e[1]=i):i=e[1];let{formInitializing:a,path:l,setValue:c,value:u}=Te(i),d,f;e[2]!==s||e[3]!==a||e[4]!==c||e[5]!==r?(d=()=>{r!==void 0&&!a&&c(r,s)},f=[r,c,s,a],e[2]=s,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=f):(d=e[6],f=e[7]),x7(d,f);let m=`field-${l?.replace(/\./g,"__")}`,p=u||"",h;return e[8]!==l||e[9]!==c||e[10]!==m||e[11]!==p?(h=C7("input",{id:m,name:l,onChange:c,type:"hidden",value:p}),e[8]=l,e[9]=c,e[10]=m,e[11]=p,e[12]=h):h=e[12],h},ku=ze(w7);var Qp=Ri(Jv(),1);import{jsx as aa,jsxs as xV}from"react/jsx-runtime";import{fieldAffectsData as wV,flattenTopLevelFields as SV}from"payload/shared";import{useMemo as ZF}from"react";import{jsx as ur,jsxs as Ol}from"react/jsx-runtime";import{getTranslation as XF}from"@payloadcms/translations";import{hoistQueryParamsToAnd as bV,transformColumnsToPreferences as YF}from"payload/shared";import vV,{Fragment as yV,useCallback as qp,useEffect as Uu,useRef as CV,useState as vs}from"react";import{jsx as KT}from"react/jsx-runtime";import{useRouter as A7,useSearchParams as P7}from"next/navigation.js";import*as e0 from"qs-esm";import E7,{useCallback as $u,useEffect as N7,useMemo as L7,useRef as k7,useState as eF}from"react";import{jsx as T7}from"react/jsx-runtime";import{createContext as F7,use as D7}from"react";var YT=F7({}),qv=({children:t,...e})=>T7(YT,{value:{isInDrawer:!!e.drawerSlug,...e},children:t}),_r=()=>{let t=D7(YT);if(!t)throw new Error("useListDrawerContext must be used within a ListDrawerContextProvider");return t};import*as ZT from"qs-esm";function Yt(t){let e=t.toString();return ZT.parse(e,{depth:10,ignoreQueryPrefix:!0})}import{createContext as JT,use as R7}from"react";var Qv=JT({}),mt=()=>R7(Qv),qT=JT(!1);var QT=(t,e,o)=>{let n="page"in e?e.page:t?.page;["where","search","groupBy"].some(l=>l in e&&!["limit","page"].includes(l))&&(n=1);let s=["where","search","page","limit","groupBy","sort"].some(l=>l in e),i;return s||(i={...t?.queryByGroup||{},...e.queryByGroup?Object.fromEntries(Object.entries(e.queryByGroup).map(([l,c])=>[l,{...t?.queryByGroup?.[l]||{},...c}])):{}}),{...t,...e,columns:"columns"in e?e.columns:t.columns,groupBy:"groupBy"in e?e.groupBy:t?.groupBy??o?.defaults?.groupBy,limit:"limit"in e?e.limit:t?.limit??o?.defaults?.limit,page:n,preset:"preset"in e?e.preset:t?.preset,queryByGroup:i,search:"search"in e?e.search:t?.search,sort:"sort"in e?e.sort:t?.sort??o?.defaults?.sort,where:"where"in e?e.where:t?.where}};var Kv=t=>{let e={...t};return Object.entries(e).forEach(([o,n])=>{if(o==="columns"&&(n==="[]"||Array.isArray(e[o])&&e[o].length===0)&&delete e[o],o==="where"&&typeof n=="object"&&n!==null&&!Object.keys(n).length&&delete e[o],(o==="limit"||o==="page")&&typeof n=="string"){let r=parseInt(n,10);e[o]=Number.isNaN(r)?void 0:r}o==="page"&&n===0&&delete e[o],n===""&&delete e[o]}),e};var t0=({children:t,collectionSlug:e,data:o,modifySearchParams:n,onQueryChange:r,orderableFieldName:s,query:i})=>{"use no memo";let a=A7(),l=P7(),{startRouteTransition:c}=Ye(),[u,d]=eF(!1),{getEntityConfig:f}=H(),m=f({collectionSlug:e}),p=k7({});p.current.modified=u;let{onQueryChange:h}=_r(),g=h||r,b=L7(()=>Kv(Yt(l)),[l]),[C,y]=eF(()=>n?b:{limit:i.limit,sort:i.sort}),v=$u(async(D,_)=>{d(_??!0);let T=QT(C,D,{defaults:{limit:i.limit,sort:i.sort}});if(n){let A=`?${e0.stringify({...T,columns:JSON.stringify(T.columns),queryByGroup:JSON.stringify(T.queryByGroup)})}`;window.location.search!==A&&c(()=>a.replace(A))}else typeof g=="function"&&g(T);y(T)},[C,i.limit,i.sort,n,g,c,a]),x=$u(async D=>{await v({page:D})},[v]),I=E7.useCallback(async D=>{await v({limit:D,page:1})},[v]),w=$u(async D=>{await v({search:D===""?void 0:D})},[v]),F=$u(async D=>{await v({sort:D})},[v]),S=$u(async D=>{await v({where:D})},[v]),R=Qe(()=>{let D=Kv({...C||{},...i||{}}),_=`?${e0.stringify({...D,columns:JSON.stringify(D.columns),queryByGroup:JSON.stringify(D.queryByGroup)})}`;window.location.search!==_&&(y(D),window.history.replaceState(null,"",_))});return N7(()=>{n&&i&&R()},[n,i]),KT(Qv,{value:{collectionSlug:e,data:o,defaultLimit:o?.limit,handlePageChange:x,handlePerPageChange:I,handleSearchChange:w,handleSortChange:F,handleWhereChange:S,isGroupingBy:!!(m?.admin?.groupBy&&C?.groupBy),orderableFieldName:s,query:C,refineListData:v,setModified:d,...p.current},children:KT(qT,{value:u,children:t})})};import{jsx as j7}from"react/jsx-runtime";import $7,{createContext as B7,useCallback as gs}from"react";var o0=B7(void 0),Lt=()=>{let t=$7.use(o0);if(t===void 0)throw new Error("useServerFunctions must be used within a ServerFunctionsProvider");return t},r0=({children:t,serverFunction:e})=>{if(!e)throw new Error("ServerFunctionsProvider requires a serverFunction prop");let o=gs(async d=>await e({name:"render-document-slots",args:d}),[e]),n=gs(async d=>{let{signal:f,...m}=d;try{if(!f?.aborted){let h=await e({name:"schedule-publish",args:{...m}});if(!f?.aborted)return h}}catch(h){console.error(h)}let p=`Error scheduling ${m.type}`;return m.doc&&(p+=` for document with ID ${m.doc.value} in collection ${m.doc.relationTo}`),{error:p}},[e]),r=gs(async d=>{let{signal:f,...m}=d||{};try{if(!f?.aborted){let p=await e({name:"form-state",args:{fallbackLocale:!1,...m}});if(!f?.aborted)return p}}catch(p){console.error(p)}return{state:null}},[e]),s=gs(async d=>{let{signal:f,...m}=d||{};try{if(!f?.aborted){let p=await e({name:"table-state",args:{fallbackLocale:!1,...m}});if(!f?.aborted)return p}}catch(p){console.error(p)}},[e]),i=gs(async d=>{let{signal:f,...m}=d||{};try{return await e({name:"render-document",args:{fallbackLocale:!1,...m}})}catch(p){console.error(p)}},[e]),a=gs(async d=>{let{signal:f,...m}=d||{},p=await e({name:"copy-data-from-locale",args:m});if(!f?.aborted)return{data:p}},[e]),l=gs(async d=>{let{signal:f,...m}=d||{};try{let p=await e({name:"get-folder-results-component-and-data",args:m});if(!f?.aborted)return p}catch(p){console.error(p)}},[e]),c=gs(async d=>{try{return await e({name:"render-field",args:d})}catch(f){console.error(f)}},[e]),u=gs(async d=>{let{signal:f,...m}=d||{};try{return await e({name:"slugify",args:{...m}})}catch(p){console.error(p)}},[e]);return j7(o0,{value:{_internal_renderField:c,copyDataFromLocale:a,getDocumentSlots:o,getFolderResultsComponentAndData:l,getFormState:r,getTableState:s,renderDocument:i,schedulePublish:n,serverFunction:e,slugify:u},children:t})};import{jsx as V7}from"react/jsx-runtime";import{transformColumnsToSearchParams as tF}from"payload/shared";import oF,{startTransition as rF,useCallback as s0,useRef as G7}from"react";import{createContext as M7,use as O7}from"react";var n0=M7({}),kl=()=>O7(n0);var Bu=({children:t,collectionSlug:e,columnState:o,LinkedCellOverride:n})=>{let{getEntityConfig:r}=H(),{query:s,refineListData:i}=mt(),{admin:{defaultColumns:a}={}}=r({collectionSlug:e}),[l,c]=oF.useOptimistic(o,(h,g)=>g),u=G7({}),d=s0(async h=>{let g=(l||[]).map(b=>b.accessor===h?{...b,active:!b.active}:b);rF(()=>{c(g)}),await i({columns:tF(g)})},[i,l,c]),f=s0(async h=>{let{fromIndex:g,toIndex:b}=h,C=[...l||[]],[y]=C.splice(g,1);C.splice(b,0,y),rF(()=>{c(C)}),await i({columns:tF(C)})},[l,i,c]),m=s0(async h=>{let g=s.columns;h.forEach(b=>{let C=g.findIndex(y=>b===y);C!==void 0&&g[C][0]==="-"&&(g[C]=b.slice(1))}),await i({columns:g})},[s,i]),p=oF.useCallback(async()=>{await i({columns:a||[]})},[a,i]);return V7(n0,{value:{columns:l,LinkedCellOverride:n,moveColumn:f,resetColumnsState:p,setActiveColumns:m,toggleColumn:d,...u.current},children:t})};import{jsx as nF}from"react/jsx-runtime";import{fieldIsHiddenOrDisabled as W7,fieldIsID as H7}from"payload/shared";import{useId as U7,useMemo as sF}from"react";import{jsx as jl}from"react/jsx-runtime";import z7 from"react";var Mu="pill-selector",Ou=({draggable:t,onClick:e,pills:o})=>{let n=z7.useMemo(()=>o.map((r,s)=>jl(yt,{alignIcon:"left","aria-checked":r.selected,className:[`${Mu}__pill`,r.selected&&`${Mu}__pill--selected`].filter(Boolean).join(" "),draggable:!!t,icon:r.selected?jl(vt,{}):jl(ar,{}),id:r.name,onClick:()=>{e&&e({pill:r})},size:"small",children:r.Label??jl("span",{className:`${Mu}__pill-label`,children:r.name})},r.key??`${r.name}-${s}`)),[o,e,t]);return t?jl(Vr,{className:Mu,ids:o.map(r=>r.name),onDragEnd:({moveFromIndex:r,moveToIndex:s})=>{t.onDragEnd({moveFromIndex:r,moveToIndex:s})},children:n}):jl("div",{className:Mu,children:n})};var kp=({collectionSlug:t})=>{let{columns:e,moveColumn:o,toggleColumn:n}=kl(),r=U7(),s=ut(),i=sF(()=>e?.filter(l=>!(W7(l.field)&&!H7(l.field))&&!l?.field?.admin?.disableListColumn),[e]),a=sF(()=>i?i.map((l,c)=>{let{accessor:u,active:d,field:f}=l,m="labelWithPrefix"in f&&f.labelWithPrefix!==void 0?f.labelWithPrefix:"label"in f&&f.label!==void 0?f.label:"name"in f&&f.name!==void 0?f.name:void 0;return{name:u,key:`${t}-${u}-${c}${s?`-${s}-`:""}${r}`,Label:nF(Ce,{label:m,unstyled:!0}),selected:d}}):null,[t,s,i,r]);return a?nF(Ou,{draggable:{onDragEnd:({moveFromIndex:l,moveToIndex:c})=>{o({fromIndex:l,toIndex:c})}},onClick:({pill:l})=>{n(l.name)},pills:a}):null};import{c as bF}from"react/compiler-runtime";import{jsx as Bp}from"react/jsx-runtime";import{createElement as a8}from"react";import{useEffect as l8,useId as c8,useState as u8}from"react";import{c as X7}from"react/compiler-runtime";import{useState as Y7}from"react";var jp=t=>{let e=X7(3),{getEntityConfig:o}=H(),n;e[0]!==o||e[1]!==t?(n=()=>t?(typeof t=="string"?[t]:t).map(i=>o({collectionSlug:i})):[],e[0]=o,e[1]=t,e[2]=n):n=e[2];let[r]=Y7(n);return r};import{jsx as pF}from"react/jsx-runtime";import s8,{useCallback as Gu,useEffect as hF,useRef as i8,useState as u0}from"react";import{c as c0}from"react/compiler-runtime";import{jsx as ia,jsxs as uF}from"react/jsx-runtime";import{getTranslation as K7}from"@payloadcms/translations";import e8 from"react";import{jsx as J7,jsxs as q7}from"react/jsx-runtime";import l0,{createContext as Q7}from"react";import{c as Z7}from"react/compiler-runtime";import*as oi from"react";var i0=t=>{let e=Z7(13),{delayBeforeShow:o,inTimeout:n,minShowTime:r,outTimeout:s,show:i}=t,a=n+r+s,[l,c]=Cb(o),[u,d]=oi.useState(!1),[f,m]=oi.useState(!1),p=oi.useRef(0),h=oi.useRef(void 0),g;e[0]!==s?(g=()=>{m(!0),h.current=setTimeout(()=>{d(!1),m(!1)},s)},e[0]=s,e[1]=g):g=e[1];let b=g,C,y;e[2]!==l||e[3]!==u||e[4]!==i||e[5]!==a||e[6]!==b?(C=()=>{let x=l&&!u&&i,I=u&&!i;if(x)p.current=Date.now(),d(!0);else if(I){let w=Date.now()-p.current,F=a-w;clearTimeout(h.current),h.current=setTimeout(b,Math.max(0,F))}},y=[u,i,b,a,l],e[2]=l,e[3]=u,e[4]=i,e[5]=a,e[6]=b,e[7]=C,e[8]=y):(C=e[7],y=e[8]),oi.useEffect(C,y);let v;return e[9]!==u||e[10]!==f||e[11]!==c?(v={isMounted:u,isUnmounting:f,triggerDelayedRender:c},e[9]=u,e[10]=f,e[11]=c,e[12]=v):v=e[12],v};var iF={isLoading:!1,loaders:[],loadingText:"",overlayType:null},aF=(t,e)=>{let o=[...t.loaders],{type:n="fullscreen",key:r="user",loadingText:s}=e.payload;if(e.type==="add")o.push({type:n,key:r,loadingText:s});else if(e.type==="remove"){let a=o.findIndex(l=>l.key===r&&l.type===n);o.splice(a,1)}let i=o?.length>0?o[o.length-1]:null;return{isLoading:!!i,loaders:o,loadingText:i?.loadingText||t?.loadingText,overlayType:i?.type||t?.overlayType}};var a0=250,lF=Q7({isOnScreen:!1,toggleLoadingOverlay:void 0}),cF=({children:t})=>{let{t:e}=N(),o=e("general:loading"),[n,r]=l0.useReducer(aF,iF),{isMounted:s,isUnmounting:i,triggerDelayedRender:a}=i0({delayBeforeShow:1e3,inTimeout:a0,minShowTime:500,outTimeout:a0,show:n.isLoading}),l=l0.useCallback(({type:c,isLoading:u,key:d,loadingText:f=o})=>{u?(a(),r({type:"add",payload:{type:c,key:d,loadingText:f}})):r({type:"remove",payload:{type:c,key:d}})},[a,o]);return q7(lF,{value:{isOnScreen:s,toggleLoadingOverlay:l},children:[s&&J7(vn,{animationDuration:`${a0}ms`,loadingText:n.loadingText||o,overlayType:n.overlayType,show:!i}),t]})},$p=()=>{let t=l0.use(lF);if(t===void 0)throw new Error("useLoadingOverlay must be used within a LoadingOverlayProvider");return t};var yn="loading-overlay",vn=t=>{let e=c0(8),{animationDuration:o,loadingText:n,overlayType:r,show:s}=t,i=s===void 0?!0:s,{t:a}=N(),l=i?`${yn}--entering`:`${yn}--exiting`,c=r?`${yn}--${r}`:"",u;e[0]!==l||e[1]!==c?(u=[yn,l,c].filter(Boolean),e[0]=l,e[1]=c,e[2]=u):u=e[2];let d=u.join(" "),f=o||"500ms",m;return e[3]!==n||e[4]!==a||e[5]!==d||e[6]!==f?(m=uF("div",{className:d,style:{animationDuration:f},children:[uF("div",{className:`${yn}__bars`,children:[ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`})]}),ia("span",{className:`${yn}__text`,children:n||a("general:loading")})]}),e[3]=n,e[4]=a,e[5]=d,e[6]=f,e[7]=m):m=e[7],m},dF=t=>{let e=c0(7),{name:o,type:n,loadingText:r,show:s}=t,i=n===void 0?"fullscreen":n,{toggleLoadingOverlay:a}=$p(),l,c;return e[0]!==o||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==i?(l=()=>(a({type:i,isLoading:s,key:o,loadingText:r||void 0}),()=>{a({type:i,isLoading:!1,key:o})}),c=[s,a,o,i,r],e[0]=o,e[1]=r,e[2]=s,e[3]=a,e[4]=i,e[5]=l,e[6]=c):(l=e[5],c=e[6]),e8.useEffect(l,c),null},t8=t=>{let e=c0(6),{name:o,type:n,action:r,formIsLoading:s,loadingSuffix:i}=t,a=n===void 0?"fullscreen":n,l=s===void 0?!1:s,c=Or(),{i18n:u,t:d}=N(),m=`${{create:d("general:creating"),loading:d("general:loading"),update:d("general:updating")}[r]} ${i?K7(i,u):""}`,p;return e[0]!==l||e[1]!==c||e[2]!==o||e[3]!==m||e[4]!==a?(p=ia(dF,{loadingText:m.trim(),name:o,show:l||c,type:a}),e[0]=l,e[1]=c,e[2]=o,e[3]=m,e[4]=a,e[5]=p):p=e[5],p};function Tr(t){if(t)try{t.abort()}catch{}}function Fr(t){let e=new AbortController;if(t.current)try{t.current.abort()}catch{}return t.current=e,e}import{jsx as o8}from"react/jsx-runtime";import{createContext as r8,use as n8}from"react";var mF=r8({}),fF=({children:t,...e})=>o8(mF,{value:{...e},children:t}),Vu=()=>{let t=n8(mF);if(!t)throw new Error("useDocumentDrawerContext must be used within a DocumentDrawerProvider");return t};var gF=({id:t,collectionSlug:e,disableActions:o,drawerSlug:n,initialData:r,onDelete:s,onDuplicate:i,onSave:a,overrideEntityVisibility:l=!0,redirectAfterCreate:c,redirectAfterDelete:u,redirectAfterDuplicate:d,redirectAfterRestore:f})=>{let{getEntityConfig:m}=H(),[p]=u0(()=>m({collectionSlug:e})),h=s8.useRef(null),{closeModal:g}=ae(),{t:b}=N(),{renderDocument:C}=Lt(),[y,v]=u0(void 0),[x,I]=u0(!0),w=i8(!1),F=Gu((T,A=!1)=>{let L=Fr(h);(async()=>{A&&I(!0);try{let E=await C({collectionSlug:e,disableActions:o,docID:T,drawerSlug:n,initialData:r,overrideEntityVisibility:l,redirectAfterCreate:c,redirectAfterDelete:u!==void 0?u:!1,redirectAfterDuplicate:d!==void 0?d:!1,redirectAfterRestore:f!==void 0?f:!1,signal:L.signal});E?.Document&&(v(E.Document),I(!1))}catch(E){q.error(E?.message||b("error:unspecific")),g(n)}h.current=null})()},[e,o,n,r,u,d,f,C,c,g,l,b]),S=Gu(T=>{T.operation==="create"&&F(T.doc.id),typeof a=="function"&&a({...T,collectionConfig:p})},[a,p,F]),R=Gu(T=>{F(T.doc.id),typeof i=="function"&&i({...T,collectionConfig:p})},[i,p,F]),D=Gu(T=>{typeof s=="function"&&s({...T,collectionConfig:p}),g(n)},[s,g,n,p]),_=Gu(()=>{F(void 0,!0)},[F]);return hF(()=>{!y&&!w.current&&(F(t,!0),w.current=!0)},[y,F,t]),hF(()=>{let T=h.current;return()=>{Tr(T)}},[]),x?pF(vn,{}):pF(fF,{clearDoc:_,drawerSlug:n,onDelete:D,onDuplicate:R,onSave:S,children:y})};var bs="doc-drawer",d8=({id:t,collectionSlug:e,depth:o,uuid:n})=>`doc-drawer_${e}_${o}${t?`_${t}`:""}_${n}`,m8=t=>{let e=bF(2),{children:o,className:n,collectionSlug:r,disabled:s,drawerSlug:i,onClick:a,operation:l,...c}=t,{t:u}=N(),[d]=jp(r),f=u(l==="create"?"fields:addNewLabel":"general:editLabel",{label:d?.labels.singular}),m;return e[0]!==n?(m=[n,`${bs}__toggler`].filter(Boolean),e[0]=n,e[1]=m):m=e[1],Bp(cs,{"aria-label":f,className:m.join(" "),disabled:s,onClick:a,slug:i,...c,children:o})},d0=t=>{let{drawerSlug:e}=t;return Bp(St,{className:bs,gutter:!1,Header:null,slug:e,children:Bp(gF,{...t})})},jt=t=>{let e=bF(38),{id:o,collectionSlug:n,overrideEntityVisibility:r}=t,s=ut(),i=c8(),{closeModal:a,modalState:l,openModal:c,toggleModal:u}=ae(),[d,f]=u8(!1),m;e[0]!==n||e[1]!==s||e[2]!==o||e[3]!==i?(m=d8({id:o,collectionSlug:n,depth:s,uuid:i}),e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=m):m=e[4];let p=m,h,g;e[5]!==p||e[6]!==l?(h=()=>{f(!!l[p]?.isOpen)},g=[l,p],e[5]=p,e[6]=l,e[7]=h,e[8]=g):(h=e[7],g=e[8]),l8(h,g);let b;e[9]!==p||e[10]!==u?(b=()=>{u(p)},e[9]=p,e[10]=u,e[11]=b):b=e[11];let C=b,y;e[12]!==a||e[13]!==p?(y=()=>{a(p)},e[12]=a,e[13]=p,e[14]=y):y=e[14];let v=y,x;e[15]!==p||e[16]!==c?(x=()=>{c(p)},e[15]=p,e[16]=c,e[17]=x):x=e[17];let I=x,w;e[18]!==n||e[19]!==p||e[20]!==o||e[21]!==r?(w=A=>a8(d0,{...A,collectionSlug:n,drawerSlug:p,id:o,key:p,overrideEntityVisibility:r}),e[18]=n,e[19]=p,e[20]=o,e[21]=r,e[22]=w):w=e[22];let F=w,S;e[23]!==n||e[24]!==p||e[25]!==o?(S=A=>Bp(m8,{...A,collectionSlug:n,drawerSlug:p,operation:o?"update":"create"}),e[23]=n,e[24]=p,e[25]=o,e[26]=S):S=e[26];let R=S,D;e[27]!==v||e[28]!==p||e[29]!==s||e[30]!==d||e[31]!==I||e[32]!==C?(D={closeDrawer:v,drawerDepth:s,drawerSlug:p,isDrawerOpen:d,openDrawer:I,toggleDrawer:C},e[27]=v,e[28]=p,e[29]=s,e[30]=d,e[31]=I,e[32]=C,e[33]=D):D=e[33];let _=D,T;return e[34]!==F||e[35]!==_||e[36]!==R?(T=[F,R,_],e[34]=F,e[35]=_,e[36]=R,e[37]=T):T=e[37],T};import{c as g8}from"react/compiler-runtime";import{jsx as b8}from"react/jsx-runtime";import{appendUploadSelectFields as v8,formatAdminURL as y8}from"payload/shared";import*as yF from"qs-esm";import{createContext as C8,use as x8,useEffect as w8,useReducer as S8,useRef as I8}from"react";import{c as f8}from"react/compiler-runtime";import{useEffect as p8,useState as h8}from"react";function Cn(t,e){let o=f8(4),[n,r]=h8(t),s,i;return o[0]!==e||o[1]!==t?(s=()=>{let a=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(a)}},i=[t,e],o[0]=e,o[1]=t,o[2]=s,o[3]=i):(s=o[2],i=o[3]),p8(s,i),n}function vF(t,e){switch(e.type){case"ADD_LOADED":{let o={...t};typeof o[e.relationTo]!="object"&&(o[e.relationTo]={});let n=[...e.idsToLoad];return Array.isArray(e.docs)&&e.docs.forEach(r=>{n.splice(n.indexOf(r.id),1),o[e.relationTo][r.id]=r}),n.forEach(r=>{o[e.relationTo][r]=!1}),o}case"REQUEST":{let o={...t};return e.docs.forEach(({relationTo:n,value:r})=>{typeof o[n]!="object"&&(o[n]={}),o[n][r]=null}),o}default:return t}}var CF=C8({}),zu=t=>{let e=g8(15),{children:o}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={},e[0]=n):n=e[0];let[r,s]=S8(vF,n),i=Cn(r,100),{config:a}=H(),{collections:l,routes:c}=a,{api:u}=c,{i18n:d}=N(),{code:f}=ye(),m=I8(f),p;e[1]!==u||e[2]!==l||e[3]!==i||e[4]!==d||e[5]!==f?(p=x=>{let I=x===void 0?!1:x;Object.entries(i).forEach(async w=>{let[F,S]=w,R=[];if(Object.entries(S).forEach(D=>{let[_,T]=D;(T===null||I)&&R.push(_)}),R.length>0){let D=y8({apiRoute:u,path:`/${F}`}),_=new URLSearchParams,T={};_.append("depth","0"),_.append("limit","250");let A=l.find(B=>B.slug===F);if(A.admin.enableListViewSelectAPI){let B=A.admin.useAsTitle??"id";T[B]=!0,A.upload&&v8({collectionConfig:A,select:T})}f&&_.append("locale",f);let L=R.map(_8);_.append("where[id][in]",L.join(","));let P=`?${_.toString()}&${yF.stringify({select:T})}`,E=await fetch(`${D}${P}`,{credentials:"include",headers:{"Accept-Language":d.language}});if(E.ok){let B=await E.json();B.docs&&s({type:"ADD_LOADED",docs:B.docs,idsToLoad:R,relationTo:F})}else s({type:"ADD_LOADED",docs:[],idsToLoad:R,relationTo:F})}})},e[1]=u,e[2]=l,e[3]=i,e[4]=d,e[5]=f,e[6]=p):p=e[6];let h=p,g,b;e[7]!==h||e[8]!==f?(g=()=>{h(f&&m.current!==f),m.current=f},b=[f,h],e[7]=h,e[8]=f,e[9]=g,e[10]=b):(g=e[9],b=e[10]),w8(g,b);let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=x=>{s({type:"REQUEST",docs:x})},e[11]=C):C=e[11];let y=C,v;return e[12]!==o||e[13]!==r?(v=b8(CF,{value:{documents:r,getRelationships:y},children:o}),e[12]=o,e[13]=r,e[14]=v):v=e[14],v},m0=()=>x8(CF);function _8(t){return String(t)}import{jsx as $l}from"react/jsx-runtime";import{getTranslation as T8}from"@payloadcms/translations";var f0=({allowCreate:t,baseClass:e,buttonStyle:o,className:n,collections:r,i18n:s,icon:i,label:a,onClick:l,permissions:c,relationTo:u})=>t?Array.isArray(u)?$l("div",{className:`${e}__add-new-polymorphic-wrapper`,children:$l(it,{button:$l(oe,{buttonStyle:o,className:n,icon:i,children:a}),buttonType:"custom",horizontalAlign:"center",render:({close:f})=>$l(ve.ButtonGroup,{children:u.map(m=>c.collections[m]?.create?$l(ve.Button,{className:`${e}__relation-button--${m}`,onClick:()=>{f(),l(m)},children:T8(r.find(p=>p.slug===m).labels.singular,s)},m):null)}),size:"medium"})}):$l(oe,{buttonStyle:o,className:n,onClick:()=>l(),children:a}):null;import{c as cV}from"react/compiler-runtime";import{jsx as C0,jsxs as uV}from"react/jsx-runtime";import"react";import{c as iV}from"react/compiler-runtime";import{jsx as MF}from"react/jsx-runtime";import OF from"react";import{c as eV}from"react/compiler-runtime";import{jsx as Ml,jsxs as tV}from"react/jsx-runtime";import{getTranslation as oV}from"@payloadcms/translations";import{fieldAffectsData as rV,fieldIsID as nV}from"payload/shared";import"react";import{formatAdminURL as Mp}from"payload/shared";import{getTranslation as R8}from"@payloadcms/translations";import F8 from"react";var D8=Symbol.for("react.lazy");function Op(t){return F8.isValidElement(t)||t?.$$typeof===D8}var xF=(t,e,o)=>{if((e?.type==="select"||e?.type==="radio")&&Array.isArray(e.options)){let n=e.options.find(r=>typeof r=="object"?r.value===t:r===t);if(n)return typeof n=="object"&&"label"in n?Op(n.label)?n.label:R8(n.label,o)||n.value:n}return t};import{jsx as wF}from"react/jsx-runtime";import"react";var Vp=({cellData:t,nowrap:e})=>{let o=t?.length>100?`${t.substring(0,100)}\u2026`:t;return wF("code",{className:"code-cell",style:e?{whiteSpace:"nowrap"}:{},children:wF("span",{children:o})})};import{c as A8}from"react/compiler-runtime";import{jsx as P8}from"react/jsx-runtime";import{getTranslation as SF}from"@payloadcms/translations";import"react";var IF=t=>{let e=A8(2),{cellData:o,field:n}=t,{labels:r}=n,{i18n:s}=N(),i=o??[],a=i.length===1?`${i.length} ${SF(r?.singular||s.t("general:rows"),s)}`:`${i.length} ${SF(r?.plural||s.t("general:rows"),s)}`,l;return e[0]!==a?(l=P8("span",{children:a}),e[0]=a,e[1]=l):l=e[1],l};import{c as E8}from"react/compiler-runtime";import{jsx as N8}from"react/jsx-runtime";import{getTranslation as Gp}from"@payloadcms/translations";import"react";var _F=t=>{let e=E8(2),{cellData:o,field:n}=t,{blockReferences:r,blocks:s,labels:i}=n,{i18n:a}=N(),{config:l}=H(),c=Array.isArray(o)?o.map(L8):[],u=(r??s)?.map(p=>{let h=typeof p=="string"?l.blocksMap[p]:p;return{slug:h.slug,label:Gp(h.labels.singular,a)}}),d=`0 ${Gp(i?.plural,a)}`,f=p=>p.map(h=>u.filter(b=>b.slug===h)?.[0]?.label).join(", ");if(c.length>5){let p=c.length-5;d=`${c.length} ${Gp(i?.plural,a)} - ${a.t("fields:itemsAndMore",{count:p,items:f(c.slice(0,5))})}`}else c.length>0&&(d=`${c.length} ${Gp(c.length===1?i?.singular:i?.plural,a)} - ${f(c)}`);let m;return e[0]!==d?(m=N8("span",{children:d}),e[0]=d,e[1]=m):m=e[1],m};function L8(t){let{blockType:e}=t;return e}import{c as k8}from"react/compiler-runtime";import{jsx as TF}from"react/jsx-runtime";import"react";var FF=t=>{let e=k8(3),{cellData:o}=t,{t:n}=N(),r=`general:${o}`,s;return e[0]!==n||e[1]!==r?(s=TF("code",{className:"bool-cell",children:TF("span",{children:n(r).toLowerCase()})}),e[0]=n,e[1]=r,e[2]=s):s=e[2],s};import{jsx as j8}from"react/jsx-runtime";import{getObjectDotNotation as $8}from"payload/shared";import"react";var p0=t=>{let{cellData:e,field:o,rowData:n}=t,{name:r,accessor:s,admin:i,timezone:a}=o,{date:l}=i===void 0?{}:i,{config:c}=H(),{admin:u}=c,{dateFormat:d}=u,{i18n:f}=N(),p=`${s||r}_tz`,h=a&&n?$8(n,p,void 0):void 0,g=l?.displayFormat||d;return j8("span",{children:!!e&&zr({date:e,i18n:f,pattern:g,timezone:h})})};import{jsx as h0,jsxs as M8,Fragment as O8}from"react/jsx-runtime";import{getBestFitFromSizes as V8,isImage as G8}from"payload/shared";import"react";import{c as RF}from"react/compiler-runtime";import{jsx as Bl,jsxs as AF}from"react/jsx-runtime";import Wp from"react";import{jsx as DF,jsxs as B8}from"react/jsx-runtime";import"react";var zp=()=>B8("svg",{height:"150",style:{backgroundColor:"#333333"},viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[DF("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),DF("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]});var Hp="thumbnail",Dr=t=>{let e=RF(6),{className:o,doc:n,fileSrc:r,height:s,imageCacheTag:i,size:a,width:l}=t,c=o===void 0?"":o,{filename:u}=n===void 0?{}:n,[d,f]=Wp.useState(void 0),m=`${Hp}--size-${a||"medium"}`,p;e[0]!==c||e[1]!==m?(p=[Hp,m,c],e[0]=c,e[1]=m,e[2]=p):p=e[2];let h=p.join(" "),g,b;e[3]!==r?(g=()=>{if(!r){f(!1);return}f(void 0);let y=new Image;y.src=r,y.onload=()=>{f(!0)},y.onerror=()=>{f(!1)}},b=[r],e[3]=r,e[4]=g,e[5]=b):(g=e[4],b=e[5]),Wp.useEffect(g,b);let C=null;if(r){let y=r?.includes("?")?"&":"?";C=i?`${r}${y}${encodeURIComponent(i)}`:r}return AF("div",{className:h,children:[d===void 0&&Bl(Et,{height:"100%"}),d&&Bl("img",{alt:u,height:s,src:C,width:l}),d===!1&&Bl(zp,{})]})};function PF(t){let e=RF(12),{alt:o,className:n,filename:r,fileSrc:s,imageCacheTag:i,size:a}=t,l=n===void 0?"":n,[c,u]=Wp.useState(void 0),d=`${Hp}--size-${a||"medium"}`,f;e[0]!==l||e[1]!==d?(f=[Hp,d,l],e[0]=l,e[1]=d,e[2]=f):f=e[2];let m=f.join(" "),p,h;e[3]!==s?(p=()=>{if(!s){u(!1);return}u(void 0);let C=new Image;C.src=s,C.onload=()=>{u(!0)},C.onerror=()=>{u(!1)}},h=[s],e[3]=s,e[4]=p,e[5]=h):(p=e[4],h=e[5]),Wp.useEffect(p,h);let g="";if(s){let C=s?.includes("?")?"&":"?";g=i?`${s}${C}${encodeURIComponent(i)}`:s}let b;return e[6]!==o||e[7]!==m||e[8]!==c||e[9]!==r||e[10]!==g?(b=AF("div",{className:m,children:[c===void 0&&Bl(Et,{height:"100%"}),c&&Bl("img",{alt:o||r,src:g}),c===!1&&Bl(zp,{})]}),e[6]=o,e[7]=m,e[8]=c,e[9]=r,e[10]=g,e[11]=b):b=e[11],b}var g0="file",Up=({cellData:t,collectionConfig:e,field:o,rowData:n})=>{if(("displayPreview"in o?o.displayPreview:void 0)??e.upload?.displayPreview??!0){let i=G8(n?.mimeType),a=i?n?.thumbnailURL||n?.url:n?.thumbnailURL;return i&&(a=V8({sizes:n?.sizes,thumbnailURL:n?.thumbnailURL,url:n?.url,width:n?.width})),M8("div",{className:g0,children:[h0(Dr,{className:`${g0}__thumbnail`,collectionSlug:e?.slug,doc:{...n,filename:t},fileSrc:a,imageCacheTag:e?.upload?.cacheTags&&n?.updatedAt,size:"small",uploadConfig:e?.upload}),h0("span",{className:`${g0}__filename`,children:String(t)})]})}else return h0(O8,{children:String(t)})};import{c as z8}from"react/compiler-runtime";import{jsx as Xp}from"react/jsx-runtime";import"react";function EF(t,e){let o=JSON.stringify(t);return o.length/e>1.5?`${o.substring(0,e)}\u2026`:o}var NF=t=>{let e=z8(4),{cellData:o}=t,{t:n}=N();try{let r;if(e[0]!==o){let s=EF(o,100);r=Xp("code",{className:"json-cell",children:Xp("span",{children:s})}),e[0]=o,e[1]=r}else r=e[1];return r}catch{let s;return e[2]!==n?(s=Xp("code",{className:"json-cell",children:Xp("span",{children:n("general:error")})}),e[2]=n,e[3]=s):s=e[3],s}};import{c as W8}from"react/compiler-runtime";import{jsx as H8,jsxs as kF}from"react/jsx-runtime";import{getTranslation as U8}from"@payloadcms/translations";import X8,{useEffect as jF,useState as $F}from"react";var LF=!!(typeof window<"u"&&window.document&&window.document.createElement);var Y8="relationship-cell",Yp=3,Zp=t=>{let e=W8(39),{cellData:o,customCellProps:n,field:r,field:s}=t,{label:i}=s,a="relationTo"in r&&r.relationTo||"collection"in r&&r.collection,l="collection"in r?o?.docs:o,{config:c,getEntityConfig:u}=H(),{collections:d}=c,[f,m]=Li(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];let[h,g]=$F(p),{documents:b,getRelationships:C}=m0(),[y,v]=$F(!1),{i18n:x,t:I}=N(),w=LF?m?.boundingClientRect?.top<window.innerHeight:!1,F;e[1]!==l||e[2]!==C||e[3]!==y||e[4]!==w||e[5]!==a?(F=()=>{if((l||typeof l=="number")&&w&&!y){let T=[],A=Array.isArray(l)?l:[l];A.slice(0,A.length<Yp?A.length:Yp).forEach(L=>{typeof L=="object"&&"relationTo"in L&&"value"in L&&T.push(L),(typeof L=="number"||typeof L=="string")&&typeof a=="string"&&T.push({relationTo:a,value:L})}),C(T),v(!0),g(T)}},e[1]=l,e[2]=C,e[3]=y,e[4]=w,e[5]=a,e[6]=F):F=e[6];let S;e[7]!==l||e[8]!==d||e[9]!==C||e[10]!==y||e[11]!==w||e[12]!==a?(S=[l,a,d,w,y,C],e[7]=l,e[8]=d,e[9]=C,e[10]=y,e[11]=w,e[12]=a,e[13]=S):S=e[13],jF(F,S);let R;e[14]!==y?(R=()=>{y&&v(!1)},e[14]=y,e[15]=R):R=e[15];let D;e[16]!==l?(D=[l],e[16]=l,e[17]=D):D=e[17],jF(R,D);let _;if(e[18]!==l||e[19]!==c.admin||e[20]!==n||e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==f||e[26]!==i||e[27]!==I||e[28]!==h){let T;e[30]!==c.admin||e[31]!==n||e[32]!==b||e[33]!==r||e[34]!==u||e[35]!==x||e[36]!==I||e[37]!==h.length?(T=(A,L)=>{let{relationTo:P,value:E}=A,B=b[P][E],k=u({collectionSlug:P}),$=Jo({collectionConfig:k,data:B||null,dateFormat:c.admin.dateFormat,fallback:`${I("general:untitled")} - ID: ${E}`,i18n:x}),j=null;return r.type==="upload"&&(("displayPreview"in r?r.displayPreview:void 0)??k.upload?.displayPreview??!0)&&B&&(j=H8(Up,{cellData:$,collectionConfig:k,collectionSlug:k.slug,customCellProps:n,field:r,rowData:B})),kF(X8.Fragment,{children:[B===!1&&`${I("general:untitled")} - ID: ${E}`,B===null&&`${I("general:loading")}...`,B?j||$:null,h.length>L+1&&", "]},L)},e[30]=c.admin,e[31]=n,e[32]=b,e[33]=r,e[34]=u,e[35]=x,e[36]=I,e[37]=h.length,e[38]=T):T=e[38],_=kF("div",{className:Y8,ref:f,children:[h.map(T),Array.isArray(l)&&l.length>Yp&&I("fields:itemsAndMore",{count:l.length-Yp,items:""}),h.length===0&&I("general:noLabel",{label:U8(i||"",x)})]}),e[18]=l,e[19]=c.admin,e[20]=n,e[21]=b,e[22]=r,e[23]=u,e[24]=x,e[25]=f,e[26]=i,e[27]=I,e[28]=h,e[29]=_}else _=e[29];return _};import{c as Z8}from"react/compiler-runtime";import{jsx as J8}from"react/jsx-runtime";import{getTranslation as q8}from"@payloadcms/translations";import{optionsAreObjects as Q8}from"payload/shared";import"react";var b0=t=>{let e=Z8(7),{cellData:o,field:n}=t,{options:r}=n,{i18n:s}=N(),i;e[0]!==s||e[1]!==r?(i=c=>c.map(u=>{let d=r.filter(f=>f.value===u)?.[0]?.label;return q8(d,s)}).join(", "),e[0]=s,e[1]=r,e[2]=i):i=e[2];let a=i,l;if(e[3]!==o||e[4]!==a||e[5]!==r){let c;Q8(r)?c=Array.isArray(o)?a(o):a([o]):c=Array.isArray(o)?o.join(", "):o,l=J8("span",{children:c}),e[3]=o,e[4]=a,e[5]=r,e[6]=l}else l=e[6];return l};import{jsx as K8}from"react/jsx-runtime";import"react";var BF=({cellData:t})=>{let e=t?.length>100?`${t.substring(0,100)}\u2026`:t;return K8("span",{children:e})};var v0={array:IF,blocks:_F,checkbox:FF,code:Vp,date:p0,File:Up,join:Zp,json:NF,radio:b0,relationship:Zp,select:b0,textarea:BF,upload:Zp};var Wu=t=>{let e=eV(16),{cellData:o,className:n,collectionSlug:r,field:s,field:i,link:a,linkURL:l,onClick:c,rowData:u,viewType:d}=t,{admin:f}=i,{i18n:m}=N(),{config:p,getEntityConfig:h}=H(),{routes:g}=p,{admin:b}=g,C,y;if(e[0]!==f||e[1]!==b||e[2]!==o||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==h||e[7]!==m||e[8]!==a||e[9]!==l||e[10]!==c||e[11]!==t||e[12]!==u||e[13]!==d){y=Symbol.for("react.early_return_sentinel");e:{let v=h({collectionSlug:r}),x=f&&"className"in f?f.className:void 0,I=n||(s.admin&&"className"in s.admin?s.admin.className:null)||x,w=c,F="span",S={className:I};if(a&&(S.prefetch=!1,F=Qt,l?S.href=l:S.href=v?.slug?Mp({adminRoute:b,path:`/collections/${v?.slug}${d==="trash"?"/trash":""}/${encodeURIComponent(u.id)}`}):""),typeof w=="function"&&(F="button",S.type="button",S.onClick=()=>{w({cellData:o,collectionSlug:v?.slug,rowData:u})}),nV(s)){y=Ml(F,{...S,children:Ml(Vp,{cellData:`ID: ${o}`,collectionConfig:v,collectionSlug:r,field:{...s,type:"code"},nowrap:!0,rowData:u})});break e}let R=xF(o,s,m),D=typeof o<"u"&&v0[s.type],_=null;if(Op(R))_=R;else if(D)_=Ml(D,{cellData:o,rowData:u,...t});else if(!D)if(v?.upload&&rV(s)&&s.name==="filename"&&s.type==="text"){let T=v0.File;_=Ml(T,{cellData:o,rowData:u,...t,collectionConfig:v,field:s})}else{y=tV(F,{...S,children:[(R===""||typeof R>"u"||R===null)&&m.t("general:noLabel",{label:oV(("label"in s?s.label:null)||"data",m)}),typeof R=="string"&&R,typeof R=="number"&&R,typeof R=="object"&&R!==null&&JSON.stringify(R)]});break e}if((s.type==="select"||s.type==="radio")&&s.options.length&&o){let T=Array.isArray(o)?o.map(sV).join(" "):`selected--${o}`,A=[S.className,T].filter(Boolean).join(" ");y=Ml(F,{...S,className:A,children:_});break e}C=Ml(F,{...S,children:_})}e[0]=f,e[1]=b,e[2]=o,e[3]=n,e[4]=r,e[5]=s,e[6]=h,e[7]=m,e[8]=a,e[9]=l,e[10]=c,e[11]=t,e[12]=u,e[13]=d,e[14]=C,e[15]=y}else C=e[14],y=e[15];return y!==Symbol.for("react.early_return_sentinel")?y:C};function sV(t){return`selected--${t}`}var aV="default-cell",VF=OF.createContext(null),y0=()=>OF.use(VF),lV=t=>{let e=iV(9),{clientProps:o,columnIndex:n,isLinkedColumn:r}=t,{drawerSlug:s,onSelect:i}=_r(),{LinkedCellOverride:a}=kl(),l;if(e[0]!==a||e[1]!==o||e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==i){let c={...o,columnIndex:n};if(r&&s){c.className=`${aV}__first-cell`,c.link=!1;let u;e[7]!==i?(u=d=>{let{collectionSlug:f,rowData:m}=d;typeof i=="function"&&i({collectionSlug:f,doc:m,docID:m.id})},e[7]=i,e[8]=u):u=e[8],c.onClick=u}l=MF(VF,{value:c,children:r&&a?a:MF(Wu,{...c})}),e[0]=a,e[1]=o,e[2]=n,e[3]=s,e[4]=r,e[5]=i,e[6]=l}else l=e[6];return l};var GF=t=>{let e=cV(3),{onDrawerOpen:o}=t,n=y0(),r;return e[0]!==n||e[1]!==o?(r=uV("div",{className:"drawer-link",children:[C0(Wu,{...n,className:"drawer-link__cell",link:!1,onClick:null}),C0("button",{className:"drawer-link__doc-drawer-toggler",onClick:()=>{o(n.rowData.id,n.collectionSlug)},type:"button",children:C0(yr,{})})]}),e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as hV}from"react/compiler-runtime";import{jsx as gV}from"react/jsx-runtime";import"react";import{jsx as S0}from"react/jsx-runtime";import"react";import{jsx as zF}from"react/jsx-runtime";import"react";var x0="clickable-arrow",WF=t=>{let{direction:e="right",isDisabled:o=!1,updatePage:n}=t,r=[x0,o&&`${x0}--is-disabled`,e&&`${x0}--${e}`].filter(Boolean).join(" ");return zF("button",{className:r,disabled:o,onClick:o?void 0:n,type:"button",children:zF(He,{})})};import{jsx as dV}from"react/jsx-runtime";import"react";var Jp="paginator__page",w0=({isCurrent:t,isFirstPage:e=!1,isLastPage:o=!1,page:n=1,updatePage:r})=>{let s=[Jp,t&&`${Jp}--is-current`,e&&`${Jp}--is-first-page`,o&&`${Jp}--is-last-page`].filter(Boolean).join(" ");return dV("button",{className:s,onClick:()=>r(n),type:"button",children:n})};import{jsx as mV}from"react/jsx-runtime";import"react";var HF=()=>mV("span",{className:"paginator__separator",children:"\u2014"});var fV={ClickableArrow:WF,Page:w0,Separator:HF},pV="paginator",Hu=t=>{let{hasNextPage:e=!1,hasPrevPage:o=!1,nextPage:n=null,numberOfNeighbors:r=1,onChange:s,page:i,prevPage:a=null,totalPages:l=null}=t;if(!o&&!e)return null;let c=p=>{typeof s=="function"&&s(p)},u=Array.from({length:l},(p,h)=>h+1),d=i-1-r;d<=0&&(d=0);let f=i-1+r+1,m=u.slice(d,f);return i-r-1>=2&&m.unshift({type:"Separator"}),i>r+1&&m.unshift({type:"Page",props:{isFirstPage:!0,page:1,updatePage:c}}),i+r+1<l&&m.push({type:"Separator"}),f<l&&m.push({type:"Page",props:{isLastPage:!0,page:l,updatePage:c}}),m.unshift({type:"ClickableArrow",props:{direction:"right",isDisabled:!e,updatePage:()=>c(n??i+1)}}),m.unshift({type:"ClickableArrow",props:{direction:"left",isDisabled:!o,updatePage:()=>c(a??Math.max(1,i-1))}}),S0("div",{className:pV,children:m.map((p,h)=>{if(typeof p=="number")return S0(w0,{isCurrent:i===p,page:p,updatePage:c},h);let g=fV[p.type];return S0(g,{...p.props},h)})})};var UF=()=>{let t=hV(11),{data:e,handlePageChange:o}=mt(),n=e.nextPage||2,r;t[0]!==o?(r=l=>{o(l)},t[0]=o,t[1]=r):r=t[1];let s=e.page||1,i=e.prevPage||void 0,a;return t[2]!==e.hasNextPage||t[3]!==e.hasPrevPage||t[4]!==e.limit||t[5]!==e.totalPages||t[6]!==n||t[7]!==r||t[8]!==s||t[9]!==i?(a=gV(Hu,{hasNextPage:e.hasNextPage,hasPrevPage:e.hasPrevPage,limit:e.limit,nextPage:n,numberOfNeighbors:1,onChange:r,page:s,prevPage:i,totalPages:e.totalPages}),t[2]=e.hasNextPage,t[3]=e.hasPrevPage,t[4]=e.limit,t[5]=e.totalPages,t[6]=n,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a};var Rr="relationship-table",I0=t=>{let{AfterInput:e,allowCreate:o=!0,BeforeInput:n,disableTable:r=!1,field:s,fieldPath:i,filterOptions:a,initialData:l,initialDrawerData:c,Label:u,parent:d,relationTo:f}=t,[m,p]=vs(null),{config:h,getEntityConfig:g}=H(),{i18n:b,t:C}=N(),[y,v]=vs(),[x,I]=vs(!1),[w]=vs(()=>g({collectionSlug:f})),F=Array.isArray(f),[S,R]=vs(F?void 0:f),{permissions:D}=Ie(),_=CV(!1),[T,A]=vs(void 0),[L,,{closeDrawer:P,isDrawerOpen:E,openDrawer:B}]=jt({id:T,collectionSlug:S}),[k,$]=vs(!r),[j,M]=vs(()=>l?{...l,docs:Array.isArray(l.docs)?l.docs.reduce((J,re)=>typeof re=="string"||typeof re=="number"?[...J,{id:re}]:[...J,re],[]):[]}:void 0),[O,V]=vs(),{getTableState:W}=Lt(),Y=qp(async J=>{let re={limit:s?.defaultLimit||w?.admin?.pagination?.defaultLimit,sort:s.defaultSort||w?.defaultSort,...y||{},where:{...y?.where||{}}};a&&(re.where=bV(re.where,a));let me=s.admin.defaultColumns?s.admin.defaultColumns.map(Ue=>({accessor:Ue,active:!0})):void 0,xe=typeof s.admin.disableRowTypes=="boolean"?!s.admin.disableRowTypes:Array.isArray(f),{data:_e,state:Be,Table:Me}=await W({collectionSlug:f,columns:YF(y?.columns)||me,data:J,enableRowSelections:!1,orderableFieldName:!s.orderable||Array.isArray(s.collection)?void 0:`_${s.collection}_${s.name}_order`,parent:d,query:re,renderRowTypes:xe,tableAppearance:"condensed"});M(_e),p(Me),V(Be),$(!1)},[s.defaultLimit,s.defaultSort,s.admin.defaultColumns,s.admin.disableRowTypes,s.collection,s.name,s.orderable,w?.admin?.pagination?.defaultLimit,w?.defaultSort,y,a,W,f,d]),z=Qe((J,re)=>{!re&&(!m||J)&&Y()});Uu(()=>{z(y,r)},[y,r]);let K=qp(({doc:J,operation:re})=>{re==="create"&&P();let me=j?.docs?.findIndex(_e=>_e.id===J.id),xe={docs:[]};if(me!==-1){let _e=[...j.docs];_e[me]=J,xe.docs=_e}else xe.docs=[J,...j.docs];Y(xe)},[j?.docs,Y,P]),U=qp(J=>{let re=j.docs.filter(me=>me.id!==J.id);Y({...j,docs:re}),A(void 0)},[j,Y]),X=qp((J,re)=>{_.current=!0,A(J||void 0),R(re||void 0)},[]);Uu(()=>{_.current&&(_.current=!1,B())},[B]),Uu(()=>{E||A(void 0)},[E]);let ne=o!==!1&&D?.collections?.[F?f[0]:f]?.create;Uu(()=>{F&&S&&B()},[S,B,F]),Uu(()=>{F&&!E&&S&&R(void 0)},[E]);let Z=vV.useMemo(()=>({columns:YF(O)?.map(({accessor:J})=>J),limit:s.defaultLimit??w?.admin?.pagination?.defaultLimit,sort:s.defaultSort??w?.defaultSort}),[O,s,w]);return Ol("div",{className:Rr,children:[Ol("div",{className:`${Rr}__header`,children:[u,Ol("div",{className:`${Rr}__actions`,children:[ur(f0,{allowCreate:o!==!1,baseClass:Rr,buttonStyle:"none",className:`${Rr}__add-new${F?"-polymorphic":" doc-drawer__toggler"}`,collections:h.collections,i18n:b,icon:F?"plus":void 0,label:b.t("fields:addNew"),onClick:F?R:B,permissions:D,relationTo:f}),ur(yt,{"aria-controls":`${Rr}-columns`,"aria-expanded":x,className:`${Rr}__toggle-columns ${x?`${Rr}__buttons-active`:""}`,icon:ur(He,{direction:x?"up":"down"}),onClick:()=>I(!x),pillStyle:"light",size:"small",children:C("general:columns")})]})]}),n,k?ur("p",{children:C("general:loading")}):Ol(yV,{children:[j?.docs&&j.docs.length===0&&Ol("div",{className:`${Rr}__no-results`,children:[ur("p",{children:b.t("general:noResults",{label:F?b.t("general:documents"):XF(w?.labels?.plural,b)})}),ur(f0,{allowCreate:ne,baseClass:Rr,collections:h.collections,i18n:b,label:b.t("general:createNewLabel",{label:F?b.t("general:document"):XF(w?.labels?.singular,b)}),onClick:F?R:B,permissions:D,relationTo:f})]}),j?.docs&&j.docs.length>0&&ur(zu,{children:ur(t0,{data:j,modifySearchParams:!1,onQueryChange:v,orderableFieldName:!s.orderable||Array.isArray(s.collection)?void 0:`_${s.collection}_${i.replaceAll(".","_")}_order`,query:Z,children:Ol(Bu,{collectionSlug:F?f[0]:f,columnState:O,LinkedCellOverride:ur(GF,{currentDrawerID:T,onDrawerOpen:X}),children:[ur(Sr,{className:`${Rr}__columns`,height:x?"auto":0,id:`${Rr}-columns`,children:ur("div",{className:`${Rr}__columns-inner`,children:w&&ur(kp,{collectionSlug:w.slug})})}),m,ur(UF,{})]})})})]}),e,ur(L,{initialData:c,onDelete:U,onSave:K})]})};var JF="default"in Qp.default?Qp.default.default:Qp.default,Kp=({collectionSlug:t,config:e,docID:o,fields:n,segments:r})=>{let s=SV(n,{keepPresentationalFields:!0}),i=r[0],a=s.find(c=>c.name===i);if(!a)return null;if(a.type==="relationship"||a.type==="upload"){let c=o;return Array.isArray(a.relationTo)&&(c={relationTo:t,value:o}),{[a.name]:a.hasMany?[c]:c}}let l=r.slice(1,r.length);if(a.type==="tab"||a.type==="group"&&wV(a))return{[a.name]:Kp({collectionSlug:t,config:e,docID:o,fields:a.fields,segments:l})};if(a.type==="array"){let c=Kp({collectionSlug:t,config:e,docID:o,fields:a.fields,segments:l});return c.id=JF().toHexString(),{[a.name]:[c]}}if(a.type==="blocks")for(let c of a.blockReferences??a.blocks){let u=typeof c=="string"?e.blocksMap[c]:c,d=Kp({collectionSlug:t,config:e,docID:o,fields:u.fields,segments:l});if(d)return d.id=JF().toHexString(),d.blockType=u.slug,{[a.name]:[d]}}},IV=t=>{let{field:e,field:{admin:{allowCreate:o,description:n},collection:r,label:s,localized:i,on:a,required:l},path:c}=t,{id:u,docConfig:d}=Se(),{config:f,getEntityConfig:m}=H(),{customComponents:{AfterInput:p,BeforeInput:h,Description:g,Error:b,Label:C}={},path:y,showError:v,value:x}=Te({potentiallyStalePath:c}),I=ZF(()=>{if(!u)return null;let F=u;Array.isArray(e.targetField.relationTo)&&(F={relationTo:d.slug,value:F});let S=Array.isArray(r)?{}:{[a]:{equals:F}};return e.where?{and:[S,e.where]}:S},[u,r,e.targetField.relationTo,e.where,a,d?.slug]),w=ZF(()=>{let F=m({collectionSlug:Array.isArray(e.collection)?e.collection[0]:e.collection});return Kp({collectionSlug:d?.slug,config:f,docID:u,fields:F?.fields,segments:e.on.split(".")})},[m,e.collection,e.on,d?.slug,u,f]);return d?xV("div",{className:[Ae,v&&"error","join"].filter(Boolean).join(" "),id:`field-${y?.replace(/\./g,"__")}`,children:[aa(ue,{CustomComponent:b,Fallback:aa(Ze,{path:y,showError:v})}),aa(I0,{AfterInput:p,allowCreate:typeof u<"u"&&o,BeforeInput:h,disableTable:I===null,field:e,fieldPath:y,filterOptions:I,initialData:u&&x?x:{docs:[]},initialDrawerData:w,Label:aa("h4",{style:{margin:0},children:C||aa(Ce,{label:s,localized:i,path:y,required:l})}),parent:Array.isArray(r)?{id:u,collectionSlug:d.slug,joinPath:y}:void 0,relationTo:r}),aa(ue,{CustomComponent:g,Fallback:aa(Xe,{description:n,path:y})})]}):null},Xu=ze(IV);import{jsx as la,jsxs as qF}from"react/jsx-runtime";import QF,{useCallback as eh,useEffect as _V,useMemo as TV,useState as KF}from"react";var FV="json-field",DV=t=>{let{field:e,field:{admin:{className:o,description:n,editorOptions:r,maxHeight:s}={},jsonSchema:i,label:a,localized:l,required:c},path:u,readOnly:d,validate:f}=t,{insertSpaces:m=wb.insertSpaces,tabSize:p=wb.tabSize}=r||{},h=eh(j=>{if(j!==void 0)return j===null?"":m?JSON.stringify(j,null,p):JSON.stringify(j,null," ")},[p,m]),[g,b]=KF(),C=QF.useRef("formState"),[y,v]=KF(Date.now()),x=eh((j,M)=>{if(typeof f=="function")return f(j,{...M,jsonError:g,required:c})},[f,c,g]),{customComponents:{AfterInput:I,BeforeInput:w,Description:F,Error:S,Label:R}={},disabled:D,initialValue:_,path:T,setValue:A,showError:L,value:P}=Te({potentiallyStalePath:u,validate:x}),E=QF.useRef(h(P??_)),B=eh((j,M)=>{if(!i)return;M.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...M.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],i],validate:!0});let O=i.uri,V=O.includes("?")?`${O}&${crypto.randomUUID?crypto.randomUUID():fn()}`:`${O}?${crypto.randomUUID?crypto.randomUUID():fn()}`;j.setModel(M.editor.createModel(h(P)||"","json",M.Uri.parse(V)))},[i,h,P]),k=eh(j=>{if(!(d||D)){C.current="internalEditor";try{A(j?JSON.parse(j):null),E.current=j,b(void 0)}catch(M){A(j||null),E.current=j,b(M)}}},[d,D,A]);_V(()=>{if(C.current==="formState"){let j=h(P??_);j!==E.current&&(E.current=j,v(Date.now()))}C.current="formState"},[_,T,h,P]);let $=TV(()=>et(e),[e]);return qF("div",{className:[Ae,FV,o,L&&"error",(d||D)&&"read-only"].filter(Boolean).join(" "),style:$,children:[la(ue,{CustomComponent:R,Fallback:la(Ce,{label:a,localized:l,path:T,required:c})}),qF("div",{className:`${Ae}__wrap`,children:[la(ue,{CustomComponent:S,Fallback:la(Ze,{message:g,path:T,showError:L})}),w,la(pu,{defaultLanguage:"json",maxHeight:s,onChange:k,onMount:B,options:r,readOnly:d||D,recalculatedHeightAt:y,value:E.current,wrapperProps:{id:`field-${T?.replace(/\./g,"__")}`}}),I]}),la(ue,{CustomComponent:F,Fallback:la(Xe,{description:n,path:T})})]})},Yu=ze(DV);import{jsx as ys,jsxs as eD}from"react/jsx-runtime";import{getTranslation as RV}from"@payloadcms/translations";import{isNumber as AV}from"payload/shared";import{useCallback as _0,useEffect as PV,useMemo as EV,useState as NV}from"react";var LV=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,step:s=1}={},hasMany:i=!1,label:a,localized:l,max:c=1/0,maxRows:u=1/0,min:d=-1/0,required:f},onChange:m,path:p,readOnly:h,validate:g}=t,{i18n:b,t:C}=N(),y=_0(($,j)=>{if(typeof g=="function")return g($,{...j,max:c,min:d,required:f})},[g,d,c,f]),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Error:w,Label:F}={},disabled:S,path:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:p,validate:y}),A=_0($=>{let j=parseFloat($.target.value),M=j;Number.isNaN(j)&&(M=null),typeof m=="function"&&m(M),D(M)},[m,D]),[L,P]=NV([]),E=_0($=>{if(!(h||S)){let j;$?Array.isArray($)?j=$.map(M=>Number(M.value?.value||M.value)):j=[Number($.value?.value||$.value)]:j=[],D(j)}},[h,S,D]);PV(()=>{i&&Array.isArray(T)&&P(T.map(($,j)=>({id:`${$}${j}`,label:`${$}`,value:{toString:()=>`${$}${j}`,value:$?.value||$}})))},[T,i]);let B=EV(()=>et(e),[e]),k=RV(r,b);return eD("div",{className:[Ae,"number",o,_&&"error",(h||S)&&"read-only",i&&"has-many"].filter(Boolean).join(" "),style:B,children:[ys(ue,{CustomComponent:F,Fallback:ys(Ce,{label:a,localized:l,path:R,required:f})}),eD("div",{className:`${Ae}__wrap`,children:[ys(ue,{CustomComponent:w,Fallback:ys(Ze,{path:R,showError:_})}),x,i?ys(pt,{className:`field-${R.replace(/\./g,"__")}`,disabled:h||S,filterOption:($,j)=>{let M=Array.isArray(T)&&T.length>=u;return AV(j)&&!M},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(T)&&T.length>=u?C("validation:limitReached",{max:u,value:T.length+1}):null,onChange:E,options:[],placeholder:k,showError:_,value:L}):ys("div",{children:ys("input",{disabled:h||S,id:`field-${R.replace(/\./g,"__")}`,max:c,min:d,name:R,onChange:A,onWheel:$=>{$.target.blur()},placeholder:k,step:s,type:"number",value:typeof T=="number"?T:""})}),v,ys(ue,{CustomComponent:I,Fallback:ys(Xe,{description:n,path:R})})]})]})},Zu=ze(LV);import{jsx as Mn,jsxs as Vl}from"react/jsx-runtime";import{getTranslation as T0}from"@payloadcms/translations";import{useCallback as tD,useMemo as kV}from"react";var oD="point",jV=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,step:s}={},label:i,localized:a,required:l},path:c,readOnly:u,validate:d}=t,{i18n:f,t:m}=N(),p=tD((_,T)=>{if(typeof d=="function")return d(_,{...T,required:l})},[d,l]),{customComponents:{AfterInput:h,BeforeInput:g,Description:b,Error:C,Label:y}={},disabled:v,path:x,setValue:I,showError:w,value:F=[null,null]}=Te({potentiallyStalePath:c,validate:p}),S=tD((_,T)=>{let A=parseFloat(_.target.value);Number.isNaN(A)&&(A=_.target.value);let L=[...F];L[T]=A,I(L)},[I,F]),R=_=>{let T=m(_==="longitude"?"fields:longitude":"fields:latitude"),A=i?T0(i,f):"";return`${A}${A?" - ":""}${T}`},D=kV(()=>et(e),[e]);return Vl("div",{className:[Ae,oD,o,w&&"error",(u||v)&&"read-only"].filter(Boolean).join(" "),style:D,children:[Vl("ul",{className:`${oD}__wrap`,children:[Vl("li",{children:[Mn(ue,{CustomComponent:y,Fallback:Mn(Ce,{label:R("longitude"),localized:a,path:x,required:l})}),Vl("div",{className:"input-wrapper",children:[g,Mn("input",{disabled:u||v,id:`field-longitude-${x?.replace(/\./g,"__")}`,name:`${x}.longitude`,onChange:_=>S(_,0),placeholder:T0(r,f),step:s,type:"number",value:F&&typeof F[0]=="number"?F[0]:""}),h]})]}),Vl("li",{children:[Mn(ue,{CustomComponent:y,Fallback:Mn(Ce,{label:R("latitude"),localized:a,path:x,required:l})}),Vl("div",{className:"input-wrapper",children:[Mn(ue,{CustomComponent:C,Fallback:Mn(Ze,{path:x,showError:w})}),g,Mn("input",{disabled:u||v,id:`field-latitude-${x?.replace(/\./g,"__")}`,name:`${x}.latitude`,onChange:_=>S(_,1),placeholder:T0(r,f),step:s,type:"number",value:F&&typeof F[1]=="number"?F[1]:""}),h]})]})]}),Mn(ue,{CustomComponent:b,Fallback:Mn(Xe,{description:n,path:x})})]})},Ju=ze(jV);import{jsx as Cs,jsxs as rD}from"react/jsx-runtime";import{optionIsObject as nD}from"payload/shared";import{useCallback as OV,useMemo as VV}from"react";import{c as $V}from"react/compiler-runtime";import{jsx as th,jsxs as BV}from"react/jsx-runtime";import{getTranslation as MV}from"@payloadcms/translations";import"react";var qu="radio-input",Qu=t=>{let e=$V(16),{isSelected:o,onChange:n,option:r,path:s,readOnly:i,uuid:a}=t,{i18n:l}=N(),c=ut(),u=`field-${s}-${r.value}${c>1?`-${c}`:""}${a?`-${a}`:""}`,d=o&&`${qu}--is-selected`,f;e[0]!==d?(f=[qu,d].filter(Boolean),e[0]=d,e[1]=f):f=e[1];let m=f.join(" "),p;e[2]!==n||e[3]!==r.value?(p=()=>typeof n=="function"?n(r.value):null,e[2]=n,e[3]=r.value,e[4]=p):p=e[4];let h;if(e[5]!==l||e[6]!==u||e[7]!==o||e[8]!==r.label||e[9]!==s||e[10]!==i||e[11]!==m||e[12]!==p){let g=th("input",{checked:o,disabled:i,id:u,name:s,onChange:p,type:"radio"}),b=i&&`${qu}__styled-radio--disabled`,C;e[14]!==b?(C=[`${qu}__styled-radio`,b].filter(Boolean),e[14]=b,e[15]=C):C=e[15],h=th("label",{htmlFor:u,children:BV("div",{className:m,children:[g,th("span",{className:C.join(" ")}),th("span",{className:`${qu}__label`,children:MV(r.label,l)})]})}),e[5]=l,e[6]=u,e[7]=o,e[8]=r.label,e[9]=s,e[10]=i,e[11]=m,e[12]=p,e[13]=h}else h=e[13];return h};var oh="radio-group",GV=t=>{let{disableModifyingForm:e,field:o,field:{admin:{className:n,description:r,layout:s="horizontal"}={},label:i,localized:a,options:l=[],required:c}={},onChange:u,path:d,readOnly:f,validate:m,value:p}=t,{uuid:h}=$e(),g=OV((T,A)=>{if(typeof m=="function")return m(T,{...A,options:l,required:c})},[m,l,c]),{customComponents:{AfterInput:b,BeforeInput:C,Description:y,Error:v,Label:x}={},disabled:I,path:w,setValue:F,showError:S,value:R}=Te({potentiallyStalePath:d,validate:g}),D=R||p,_=VV(()=>et(o),[o]);return rD("div",{className:[Ae,oh,n,`${oh}--layout-${s}`,S&&"error",(f||I)&&`${oh}--read-only`].filter(Boolean).join(" "),style:_,children:[Cs(ue,{CustomComponent:v,Fallback:Cs(Ze,{path:w,showError:S})}),Cs(ue,{CustomComponent:x,Fallback:Cs(Ce,{label:i,localized:a,path:w,required:c})}),rD("div",{className:`${Ae}__wrap`,children:[C,Cs("ul",{className:`${oh}--group`,id:`field-${w.replace(/\./g,"__")}`,children:l.map(T=>{let A="";nD(T)?A=T.value:A=T;let L=String(A)===String(D),P=`field-${w}-${A}${h?`-${h}`:""}`;return Cs("li",{children:Cs(Qu,{id:P,isSelected:L,onChange:()=>{typeof u=="function"&&u(A),f||I||F(A,!!e)},option:nD(T)?T:{label:T,value:T},path:w,readOnly:f||I,uuid:h})},`${w} - ${A}`)})}),b,Cs(ue,{CustomComponent:y,Fallback:Cs(Xe,{description:r,path:w})})]})]})},Ku=ze(GV);import{jsx as IG}from"react/jsx-runtime";import $0,{useCallback as B0,useMemo as _G}from"react";import{jsx as xn,jsxs as N0}from"react/jsx-runtime";import{dequal as CG}from"dequal/lite";import{formatAdminURL as L0,wordBoundariesRegex as xG}from"payload/shared";import*as k0 from"qs-esm";import{useCallback as da,useEffect as Ul,useMemo as wG,useReducer as SG,useRef as rd,useState as ri}from"react";import{c as zV}from"react/compiler-runtime";import{jsx as On,jsxs as rh}from"react/jsx-runtime";import{getTranslation as sD}from"@payloadcms/translations";import{hasAutosaveEnabled as WV}from"payload/shared";import{Fragment as F0,useEffect as nh,useState as ed}from"react";var Gl="relationship-add-new",iD=t=>{let e=zV(46),{Button:o,hasMany:n,onChange:r,path:s,relationTo:i,unstyled:a,value:l}=t,c=jp(i),{permissions:u}=Ie(),[d,f]=ed(!1),[m,p]=ed(),h=c.length>1,g;e[0]!==c[0]||e[1]!==h?(g=()=>h?void 0:c[0],e[0]=c[0],e[1]=h,e[2]=g):g=e[2];let[b,C]=ed(g),[y,v]=ed(!1),{i18n:x,t:I}=N(),[w,F]=ed(!1),S=b?.slug,R;e[3]!==S?(R={collectionSlug:S},e[3]=S,e[4]=R):R=e[4];let[D,_,T]=jt(R),{isDrawerOpen:A,toggleDrawer:L}=T,P;e[5]!==b||e[6]!==n||e[7]!==r||e[8]!==l?(P=ne=>{let{doc:Z,operation:J}=ne;if(J==="create"||J==="update"&&WV(b)){let re;l?re=Array.isArray(l)?!l.some(me=>me&&me.value===Z.id):l.value!==Z.id:re=!0,re&&r(n===!0?[...Array.isArray(l)?l:[],{relationTo:b?.slug,value:Z.id}]:{relationTo:b?.slug,value:Z.id}),p(void 0)}},e[5]=b,e[6]=n,e[7]=r,e[8]=l,e[9]=P):P=e[9];let E=P,B;e[10]===Symbol.for("react.memo_cache_sentinel")?(B=ne=>{v(ne)},e[10]=B):B=e[10];let k=B,$,j;e[11]!==u||e[12]!==c?($=()=>{u&&(c.length===1?f(u.collections[c[0]?.slug]?.create):f(c.some(ne=>u.collections[ne?.slug]?.create)))},j=[u,c],e[11]=u,e[12]=c,e[13]=$,e[14]=j):($=e[13],j=e[14]),nh($,j);let M,O;e[15]!==c||e[16]!==h||e[17]!==m?(O=()=>{h&&m&&C(c.find(ne=>ne?.slug===m))},M=[m,h,c],e[15]=c,e[16]=h,e[17]=m,e[18]=M,e[19]=O):(M=e[18],O=e[19]),nh(O,M);let V,W;e[20]!==b||e[21]!==h||e[22]!==L?(V=()=>{h&&b&&(L(),p(void 0))},W=[L,h,b],e[20]=b,e[21]=h,e[22]=L,e[23]=V,e[24]=W):(V=e[23],W=e[24]),nh(V,W);let Y,z;e[25]!==A||e[26]!==h?(Y=()=>{h&&!A&&C(void 0)},z=[A,h],e[25]=A,e[26]=h,e[27]=Y,e[28]=z):(Y=e[27],z=e[28]),nh(Y,z);let K=c[0]?.labels.singular,U,X;if(e[29]!==o||e[30]!==D||e[31]!==_||e[32]!==b||e[33]!==x||e[34]!==E||e[35]!==s||e[36]!==u||e[37]!==y||e[38]!==c||e[39]!==d||e[40]!==w||e[41]!==I||e[42]!==K||e[43]!==a){X=Symbol.for("react.early_return_sentinel");e:{let ne=I("fields:addNewLabel",{label:sD(K,x)});if(!d){X=null;break e}U=rh("div",{className:Gl,id:`${s}-add-new`,children:[c.length===1&&rh(F0,{children:[On(_,{className:[`${Gl}__add-button`,a&&`${Gl}__add-button--unstyled`].filter(Boolean).join(" "),onClick:()=>{F(!1)},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:o||rh(F0,{children:[On(Ao,{className:`${Gl}__tooltip`,show:w,children:ne}),On(ar,{})]})}),On(D,{onSave:E})]}),c.length>1&&rh(F0,{children:[On(it,{button:o||On(oe,{buttonStyle:"none",className:`${Gl}__add-button`,tooltip:y?void 0:I("fields:addNew"),children:On(ar,{})}),buttonType:"custom",horizontalAlign:"center",onToggleOpen:k,render:Z=>{let{close:J}=Z;return On(Ub,{children:c.map(re=>u.collections[re?.slug]?.create?On(Xb,{className:`${Gl}__relation-button--${re?.slug}`,onClick:()=>{J(),p(re?.slug)},children:sD(re?.labels?.singular,x)},re?.slug):null)})},size:"medium"}),b&&u.collections[b?.slug]?.create&&On(D,{onSave:E})]})]})}e[29]=o,e[30]=D,e[31]=_,e[32]=b,e[33]=x,e[34]=E,e[35]=s,e[36]=u,e[37]=y,e[38]=c,e[39]=d,e[40]=w,e[41]=I,e[42]=K,e[43]=a,e[44]=U,e[45]=X}else U=e[44],X=e[45];return X!==Symbol.for("react.early_return_sentinel")?X:U};import{c as XV}from"react/compiler-runtime";import{jsx as sh}from"react/jsx-runtime";import{createElement as YV}from"react";import{useEffect as uD,useId as ZV,useState as dD}from"react";import{jsx as aD,jsxs as HV}from"react/jsx-runtime";import{hoistQueryParamsToAnd as UV}from"payload/shared";import{useCallback as td,useEffect as lD,useState as D0}from"react";var cD=({allowCreate:t=!0,collectionSlugs:e,disableQueryPresets:o,drawerSlug:n,enableRowSelections:r,filterOptions:s,onBulkSelect:i,onSelect:a,overrideEntityVisibility:l=!0,selectedCollection:c})=>{let{closeModal:u,isModalOpen:d}=ae(),{serverFunction:f}=Lt(),[m,p]=D0(void 0),[h,g]=D0(!0),{config:{collections:b},getEntityConfig:C}=H(),y=d(n),v=b.filter(({slug:P})=>e.includes(P)),[x,I]=D0(()=>{let P=c||v[0]?.slug,E=C({collectionSlug:P});return E?{label:E.labels,value:E.slug}:void 0}),[w,F,{drawerSlug:S}]=jt({collectionSlug:x.value}),R=Qe(P=>{P&&P!==x?.value&&I({label:C({collectionSlug:P})?.labels,value:P})});lD(()=>{R(c)},[c]);let D=td(async({slug:P,query:E})=>{try{let B={...E||{},where:{...E?.where||{}}},k=s?.[P];if(s&&typeof k!="boolean"&&(B.where=UV(B.where,k)),P){let $=await f({name:"render-list",args:{collectionSlug:P,disableBulkDelete:!0,disableBulkEdit:!0,disableQueryPresets:o,drawerSlug:n,enableRowSelections:r,overrideEntityVisibility:l,query:B}});p($?.List||null)}else p(null);g(!1)}catch(B){console.error("Error rendering List View: ",B),y&&u(n)}},[f,u,n,y,r,s,l,o]);lD(()=>{m||D({slug:x?.value})},[D,m,x.value]);let _=td(({doc:P})=>{typeof a=="function"&&a({collectionSlug:x?.value,doc:P,docID:P.id}),u(S),u(n)},[u,S,n,a,x.value]),T=td(P=>{D({slug:x?.value,query:P})},[D,x.value]),A=td(P=>{I(P),D({slug:P?.value})},[D]),L=td(async P=>{P&&I({label:C({collectionSlug:P})?.labels,value:P}),await D({slug:x.value||P})},[C,D,x.value]);return h?aD(vn,{}):HV(qv,{allowCreate:t,createNewDrawerSlug:S,DocumentDrawerToggler:F,drawerSlug:n,enabledCollections:e,onBulkSelect:i,onQueryChange:T,onSelect:a,refresh:L,selectedOption:x,setSelectedOption:A,children:[m,aD(w,{onSave:_})]})};var mD="list-drawer",JV=({depth:t,uuid:e})=>`list-drawer_${t}_${e}`,qV=({children:t,className:e,disabled:o,drawerSlug:n,onClick:r,...s})=>sh(cs,{className:[e,`${mD}__toggler`].filter(Boolean).join(" "),disabled:o,onClick:r,slug:n,...s,children:t}),QV=t=>{let{drawerSlug:e}=t;return sh(St,{className:mD,gutter:!1,Header:null,slug:e,children:sh(cD,{...t})})},ca=t=>{let e=XV(42),{collectionSlugs:o,filterOptions:n,selectedCollection:r,uploads:s}=t,{config:i}=H(),{collections:a}=i,l=ut(),c=ZV(),{closeModal:u,modalState:d,openModal:f,toggleModal:m}=ae(),[p,h]=dD(!1),[g,b]=dD(o),C;e[0]!==l||e[1]!==c?(C=JV({depth:l,uuid:c}),e[0]=l,e[1]=c,e[2]=C):C=e[2];let y=C,v,x;e[3]!==y||e[4]!==d?(v=()=>{h(!!d[y]?.isOpen)},x=[d,y],e[3]=y,e[4]=d,e[5]=v,e[6]=x):(v=e[5],x=e[6]),uD(v,x);let I,w;e[7]!==g||e[8]!==a||e[9]!==s?(I=()=>{if(!g||g.length===0){let j=a.filter(M=>{let{upload:O}=M;return s?!!O:!0});b(j.map(KV))}},w=[g,s,a],e[7]=g,e[8]=a,e[9]=s,e[10]=I,e[11]=w):(I=e[10],w=e[11]),uD(I,w);let F;e[12]!==y||e[13]!==m?(F=()=>{m(y)},e[12]=y,e[13]=m,e[14]=F):F=e[14];let S=F,R;e[15]!==u||e[16]!==y?(R=()=>{u(y)},e[15]=u,e[16]=y,e[17]=R):R=e[17];let D=R,_;e[18]!==y||e[19]!==f?(_=()=>{f(y)},e[18]=y,e[19]=f,e[20]=_):_=e[20];let T=_,A;e[21]!==D||e[22]!==g||e[23]!==y||e[24]!==n||e[25]!==r||e[26]!==s?(A=j=>YV(QV,{...j,closeDrawer:D,collectionSlugs:g,drawerSlug:y,filterOptions:n,key:y,selectedCollection:r,uploads:s}),e[21]=D,e[22]=g,e[23]=y,e[24]=n,e[25]=r,e[26]=s,e[27]=A):A=e[27];let L=A,P;e[28]!==y?(P=j=>sh(qV,{...j,drawerSlug:y}),e[28]=y,e[29]=P):P=e[29];let E=P,B;e[30]!==D||e[31]!==g||e[32]!==l||e[33]!==y||e[34]!==p||e[35]!==T||e[36]!==S?(B={closeDrawer:D,collectionSlugs:g,drawerDepth:l,drawerSlug:y,isDrawerOpen:p,openDrawer:T,setCollectionSlugs:b,toggleDrawer:S},e[30]=D,e[31]=g,e[32]=l,e[33]=y,e[34]=p,e[35]=T,e[36]=S,e[37]=B):B=e[37];let k=B,$;return e[38]!==L||e[39]!==k||e[40]!==E?($=[L,E,k],e[38]=L,e[39]=k,e[40]=E,e[41]=$):$=e[41],$};function KV(t){let{slug:e}=t;return e}import{c as eG}from"react/compiler-runtime";import{useRef as tG}from"react";var R0=(t,e)=>{let o=eG(3),n=tG(void 0),r;return o[0]!==t||o[1]!==e?(r=(...s)=>{let i=s,a=()=>{clearTimeout(n.current),t(...i)};clearTimeout(n.current),n.current=setTimeout(a,e)},o[0]=t,o[1]=e,o[2]=r):r=o[2],r};import{useCallback as oG,useRef as fD}from"react";function ua(){let t=fD([]),e=fD(!1);return{queueTask:oG((n,r)=>{t.current.push(n);async function s(){if(!e.current&&!(typeof r?.beforeProcess=="function"&&r.beforeProcess()===!1))for(;t.current.length>0;){let i=t.current.pop();t.current=[],e.current=!0;try{await i()}catch(a){console.error("Error in queued function:",a)}finally{e.current=!1,typeof r?.afterProcess=="function"&&r.afterProcess()}}}s()},[])}}import{c as rG}from"react/compiler-runtime";import{jsx as nG}from"react/jsx-runtime";import{createContext as sG,use as iG,useState as aG}from"react";var pD=sG({mostRecentUpdate:null,reportUpdate:()=>null}),A0=t=>{let e=rG(3),{children:o}=t,[n,r]=aG(null),s;return e[0]!==o||e[1]!==n?(s=nG(pD,{value:{mostRecentUpdate:n,reportUpdate:r},children:o}),e[0]=o,e[1]=n,e[2]=s):s=e[2],s},xs=()=>iG(pD);var P0=t=>{for(let e in t){let o=t[e];if((e.toLowerCase()==="and"||e.toLowerCase()==="or")&&Array.isArray(o))for(let n of o)P0(n);else o&&typeof o=="object"&&"in"in o&&Array.isArray(o.in)&&o.in.length===0&&(t[e]={exists:!1})}return t};var E0=({hasMany:t,relationTo:e,value:o})=>{let n=e.reduce((r,s)=>({...r,[s]:[]}),{});if(o===null)return n;if(o){let r=(s,i)=>{(typeof i=="string"||typeof i=="number")&&typeof s=="string"&&(n[s]?n[s].push(i):n[s]=[i])};t===!0?o.forEach(s=>{s&&r(s.relationTo,s.value)}):r(o.relationTo,o.value)}return n};var hD=({allowEdit:t,options:e,value:o})=>{if(o||typeof o=="number"){if(Array.isArray(o))return o.map(r=>{let s;return e.forEach(i=>{s||(s=i.options.find(a=>a.value===r.value&&a.relationTo===r.relationTo))}),s?{allowEdit:t,...s}:void 0});let n;return e.forEach(r=>{n||(n=r.options.find(s=>s.value===o.value&&s.relationTo===o.relationTo))}),n?{allowEdit:t,...n}:void 0}};import{getTranslation as lG}from"@payloadcms/translations";var bD=t=>t.reduce((e,o)=>o.options?[...e,...bD(o.options)]:[...e,{id:o.value,relationTo:o.relationTo}],[]),gD=t=>t.sort((e,o)=>typeof e?.label?.localeCompare=="function"&&typeof o?.label?.localeCompare=="function"?e.label.localeCompare(o.label):0),vD=(t,e)=>{switch(e.type){case"ADD":{let{collection:o,config:n,docs:r,i18n:s,ids:i=[],sort:a}=e,l=o.slug,c=bD(t),u=[...t],d=u.find(m=>m.label===o.labels.plural),f=r.reduce((m,p)=>{if(c.filter(h=>h.id===p.id&&h.relationTo===l).length===0){c.push({id:p.id,relationTo:l});let h=Jo({collectionConfig:o,data:p,dateFormat:n.admin.dateFormat,fallback:`${s.t("general:untitled")} - ID: ${p.id}`,i18n:s});return[...m,{label:h,relationTo:l,value:p.id}]}return m},[]);if(i.forEach(m=>{c.filter(p=>p.id===m&&p.relationTo===l).length===0&&(c.push({id:m,relationTo:l}),f.push({allowEdit:!1,label:`${s.t("general:untitled")} - ID: ${m}`,relationTo:l,value:m}))}),d){let m=[...d.options,...f];d.options=a?gD(m):m}else u.push({label:lG(o.labels.plural,s),options:a?gD(f):f});return u}case"CLEAR":{let o=e.exemptValues?Array.isArray(e.exemptValues)?e.exemptValues:[e.exemptValues]:[];return t.filter(r=>{let s=r.options.filter(i=>o?o.some(a=>a&&i.value===a.value):!1);return r.options=s,s.length>0})}case"REMOVE":{let{id:o,collection:n}=e,r=[...t],s=r.findIndex(i=>i.label===n.labels.plural);return s===-1||(r[s]={...r[s],options:r[s].options.filter(i=>i.value!==o)}),r}case"UPDATE":{let{collection:o,config:n,doc:r,i18n:s}=e,i=o.slug,a=[...t],l=Jo({collectionConfig:o,data:r,dateFormat:n.admin.dateFormat,fallback:`${s.t("general:untitled")} - ID: ${r.id}`,i18n:s}),u=a.find(d=>d.label===o.labels.plural)?.options?.find(d=>d.value===r.id);return u&&(u.label=l,u.relationTo=i),a}default:return t}};import{jsx as od,jsxs as yD}from"react/jsx-runtime";import{Fragment as cG,useState as uG}from"react";var zl="relationship--multi-value-label",CD=t=>{let{data:e,selectProps:o}=t,{allowEdit:n,label:r,relationTo:s,value:i}=e,{customProps:a}=o===void 0?{}:o,{draggableProps:l,onDocumentOpen:c}=a===void 0?{}:a,{permissions:u}=Ie(),[d,f]=uG(!1),{t:m}=N(),p=!!u?.collections?.[s]?.read;return yD("div",{className:zl,title:r||"",children:[od("div",{className:`${zl}__content`,children:od(Fo.MultiValueLabel,{...t,innerProps:{className:`${zl}__text`,...l||{}}})}),s&&p&&n!==!1&&od(cG,{children:yD("button",{"aria-label":`Edit ${r}`,className:`${zl}__drawer-toggler`,onClick:h=>{f(!1),c({id:i,collectionSlug:s,hasReadPermission:p,openInNewTab:h.metaKey||h.ctrlKey})},onKeyDown:dG,onMouseDown:mG,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onTouchEnd:fG,type:"button",children:[od(Ao,{className:`${zl}__tooltip`,show:d,children:m("general:editLabel",{label:""})}),od(yr,{className:`${zl}__icon`})]})})]})};function dG(t){t.key==="Enter"&&t.stopPropagation()}function mG(t){return t.stopPropagation()}function fG(t){return t.stopPropagation()}import{c as pG}from"react/compiler-runtime";import{jsx as Wl,jsxs as xD}from"react/jsx-runtime";import{Fragment as hG,useState as gG}from"react";var Hl="relationship--single-value",wD=t=>{let e=pG(16),{children:o,data:n,selectProps:r}=t,{allowEdit:s,label:i,relationTo:a,value:l}=n,c;e[0]!==r?(c=r===void 0?{}:r,e[0]=r,e[1]=c):c=e[1];let{customProps:u}=c,d;e[2]!==u?(d=u===void 0?{}:u,e[2]=u,e[3]=d):d=e[3];let{onDocumentOpen:f}=d,[m,p]=gG(!1),{t:h}=N(),{permissions:g}=Ie(),b=!!g?.collections?.[a]?.read,C=i||"",y;return e[4]!==s||e[5]!==o||e[6]!==b||e[7]!==i||e[8]!==f||e[9]!==t||e[10]!==a||e[11]!==m||e[12]!==h||e[13]!==C||e[14]!==l?(y=Wl(Fo.SingleValue,{...t,className:Hl,children:Wl("div",{className:`${Hl}__label`,title:C,children:xD("div",{className:`${Hl}__label-text`,children:[Wl("div",{className:`${Hl}__text`,children:o}),a&&b&&s!==!1&&Wl(hG,{children:xD("button",{"aria-label":h("general:editLabel",{label:i}),className:`${Hl}__drawer-toggler`,onClick:v=>{p(!1),f({id:l,collectionSlug:a,hasReadPermission:b,openInNewTab:v.metaKey||v.ctrlKey})},onKeyDown:bG,onMouseDown:vG,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onTouchEnd:yG,type:"button",children:[Wl(Ao,{className:`${Hl}__tooltip`,show:m,children:h("general:edit")}),Wl(yr,{})]})})]})})}),e[4]=s,e[5]=o,e[6]=b,e[7]=i,e[8]=f,e[9]=t,e[10]=a,e[11]=m,e[12]=h,e[13]=C,e[14]=l,e[15]=y):y=e[15],y};function bG(t){t.key==="Enter"&&t.stopPropagation()}function vG(t){return t.stopPropagation()}function yG(t){return t.stopPropagation()}var nd="relationship",j0=t=>{let{AfterInput:e,allowCreate:o=!0,allowEdit:n=!0,appearance:r="select",BeforeInput:s,className:i,description:a,Description:l,Error:c,filterOptions:u,formatDisplayedOptions:d,hasMany:f,initialValue:m,isSortable:p=!0,label:h,Label:g,localized:b,maxResultsPerRequest:C=10,onChange:y,path:v,placeholder:x,readOnly:I,relationTo:w,required:F,showError:S,sortOptions:R,style:D,value:_}=t,{config:T,getEntityConfig:A}=H(),{routes:{api:L},serverURL:P}=T,{i18n:E,t:B}=N(),{permissions:k}=Ie(),{code:$}=ye(),[j,M]=ri({id:void 0,collectionSlug:void 0,hasReadPermission:!1}),[O,V]=ri(-1),[W,Y]=ri({}),[z,K]=ri(""),[U,X]=ri(""),[ne,Z]=ri(!1),[J,re]=ri(!1),[me,xe]=ri(!1),_e=rd(!1),{queueTask:Be}=ua(),[Me,Ue]=SG(vD,[]),he=rd(_),[Oe,,{drawerSlug:Ke,isDrawerOpen:le,openDrawer:we}]=jt({id:j.id,collectionSlug:j.collectionSlug}),G=wG(()=>{let ce=u;if(_){let ke=(f===!1?[_]:_).reduce((Pe,qe)=>(Pe[qe.relationTo]||(Pe[qe.relationTo]=[]),Pe[qe.relationTo].push(qe.value),Pe),{});(Array.isArray(w)?w:[w]).forEach(Pe=>{ce={...ce||{},[Pe]:{...typeof u?.[Pe]=="object"?u[Pe]:{},...ke[Pe]?{id:{not_in:ke[Pe]}}:{}}}})}return ce},[u,_,f,w]),[ie,,{closeDrawer:Q,isDrawerOpen:fe,openDrawer:de}]=ca({collectionSlugs:w,filterOptions:G}),se=da(({collectionSlug:ce,doc:ke})=>{f?y([...Array.isArray(_)?_:[],{relationTo:ce,value:ke.id}]):f===!1&&y({relationTo:ce,value:ke.id}),Q()},[f,y,Q,_]),ee=rd(!1),ge=da(({filterOptions:ce,hasMany:ke,lastFullyLoadedRelation:Pe,lastLoadedPage:qe,onSuccess:ct,search:nt,sort:Fe,value:Ve})=>{k&&Be(async()=>{let Ot=typeof Pe<"u"?Pe:-1,gt=Array.isArray(w)?w:[w],At=Ot===-1?gt:gt.slice(Ot+1),wt=0,mo=E0(ke===!0?{hasMany:!0,relationTo:w,value:Ve}:{hasMany:!1,relationTo:w,value:Ve});z||(await At.reduce(async(jr,bt)=>{let Bo=ce?.[bt],$r;if(U!==nt?$r=1:$r=(qe[bt]||0)+1,await jr,Bo===!1)return V(gt.indexOf(bt)),Promise.resolve();if(wt<10){let Mo=A({collectionSlug:bt}),Rn=Mo?.admin?.useAsTitle||"id",_i=Mo?.defaultSort||"id";typeof R=="string"?_i=R:R?.[bt]&&(_i=R[bt]);let Br={depth:0,draft:!0,limit:C,locale:$,page:$r,select:{[Rn]:!0},sort:_i,where:{and:[{id:{not_in:mo[bt]}}]}};nt&&Br.where.and.push({[Rn]:{like:nt}}),Bo&&typeof Bo!="boolean"&&Br.where.and.push(Bo),P0(Br.where);let vr=await fetch(L0({apiRoute:L,path:`/${bt}`}),{body:k0.stringify(Br),credentials:"include",headers:{"Accept-Language":E.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"});if(vr.ok){let os=await vr.json();Y(Ua=>({...Ua,[bt]:$r})),os.nextPage||V(gt.indexOf(bt)),os.docs.length>0&&(wt+=os.docs.length,Ue({type:"ADD",collection:Mo,config:T,docs:os.docs,i18n:E,sort:Fe}))}else vr.status===403?(V(gt.indexOf(bt)),Ue({type:"ADD",collection:Mo,config:T,docs:[],i18n:E,ids:mo[bt],sort:Fe})):K(B("error:unspecific"))}},Promise.resolve()),typeof ct=="function"&&ct())})},[k,Be,w,z,U,A,R,C,$,L,E,T,B]),te=R0(({hasMany:ce,search:ke,value:Pe})=>{kt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{Z(!1)},search:ke,sort:!0,...ce===!0?{hasMany:ce,value:Pe}:{hasMany:ce,value:Pe}}),X(ke)},300),pe=da(ce=>{U!==ce.search&&(Z(!0),Y({}),te(ce))},[U,te]),be=Qe(({hasMany:ce,value:ke})=>{let Pe=E0(ce===!0?{hasMany:ce,relationTo:w,value:ke}:{hasMany:ce,relationTo:w,value:ke});Object.entries(Pe).reduce(async(qe,[ct,nt])=>{await qe;let Fe=nt.filter(Ve=>!Me.find(Ot=>Ot?.options?.find(gt=>gt.value===Ve&&gt.relationTo===ct)));if(Fe.length>0){let Ve=A({collectionSlug:ct}),Ot=Ve?.admin?.useAsTitle||"id",gt={depth:0,draft:!0,limit:Fe.length,locale:$,select:{[Ot]:!0},where:{id:{in:Fe}}};if(!z){let At=await fetch(L0({apiRoute:L,path:`/${ct}`}),{body:k0.stringify(gt),credentials:"include",headers:{"Accept-Language":E.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),wt=[];At.ok&&(wt=(await At.json()).docs),Ue({type:"ADD",collection:Ve,config:T,docs:wt,i18n:E,ids:Fe,sort:!0})}}},Promise.resolve())}),{mostRecentUpdate:ot}=xs(),je=Qe(ce=>{if(!_)return!1;let ke=ce.doc.id,Pe=!1;if(ce.operation==="update"?f===!0?Pe=(Array.isArray(_)?_:[_]).some(nt=>nt.value===ke&&nt.relationTo===ce.entitySlug):f===!1&&(Pe=_?.value===ke&&_?.relationTo===ce.entitySlug):ce.operation==="create"&&(Pe=ce.drawerSlug===Ke),!Pe)return;let qe=A({collectionSlug:ce.entitySlug});if(Ue({type:"UPDATE",collection:qe,config:T,doc:ce.doc,i18n:E}),f){let nt=(_?Array.isArray(_)?_:[_]:[]).map(Fe=>({relationTo:Fe.value===ke?ce.entitySlug:Fe.relationTo,value:Fe.value}));y(nt)}else f===!1&&y({relationTo:ce.entitySlug,value:ke})});Ul(()=>{ot&&je(ot)},[ot]);let Je=da(ce=>{Ue({type:"ADD",collection:ce.collectionConfig,config:T,docs:[ce.doc],i18n:E,sort:!0}),f?y(_?_.concat({relationTo:ce.collectionConfig.slug,value:ce.doc.id}):null):f===!1&&y({relationTo:ce.collectionConfig.slug,value:ce.doc.id})},[E,T,f,y,_]),Rt=da(ce=>{Ue({id:ce.id,type:"REMOVE",collection:ce.collectionConfig,config:T,i18n:E}),y(f&&_?_.filter(ke=>ke.value!==ce.id):null)},[E,T,f,y,_]),Xt=da((ce,ke)=>{if(!ke)return!0;let Pe=xG(ke||""),qe=250,ct=String(ce.label);for(;ct.length>qe;){let nt=ct.indexOf(" ",ke.length);if(Pe.test(ct.slice(0,nt===-1?ke.length:nt+1)))return!0;ct=ct.slice(nt===-1?ke.length:nt+1)}return Pe.test(ct.slice(-qe))},[]),$o=da(({id:ce,collectionSlug:ke,hasReadPermission:Pe,openInNewTab:qe})=>{if(qe){if(Pe&&ce&&ke){let ct=L0({adminRoute:T.routes.admin,path:`/collections/${ke}/${ce}`,serverURL:P});window.open(ct,"_blank")}}else ee.current=!0,M({id:ce,collectionSlug:ke,hasReadPermission:Pe})},[T.routes.admin,P]),kt=Qe(ce=>ge(ce));Ul(()=>{_e.current&&me&&(Z(!0),kt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{_e.current=!0,Z(!1)},...f===!0?{hasMany:f,value:he.current}:{hasMany:f,value:he.current}})),Ue({type:"CLEAR",exemptValues:he.current}),V(-1),Y({})},[w,u,$,v,me,f]);let br=rd(_),De=rd(!0);Ul(()=>{(De.current||!CG(_,br.current))&&be(f===!0?{hasMany:f,value:_}:{hasMany:f,value:_}),De.current=!1,br.current=_},[_,f]),Ul(()=>{let ke=(Array.isArray(w)?w:[w]).reduce((Pe,qe)=>(A({collectionSlug:qe})?.admin?.useAsTitle||"id")==="id"&&Pe,!0);re(!ke)},[w,A]),Ul(()=>{ee.current&&(we(),ee.current=!1)},[we,j]),Ul(()=>{he.current=_},[_]);let We=hD({allowEdit:n,options:Me,value:_});return!Array.isArray(We)&&We?.value==="null"&&(We.value=null),N0("div",{className:[Ae,nd,i,S&&"error",z&&"error-loading",I&&`${nd}--read-only`,!I&&o&&`${nd}--allow-create`].filter(Boolean).join(" "),id:`field-${v.replace(/\./g,"__")}`,style:D,children:[xn(ue,{CustomComponent:g,Fallback:xn(Ce,{label:h,localized:b,path:v,required:F})}),N0("div",{className:`${Ae}__wrap`,children:[xn(ue,{CustomComponent:c,Fallback:xn(Ze,{path:v,showError:S})}),s,z?xn("div",{className:`${nd}__error-loading`,children:z}):N0("div",{className:`${nd}__wrap`,children:[xn(pt,{backspaceRemovesValue:!(le||fe),components:{MultiValueLabel:CD,SingleValue:wD,...r!=="select"&&{DropdownIndicator:null}},customProps:{disableKeyDown:le||fe,disableMouseDown:le||fe,onDocumentOpen:$o},disabled:I||le||fe,filterOption:J?Xt:void 0,getOptionValue:ce=>{if(ce)return f&&Array.isArray(w)?`${ce.relationTo}_${ce.value}`:ce.value},isLoading:r==="select"&&ne,isMulti:f,isSearchable:r==="select",isSortable:p,menuIsOpen:r==="select"?me:!1,onChange:I?void 0:ce=>{f?ce===null?(he.current=[],y([])):(he.current=ce,y(ce)):f===!1&&(ce===null?(he.current=null,y(null)):(he.current=ce,y(ce)))},onInputChange:ce=>pe({search:ce,...f===!0?{hasMany:f,value:_}:{hasMany:f,value:_}}),onMenuClose:()=>{xe(!1)},onMenuOpen:()=>{r==="drawer"?de():r==="select"&&(xe(!0),_e.current||(Z(!0),kt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{_e.current=!0,Z(!1)},...f===!0?{hasMany:f,value:_}:{hasMany:f,value:_}})))},onMenuScrollToBottom:()=>{Z(!0),kt({filterOptions:u,lastFullyLoadedRelation:O,lastLoadedPage:W,onSuccess:()=>{Z(!1)},search:U,sort:!1,...f===!0?{hasMany:f,value:m}:{hasMany:f,value:m}})},options:typeof d=="function"?d(Me):Me,placeholder:x,showError:S,value:We??null}),!I&&o&&xn(iD,{path:v,relationTo:w,...f===!0?{hasMany:f,onChange:y,value:_}:{hasMany:f,onChange:y,value:_}})]}),e,xn(ue,{CustomComponent:l,Fallback:xn(Xe,{description:a,path:v})})]}),j.collectionSlug&&j.hasReadPermission&&xn(Oe,{onDelete:Rt,onDuplicate:Je}),r==="drawer"&&!I&&xn(ie,{allowCreate:o,enableRowSelections:!1,onSelect:se})]})};var TG=t=>{let{field:e,field:{admin:{allowCreate:o=!0,allowEdit:n=!0,appearance:r="select",className:s,description:i,isSortable:a=!0,placeholder:l,sortOptions:c}={},hasMany:u,label:d,localized:f,relationTo:m,required:p},path:h,readOnly:g,validate:b}=t,C=B0((M,O)=>{if(typeof b=="function")return b(M,{...O,required:p})},[b,p]),{customComponents:{AfterInput:y,BeforeInput:v,Description:x,Error:I,Label:w}={},disabled:F,filterOptions:S,initialValue:R,path:D,setValue:_,showError:T,value:A}=Te({potentiallyStalePath:h,validate:C}),L=_G(()=>et(e),[e]),P=Array.isArray(m),[E]=$0.useState(()=>Array.isArray(m)?m:[m]),B=B0(M=>{if(!M){_(null,M===A);return}let O=!1;P?O=Array.isArray(A)&&Array.isArray(M)&&A.length===M.length&&A.every((W,Y)=>{let z=M[Y];return W.value===z.value&&W.relationTo===z.relationTo}):O=Array.isArray(A)&&Array.isArray(M)&&A.length===M.length&&A.every((W,Y)=>W===M[Y].value);let V=M.map(W=>P?W:W.value);_(V,O)},[P,_,A]),k=B0(M=>{if(!M){_(null,M===A);return}let O=!1;P?O=A&&M&&A.value===M.value&&A.relationTo===M.relationTo:O=A&&M&&A===M.value;let V=P?M:M.value;_(V,O)},[P,_,A]),$=$0.useMemo(()=>u===!0?Array.isArray(A)?A.map(M=>P?M:{relationTo:Array.isArray(E)?E[0]:E,value:M}):A:A&&(P?A:{relationTo:Array.isArray(E)?E[0]:E,value:A}),[u,A,P,E]),j=$0.useMemo(()=>u===!0?Array.isArray(R)?R.map(M=>P?M:{relationTo:Array.isArray(E)?E[0]:E,value:M}):R:R&&(P?R:{relationTo:Array.isArray(E)?E[0]:E,value:R}),[R,P,E,u]);return IG(j0,{AfterInput:y,allowCreate:o,allowEdit:n,appearance:r,BeforeInput:v,className:s,Description:x,description:i,Error:I,filterOptions:S,formatDisplayedOptions:P?void 0:M=>M.map(O=>O.options).flat(),isSortable:a,Label:w,label:d,localized:f,maxResultsPerRequest:10,maxRows:e?.maxRows,minRows:e?.minRows,path:D,placeholder:l,readOnly:g||F,relationTo:E,required:p,showError:T,sortOptions:c,style:L,...u===!0?{hasMany:!0,initialValue:j,onChange:B,value:$}:{hasMany:!1,initialValue:j,onChange:k,value:$}})},sd=ze(TG);var id=()=>null;import{jsx as M0}from"react/jsx-runtime";import"react";var SD="row",FG=t=>{let{field:{admin:{className:e,style:o}={},fields:n},forceRender:r=!1,indexPath:s="",parentPath:i="",parentSchemaPath:a="",permissions:l,readOnly:c}=t;return M0(LT,{children:M0("div",{className:[Ae,SD,e].filter(Boolean).join(" "),style:o||void 0,children:M0(Lo,{className:`${SD}__fields`,fields:n,forceRender:r,margins:!1,parentIndexPath:s,parentPath:i,parentSchemaPath:a,permissions:l,readOnly:c})})})},ad=ze(FG);import{jsx as RG}from"react/jsx-runtime";import AG,{useCallback as _D,useMemo as PG}from"react";import{c as DG}from"react/compiler-runtime";import{jsx as ma,jsxs as ID}from"react/jsx-runtime";import{getTranslation as O0}from"@payloadcms/translations";import"react";var Zr=t=>{let e=DG(37),{id:o,AfterInput:n,BeforeInput:r,className:s,Description:i,description:a,Error:l,filterOption:c,hasMany:u,isClearable:d,isSortable:f,label:m,Label:p,localized:h,onChange:g,onInputChange:b,options:C,path:y,placeholder:v,readOnly:x,required:I,showError:w,style:F,value:S}=t,R=u===void 0?!1:u,D=d===void 0?!0:d,_=f===void 0?!0:f,{i18n:T}=N(),A;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==l||e[4]!==p||e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==R||e[9]!==T||e[10]!==o||e[11]!==D||e[12]!==_||e[13]!==m||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==C||e[18]!==y||e[19]!==v||e[20]!==x||e[21]!==I||e[22]!==w||e[23]!==F||e[24]!==S){let L;if(R&&Array.isArray(S)){let $;e[26]!==T||e[27]!==C?($=j=>{let M=C.find(O=>O.value===j);return{label:M?O0(M.label,T):j,value:M?.value??j}},e[26]=T,e[27]=C,e[28]=$):$=e[28],L=S.map($)}else if(S){let $;e[29]!==S?($=M=>M.value===S,e[29]=S,e[30]=$):$=e[30];let j=C.find($);L={label:j?O0(j.label,T):S,value:j?.value??S}}else L=null;let P=w&&"error",E=x&&"read-only",B;e[31]!==s||e[32]!==P||e[33]!==E?(B=[Ae,"select",s,P,E].filter(Boolean),e[31]=s,e[32]=P,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==T?(k=$=>({...$,label:O0($.label,T)}),e[35]=T,e[36]=k):k=e[36],A=ID("div",{className:B.join(" "),id:`field-${y.replace(/\./g,"__")}`,style:F,children:[ma(ue,{CustomComponent:p,Fallback:ma(Ce,{label:m,localized:h,path:y,required:I})}),ID("div",{className:`${Ae}__wrap`,children:[ma(ue,{CustomComponent:l,Fallback:ma(Ze,{path:y,showError:w})}),r,ma(pt,{disabled:x,filterOption:c,id:o,isClearable:D,isMulti:R,isSortable:_,onChange:g,onInputChange:b,options:C.map(k),placeholder:v,showError:w,value:L}),n]}),ma(ue,{CustomComponent:i,Fallback:ma(Xe,{description:a,path:y})})]}),e[0]=n,e[1]=r,e[2]=i,e[3]=l,e[4]=p,e[5]=s,e[6]=a,e[7]=c,e[8]=R,e[9]=T,e[10]=o,e[11]=D,e[12]=_,e[13]=m,e[14]=h,e[15]=g,e[16]=b,e[17]=C,e[18]=y,e[19]=v,e[20]=x,e[21]=I,e[22]=w,e[23]=F,e[24]=S,e[25]=A}else A=e[25];return A};var ih=t=>t.map(e=>typeof e=="object"&&(e.value||e.value==="")?e:{label:e,value:e}),EG=t=>{let{field:e,field:{name:o,admin:{className:n,description:r,isClearable:s=!0,isSortable:i=!0,placeholder:a}={},hasMany:l=!1,label:c,localized:u,options:d=[],required:f},onChange:m,path:p,readOnly:h,validate:g}=t,b=AG.useMemo(()=>ih(d),[d]),C=_D((P,E)=>{if(typeof g=="function")return g(P,{...E,hasMany:l,options:b,required:f})},[g,f,l,b]),{customComponents:{AfterInput:y,BeforeInput:v,Description:x,Error:I,Label:w}={},disabled:F,path:S,selectFilterOptions:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:p,validate:C}),A=_D(P=>{if(!h||F){let E=null;P&&l?Array.isArray(P)?E=P.map(B=>B.value):E=[]:P&&!Array.isArray(P)&&(E=P.value),typeof m=="function"&&m(E),D(E)}},[h,F,l,D,m]),L=PG(()=>et(e),[e]);return RG(Zr,{AfterInput:y,BeforeInput:v,className:n,Description:x,description:r,Error:I,filterOption:R?({label:P,value:E},B)=>R?.some(k=>(typeof k=="string"?k:k.value)===E)&&P.toLowerCase().includes(B.toLowerCase()):void 0,hasMany:l,isClearable:s,isSortable:i,Label:w,label:c,localized:u,name:o,onChange:A,options:b,path:S,placeholder:a,readOnly:h||F,required:f,showError:_,style:L,value:T})},ld=ze(EG);import{c as zD}from"react/compiler-runtime";import{jsx as Ss,jsxs as WD}from"react/jsx-runtime";import{getTranslation as yz}from"@payloadcms/translations";import{getFieldPaths as Cz,toKebabCase as xz}from"payload/shared";import{useEffect as GD,useState as wz}from"react";var BD=Ri(z0(),1);import{jsx as wn}from"react/jsx-runtime";import{dequal as jD}from"dequal/lite";import{useRouter as az}from"next/navigation.js";import{deepCopyObjectSimpleWithoutReactComponents as $D,getDataByPath as lz,getSiblingData as cz,hasDraftValidationEnabled as uz,reduceFieldsToValues as X0,wait as dz}from"payload/shared";import mz,{useCallback as Go,useEffect as pa,useReducer as fz,useRef as ha,useState as ni}from"react";import{c as $G}from"react/compiler-runtime";import{jsx as W0,jsxs as BG}from"react/jsx-runtime";import MG from"react";function OG(t){let e=[];for(let o of t)if(o){let n=o.split(" \u2192 "),r=!1;for(let s=0;s<e.length;s++)if(e[s].startsWith(n[0])){e.splice(s+1,0,o),r=!0;break}r||e.push(o)}return e}function VG(t){let[e,o]=t.split(":");if(!o)return{message:e};let n=o.split(",").map(r=>r.replaceAll(" > "," \u2192 ").trim());return n.length===1?{errors:n,message:`${e}: `}:{errors:OG(n),message:`${e} (${n.length}):`}}function RD(t){let e=$G(5),{errorMessage:o}=t,n;e[0]!==o?(n=()=>VG(o),e[0]=o,e[1]=n):n=e[1];let[r]=MG.useState(n),{errors:s,message:i}=r,a;return e[2]!==s||e[3]!==i?(a=BG("div",{children:[i,Array.isArray(s)&&s.length>0?s.length===1?W0("span",{"data-testid":"field-error",children:s[0]}):W0("ul",{"data-testid":"field-errors",children:s.map(GG)}):null]}),e[2]=s,e[3]=i,e[4]=a):a=e[4],a}function GG(t,e){return W0("li",{children:t},e)}import{c as zG}from"react/compiler-runtime";import{useEffect as AD,useState as WG}from"react";function H0(t,e,o){let n=zG(11),r;n[0]!==t?(r=()=>t,n[0]=t,n[1]=r):r=n[1];let[s,i]=WG(r),a;n[2]!==o||n[3]!==t?(a=()=>{let d=setTimeout(()=>{i(()=>t)},o);return()=>{clearTimeout(d)}},n[2]=o,n[3]=t,n[4]=a):a=n[4];let l;n[5]!==o||n[6]!==e?(l=[...e,o],n[5]=o,n[6]=e,n[7]=l):l=n[7],AD(a,l);let c,u;n[8]!==s?(c=()=>{s()},u=[s],n[8]=s,n[9]=c,n[10]=u):(c=n[9],u=n[10]),AD(c,u)}import{c as HG}from"react/compiler-runtime";import{jsx as UG}from"react/jsx-runtime";import PD,{useState as XG}from"react";var ED=PD.createContext(null),U0=t=>{let e=HG(6),{children:o}=t,[n,r]=XG(YG),s;e[0]!==n?(s=u=>{let{collectionSlug:d}=u;return n.get(d)},e[0]=n,e[1]=s):s=e[1];let i=s,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u=>{let{collectionSlug:d,handler:f}=u;r(m=>{let p=new Map(m);return p.set(d,f),p})},e[2]=a):a=e[2];let l=a,c;return e[3]!==o||e[4]!==i?(c=UG(ED,{value:{getUploadHandler:i,setUploadHandler:l},children:o}),e[3]=o,e[4]=i,e[5]=c):c=e[5],c},cd=()=>{let t=PD.use(ED);if(t===null)throw new Error("useUploadHandlers must be used within UploadHandlersProvider");return t};function YG(){return new Map}var ND={413:"Your request was too large to submit successfully."};var lh=Ri(Jv(),1);import{dequal as JG}from"dequal/lite";import{deepCopyObjectSimpleWithoutReactComponents as kD}from"payload/shared";import{dequal as ZG}from"dequal/lite";var LD=({acceptValues:t,currentState:e={},incomingState:o})=>{let n={...e};for(let[r,s]of Object.entries(o||{})){if(!(r in e)&&!s.addedByServer)continue;let i=s.addedByServer||t===!0||typeof t=="object"&&t!==null&&t.overrideLocalChanges===!1&&!e[r]?.isModified,a=s;if(!i){let{initialValue:l,value:c,...u}=s;a=u}n[r]={...e[r],...a},e[r]&&"errorPaths"in e[r]&&!("errorPaths"in s)&&(n[r].errorPaths=[]),Array.isArray(s.rows)&&r in e&&(n[r].rows=[...e[r]?.rows||[]],s.rows.forEach(l=>{let c=e[r].rows?.findIndex(u=>u.id===l.id);if(c>-1)n[r].rows[c]={...e[r].rows[c],...l};else if(l.addedByServer){let u={...l};delete u.addedByServer,n[r].rows.push(u)}})),s.valid!==!1&&(n[r].valid=!0),s.passesCondition!==!1&&(n[r].passesCondition=!0),s.blocksFilterOptions||delete n[r].blocksFilterOptions,delete n[r].addedByServer}return ZG(n,e)?e:n};var Xl=(t,e)=>{let o={},n=Object.entries(e).reduce((r,[s,i])=>{let a=r;if(s.indexOf(`${t}.`)===0){let[l]=s.replace(`${t}.`,"").split(".");a[l]||(a[l]={}),a[l][s.replace(`${t}.${String(l)}.`,"")]={...i}}else o[s]=i;return a},[]);return{remainingFields:o,rows:n}},Yl=(t,e)=>e.reduce((o,n,r)=>({...o,...Object.entries(n).reduce((s,[i,a])=>({...s,[`${t}.${r}.${i}`]:{...a}}),{})}),{});var ud="default"in lh.default?lh.default.default:lh.default;function dd(t,e){switch(e.type){case"ADD_ROW":{let{blockType:o,path:n,rowIndex:r,subFieldState:s={}}=e,i=typeof r=="number"?r:t[n]?.rows?.length||0,a=[...t[n]?.rows||[]],l={id:s?.id?.value||new ud().toHexString(),isLoading:!0};o&&(l.blockType=o),a.splice(i,0,l),o&&(s.blockType={initialValue:o,valid:!0,value:o});let{remainingFields:c,rows:u}=Xl(n,t);return u.splice(i,0,s),{...c,...Yl(n,u),[`${n}.${i}.id`]:{initialValue:l.id,passesCondition:!0,valid:!0,value:l.id},[n]:{...t[n],disableFormData:!0,rows:a,value:u.length}}}case"ADD_SERVER_ERRORS":{let o={...t},n=[];return e.errors.forEach(({message:r,path:s})=>{o[s]={...o[s]||{initialValue:null,value:null},errorMessage:r,valid:!1};let i=s.split(".");i.length>1&&n.push({fieldErrorPath:s,parentPath:i.slice(0,i.length-1).join(".")})}),o=Object.entries(o).reduce((r,[s,i])=>{let a=n.reduce((c,{fieldErrorPath:u,parentPath:d})=>(d.startsWith(s)&&c.push(u),c),[]),l=!1;if(a.length>0){let c=Array.isArray(i.errorPaths)?i.errorPaths:[];a.forEach(u=>{c.includes(u)||(c.push(u),l=!0)}),l&&(r[s]={...i,errorPaths:c})}return l||(r[s]=i),r},{}),o}case"DUPLICATE_ROW":{let{path:o,rowIndex:n}=e,{remainingFields:r,rows:s}=Xl(o,t),i=[...t[o].rows||[]],a=kD(i[n]),l=new ud().toHexString();a.id&&(a.id=l),i[n]?.customComponents?.RowLabel&&(a.customComponents={RowLabel:i[n].customComponents.RowLabel});let c=kD(s[n]);c.id&&(c.id.value=l,c.id.initialValue=l);for(let d of Object.keys(c).filter(f=>f.endsWith(".id"))){let f=c[d],m=new ud().toHexString();if(f&&typeof f.value=="string"&&ud.isValid(f.value)){c[d].value=m,c[d].initialValue=m;let p=d.split("."),h=parseInt(p[p.length-2],10),g=p.slice(0,p.length-2).join("."),b=c?.[g]?.rows;c[g]&&Array.isArray(b)&&(b[h]?b[h].id=m:b[h]={id:m})}}return Object.keys(c).length>0&&(s.splice(n+1,0,c),i.splice(n+1,0,a)),{...r,...Yl(o,s),[o]:{...t[o],disableFormData:!0,rows:i,value:s.length}}}case"MERGE_SERVER_STATE":{let{acceptValues:o,prevStateRef:n,serverState:r}=e,s=LD({acceptValues:o,currentState:t||{},incomingState:r});return n.current=s,s}case"MOVE_ROW":{let{moveFromIndex:o,moveToIndex:n,path:r}=e,{remainingFields:s,rows:i}=Xl(r,t),a=i[o];i.splice(o,1),i.splice(n,0,a);let l=[...t[r]?.rows||[]],c={...l[o]};return l.splice(o,1),l.splice(n,0,c),{...s,...Yl(r,i),[r]:{...t[r],rows:l}}}case"REMOVE":{let o={...t};return o[e.path]&&delete o[e.path],o}case"REMOVE_ROW":{let{path:o,rowIndex:n}=e,{remainingFields:r,rows:s}=Xl(o,t),i=[...t[o]?.rows||[]];return s.splice(n,1),i.splice(n,1),{...r,[o]:{...t[o],disableFormData:s.length>0,rows:i,value:s.length},...Yl(o,s)}}case"REPLACE_ROW":{let{blockType:o,path:n,rowIndex:r,subFieldState:s={}}=e,{remainingFields:i,rows:a}=Xl(n,t),l=Math.max(0,Math.min(r,a?.length-1||0)),c=[...t[n]?.rows||[]];return c[l]={id:new ud().toHexString(),blockType:o||void 0,collapsed:!1},o&&(s.blockType={initialValue:o,valid:!0,value:o}),a[l]=s,{...i,...Yl(n,a),[n]:{...t[n],disableFormData:!0,rows:c,value:a.length}}}case"REPLACE_STATE":{if(e.optimize!==!1){let o={};for(let[n,r]of Object.entries(e.state)){let s=t[n];r.valid!==!1&&(r.valid=!0),r.passesCondition!==!1&&(r.passesCondition=!0),JG(s,r)?s&&(o[n]=s):o[n]=r}return o}if(e.sanitize)for(let o of Object.values(e.state))o.valid!==!1&&(o.valid=!0),o.passesCondition!==!1&&(o.passesCondition=!0);return e.state}case"SET_ALL_ROWS_COLLAPSED":{let{path:o,updatedRows:n}=e;return{...t,[o]:{...t[o],rows:n}}}case"SET_ROW_COLLAPSED":{let{path:o,updatedRows:n}=e;return{...t,[o]:{...t[o],rows:n}}}case"UPDATE":{let o=Object.entries(e).reduce((r,[s,i])=>["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(s)?{...r,[s]:i,...s==="value"?{isModified:!0}:{}}:r,t?.[e.path]||{}),n={...t,[e.path]:o};if("value"in e)for(let[r,s]of Object.entries(n))r!==e.path&&"isModified"in s&&delete n[r].isModified;return n}case"UPDATE_MANY":{let o={...t};return Object.entries(e.formState).forEach(([n,r])=>{o[n]=r}),o}default:return t}}var qG=()=>{},QG=()=>{},KG=()=>{},ez=()=>{},tz=()=>{},oz=()=>{},rz=()=>{},nz=()=>{},sz=()=>{},iz=()=>{},ch={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:tz,disabled:!1,dispatchFields:KG,fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:QG,initializing:void 0,isValid:!0,moveFieldRow:()=>{},removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:iz,setBackgroundProcessing:nz,setDisabled:()=>{},setIsValid:()=>{},setModified:oz,setProcessing:rz,setSubmitted:sz,submit:qG,validateForm:ez};var pz="form",ws=t=>{let{id:e,collectionSlug:o,docConfig:n,docPermissions:r,getDocPreferences:s,globalSlug:i}=Se(),a=uz(n),{action:l,beforeSubmit:c,children:u,className:d,disabled:f,disableSuccessStatus:m,disableValidationOnSubmit:p,el:h,handleResponse:g,initialState:b,isDocumentForm:C,isInitializing:y,onChange:v,onSubmit:x,onSuccess:I,redirect:w,submitted:F,uuid:S,waitForAutocomplete:R}=t,D="method"in t?t?.method:void 0,_=az(),T=Qa(),{code:A}=ye(),{i18n:L,t:P}=N(),{refreshCookie:E,user:B}=Ie(),k=xr(),{queueTask:$}=ua(),{getFormState:j}=Lt(),{startRouteTransition:M}=Ye(),{getUploadHandler:O}=cd(),{config:V}=H(),[W,Y]=ni(f||!1),[z,K]=ni(!1),[U,X]=ni(!1),[ne,Z]=ni(!0),[J,re]=ni(y),[me,xe]=ni(!1),[_e,Be]=ni(!1),Me=ha(_e),Ue=ha(!1),he=Go(Fe=>{Me.current=Fe,Be(Fe)},[]),[Oe,Ke]=ni(!1),le=Go(Fe=>{Me.current&&(Ue.current=!0),Ke(Fe)},[]),we=ha(null),G=ha({}),ie=ha(null),Q=ha(!0),fe=fz(dd,{},()=>b),[de,se]=fe;G.current.fields=de;let ee=ha(de),ge=Go(async()=>{let Fe={},Ve=!0,Ot=G.current.getData(),gt=Object.entries(G.current.fields).map(async([At,wt])=>{let mo=wt,jr=At?At.split("."):[];if(wt.passesCondition!==!1){let bt=mo.valid;if("validate"in wt&&typeof wt.validate=="function"){let Bo=wt.value;wt?.rows&&Array.isArray(wt.rows)&&(Bo=G.current.getDataByPath(At)),bt=await wt.validate(Bo,{...wt,id:e,collectionSlug:o,blockData:void 0,data:T?.getData?T.getData():Ot,event:"submit",operation:k,path:jr,preferences:{},req:{payload:{config:V},t:P,user:B},siblingData:G.current.getSiblingData(At)}),typeof bt=="string"?(mo.errorMessage=bt,mo.valid=!1):(mo.valid=!0,mo.errorMessage=void 0)}mo.valid===!1&&(Ve=!1)}Fe[At]=mo});return await Promise.all(gt),jD(G.current.fields,Fe)||se({type:"REPLACE_STATE",state:Fe}),Z(Ve),Ve},[o,V,se,e,k,P,B,T]),te=Go(async(Fe,Ve)=>{let{acceptValues:Ot=!0,action:gt=l,context:At,disableFormWhileProcessing:wt=!0,disableSuccessStatus:mo,method:jr=D,overrides:bt={},skipValidation:Bo}=Fe||{},$r=mo??m;if(W){Ve&&Ve.preventDefault();return}let Mo,Rn,_i=new Promise((Pt,So)=>{Rn=Pt,Mo=So}),Br=gt||typeof l=="string"||typeof l=="function";w||$r||!Br?(Rn=Pt=>q.success(Pt),Mo=Pt=>q.error(Pt)):q.promise(_i,{error:Pt=>Pt,loading:P("general:submitting"),success:Pt=>Pt}),Ve&&(Ve.stopPropagation(),Ve.preventDefault()),wt&&(xe(!0),Y(!0)),R&&await dz(100);let vr=X0(G.current.fields,!0),os=$D(G.current.fields,{excludeFiles:!0});if(Array.isArray(c)){let Pt;await c.reduce(async(Bs,Ti)=>{await Bs,Pt=await Ti({formState:os})},Promise.resolve());let So=Object.entries(Pt).every(([,Bs])=>Bs.valid!==!1);if(Z(So),!So)return xe(!1),X(!0),Y(!1),se({type:"REPLACE_STATE",state:Pt})}let Ua=Bo||p?!0:await G.current.validateForm();if(Z(Ua),!Ua){Mo(P("error:correctInvalidFields")),xe(!1),X(!0),Y(!1);return}let Xa={};if(typeof bt=="function"?Xa=bt(G.current.fields):typeof bt=="object"&&(Xa=bt),x){for(let[Pt,So]of Object.entries(Xa))vr[Pt]=So;x(G.current.fields,vr)}if(!Br){xe(!1),X(!0),Y(!1);return}try{let Pt=await G.current.createFormData(Xa,{data:vr,mergeOverrideData:typeof bt!="function"}),So;if(typeof gt=="string"?So=await Ge[jr.toLowerCase()](gt,{body:Pt,headers:{"Accept-Language":L.language}}):typeof l=="function"&&(So=await l(Pt)),Ue.current?Ue.current=!1:le(!1),Y(!1),typeof g=="function"){g(So,Rn,Mo);return}let Bs=So.headers.get("content-type"),Ti=Bs&&Bs.indexOf("application/json")!==-1,on={};if(Ti&&(on=await So.json()),So.status<400){if(typeof I=="function"){let Ya=await I(on,{context:At,formState:os});Ya&&se({type:"MERGE_SERVER_STATE",acceptValues:Ot,prevStateRef:ee,serverState:Ya})}X(!1),xe(!1),w?M(()=>_.push(w)):$r||Rn(on.message||P("general:submissionSuccessful"))}else{if(xe(!1),X(!0),bt._status==="draft"&&(le(!0),a||X(!1)),G.current={...G.current},on.message){Mo(on.message);return}if(Array.isArray(on.errors)){let[pb,hb]=on.errors.reduce(([Za,gb],Fi)=>{let Ec=[],st=[];return Fi?.message&&st.push(Fi),Array.isArray(Fi?.data?.errors)&&Fi.data?.errors.forEach(rr=>{rr?.path?Ec.push(rr):st.push(rr)}),[[...Za,...Ec],[...gb,...st]]},[[],[]]);Z(!1),se({type:"ADD_SERVER_ERRORS",errors:pb}),hb.forEach(Za=>{Mo(wn(RD,{errorMessage:Za.message||P("error:unknown")}))});return}let Ya=ND?.[So.status]||So?.statusText||P("error:unknown");Mo(Ya)}return{formState:G.current.fields,res:So}}catch(Pt){console.error("Error submitting form",Pt),xe(!1),X(!0),Y(!1),Mo(Pt.message)}},[c,M,l,m,p,W,se,g,D,x,I,w,_,P,L,a,R,le,X]),pe=Go(()=>G.current.fields,[]),be=Go(Fe=>G.current.fields[Fe],[]),ot=Go(()=>X0(G.current.fields,!0),[]),je=Go(Fe=>cz(G.current.fields,Fe),[]),Je=Go(Fe=>lz(G.current.fields,Fe),[]),Rt=Go(async(Fe,{data:Ve,mergeOverrideData:Ot=!0})=>{let gt=Ve||X0(G.current.fields,!0),At=gt?.file;if(n&&"upload"in n&&n.upload&&At){delete gt.file;let jr=O({collectionSlug:o});if(typeof jr=="function"){let bt=At.name,Bo=await jr({file:At,updateFilename:$r=>{bt=$r}});At=JSON.stringify({clientUploadContext:Bo,collectionSlug:o,filename:bt,mimeType:At.type,size:At.size})}}Ot?gt={...gt,...Fe}:gt=Fe;let wt={_payload:JSON.stringify(gt)};return n&&"upload"in n&&n.upload&&At&&(wt.file=At),(0,BD.serialize)(wt,{indices:!0,nullsAsUndefineds:!1})},[o,n,O]),Xt=Go(async Fe=>{let Ve=Fr(ie),Ot=await s(),{state:gt}=await j({id:e,collectionSlug:o,data:Fe,docPermissions:r,docPreferences:Ot,globalSlug:i,locale:A,operation:k,renderAllFields:!0,schemaPath:o||i,signal:Ve.signal,skipValidation:!0});G.current={...ch},le(!1),se({type:"REPLACE_STATE",state:gt}),ie.current=null},[o,se,i,e,k,j,r,s,A,le]),$o=Go(Fe=>{G.current={...ch},le(!1),se({type:"REPLACE_STATE",state:Fe})},[se,le]),kt=Go(({blockType:Fe,path:Ve,rowIndex:Ot,subFieldState:gt})=>{let At=Je(Ve)||[],wt=Ot===void 0?At.length:Ot;se({type:"ADD_ROW",blockType:Fe,path:Ve,rowIndex:wt,subFieldState:gt}),le(!0)},[se,Je,le]),br=Go(({moveFromIndex:Fe,moveToIndex:Ve,path:Ot})=>{se({type:"MOVE_ROW",moveFromIndex:Fe,moveToIndex:Ve,path:Ot}),le(!0)},[se,le]),De=Go(({path:Fe,rowIndex:Ve})=>{se({type:"REMOVE_ROW",path:Fe,rowIndex:Ve}),le(!0)},[se,le]),We=Go(({blockType:Fe,path:Ve,rowIndex:Ot,subFieldState:gt})=>{let At=Je(Ve),wt=Ot===void 0?At.length:Ot;se({type:"REPLACE_ROW",blockType:Fe,path:Ve,rowIndex:wt,subFieldState:gt}),le(!0)},[se,Je,le]);pa(()=>{let Fe=ie.current;return()=>{Tr(Fe)}},[]),pa(()=>{y!==void 0&&re(y)},[y]),G.current.submit=te,G.current.getFields=pe,G.current.getField=be,G.current.getData=ot,G.current.getSiblingData=je,G.current.getDataByPath=Je,G.current.validateForm=ge,G.current.createFormData=Rt,G.current.setModified=le,G.current.setProcessing=xe,G.current.setBackgroundProcessing=he,G.current.setSubmitted=X,G.current.setIsValid=Z,G.current.disabled=W,G.current.setDisabled=Y,G.current.formRef=we,G.current.reset=Xt,G.current.replaceState=$o,G.current.dispatchFields=se,G.current.addFieldRow=kt,G.current.removeFieldRow=De,G.current.moveFieldRow=br,G.current.replaceFieldRow=We,G.current.uuid=S,G.current.initializing=J,G.current.isValid=ne,pa(()=>{K(!0)},[]),pa(()=>{typeof f=="boolean"&&Y(f)},[f]),pa(()=>{typeof F=="boolean"&&X(F)},[F]),pa(()=>{b&&(G.current={...ch},se({type:"REPLACE_STATE",optimize:!1,sanitize:!0,state:b}))},[b,se]),zi(()=>{E()},15e3,[de]);let ce=Qe(()=>{G.current={...G.current},le(!1)});pa(()=>{ce()},[A]);let ke=[d,pz].filter(Boolean).join(" "),Pe=Qe(Fe=>{$(async()=>{if(Array.isArray(v)){let Ve;for(let Ot of v)Ve=await Ot({formState:$D(de,{excludeFiles:!0}),submitted:Fe});se({type:"MERGE_SERVER_STATE",prevStateRef:ee,serverState:Ve})}})});H0(()=>{(Q.current||!jD(de,ee.current))&&Oe&&Pe(U),ee.current=de,Q.current=!1},[Oe,U,de],250);let qe=C?Jm:mz.Fragment,ct=C?{value:G.current}:{};return wn(h||"form",{action:typeof l=="function"?void 0:l,className:ke,"data-form-ready":!me&&z&&!J,method:D,noValidate:!0,onSubmit:Fe=>{G.current.submit({},Fe)},ref:we,children:wn(qe,{...ct,children:wn(Zm,{value:G.current,children:wn(qm,{value:{fields:de,...G.current},children:wn(Qm,{value:U,children:wn(Nb,{value:!z||z&&J,children:wn(Km,{value:me,children:wn(Eb,{value:_e,children:wn(ef,{value:Oe,children:wn(Mc.Provider,{value:fe,children:u})})})})})})})})})})};import{c as hz}from"react/compiler-runtime";import{jsx as MD,jsxs as OD}from"react/jsx-runtime";import{getTranslation as gz}from"@payloadcms/translations";import{tabHasName as VD}from"payload/shared";import bz,{useState as vz}from"react";var uh="tabs-field__tab-button",Y0=t=>{let e=hz(12),{hidden:o,isActive:n,parentPath:r,setIsActive:s,tab:i}=t,{i18n:a}=N(),[l,c]=vz(void 0),u;if(e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==i){let d=[...r?r.split(".").slice(0,-1):[],...VD(i)?[i.name]:[]],f=l>0,m=MD(qi,{fields:i.fields,path:d,setErrorCount:c}),p=f&&`${uh}--has-error`,h=n&&`${uh}--active`,g=o&&`${uh}--hidden`,b;e[8]!==p||e[9]!==h||e[10]!==g?(b=[uh,p,h,g].filter(Boolean),e[8]=p,e[9]=h,e[10]=g,e[11]=b):b=e[11],u=OD(bz.Fragment,{children:[m,OD("button",{className:b.join(" "),onClick:s,type:"button",children:[i.label?gz(i.label,a):VD(i)?i.name:"",f&&MD(Io,{count:l,i18n:a})]})]}),e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=s,e[6]=i,e[7]=u}else u=e[7];return u};var Is="tabs-field";var Sz=t=>{let e=zD(44),{field:o,forceRender:n,indexPath:r,parentPath:s,parentSchemaPath:i,path:a,permissions:l,readOnly:c,schemaPath:u}=t,{admin:d,tabs:f}=o,m;e[0]!==d?(m=d===void 0?{}:d,e[0]=d,e[1]=m):m=e[1];let{className:p}=m,h;e[2]!==f?(h=f===void 0?[]:f,e[2]=f,e[3]=h):h=e[3];let g=h,b=n===void 0?!1:n,C=r===void 0?"":r,y=s===void 0?"":s,v=i===void 0?"":i,x=a===void 0?"":a,I=u===void 0?"":u,{getPreference:w,setPreference:F}=so(),{preferencesKey:S}=Se(),{i18n:R}=N(),{isWithinCollapsible:D}=Zs(),_;e[4]!==g?(_=J=>{let[re]=J;return g.map((me,xe)=>{let _e=me?.id;return{index:xe,passesCondition:re?.[_e]?.passesCondition??!0,tab:me}})},e[4]=g,e[5]=_):_=e[5];let T=Vt(_),A;e[6]!==T?(A=()=>T.filter(_z)?.[0]?.index??0,e[6]=T,e[7]=A):A=e[7];let[L,P]=wz(A),E=`tabs-${C}`,B=T[L],k=B?.tab,$=k?.admin?.description??k?.description,j=typeof $=="function"?$({i18n:R,t:R.t}):$,M=T.some(Tz),O;e[8]!==w||e[9]!==x||e[10]!==S||e[11]!==F||e[12]!==E?(O=async J=>{P(J);let re=await w(S);S&&F(S,{...re,...x?{fields:{...re?.fields||{},[x]:{...re?.fields?.[x],tabIndex:J}}}:{fields:{...re?.fields,[E]:{...re?.fields?.[E],tabIndex:J}}}})},e[8]=w,e[9]=x,e[10]=S,e[11]=F,e[12]=E,e[13]=O):O=e[13];let V=O,W;e[14]!==w||e[15]!==x||e[16]!==S||e[17]!==T.length||e[18]!==E?(W=()=>{S&&(async()=>{let re=await w(S),me=x?re?.fields?.[x]?.tabIndex:re?.fields?.[E]?.tabIndex,xe=typeof me=="number"&&me<T.length?me:0;P(xe)})()},e[14]=w,e[15]=x,e[16]=S,e[17]=T.length,e[18]=E,e[19]=W):W=e[19];let Y;e[20]!==w||e[21]!==y||e[22]!==v||e[23]!==x||e[24]!==S||e[25]!==g||e[26]!==E?(Y=[x,w,S,E,g,y,v],e[20]=w,e[21]=y,e[22]=v,e[23]=x,e[24]=S,e[25]=g,e[26]=E,e[27]=Y):Y=e[27],GD(W,Y);let z;e[28]!==B?.passesCondition||e[29]!==V||e[30]!==T?(z=()=>{if(B?.passesCondition===!1){let J=T.find(Fz);J&&V(J.index)}},e[28]=B?.passesCondition,e[29]=V,e[30]=T,e[31]=z):z=e[31];let K;e[32]!==B||e[33]!==V||e[34]!==T?(K=[B,T,V],e[32]=B,e[33]=V,e[34]=T,e[35]=K):K=e[35],GD(z,K);let U=D&&`${Is}--within-collapsible`,X=!M&&`${Is}--hidden`,ne;e[36]!==p||e[37]!==U||e[38]!==X?(ne=[Ae,p,Is,U,X].filter(Boolean),e[36]=p,e[37]=U,e[38]=X,e[39]=ne):ne=e[39];let Z;return e[40]!==L||e[41]!==V||e[42]!==x?(Z=J=>{let{index:re,passesCondition:me,tab:xe}=J;return Ss(Y0,{hidden:!me,isActive:L===re,parentPath:x,setIsActive:()=>{V(re)},tab:xe},re)},e[40]=L,e[41]=V,e[42]=x,e[43]=Z):Z=e[43],Ss("div",{className:ne.join(" "),children:WD(Yv,{children:[Ss("div",{className:`${Is}__tabs-wrap`,children:Ss("div",{className:`${Is}__tabs`,children:T.map(Z)})}),Ss("div",{className:`${Is}__content-wrap`,children:k&&Ss(Iz,{description:j,field:k,forceRender:b,hidden:!1,parentIndexPath:C,parentPath:x,parentSchemaPath:I,path:x,permissions:l&&typeof l=="object"&&"name"in k?l[k.name]&&typeof l[k.name]=="object"&&"fields"in l[k.name]?l[k.name].fields:l[k.name]:l,readOnly:c,tabIndex:L})})]})})},md=ze(Sz);function Iz(t){let e=zD(21),{description:o,field:n,forceRender:r,hidden:s,label:i,parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:u,readOnly:d,tabIndex:f}=t,{i18n:m}=N(),{customComponents:p}=Te(),h,g;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==m||e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==p||e[12]!==f){g=Symbol.for("react.early_return_sentinel");e:{let{AfterInput:b,BeforeInput:C,Description:y,Field:v}=p===void 0?{}:p;if(v){g=v;break e}let{indexPath:x,path:I,schemaPath:w}=Cz({field:n,index:f,parentIndexPath:a,parentPath:l,parentSchemaPath:c}),F=s&&`${Is}__tab--hidden`,S;e[15]!==m||e[16]!==i?(S=i&&`${Is}__tabConfigLabel-${xz(yz(i,m))}`,e[15]=m,e[16]=i,e[17]=S):S=e[17];let R;e[18]!==F||e[19]!==S?(R=[F,`${Is}__tab`,S].filter(Boolean),e[18]=F,e[19]=S,e[20]=R):R=e[20],h=WD("div",{className:R.join(" "),children:[Ss(ue,{CustomComponent:y,Fallback:Ss(Xe,{description:o,marginPlacement:"bottom",path:l})}),C,Ss(Lo,{fields:n.fields,forceRender:r,parentIndexPath:x,parentPath:I,parentSchemaPath:w,permissions:u,readOnly:d}),b]})}e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=m,e[5]=i,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=g}else h=e[13],g=e[14];return g!==Symbol.for("react.early_return_sentinel")?g:h}function _z(t){let{passesCondition:e}=t;return e}function Tz(t){let{passesCondition:e}=t;return e}function Fz(t){let{passesCondition:e}=t;return e}import{jsx as Ez}from"react/jsx-runtime";import{useCallback as UD,useEffect as Nz,useMemo as Lz,useState as kz}from"react";import{c as Dz}from"react/compiler-runtime";import{jsx as si,jsxs as HD}from"react/jsx-runtime";import{getTranslation as Rz}from"@payloadcms/translations";import"react";var fd=t=>{let e=Dz(32),{AfterInput:o,BeforeInput:n,className:r,Description:s,description:i,Error:a,hasMany:l,htmlAttributes:c,inputRef:u,Label:d,label:f,localized:m,maxRows:p,onChange:h,onKeyDown:g,path:b,placeholder:C,readOnly:y,required:v,rtl:x,showError:I,style:w,value:F,valueToRender:S}=t,{i18n:R,t:D}=N(),_=Pz,T;if(e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==a||e[4]!==d||e[5]!==r||e[6]!==i||e[7]!==l||e[8]!==c||e[9]!==R||e[10]!==u||e[11]!==f||e[12]!==m||e[13]!==p||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==C||e[18]!==y||e[19]!==v||e[20]!==x||e[21]!==I||e[22]!==w||e[23]!==D||e[24]!==F||e[25]!==S){let A=Rz(C,R),L=I&&"error",P=y&&"read-only",E=l&&"has-many",B;e[27]!==r||e[28]!==L||e[29]!==P||e[30]!==E?(B=[Ae,"text",r,L,P,E].filter(Boolean),e[27]=r,e[28]=L,e[29]=P,e[30]=E,e[31]=B):B=e[31],T=HD("div",{className:B.join(" "),style:w,children:[si(ue,{CustomComponent:d,Fallback:si(Ce,{label:f,localized:m,path:b,required:v})}),HD("div",{className:`${Ae}__wrap`,children:[si(ue,{CustomComponent:a,Fallback:si(Ze,{path:b,showError:I})}),n,l?si(pt,{className:`field-${b.replace(/\./g,"__")}`,components:{DropdownIndicator:null},customProps:{editableProps:_},disabled:y,filterOption:()=>p?!(Array.isArray(F)&&p&&F.length>=p):!0,isClearable:!1,isCreatable:!0,isMulti:!0,isSortable:!0,menuIsOpen:!1,noOptionsMessage:()=>Array.isArray(F)&&F.length>=p?D("validation:limitReached",{max:p,value:F.length+1}):null,onChange:h,options:[],placeholder:A,showError:I,value:S}):si("input",{"data-rtl":x,disabled:y,id:`field-${b?.replace(/\./g,"__")}`,name:b,onChange:h,onKeyDown:g,placeholder:A,ref:u,type:"text",value:F||"",...c??{}}),o,si(ue,{CustomComponent:s,Fallback:si(Xe,{description:i,path:b})})]})]}),e[0]=o,e[1]=n,e[2]=s,e[3]=a,e[4]=d,e[5]=r,e[6]=i,e[7]=l,e[8]=c,e[9]=R,e[10]=u,e[11]=f,e[12]=m,e[13]=p,e[14]=h,e[15]=g,e[16]=b,e[17]=C,e[18]=y,e[19]=v,e[20]=x,e[21]=I,e[22]=w,e[23]=D,e[24]=F,e[25]=S,e[26]=T}else T=e[26];return T};function Az(t){t.currentTarget.contentEditable="false"}function Pz(t,e,o){let n=`${e}--editable`;return{onBlur:Az,onClick:r=>{r.currentTarget.contentEditable="true",r.currentTarget.classList.add(n),r.currentTarget.focus()},onKeyDown:r=>{if(!r.nativeEvent.isComposing&&(r.key==="Enter"||r.key==="Tab"||r.key==="Escape")){if(r.currentTarget.contentEditable="false",r.currentTarget.classList.remove(n),t.value.value=r.currentTarget.innerText,t.label=r.currentTarget.innerText,t.value.value.replaceAll(`
53
+ `]))),C_=function(e,o){var n=e.isFocused,r=e.size,s=e.theme,i=s.colors,a=s.spacing.baseUnit;return Ne({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},o?{}:{color:n?i.neutral60:i.neutral20,padding:a*2})},wv=function(e){var o=e.delay,n=e.offset;return Le("span",{css:_u({animation:"".concat(yM," 1s ease-in-out ").concat(o,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},CM=function(e){var o=e.innerProps,n=e.isRtl,r=e.size,s=r===void 0?4:r,i=lr(e,pM);return Le("div",Ee({},eo(Ne(Ne({},i),{},{innerProps:o,isRtl:n,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),o),Le(wv,{delay:0,offset:n}),Le(wv,{delay:160,offset:!0}),Le(wv,{delay:320,offset:!n}))},x_=function(e,o){var n=e.isDisabled,r=e.isFocused,s=e.theme,i=s.colors,a=s.borderRadius,l=s.spacing;return Ne({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},o?{}:{backgroundColor:n?i.neutral5:i.neutral0,borderColor:n?i.neutral10:r?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:r?i.primary:i.neutral30}})},xM=function(e){var o=e.children,n=e.isDisabled,r=e.isFocused,s=e.innerRef,i=e.innerProps,a=e.menuIsOpen;return Le("div",Ee({ref:s},eo(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":r,"control--menu-is-open":a}),i,{"aria-disabled":n||void 0}),o)},wM=xM,SM=["data"],w_=function(e,o){var n=e.theme.spacing;return o?{}:{paddingBottom:n.baseUnit*2,paddingTop:n.baseUnit*2}},IM=function(e){var o=e.children,n=e.cx,r=e.getStyles,s=e.getClassNames,i=e.Heading,a=e.headingProps,l=e.innerProps,c=e.label,u=e.theme,d=e.selectProps;return Le("div",Ee({},eo(e,"group",{group:!0}),l),Le(i,Ee({},a,{selectProps:d,theme:u,getStyles:r,getClassNames:s,cx:n}),c),Le("div",null,o))},S_=function(e,o){var n=e.theme,r=n.colors,s=n.spacing;return Ne({label:"group",cursor:"default",display:"block"},o?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},_M=function(e){var o=ZI(e);o.data;var n=lr(o,SM);return Le("div",Ee({},eo(e,"groupHeading",{"group-heading":!0}),n))},TM=IM,FM=["innerRef","isDisabled","isHidden","inputClassName"],I_=function(e,o){var n=e.isDisabled,r=e.value,s=e.theme,i=s.spacing,a=s.colors;return Ne(Ne({visibility:n?"hidden":"visible",transform:r?"translateZ(0)":""},DM),o?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},__={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},DM={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Ne({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},__)},RM=function(e){return Ne({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},__)},AM=function(e){var o=e.cx,n=e.value,r=ZI(e),s=r.innerRef,i=r.isDisabled,a=r.isHidden,l=r.inputClassName,c=lr(r,FM);return Le("div",Ee({},eo(e,"input",{"input-container":!0}),{"data-value":n||""}),Le("input",Ee({className:o({input:!0},l),ref:s,style:RM(a),disabled:i},c)))},PM=AM,T_=function(e,o){var n=e.theme,r=n.spacing,s=n.borderRadius,i=n.colors;return Ne({label:"multiValue",display:"flex",minWidth:0},o?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:r.baseUnit/2})},F_=function(e,o){var n=e.theme,r=n.borderRadius,s=n.colors,i=e.cropWithEllipsis;return Ne({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},o?{}:{borderRadius:r/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},D_=function(e,o){var n=e.theme,r=n.spacing,s=n.borderRadius,i=n.colors,a=e.isFocused;return Ne({alignItems:"center",display:"flex"},o?{}:{borderRadius:s/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},R_=function(e){var o=e.children,n=e.innerProps;return Le("div",n,o)},EM=R_,NM=R_;function LM(t){var e=t.children,o=t.innerProps;return Le("div",Ee({role:"button"},o),e||Le(Tv,{size:14}))}var kM=function(e){var o=e.children,n=e.components,r=e.data,s=e.innerProps,i=e.isDisabled,a=e.removeProps,l=e.selectProps,c=n.Container,u=n.Label,d=n.Remove;return Le(c,{data:r,innerProps:Ne(Ne({},eo(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:l},Le(u,{data:r,innerProps:Ne({},eo(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},o),Le(d,{data:r,innerProps:Ne(Ne({},eo(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(o||"option")},a),selectProps:l}))},jM=kM,A_=function(e,o){var n=e.isDisabled,r=e.isFocused,s=e.isSelected,i=e.theme,a=i.spacing,l=i.colors;return Ne({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},o?{}:{backgroundColor:s?l.primary:r?l.primary25:"transparent",color:n?l.neutral20:s?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:n?void 0:s?l.primary:l.primary50}})},$M=function(e){var o=e.children,n=e.isDisabled,r=e.isFocused,s=e.isSelected,i=e.innerRef,a=e.innerProps;return Le("div",Ee({},eo(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":r,"option--is-selected":s}),{ref:i,"aria-disabled":n},a),o)},BM=$M,P_=function(e,o){var n=e.theme,r=n.spacing,s=n.colors;return Ne({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},o?{}:{color:s.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},MM=function(e){var o=e.children,n=e.innerProps;return Le("div",Ee({},eo(e,"placeholder",{placeholder:!0}),n),o)},OM=MM,E_=function(e,o){var n=e.isDisabled,r=e.theme,s=r.spacing,i=r.colors;return Ne({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o?{}:{color:n?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},VM=function(e){var o=e.children,n=e.isDisabled,r=e.innerProps;return Le("div",Ee({},eo(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),r),o)},GM=VM,Fo={ClearIndicator:bM,Control:wM,DropdownIndicator:gM,DownChevron:h_,CrossIcon:Tv,Group:TM,GroupHeading:_M,IndicatorsContainer:mM,IndicatorSeparator:vM,Input:PM,LoadingIndicator:CM,Menu:sM,MenuList:iM,MenuPortal:cM,LoadingMessage:lM,NoOptionsMessage:aM,MultiValue:jM,MultiValueContainer:EM,MultiValueLabel:NM,MultiValueRemove:LM,Option:BM,Placeholder:OM,SelectContainer:uM,SingleValue:GM,ValueContainer:dM},N_=function(e){return Ne(Ne({},Fo),e.components)};var L_=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function zM(t,e){return!!(t===e||L_(t)&&L_(e))}function WM(t,e){if(t.length!==e.length)return!1;for(var o=0;o<t.length;o++)if(!zM(t[o],e[o]))return!1;return!0}function k_(t,e){e===void 0&&(e=WM);var o=null;function n(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];if(o&&o.lastThis===this&&e(r,o.lastArgs))return o.lastResult;var i=t.apply(this,r);return o={lastResult:i,lastArgs:r,lastThis:this},i}return n.clear=function(){o=null},n}var UM={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},XM=function(e){return Le("span",Ee({css:UM},e))},j_=XM,YM={guidance:function(e){var o=e.isSearchable,n=e.isMulti,r=e.tabSelectsValue,s=e.context,i=e.isInitialFocus;switch(s){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(r?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(e["aria-label"]||"Select"," is focused ").concat(o?",type to refine list":"",", press Down to open the menu, ").concat(n?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var o=e.action,n=e.label,r=n===void 0?"":n,s=e.labels,i=e.isDisabled;switch(o){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(e){var o=e.context,n=e.focused,r=e.options,s=e.label,i=s===void 0?"":s,a=e.selectValue,l=e.isDisabled,c=e.isSelected,u=e.isAppleDevice,d=function(h,g){return h&&h.length?"".concat(h.indexOf(g)+1," of ").concat(h.length):""};if(o==="value"&&a)return"value ".concat(i," focused, ").concat(d(a,n),".");if(o==="menu"&&u){var f=l?" disabled":"",m="".concat(c?" selected":"").concat(f);return"".concat(i).concat(m,", ").concat(d(r,n),".")}return""},onFilter:function(e){var o=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(o?" for search term "+o:"",".")}},ZM=function(e){var o=e.ariaSelection,n=e.focusedOption,r=e.focusedValue,s=e.focusableOptions,i=e.isFocused,a=e.selectValue,l=e.selectProps,c=e.id,u=e.isAppleDevice,d=l.ariaLiveMessages,f=l.getOptionLabel,m=l.inputValue,p=l.isMulti,h=l.isOptionDisabled,g=l.isSearchable,b=l.menuIsOpen,C=l.options,y=l.screenReaderStatus,v=l.tabSelectsValue,x=l.isLoading,I=l["aria-label"],w=l["aria-live"],F=Du(function(){return Ne(Ne({},YM),d||{})},[d]),S=Du(function(){var L="";if(o&&F.onChange){var P=o.option,E=o.options,B=o.removedValue,k=o.removedValues,$=o.value,j=function(K){return Array.isArray(K)?null:K},M=B||P||j($),O=M?f(M):"",V=E||k||void 0,W=V?V.map(f):[],Y=Ne({isDisabled:M&&h(M,a),label:O,labels:W},o);L=F.onChange(Y)}return L},[o,F,h,a,f]),R=Du(function(){var L="",P=n||r,E=!!(n&&a&&a.includes(n));if(P&&F.onFocus){var B={focused:P,label:f(P),isDisabled:h(P,a),isSelected:E,options:s,context:P===n?"menu":"value",selectValue:a,isAppleDevice:u};L=F.onFocus(B)}return L},[n,r,f,h,F,s,a,u]),D=Du(function(){var L="";if(b&&C.length&&!x&&F.onFilter){var P=y({count:s.length});L=F.onFilter({inputValue:m,resultsMessage:P})}return L},[s,m,b,F,C,y,x]),_=o?.action==="initial-input-focus",T=Du(function(){var L="";if(F.guidance){var P=r?"value":b?"menu":"input";L=F.guidance({"aria-label":I,context:P,isDisabled:n&&h(n,a),isMulti:p,isSearchable:g,tabSelectsValue:v,isInitialFocus:_})}return L},[I,n,r,p,h,g,b,F,a,v,_]),A=Le(Rv,null,Le("span",{id:"aria-selection"},S),Le("span",{id:"aria-focused"},R),Le("span",{id:"aria-results"},D),Le("span",{id:"aria-guidance"},T));return Le(Rv,null,Le(j_,{id:c},_&&A),Le(j_,{"aria-live":w,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!_&&A))},JM=ZM,Av=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}],qM=new RegExp("["+Av.map(function(t){return t.letters}).join("")+"]","g"),Z_={};for(Dp=0;Dp<Av.length;Dp++)for(Rp=Av[Dp],Ap=0;Ap<Rp.letters.length;Ap++)Z_[Rp.letters[Ap]]=Rp.base;var Rp,Ap,Dp,J_=function(e){return e.replace(qM,function(o){return Z_[o]})},QM=k_(J_),$_=function(e){return e.replace(/^\s+|\s+$/g,"")},KM=function(e){return"".concat(e.label," ").concat(e.value)},eO=function(e){return function(o,n){if(o.data.__isNew__)return!0;var r=Ne({ignoreCase:!0,ignoreAccents:!0,stringify:KM,trim:!0,matchFrom:"any"},e),s=r.ignoreCase,i=r.ignoreAccents,a=r.stringify,l=r.trim,c=r.matchFrom,u=l?$_(n):n,d=l?$_(a(o)):a(o);return s&&(u=u.toLowerCase(),d=d.toLowerCase()),i&&(u=QM(u),d=J_(d)),c==="start"?d.substr(0,u.length)===u:d.indexOf(u)>-1}},tO=["innerRef"];function oO(t){var e=t.innerRef,o=lr(t,tO),n=t_(o,"onExited","in","enter","exit","appear");return Le("input",Ee({ref:e},n,{css:_u({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var rO=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function nO(t){var e=t.isEnabled,o=t.onBottomArrive,n=t.onBottomLeave,r=t.onTopArrive,s=t.onTopLeave,i=Ll(!1),a=Ll(!1),l=Ll(0),c=Ll(null),u=ei(function(g,b){if(c.current!==null){var C=c.current,y=C.scrollTop,v=C.scrollHeight,x=C.clientHeight,I=c.current,w=b>0,F=v-x-y,S=!1;F>b&&i.current&&(n&&n(g),i.current=!1),w&&a.current&&(s&&s(g),a.current=!1),w&&b>F?(o&&!i.current&&o(g),I.scrollTop=v,S=!0,i.current=!0):!w&&-b>y&&(r&&!a.current&&r(g),I.scrollTop=0,S=!0,a.current=!0),S&&rO(g)}},[o,n,r,s]),d=ei(function(g){u(g,g.deltaY)},[u]),f=ei(function(g){l.current=g.changedTouches[0].clientY},[]),m=ei(function(g){var b=l.current-g.changedTouches[0].clientY;u(g,b)},[u]),p=ei(function(g){if(g){var b=KI?{passive:!1}:!1;g.addEventListener("wheel",d,b),g.addEventListener("touchstart",f,b),g.addEventListener("touchmove",m,b)}},[m,f,d]),h=ei(function(g){g&&(g.removeEventListener("wheel",d,!1),g.removeEventListener("touchstart",f,!1),g.removeEventListener("touchmove",m,!1))},[m,f,d]);return Y_(function(){if(e){var g=c.current;return p(g),function(){h(g)}}},[e,p,h]),function(g){c.current=g}}var B_=["boxSizing","height","overflow","paddingRight","position"],M_={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function O_(t){t.cancelable&&t.preventDefault()}function V_(t){t.stopPropagation()}function G_(){var t=this.scrollTop,e=this.scrollHeight,o=t+this.offsetHeight;t===0?this.scrollTop=1:o===e&&(this.scrollTop=t-1)}function z_(){return"ontouchstart"in window||navigator.maxTouchPoints}var W_=!!(typeof window<"u"&&window.document&&window.document.createElement),Ru=0,Nl={capture:!1,passive:!1};function sO(t){var e=t.isEnabled,o=t.accountForScrollbars,n=o===void 0?!0:o,r=Ll({}),s=Ll(null),i=ei(function(l){if(W_){var c=document.body,u=c&&c.style;if(n&&B_.forEach(function(p){var h=u&&u[p];r.current[p]=h}),n&&Ru<1){var d=parseInt(r.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,m=window.innerWidth-f+d||0;Object.keys(M_).forEach(function(p){var h=M_[p];u&&(u[p]=h)}),u&&(u.paddingRight="".concat(m,"px"))}c&&z_()&&(c.addEventListener("touchmove",O_,Nl),l&&(l.addEventListener("touchstart",G_,Nl),l.addEventListener("touchmove",V_,Nl))),Ru+=1}},[n]),a=ei(function(l){if(W_){var c=document.body,u=c&&c.style;Ru=Math.max(Ru-1,0),n&&Ru<1&&B_.forEach(function(d){var f=r.current[d];u&&(u[d]=f)}),c&&z_()&&(c.removeEventListener("touchmove",O_,Nl),l&&(l.removeEventListener("touchstart",G_,Nl),l.removeEventListener("touchmove",V_,Nl)))}},[n]);return Y_(function(){if(e){var l=s.current;return i(l),function(){a(l)}}},[e,i,a]),function(l){s.current=l}}var iO=function(e){var o=e.target;return o.ownerDocument.activeElement&&o.ownerDocument.activeElement.blur()},aO={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function lO(t){var e=t.children,o=t.lockEnabled,n=t.captureEnabled,r=n===void 0?!0:n,s=t.onBottomArrive,i=t.onBottomLeave,a=t.onTopArrive,l=t.onTopLeave,c=nO({isEnabled:r,onBottomArrive:s,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),u=sO({isEnabled:o}),d=function(m){c(m),u(m)};return Le(Rv,null,o&&Le("div",{onClick:iO,css:aO}),e(d))}var cO={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},uO=function(e){var o=e.name,n=e.onFocus;return Le("input",{required:!0,name:o,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:cO,value:"",onChange:function(){}})},dO=uO;function Pv(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function mO(){return Pv(/^iPhone/i)}function q_(){return Pv(/^Mac/i)}function fO(){return Pv(/^iPad/i)||q_()&&navigator.maxTouchPoints>1}function pO(){return mO()||fO()}function hO(){return q_()||pO()}var gO=function(e){return e.label},Ev=function(e){return e.label},Nv=function(e){return e.value},bO=function(e){return!!e.isDisabled},vO={clearIndicator:v_,container:d_,control:x_,dropdownIndicator:b_,group:w_,groupHeading:S_,indicatorsContainer:f_,indicatorSeparator:y_,input:I_,loadingIndicator:C_,loadingMessage:c_,menu:r_,menuList:i_,menuPortal:u_,multiValue:T_,multiValueLabel:F_,multiValueRemove:D_,noOptionsMessage:l_,option:A_,placeholder:P_,singleValue:E_,valueContainer:m_};var yO={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},CO=4,Q_=4,xO=38,wO=Q_*2,SO={baseUnit:Q_,controlHeight:xO,menuGutter:wO},Fv={borderRadius:CO,colors:yO,spacing:SO},IO={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:_v(),captureMenuScroll:!_v(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:eO(),formatGroupLabel:gO,getOptionLabel:Ev,getOptionValue:Nv,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:bO,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!qI(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var o=e.count;return"".concat(o," result").concat(o!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function H_(t,e,o,n){var r=tT(t,e,o),s=oT(t,e,o),i=eT(t,e),a=Ep(t,e);return{type:"option",data:e,isDisabled:r,isSelected:s,label:i,value:a,index:n}}function Pp(t,e){return t.options.map(function(o,n){if("options"in o){var r=o.options.map(function(i,a){return H_(t,i,e,a)}).filter(function(i){return X_(t,i)});return r.length>0?{type:"group",data:o,options:r,index:n}:void 0}var s=H_(t,o,e,n);return X_(t,s)?s:void 0}).filter(e_)}function K_(t){return t.reduce(function(e,o){return o.type==="group"?e.push.apply(e,Qs(o.options.map(function(n){return n.data}))):e.push(o.data),e},[])}function U_(t,e){return t.reduce(function(o,n){return n.type==="group"?o.push.apply(o,Qs(n.options.map(function(r){return{data:r.data,id:"".concat(e,"-").concat(n.index,"-").concat(r.index)}}))):o.push({data:n.data,id:"".concat(e,"-").concat(n.index)}),o},[])}function _O(t,e){return K_(Pp(t,e))}function X_(t,e){var o=t.inputValue,n=o===void 0?"":o,r=e.data,s=e.isSelected,i=e.label,a=e.value;return(!nT(t)||!s)&&rT(t,{label:i,value:a,data:r},n)}function TO(t,e){var o=t.focusedValue,n=t.selectValue,r=n.indexOf(o);if(r>-1){var s=e.indexOf(o);if(s>-1)return o;if(r<e.length)return e[r]}return null}function FO(t,e){var o=t.focusedOption;return o&&e.indexOf(o)>-1?o:e[0]}var Dv=function(e,o){var n,r=(n=e.find(function(s){return s.data===o}))===null||n===void 0?void 0:n.id;return r||null},eT=function(e,o){return e.getOptionLabel(o)},Ep=function(e,o){return e.getOptionValue(o)};function tT(t,e,o){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,o):!1}function oT(t,e,o){if(o.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,o);var n=Ep(t,e);return o.some(function(r){return Ep(t,r)===n})}function rT(t,e,o){return t.filterOption?t.filterOption(e,o):!0}var nT=function(e){var o=e.hideSelectedOptions,n=e.isMulti;return o===void 0?n:o},DO=1,Au=(function(t){YS(o,t);var e=JS(o);function o(n){var r;if(HS(this,o),r=e.call(this,n),r.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.isAppleDevice=hO(),r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,c){var u=r.props,d=u.onChange,f=u.name;c.name=f,r.ariaOnChange(l,c),d(l,c)},r.setValue=function(l,c,u){var d=r.props,f=d.closeMenuOnSelect,m=d.isMulti,p=d.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:p}),f&&(r.setState({inputIsHiddenAfterUpdate:!m}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:c,option:u})},r.selectOption=function(l){var c=r.props,u=c.blurInputOnSelect,d=c.isMulti,f=c.name,m=r.state.selectValue,p=d&&r.isOptionSelected(l,m),h=r.isOptionDisabled(l,m);if(p){var g=r.getOptionValue(l);r.setValue(m.filter(function(b){return r.getOptionValue(b)!==g}),"deselect-option",l)}else if(!h)d?r.setValue([].concat(Qs(m),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:f});return}u&&r.blurInput()},r.removeValue=function(l){var c=r.props.isMulti,u=r.state.selectValue,d=r.getOptionValue(l),f=u.filter(function(p){return r.getOptionValue(p)!==d}),m=oa(c,f,f[0]||null);r.onChange(m,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(oa(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,c=r.state.selectValue,u=c[c.length-1],d=c.slice(0,c.length-1),f=oa(l,d,d[0]||null);u&&r.onChange(f,{action:"pop-value",removedValue:u})},r.getFocusedOptionId=function(l){return Dv(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return U_(Pp(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];return YI.apply(void 0,[r.props.classNamePrefix].concat(c))},r.getOptionLabel=function(l){return eT(r.props,l)},r.getOptionValue=function(l){return Ep(r.props,l)},r.getStyles=function(l,c){var u=r.props.unstyled,d=vO[l](c,u);d.boxSizing="border-box";var f=r.props.styles[l];return f?f(d,c):d},r.getClassNames=function(l,c){var u,d;return(u=(d=r.props.classNames)[l])===null||u===void 0?void 0:u.call(d,c)},r.getElementId=function(l){return"".concat(r.state.instancePrefix,"-").concat(l)},r.getComponents=function(){return N_(r.props)},r.buildCategorizedOptions=function(){return Pp(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return K_(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(l,c){r.setState({ariaSelection:Ne({value:l},c)})},r.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(l){r.blockOptionHover=!1},r.onControlMouseDown=function(l){if(!l.defaultPrevented){var c=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&r.onMenuClose():c&&r.openMenu("first"):(c&&(r.openAfterFocus=!0),r.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},r.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!r.props.isDisabled){var c=r.props,u=c.isMulti,d=c.menuIsOpen;r.focusInput(),d?(r.setState({inputIsHiddenAfterUpdate:!u}),r.onMenuClose()):r.openMenu("first"),l.preventDefault()}},r.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(r.clearValue(),l.preventDefault(),r.openAfterFocus=!1,l.type==="touchend"?r.focusInput():setTimeout(function(){return r.focusInput()}))},r.onScroll=function(l){typeof r.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&Fu(l.target)&&r.props.onMenuClose():typeof r.props.closeMenuOnScroll=="function"&&r.props.closeMenuOnScroll(l)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(l){var c=l.touches,u=c&&c.item(0);u&&(r.initialTouchX=u.clientX,r.initialTouchY=u.clientY,r.userIsDragging=!1)},r.onTouchMove=function(l){var c=l.touches,u=c&&c.item(0);if(u){var d=Math.abs(u.clientX-r.initialTouchX),f=Math.abs(u.clientY-r.initialTouchY),m=5;r.userIsDragging=d>m||f>m}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var c=r.props.inputValue,u=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(u,{action:"input-change",prevInputValue:c}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var c=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:c}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var c=r.getFocusableOptions(),u=c.indexOf(l);r.setState({focusedOption:l,focusedOptionId:u>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return nT(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var c=r.props,u=c.isMulti,d=c.backspaceRemovesValue,f=c.escapeClearsValue,m=c.inputValue,p=c.isClearable,h=c.isDisabled,g=c.menuIsOpen,b=c.onKeyDown,C=c.tabSelectsValue,y=c.openMenuOnFocus,v=r.state,x=v.focusedOption,I=v.focusedValue,w=v.selectValue;if(!h&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!u||m)return;r.focusValue("previous");break;case"ArrowRight":if(!u||m)return;r.focusValue("next");break;case"Delete":case"Backspace":if(m)return;if(I)r.removeValue(I);else{if(!d)return;u?r.popValue():p&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!g||!C||!x||y&&r.isOptionSelected(x,w))return;r.selectOption(x);break;case"Enter":if(l.keyCode===229)break;if(g){if(!x||r.isComposing)return;r.selectOption(x);break}return;case"Escape":g?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:m}),r.onMenuClose()):p&&f&&r.clearValue();break;case" ":if(m)return;if(!g){r.openMenu("first");break}if(!x)return;r.selectOption(x);break;case"ArrowUp":g?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":g?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!g)return;r.focusOption("pageup");break;case"PageDown":if(!g)return;r.focusOption("pagedown");break;case"Home":if(!g)return;r.focusOption("first");break;case"End":if(!g)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++DO),r.state.selectValue=El(n.value),n.menuIsOpen&&r.state.selectValue.length){var s=r.getFocusableOptionsWithIds(),i=r.buildFocusableOptions(),a=i.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=s,r.state.focusedOption=i[a],r.state.focusedOptionId=Dv(s,i[a])}return r}return XS(o,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Iv(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(r){var s=this.props,i=s.isDisabled,a=s.menuIsOpen,l=this.state.isFocused;(l&&!i&&r.isDisabled||l&&a&&!r.menuIsOpen)&&this.focusInput(),l&&i&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Iv(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(r,s){this.props.onInputChange(r,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var s=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),u=r==="first"?0:c.length-1;if(!this.props.isMulti){var d=c.indexOf(a[0]);d>-1&&(u=d)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[u],focusedOptionId:this.getFocusedOptionId(c[u])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(r){var s=this.state,i=s.selectValue,a=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,u=-1;if(i.length){switch(r){case"previous":l===0?u=0:l===-1?u=c:u=l-1;break;case"next":l>-1&&l<c&&(u=l+1);break}this.setState({inputIsHidden:u!==-1,focusedValue:i[u]})}}}},{key:"focusOption",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),r==="up"?l=c>0?c-1:a.length-1:r==="down"?l=(c+1)%a.length:r==="pageup"?(l=c-s,l<0&&(l=0)):r==="pagedown"?(l=c+s,l>a.length-1&&(l=a.length-1)):r==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Fv):Ne(Ne({},Fv),this.props.theme):Fv}},{key:"getCommonProps",value:function(){var r=this.clearValue,s=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,u=this.setValue,d=this.props,f=d.isMulti,m=d.isRtl,p=d.options,h=this.hasValue();return{clearValue:r,cx:s,getStyles:i,getClassNames:a,getValue:l,hasValue:h,isMulti:f,isRtl:m,options:p,selectOption:c,selectProps:d,setValue:u,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,s=r.isClearable,i=r.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(r,s){return tT(this.props,r,s)}},{key:"isOptionSelected",value:function(r,s){return oT(this.props,r,s)}},{key:"filterOption",value:function(r,s){return rT(this.props,r,s)}},{key:"formatOptionLabel",value:function(r,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(r,{context:s,inputValue:i,selectValue:a})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var r=this.props,s=r.isDisabled,i=r.isSearchable,a=r.inputId,l=r.inputValue,c=r.tabIndex,u=r.form,d=r.menuIsOpen,f=r.required,m=this.getComponents(),p=m.Input,h=this.state,g=h.inputIsHidden,b=h.ariaSelection,C=this.commonProps,y=a||this.getElementId("input"),v=Ne(Ne(Ne({"aria-autocomplete":"list","aria-expanded":d,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},d&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?Ct.createElement(p,Ee({},C,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:y,innerRef:this.getInputRef,isDisabled:s,isHidden:g,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:u,type:"text",value:l},v)):Ct.createElement(oO,Ee({id:y,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:Tu,onFocus:this.onInputFocus,disabled:s,tabIndex:c,inputMode:"none",form:u,value:""},v))}},{key:"renderPlaceholderOrValue",value:function(){var r=this,s=this.getComponents(),i=s.MultiValue,a=s.MultiValueContainer,l=s.MultiValueLabel,c=s.MultiValueRemove,u=s.SingleValue,d=s.Placeholder,f=this.commonProps,m=this.props,p=m.controlShouldRenderValue,h=m.isDisabled,g=m.isMulti,b=m.inputValue,C=m.placeholder,y=this.state,v=y.selectValue,x=y.focusedValue,I=y.isFocused;if(!this.hasValue()||!p)return b?null:Ct.createElement(d,Ee({},f,{key:"placeholder",isDisabled:h,isFocused:I,innerProps:{id:this.getElementId("placeholder")}}),C);if(g)return v.map(function(F,S){var R=F===x,D="".concat(r.getOptionLabel(F),"-").concat(r.getOptionValue(F));return Ct.createElement(i,Ee({},f,{components:{Container:a,Label:l,Remove:c},isFocused:R,isDisabled:h,key:D,index:S,removeProps:{onClick:function(){return r.removeValue(F)},onTouchEnd:function(){return r.removeValue(F)},onMouseDown:function(T){T.preventDefault()}},data:F}),r.formatOptionLabel(F,"value"))});if(b)return null;var w=v[0];return Ct.createElement(u,Ee({},f,{data:w,isDisabled:h}),this.formatOptionLabel(w,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),s=r.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,u=this.state.isFocused;if(!this.isClearable()||!s||l||!this.hasValue()||c)return null;var d={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return Ct.createElement(s,Ee({},i,{innerProps:d,isFocused:u}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),s=r.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,u=this.state.isFocused;if(!s||!c)return null;var d={"aria-hidden":"true"};return Ct.createElement(s,Ee({},i,{innerProps:d,isDisabled:l,isFocused:u}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator,i=r.IndicatorSeparator;if(!s||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return Ct.createElement(i,Ee({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator;if(!s)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return Ct.createElement(s,Ee({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,s=this.getComponents(),i=s.Group,a=s.GroupHeading,l=s.Menu,c=s.MenuList,u=s.MenuPortal,d=s.LoadingMessage,f=s.NoOptionsMessage,m=s.Option,p=this.commonProps,h=this.state.focusedOption,g=this.props,b=g.captureMenuScroll,C=g.inputValue,y=g.isLoading,v=g.loadingMessage,x=g.minMenuHeight,I=g.maxMenuHeight,w=g.menuIsOpen,F=g.menuPlacement,S=g.menuPosition,R=g.menuPortalTarget,D=g.menuShouldBlockScroll,_=g.menuShouldScrollIntoView,T=g.noOptionsMessage,A=g.onMenuScrollToTop,L=g.onMenuScrollToBottom;if(!w)return null;var P=function(O,V){var W=O.type,Y=O.data,z=O.isDisabled,K=O.isSelected,U=O.label,X=O.value,ne=h===Y,Z=z?void 0:function(){return r.onOptionHover(Y)},J=z?void 0:function(){return r.selectOption(Y)},re="".concat(r.getElementId("option"),"-").concat(V),me={id:re,onClick:J,onMouseMove:Z,onMouseOver:Z,tabIndex:-1,role:"option","aria-selected":r.isAppleDevice?void 0:K};return Ct.createElement(m,Ee({},p,{innerProps:me,data:Y,isDisabled:z,isSelected:K,key:re,label:U,type:W,value:X,isFocused:ne,innerRef:ne?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(O.data,"menu"))},E;if(this.hasOptions())E=this.getCategorizedOptions().map(function(M){if(M.type==="group"){var O=M.data,V=M.options,W=M.index,Y="".concat(r.getElementId("group"),"-").concat(W),z="".concat(Y,"-heading");return Ct.createElement(i,Ee({},p,{key:Y,data:O,options:V,Heading:a,headingProps:{id:z,data:M.data},label:r.formatGroupLabel(M.data)}),M.options.map(function(K){return P(K,"".concat(W,"-").concat(K.index))}))}else if(M.type==="option")return P(M,"".concat(M.index))});else if(y){var B=v({inputValue:C});if(B===null)return null;E=Ct.createElement(d,p,B)}else{var k=T({inputValue:C});if(k===null)return null;E=Ct.createElement(f,p,k)}var $={minMenuHeight:x,maxMenuHeight:I,menuPlacement:F,menuPosition:S,menuShouldScrollIntoView:_},j=Ct.createElement(s_,Ee({},p,$),function(M){var O=M.ref,V=M.placerProps,W=V.placement,Y=V.maxHeight;return Ct.createElement(l,Ee({},p,$,{innerRef:O,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:y,placement:W}),Ct.createElement(lO,{captureEnabled:b,onTopArrive:A,onBottomArrive:L,lockEnabled:D},function(z){return Ct.createElement(c,Ee({},p,{innerRef:function(U){r.getMenuListRef(U),z(U)},innerProps:{role:"listbox","aria-multiselectable":p.isMulti,id:r.getElementId("listbox")},isLoading:y,maxHeight:Y,focusedOption:h}),E)}))});return R||S==="fixed"?Ct.createElement(u,Ee({},p,{appendTo:R,controlElement:this.controlRef,menuPlacement:F,menuPosition:S}),j):j}},{key:"renderFormField",value:function(){var r=this,s=this.props,i=s.delimiter,a=s.isDisabled,l=s.isMulti,c=s.name,u=s.required,d=this.state.selectValue;if(u&&!this.hasValue()&&!a)return Ct.createElement(dO,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=d.map(function(h){return r.getOptionValue(h)}).join(i);return Ct.createElement("input",{name:c,type:"hidden",value:f})}else{var m=d.length>0?d.map(function(h,g){return Ct.createElement("input",{key:"i-".concat(g),name:c,type:"hidden",value:r.getOptionValue(h)})}):Ct.createElement("input",{name:c,type:"hidden",value:""});return Ct.createElement("div",null,m)}else{var p=d[0]?this.getOptionValue(d[0]):"";return Ct.createElement("input",{name:c,type:"hidden",value:p})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,s=this.state,i=s.ariaSelection,a=s.focusedOption,l=s.focusedValue,c=s.isFocused,u=s.selectValue,d=this.getFocusableOptions();return Ct.createElement(JM,Ee({},r,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:u,focusableOptions:d,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),s=r.Control,i=r.IndicatorsContainer,a=r.SelectContainer,l=r.ValueContainer,c=this.props,u=c.className,d=c.id,f=c.isDisabled,m=c.menuIsOpen,p=this.state.isFocused,h=this.commonProps=this.getCommonProps();return Ct.createElement(a,Ee({},h,{className:u,innerProps:{id:d,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:p}),this.renderLiveRegion(),Ct.createElement(s,Ee({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:p,menuIsOpen:m}),Ct.createElement(l,Ee({},h,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),Ct.createElement(i,Ee({},h,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,s){var i=s.prevProps,a=s.clearFocusValueOnUpdate,l=s.inputIsHiddenAfterUpdate,c=s.ariaSelection,u=s.isFocused,d=s.prevWasFocused,f=s.instancePrefix,m=r.options,p=r.value,h=r.menuIsOpen,g=r.inputValue,b=r.isMulti,C=El(p),y={};if(i&&(p!==i.value||m!==i.options||h!==i.menuIsOpen||g!==i.inputValue)){var v=h?_O(r,C):[],x=h?U_(Pp(r,C),"".concat(f,"-option")):[],I=a?TO(s,C):null,w=FO(s,v),F=Dv(x,w);y={selectValue:C,focusedOption:w,focusedOptionId:F,focusableOptionsWithIds:x,focusedValue:I,clearFocusValueOnUpdate:!1}}var S=l!=null&&r!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},R=c,D=u&&d;return u&&!D&&(R={value:oa(b,C,C[0]||null),options:C,action:"initial-input-focus"},D=!d),c?.action==="initial-input-focus"&&(R=null),Ne(Ne(Ne({},y),S),{},{prevProps:r,ariaSelection:R,prevWasFocused:D})}}]),o})(HM);Au.defaultProps=IO;import"react-dom";var AO=RO(function(t,e){var o=tp(t);return sT.createElement(Au,Ee({ref:e},o))}),iT=AO;import*as uT from"react";import{forwardRef as NO}from"react";import{useMemo as aT,useCallback as PO}from"react";var EO=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],lT=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=String(e).toLowerCase(),s=String(n.getOptionValue(o)).toLowerCase(),i=String(n.getOptionLabel(o)).toLowerCase();return s===r||i===r},Lv={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,o,n,r){return!(!e||o.some(function(s){return lT(e,s,r)})||n.some(function(s){return lT(e,s,r)}))},getNewOptionData:function(e,o){return{label:o,value:e,__isNew__:!0}}};function cT(t){var e=t.allowCreateWhileLoading,o=e===void 0?!1:e,n=t.createOptionPosition,r=n===void 0?"last":n,s=t.formatCreateLabel,i=s===void 0?Lv.formatCreateLabel:s,a=t.isValidNewOption,l=a===void 0?Lv.isValidNewOption:a,c=t.getNewOptionData,u=c===void 0?Lv.getNewOptionData:c,d=t.onCreateOption,f=t.options,m=f===void 0?[]:f,p=t.onChange,h=lr(t,EO),g=h.getOptionValue,b=g===void 0?Nv:g,C=h.getOptionLabel,y=C===void 0?Ev:C,v=h.inputValue,x=h.isLoading,I=h.isMulti,w=h.value,F=h.name,S=aT(function(){return l(v,El(w),m,{getOptionValue:b,getOptionLabel:y})?u(v,i(v)):void 0},[i,u,y,b,v,l,m,w]),R=aT(function(){return(o||!x)&&S?r==="first"?[S].concat(Qs(m)):[].concat(Qs(m),[S]):m},[o,r,x,S,m]),D=PO(function(_,T){if(T.action!=="select-option")return p(_,T);var A=Array.isArray(_)?_:[_];if(A[A.length-1]===S){if(d)d(v);else{var L=u(v,v),P={action:"create-option",name:F,option:L};p(oa(I,[].concat(Qs(El(w)),[L]),L),P)}return}p(_,T)},[u,v,I,F,S,d,p,w]);return Ne(Ne({},h),{},{options:R,onChange:D})}import"react-dom";var LO=NO(function(t,e){var o=tp(t),n=cT(o);return uT.createElement(Au,Ee({ref:e},n))}),dT=LO;import{jsx as mT}from"react/jsx-runtime";import"react";var fT="clear-indicator",kv=t=>{let{clearValue:e,innerProps:{ref:o,...n}}=t;return mT("div",{className:fT,ref:typeof o=="string"?null:o,...n,onKeyDown:r=>{r.key==="Enter"&&(e(),r.stopPropagation())},role:"button",tabIndex:0,children:mT(vt,{className:`${fT}__icon`})})};import{jsx as pT}from"react/jsx-runtime";import kO from"react";var jv=t=>{let{children:e,innerProps:o,selectProps:{customProps:{disableKeyDown:n,disableMouseDown:r}={}}={}}=t;return pT(kO.Fragment,{children:pT(Fo.Control,{...t,innerProps:{...o,onKeyDown:s=>{if(n){s.stopPropagation();let i=new CustomEvent("bypassKeyDown",{detail:s});document.dispatchEvent(i)}},onMouseDown:s=>{r||o.onMouseDown(s)}},children:e})})};import{jsx as hT}from"react/jsx-runtime";import"react";var gT="dropdown-indicator",$v=t=>{let{innerProps:{ref:e,...o}}=t;return hT("button",{className:gT,ref:e,...o,onKeyDown:n=>{n.key==="Enter"&&(n.key=" ")},type:"button",children:hT(He,{className:`${gT}__icon`})})};import{jsx as bT}from"react/jsx-runtime";import jO from"react";var Bv=t=>bT(jO.Fragment,{children:bT(Fo.Input,{...t,"aria-activedescendant":void 0})});import{c as $O}from"react/compiler-runtime";import{jsx as vT}from"react/jsx-runtime";import BO from"react";var yT="multi-value";function Mv(t,e){return typeof e=="function"?e(t):t?.value}var Ov=t=>{let e=$O(24),{className:o,data:n,innerProps:r,isDisabled:s,selectProps:i}=t,a;e[0]!==i?(a=i===void 0?{}:i,e[0]=i,e[1]=a):a=e[1];let{customProps:l,getOptionValue:c,isSortable:u}=a,d;e[2]!==l?(d=l===void 0?{}:l,e[2]=l,e[3]=d):d=e[3];let{disableMouseDown:f}=d,m;e[4]!==n||e[5]!==c?(m=Mv(n,c),e[4]=n,e[5]=c,e[6]=m):m=e[6];let p=m,h=!u,g;e[7]!==p||e[8]!==h?(g={id:p,disabled:h},e[7]=p,e[8]=h,e[9]=g):g=e[9];let{attributes:b,isDragging:C,listeners:y,setNodeRef:v,transform:x}=il(g),I=!s&&u&&"draggable",w=C&&`${yT}--is-dragging`,F;e[10]!==o||e[11]!==I||e[12]!==w?(F=[yT,o,I,w].filter(Boolean),e[10]=o,e[11]=I,e[12]=w,e[13]=F):F=e[13];let S=F.join(" "),R;if(e[14]!==b||e[15]!==S||e[16]!==f||e[17]!==r||e[18]!==u||e[19]!==y||e[20]!==t||e[21]!==v||e[22]!==x){let{onMouseDown:D,..._}=y||{};R=vT(BO.Fragment,{children:vT(Fo.MultiValue,{...t,className:S,innerProps:{...u?{...b,..._}:{},...r,onMouseDown:T=>{u&&D&&D(T),f||T.stopPropagation()},ref:v,style:u?{transform:x,...b?.style}:{}}})}),e[14]=b,e[15]=S,e[16]=f,e[17]=r,e[18]=u,e[19]=y,e[20]=t,e[21]=v,e[22]=x,e[23]=R}else R=e[23];return R};import{jsx as CT}from"react/jsx-runtime";import{getTranslation as MO}from"@payloadcms/translations";import"react";var xT="multi-value-label",Vv=t=>{let{data:e,selectProps:o}=t,{customProps:n}=o===void 0?{}:o,{draggableProps:r,editableProps:s}=n===void 0?{}:n,{i18n:i}=N(),a=`${xT}__text`,l=e.label?MO(e.label,i):"";return CT("div",{className:xT,title:typeof l=="string"?l:"",children:CT(Fo.MultiValueLabel,{...t,innerProps:{className:a,...s&&s(e,a,t.selectProps)||{},...r||{}}})})};import{c as OO}from"react/compiler-runtime";import{jsx as wT,jsxs as VO}from"react/jsx-runtime";import GO from"react";var Gv="multi-value-remove",zv=t=>{let e=OO(12),{innerProps:o}=t,{className:n,onClick:r,onTouchEnd:s}=o,[i,a]=GO.useState(!1),{t:l}=N(),c;if(e[0]!==n||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==l){let u=l("general:remove"),d;e[6]!==n?(d=[Gv,n].filter(Boolean),e[6]=n,e[7]=d):d=e[7];let f;e[8]!==r?(f=h=>{a(!1),r(h)},e[8]=r,e[9]=f):f=e[9];let m,p;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),p=()=>a(!1),e[10]=m,e[11]=p):(m=e[10],p=e[11]),c=VO("button",{"aria-label":u,className:d.join(" "),onClick:f,onKeyDown:zO,onMouseDown:WO,onMouseEnter:m,onMouseLeave:p,onTouchEnd:s,type:"button",children:[wT(Ao,{className:`${Gv}__tooltip`,show:i,children:l("general:remove")}),wT(vt,{className:`${Gv}__icon`})]}),e[0]=n,e[1]=r,e[2]=s,e[3]=i,e[4]=l,e[5]=c}else c=e[5];return c};function zO(t){t.key==="Enter"&&t.stopPropagation()}function WO(t){return t.stopPropagation()}import{jsx as ST}from"react/jsx-runtime";import HO from"react";var UO="react-select--single-value",Wv=t=>{let{children:e,className:o}=t;return ST(HO.Fragment,{children:ST(Fo.SingleValue,{...t,className:[UO,o].filter(Boolean).join(" "),children:e})})};import{jsx as IT,jsxs as XO}from"react/jsx-runtime";import{getTranslation as YO}from"@payloadcms/translations";import"react";var _T="value-container",Hv=t=>{let{selectProps:e}=t,{customProps:o,value:n}=e===void 0?{}:e,{i18n:r}=N(),s="";if(n&&!Array.isArray(n)&&typeof n=="object"&&"label"in n){let i=n.label?YO(n.label,r):"";s=typeof i=="string"?i:""}return XO("div",{className:_T,ref:o?.droppableRef,title:s,children:[o?.valueContainerLabel&&IT("span",{className:`${_T}__label`,children:o?.valueContainerLabel}),IT(Fo.ValueContainer,{...t})]})};var qO=t=>({label:t,value:t}),DT=t=>{let{i18n:e,t:o}=N(),[n,r]=FT.useState(""),s=JO(),[i,a]=FT.useState(!1);ZO(()=>{a(!0)},[]);let{className:l,components:c,customProps:u,disabled:d=!1,filterOption:f=void 0,getOptionValue:m,isClearable:p=!0,isCreatable:h,isLoading:g,isSearchable:b=!0,noOptionsMessage:C=()=>o("general:noOptions"),numberOnly:y=!1,onChange:v,onMenuClose:x,onMenuOpen:I,options:w,placeholder:F=o("general:selectValue"),showError:S,value:R}=t,D=()=>o("general:loading")+"...",_=[l,"react-select",S&&"react-select--error"].filter(Boolean).join(" "),T={menu:L=>({...L,zIndex:void 0})};if(!i)return ra(Et,{height:"calc(var(--base) * 2 + 2px)"});if(!h)return ra(iT,{captureMenuScroll:!0,customProps:u,isLoading:g,...t,className:_,classNamePrefix:"rs",components:{ClearIndicator:kv,Control:jv,DropdownIndicator:$v,Input:Bv,MultiValue:Ov,MultiValueLabel:Vv,MultiValueRemove:zv,SingleValue:Wv,ValueContainer:Hv,...c},filterOption:f,getOptionValue:m,instanceId:s,isClearable:p,isDisabled:d,isSearchable:b,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:C,onChange:v,onMenuClose:x,onMenuOpen:I,options:w,placeholder:TT(F,e),styles:T,unstyled:!0,value:R});let A=L=>{if(y===!0){let P=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],E=!/\D/.test(L.key),B=P.includes(L.key);if(!E&&!B){L.preventDefault();return}}if(!(!R||!n||n.trim()==="")&&!(f&&!f(null,n))&&!L.nativeEvent.isComposing)switch(L.key){case"Enter":case"Tab":v([...R,qO(n)]),r(""),L.preventDefault();break;default:break}};return ra(dT,{captureMenuScroll:!0,isLoading:g,...t,className:_,classNamePrefix:"rs",components:{ClearIndicator:kv,Control:jv,DropdownIndicator:$v,Input:Bv,MultiValue:Ov,MultiValueLabel:Vv,MultiValueRemove:zv,SingleValue:Wv,ValueContainer:Hv,...c},filterOption:f,inputValue:n,instanceId:s,isClearable:p,isDisabled:d,isSearchable:b,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:C,onChange:v,onInputChange:L=>r(L),onKeyDown:A,onMenuClose:x,onMenuOpen:I,options:w,placeholder:TT(F,e),styles:T,unstyled:!0,value:R})},QO=t=>{let{getOptionValue:e,onChange:o,value:n}=t,r=[];return n&&(r=(Array.isArray(n)?n:[n]).map(s=>Mv(s,e))),ra(Vr,{className:"react-select-container",ids:r,onDragEnd:({moveFromIndex:s,moveToIndex:i})=>{let a=n;n&&Array.isArray(n)&&(a=pf(n,s,i)),o(a)},children:ra(DT,{...t})})},pt=t=>{let{isMulti:e,isSortable:o}=t;return e&&o?ra(QO,{...t}):ra(DT,{...t})};var Pu=t=>t.map(e=>typeof e=="object"&&(e.value||e.value==="")?e:{label:e,value:e});var Eu=t=>{let{id:e,onChange:o,options:n,readOnly:r,required:s,selectedTimezone:i}=t,{t:a}=N(),l=Pu(n),c=e7(()=>l.find(d=>(typeof d=="string"?d:d.value)===i),[l,i]),u=!!r||l.length===1;return KO("div",{className:"timezone-picker-wrapper",children:[RT(Ce,{htmlFor:e,label:`${a("general:timezone")} ${s?"*":""}`,required:s,unstyled:!0}),RT(pt,{className:"timezone-picker",disabled:u,inputId:e,isClearable:!s,isCreatable:!1,onChange:d=>{o&&o(d?.value||"")},options:l,value:c})]})};var PT="date-time-field",o7=t=>{let{field:e,field:{admin:{className:o,date:n,description:r,placeholder:s}={},label:i,localized:a,required:l,timezone:c},path:u,readOnly:d,validate:f}=t,m=n?.pickerAppearance||"default",p=Intl.DateTimeFormat().resolvedOptions().timeZone,{config:h}=H(),{i18n:g}=N(),{dispatchFields:b,setModified:C}=$e(),y=Uv((V,W)=>{if(typeof f=="function")return f(V,{...W,required:l})},[f,l]),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Error:w,Label:F}={},disabled:S,path:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:u,validate:y}),A=R+"_tz",L=Vt(([V,W])=>V?.[A]),P=Xv(()=>c&&typeof c=="object"&&c.supportedTimezones?c.supportedTimezones:h.admin.timezones.supportedTimezones,[h.admin.timezones.supportedTimezones,c]),E=["dayOnly","default","monthOnly"].includes(m),B=L?.value,k=l||c&&typeof c=="object"&&c.required,$=Xv(()=>{if(c&&B&&p&&T){let V=no.tz(B),W=no.tz(p),Y=new no(T).withTimeZone(B),z=un(Y,V);return un(z,W).toISOString()}return T},[c,B,T,p]),j=Xv(()=>et(e),[e]),M=Uv(V=>{if(!(d||S))if(c&&B&&V){let W=no.tz(B);if(E){let Y=V.getTimezoneOffset()/60,z=V.getHours()+Y;V.setHours(z);let K=un(V,W);D(K.toISOString()||null)}else{let Y=new no(V),z=un(Y,W);D(z.toISOString()||null)}}else D(V?.toISOString()||null)},[d,S,c,B,E,D]),O=Uv(V=>{A&&(b({type:"UPDATE",path:A,value:V}),C(!0))},[b,C,A]);return AT("div",{className:[Ae,PT,o,_&&`${PT}--has-error`,(d||S)&&"read-only"].filter(Boolean).join(" "),style:j,children:[ti(ue,{CustomComponent:F,Fallback:ti(Ce,{label:i,localized:a,path:R,required:l})}),AT("div",{className:`${Ae}__wrap`,id:`field-${R.replace(/\./g,"__")}`,children:[ti(ue,{CustomComponent:w,Fallback:ti(Ze,{path:R,showError:_})}),x,ti(Cl,{...n,onChange:M,overrides:{...n?.overrides},placeholder:t7(s,g),readOnly:d||S,value:$}),c&&P.length>0&&ti(Eu,{id:`${R}-timezone-picker`,onChange:O,options:P,readOnly:d||S,required:k,selectedTimezone:B}),v]}),ti(ue,{CustomComponent:I,Fallback:ti(Xe,{description:r,path:R})})]})},Nu=ze(o7);import{jsx as na,jsxs as ET}from"react/jsx-runtime";import{getTranslation as r7}from"@payloadcms/translations";import{useCallback as n7,useMemo as s7}from"react";var i7=t=>{let{field:e,field:{admin:{autoComplete:o,className:n,description:r,placeholder:s}={},label:i,localized:a,required:l}={},path:c,readOnly:u,validate:d}=t,{i18n:f}=N(),m=n7((S,R)=>{if(typeof d=="function")return d(S,{...R,required:l})},[d,l]),{customComponents:{AfterInput:p,BeforeInput:h,Description:g,Error:b,Label:C}={},disabled:y,path:v,setValue:x,showError:I,value:w}=Te({potentiallyStalePath:c,validate:m}),F=s7(()=>et(e),[e]);return ET("div",{className:[Ae,"email",n,I&&"error",(u||y)&&"read-only"].filter(Boolean).join(" "),style:F,children:[na(ue,{CustomComponent:C,Fallback:na(Ce,{label:i,localized:a,path:v,required:l})}),ET("div",{className:`${Ae}__wrap`,children:[na(ue,{CustomComponent:b,Fallback:na(Ze,{path:v,showError:I})}),h,na("input",{autoComplete:o,disabled:u||y,id:`field-${v.replace(/\./g,"__")}`,name:v,onChange:x,placeholder:r7(s,f),required:l,type:"email",value:w||""}),p]}),na(ue,{CustomComponent:g,Fallback:na(Xe,{description:r,path:v})})]})},sa=ze(i7);import{jsx as hs,jsxs as Np}from"react/jsx-runtime";import{getTranslation as g7}from"@payloadcms/translations";import{groupHasName as VT}from"payload/shared";import{useMemo as b7}from"react";import{jsx as a7}from"react/jsx-runtime";import{createContext as l7,use as c7}from"react";var NT=l7(!1),LT=({children:t,withinRow:e=!0})=>a7(NT,{value:e,children:t}),kT=()=>c7(NT);import{jsx as u7}from"react/jsx-runtime";import{createContext as d7,use as m7}from"react";var jT=d7(!1),Yv=({children:t,withinTab:e=!0})=>u7(jT,{value:e,children:t}),$T=()=>m7(jT);import{jsx as f7}from"react/jsx-runtime";import{createContext as p7,use as h7}from"react";var BT=p7(!1),MT=({children:t,withinGroup:e=!0})=>f7(BT,{value:e,children:t}),OT=()=>h7(BT);var bn="group-field",v7=t=>{let{field:e,field:{admin:{className:o,description:n,hideGutter:r}={},fields:s,label:i},indexPath:a,parentPath:l,parentSchemaPath:c,path:u,permissions:d,readOnly:f,schemaPath:m}=t,p=m??(e.type==="group"&&VT(e)?e.name:u),{i18n:h}=N(),{isWithinCollapsible:g}=Zs(),b=OT(),C=kT(),y=$T(),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Label:w}={},errorPaths:F}=Te({path:u}),S=fo(),R=F.length,D=S&&R>0,_=!(g||b||C),T=b7(()=>et(e),[e]);return Np("div",{className:[Ae,bn,_&&`${bn}--top-level`,g&&`${bn}--within-collapsible`,b&&`${bn}--within-group`,C&&`${bn}--within-row`,y&&`${bn}--within-tab`,!r&&b&&`${bn}--gutter`,D&&`${bn}--has-error`,o].filter(Boolean).join(" "),id:`field-${u?.replace(/\./g,"__")}`,style:T,children:[hs(MT,{children:Np("div",{className:`${bn}__wrap`,children:[!!(w||I||i||D)&&Np("div",{className:`${bn}__header`,children:[!!(w||I||i)&&Np("header",{children:[hs(ue,{CustomComponent:w,Fallback:hs("h3",{className:`${bn}__title`,children:hs(Ce,{as:"span",label:g7(i,h),localized:!1,path:u,required:!1})})}),hs(ue,{CustomComponent:I,Fallback:hs(Xe,{description:n,path:u})})]}),D&&hs(Io,{count:R,i18n:h,withMessage:!0})]}),x,VT(e)?hs(Lo,{fields:s,margins:"small",parentIndexPath:"",parentPath:u,parentSchemaPath:p,permissions:d===!0?d:d?.fields,readOnly:f}):hs(Lo,{fields:s,margins:"small",parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:d,readOnly:f})]})}),v]})};var Lu=ze(v7);import{c as y7}from"react/compiler-runtime";import{jsx as C7}from"react/jsx-runtime";import{useEffect as x7}from"react";var w7=t=>{let e=y7(13),{disableModifyingForm:o,path:n,value:r}=t,s=o===void 0?!0:o,i;e[0]!==n?(i={potentiallyStalePath:n},e[0]=n,e[1]=i):i=e[1];let{formInitializing:a,path:l,setValue:c,value:u}=Te(i),d,f;e[2]!==s||e[3]!==a||e[4]!==c||e[5]!==r?(d=()=>{r!==void 0&&!a&&c(r,s)},f=[r,c,s,a],e[2]=s,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=f):(d=e[6],f=e[7]),x7(d,f);let m=`field-${l?.replace(/\./g,"__")}`,p=u||"",h;return e[8]!==l||e[9]!==c||e[10]!==m||e[11]!==p?(h=C7("input",{id:m,name:l,onChange:c,type:"hidden",value:p}),e[8]=l,e[9]=c,e[10]=m,e[11]=p,e[12]=h):h=e[12],h},ku=ze(w7);var Qp=Ri(Jv(),1);import{jsx as aa,jsxs as xV}from"react/jsx-runtime";import{fieldAffectsData as wV,flattenTopLevelFields as SV}from"payload/shared";import{useMemo as ZF}from"react";import{jsx as ur,jsxs as Ol}from"react/jsx-runtime";import{getTranslation as XF}from"@payloadcms/translations";import{hoistQueryParamsToAnd as bV,transformColumnsToPreferences as YF}from"payload/shared";import vV,{Fragment as yV,useCallback as qp,useEffect as Uu,useRef as CV,useState as vs}from"react";import{jsx as KT}from"react/jsx-runtime";import{useRouter as A7,useSearchParams as P7}from"next/navigation.js";import*as e0 from"qs-esm";import E7,{useCallback as $u,useEffect as N7,useMemo as L7,useRef as k7,useState as eF}from"react";import{jsx as T7}from"react/jsx-runtime";import{createContext as F7,use as D7}from"react";var YT=F7({}),qv=({children:t,...e})=>T7(YT,{value:{isInDrawer:!!e.drawerSlug,...e},children:t}),_r=()=>{let t=D7(YT);if(!t)throw new Error("useListDrawerContext must be used within a ListDrawerContextProvider");return t};import*as ZT from"qs-esm";function Yt(t){let e=t.toString();return ZT.parse(e,{depth:10,ignoreQueryPrefix:!0})}import{createContext as JT,use as R7}from"react";var Qv=JT({}),mt=()=>R7(Qv),qT=JT(!1);var QT=(t,e,o)=>{let n="page"in e?e.page:t?.page;["where","search","groupBy"].some(l=>l in e&&!["limit","page"].includes(l))&&(n=1);let s=["where","search","page","limit","groupBy","sort"].some(l=>l in e),i;return s||(i={...t?.queryByGroup||{},...e.queryByGroup?Object.fromEntries(Object.entries(e.queryByGroup).map(([l,c])=>[l,{...t?.queryByGroup?.[l]||{},...c}])):{}}),{...t,...e,columns:"columns"in e?e.columns:t.columns,groupBy:"groupBy"in e?e.groupBy:t?.groupBy??o?.defaults?.groupBy,limit:"limit"in e?e.limit:t?.limit??o?.defaults?.limit,page:n,preset:"preset"in e?e.preset:t?.preset,queryByGroup:i,search:"search"in e?e.search:t?.search,sort:"sort"in e?e.sort:t?.sort??o?.defaults?.sort,where:"where"in e?e.where:t?.where}};var Kv=t=>{let e={...t};return Object.entries(e).forEach(([o,n])=>{if(o==="columns"&&(n==="[]"||Array.isArray(e[o])&&e[o].length===0)&&delete e[o],o==="where"&&typeof n=="object"&&n!==null&&!Object.keys(n).length&&delete e[o],(o==="limit"||o==="page")&&typeof n=="string"){let r=parseInt(n,10);e[o]=Number.isNaN(r)?void 0:r}o==="page"&&n===0&&delete e[o],n===""&&delete e[o]}),e};var t0=({children:t,collectionSlug:e,data:o,modifySearchParams:n,onQueryChange:r,orderableFieldName:s,query:i})=>{"use no memo";let a=A7(),l=P7(),{startRouteTransition:c}=Ye(),[u,d]=eF(!1),{getEntityConfig:f}=H(),m=f({collectionSlug:e}),p=k7({});p.current.modified=u;let{onQueryChange:h}=_r(),g=h||r,b=L7(()=>Kv(Yt(l)),[l]),[C,y]=eF(()=>n?b:{limit:i.limit,sort:i.sort}),v=$u(async(D,_)=>{d(_??!0);let T=QT(C,D,{defaults:{limit:i.limit,sort:i.sort}});if(n){let A=`?${e0.stringify({...T,columns:JSON.stringify(T.columns),queryByGroup:JSON.stringify(T.queryByGroup)})}`;window.location.search!==A&&c(()=>a.replace(A))}else typeof g=="function"&&g(T);y(T)},[C,i.limit,i.sort,n,g,c,a]),x=$u(async D=>{await v({page:D})},[v]),I=E7.useCallback(async D=>{await v({limit:D,page:1})},[v]),w=$u(async D=>{await v({search:D===""?void 0:D})},[v]),F=$u(async D=>{await v({sort:D})},[v]),S=$u(async D=>{await v({where:D})},[v]),R=Qe(()=>{let D=Kv({...C||{},...i||{}}),_=`?${e0.stringify({...D,columns:JSON.stringify(D.columns),queryByGroup:JSON.stringify(D.queryByGroup)})}`;window.location.search!==_&&(y(D),window.history.replaceState(null,"",_))});return N7(()=>{n&&i&&R()},[n,i]),KT(Qv,{value:{collectionSlug:e,data:o,defaultLimit:o?.limit,handlePageChange:x,handlePerPageChange:I,handleSearchChange:w,handleSortChange:F,handleWhereChange:S,isGroupingBy:!!(m?.admin?.groupBy&&C?.groupBy),orderableFieldName:s,query:C,refineListData:v,setModified:d,...p.current},children:KT(qT,{value:u,children:t})})};import{jsx as j7}from"react/jsx-runtime";import $7,{createContext as B7,useCallback as gs}from"react";var o0=B7(void 0),Lt=()=>{let t=$7.use(o0);if(t===void 0)throw new Error("useServerFunctions must be used within a ServerFunctionsProvider");return t},r0=({children:t,serverFunction:e})=>{if(!e)throw new Error("ServerFunctionsProvider requires a serverFunction prop");let o=gs(async d=>await e({name:"render-document-slots",args:d}),[e]),n=gs(async d=>{let{signal:f,...m}=d;try{if(!f?.aborted){let h=await e({name:"schedule-publish",args:{...m}});if(!f?.aborted)return h}}catch(h){console.error(h)}let p=`Error scheduling ${m.type}`;return m.doc&&(p+=` for document with ID ${m.doc.value} in collection ${m.doc.relationTo}`),{error:p}},[e]),r=gs(async d=>{let{signal:f,...m}=d||{};try{if(!f?.aborted){let p=await e({name:"form-state",args:{fallbackLocale:!1,...m}});if(!f?.aborted)return p}}catch(p){console.error(p)}return{state:null}},[e]),s=gs(async d=>{let{signal:f,...m}=d||{};try{if(!f?.aborted){let p=await e({name:"table-state",args:{fallbackLocale:!1,...m}});if(!f?.aborted)return p}}catch(p){console.error(p)}},[e]),i=gs(async d=>{let{signal:f,...m}=d||{};try{return await e({name:"render-document",args:{fallbackLocale:!1,...m}})}catch(p){console.error(p)}},[e]),a=gs(async d=>{let{signal:f,...m}=d||{},p=await e({name:"copy-data-from-locale",args:m});if(!f?.aborted)return{data:p}},[e]),l=gs(async d=>{let{signal:f,...m}=d||{};try{let p=await e({name:"get-folder-results-component-and-data",args:m});if(!f?.aborted)return p}catch(p){console.error(p)}},[e]),c=gs(async d=>{try{return await e({name:"render-field",args:d})}catch(f){console.error(f)}},[e]),u=gs(async d=>{let{signal:f,...m}=d||{};try{return await e({name:"slugify",args:{...m}})}catch(p){console.error(p)}},[e]);return j7(o0,{value:{_internal_renderField:c,copyDataFromLocale:a,getDocumentSlots:o,getFolderResultsComponentAndData:l,getFormState:r,getTableState:s,renderDocument:i,schedulePublish:n,serverFunction:e,slugify:u},children:t})};import{jsx as V7}from"react/jsx-runtime";import{transformColumnsToSearchParams as tF}from"payload/shared";import oF,{startTransition as rF,useCallback as s0,useRef as G7}from"react";import{createContext as M7,use as O7}from"react";var n0=M7({}),kl=()=>O7(n0);var Bu=({children:t,collectionSlug:e,columnState:o,LinkedCellOverride:n})=>{let{getEntityConfig:r}=H(),{query:s,refineListData:i}=mt(),{admin:{defaultColumns:a}={}}=r({collectionSlug:e}),[l,c]=oF.useOptimistic(o,(h,g)=>g),u=G7({}),d=s0(async h=>{let g=(l||[]).map(b=>b.accessor===h?{...b,active:!b.active}:b);rF(()=>{c(g)}),await i({columns:tF(g)})},[i,l,c]),f=s0(async h=>{let{fromIndex:g,toIndex:b}=h,C=[...l||[]],[y]=C.splice(g,1);C.splice(b,0,y),rF(()=>{c(C)}),await i({columns:tF(C)})},[l,i,c]),m=s0(async h=>{let g=s.columns;h.forEach(b=>{let C=g.findIndex(y=>b===y);C!==void 0&&g[C][0]==="-"&&(g[C]=b.slice(1))}),await i({columns:g})},[s,i]),p=oF.useCallback(async()=>{await i({columns:a||[]})},[a,i]);return V7(n0,{value:{columns:l,LinkedCellOverride:n,moveColumn:f,resetColumnsState:p,setActiveColumns:m,toggleColumn:d,...u.current},children:t})};import{jsx as nF}from"react/jsx-runtime";import{fieldIsHiddenOrDisabled as W7,fieldIsID as H7}from"payload/shared";import{useId as U7,useMemo as sF}from"react";import{jsx as jl}from"react/jsx-runtime";import z7 from"react";var Mu="pill-selector",Ou=({draggable:t,onClick:e,pills:o})=>{let n=z7.useMemo(()=>o.map((r,s)=>jl(yt,{alignIcon:"left","aria-checked":r.selected,className:[`${Mu}__pill`,r.selected&&`${Mu}__pill--selected`].filter(Boolean).join(" "),draggable:!!t,icon:r.selected?jl(vt,{}):jl(ar,{}),id:r.name,onClick:()=>{e&&e({pill:r})},size:"small",children:r.Label??jl("span",{className:`${Mu}__pill-label`,children:r.name})},r.key??`${r.name}-${s}`)),[o,e,t]);return t?jl(Vr,{className:Mu,ids:o.map(r=>r.name),onDragEnd:({moveFromIndex:r,moveToIndex:s})=>{t.onDragEnd({moveFromIndex:r,moveToIndex:s})},children:n}):jl("div",{className:Mu,children:n})};var kp=({collectionSlug:t})=>{let{columns:e,moveColumn:o,toggleColumn:n}=kl(),r=U7(),s=ut(),i=sF(()=>e?.filter(l=>!(W7(l.field)&&!H7(l.field))&&!l?.field?.admin?.disableListColumn),[e]),a=sF(()=>i?i.map((l,c)=>{let{accessor:u,active:d,field:f}=l,m="labelWithPrefix"in f&&f.labelWithPrefix!==void 0?f.labelWithPrefix:"label"in f&&f.label!==void 0?f.label:"name"in f&&f.name!==void 0?f.name:void 0;return{name:u,key:`${t}-${u}-${c}${s?`-${s}-`:""}${r}`,Label:nF(Ce,{label:m,unstyled:!0}),selected:d}}):null,[t,s,i,r]);return a?nF(Ou,{draggable:{onDragEnd:({moveFromIndex:l,moveToIndex:c})=>{o({fromIndex:l,toIndex:c})}},onClick:({pill:l})=>{n(l.name)},pills:a}):null};import{c as bF}from"react/compiler-runtime";import{jsx as Bp}from"react/jsx-runtime";import{createElement as a8}from"react";import{useEffect as l8,useId as c8,useState as u8}from"react";import{c as X7}from"react/compiler-runtime";import{useState as Y7}from"react";var jp=t=>{let e=X7(3),{getEntityConfig:o}=H(),n;e[0]!==o||e[1]!==t?(n=()=>t?(typeof t=="string"?[t]:t).map(i=>o({collectionSlug:i})):[],e[0]=o,e[1]=t,e[2]=n):n=e[2];let[r]=Y7(n);return r};import{jsx as pF}from"react/jsx-runtime";import s8,{useCallback as Gu,useEffect as hF,useRef as i8,useState as u0}from"react";import{c as c0}from"react/compiler-runtime";import{jsx as ia,jsxs as uF}from"react/jsx-runtime";import{getTranslation as K7}from"@payloadcms/translations";import e8 from"react";import{jsx as J7,jsxs as q7}from"react/jsx-runtime";import l0,{createContext as Q7}from"react";import{c as Z7}from"react/compiler-runtime";import*as oi from"react";var i0=t=>{let e=Z7(13),{delayBeforeShow:o,inTimeout:n,minShowTime:r,outTimeout:s,show:i}=t,a=n+r+s,[l,c]=Cb(o),[u,d]=oi.useState(!1),[f,m]=oi.useState(!1),p=oi.useRef(0),h=oi.useRef(void 0),g;e[0]!==s?(g=()=>{m(!0),h.current=setTimeout(()=>{d(!1),m(!1)},s)},e[0]=s,e[1]=g):g=e[1];let b=g,C,y;e[2]!==l||e[3]!==u||e[4]!==i||e[5]!==a||e[6]!==b?(C=()=>{let x=l&&!u&&i,I=u&&!i;if(x)p.current=Date.now(),d(!0);else if(I){let w=Date.now()-p.current,F=a-w;clearTimeout(h.current),h.current=setTimeout(b,Math.max(0,F))}},y=[u,i,b,a,l],e[2]=l,e[3]=u,e[4]=i,e[5]=a,e[6]=b,e[7]=C,e[8]=y):(C=e[7],y=e[8]),oi.useEffect(C,y);let v;return e[9]!==u||e[10]!==f||e[11]!==c?(v={isMounted:u,isUnmounting:f,triggerDelayedRender:c},e[9]=u,e[10]=f,e[11]=c,e[12]=v):v=e[12],v};var iF={isLoading:!1,loaders:[],loadingText:"",overlayType:null},aF=(t,e)=>{let o=[...t.loaders],{type:n="fullscreen",key:r="user",loadingText:s}=e.payload;if(e.type==="add")o.push({type:n,key:r,loadingText:s});else if(e.type==="remove"){let a=o.findIndex(l=>l.key===r&&l.type===n);o.splice(a,1)}let i=o?.length>0?o[o.length-1]:null;return{isLoading:!!i,loaders:o,loadingText:i?.loadingText||t?.loadingText,overlayType:i?.type||t?.overlayType}};var a0=250,lF=Q7({isOnScreen:!1,toggleLoadingOverlay:void 0}),cF=({children:t})=>{let{t:e}=N(),o=e("general:loading"),[n,r]=l0.useReducer(aF,iF),{isMounted:s,isUnmounting:i,triggerDelayedRender:a}=i0({delayBeforeShow:1e3,inTimeout:a0,minShowTime:500,outTimeout:a0,show:n.isLoading}),l=l0.useCallback(({type:c,isLoading:u,key:d,loadingText:f=o})=>{u?(a(),r({type:"add",payload:{type:c,key:d,loadingText:f}})):r({type:"remove",payload:{type:c,key:d}})},[a,o]);return q7(lF,{value:{isOnScreen:s,toggleLoadingOverlay:l},children:[s&&J7(vn,{animationDuration:`${a0}ms`,loadingText:n.loadingText||o,overlayType:n.overlayType,show:!i}),t]})},$p=()=>{let t=l0.use(lF);if(t===void 0)throw new Error("useLoadingOverlay must be used within a LoadingOverlayProvider");return t};var yn="loading-overlay",vn=t=>{let e=c0(8),{animationDuration:o,loadingText:n,overlayType:r,show:s}=t,i=s===void 0?!0:s,{t:a}=N(),l=i?`${yn}--entering`:`${yn}--exiting`,c=r?`${yn}--${r}`:"",u;e[0]!==l||e[1]!==c?(u=[yn,l,c].filter(Boolean),e[0]=l,e[1]=c,e[2]=u):u=e[2];let d=u.join(" "),f=o||"500ms",m;return e[3]!==n||e[4]!==a||e[5]!==d||e[6]!==f?(m=uF("div",{className:d,style:{animationDuration:f},children:[uF("div",{className:`${yn}__bars`,children:[ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`}),ia("div",{className:`${yn}__bar`})]}),ia("span",{className:`${yn}__text`,children:n||a("general:loading")})]}),e[3]=n,e[4]=a,e[5]=d,e[6]=f,e[7]=m):m=e[7],m},dF=t=>{let e=c0(7),{name:o,type:n,loadingText:r,show:s}=t,i=n===void 0?"fullscreen":n,{toggleLoadingOverlay:a}=$p(),l,c;return e[0]!==o||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==i?(l=()=>(a({type:i,isLoading:s,key:o,loadingText:r||void 0}),()=>{a({type:i,isLoading:!1,key:o})}),c=[s,a,o,i,r],e[0]=o,e[1]=r,e[2]=s,e[3]=a,e[4]=i,e[5]=l,e[6]=c):(l=e[5],c=e[6]),e8.useEffect(l,c),null},t8=t=>{let e=c0(6),{name:o,type:n,action:r,formIsLoading:s,loadingSuffix:i}=t,a=n===void 0?"fullscreen":n,l=s===void 0?!1:s,c=Or(),{i18n:u,t:d}=N(),m=`${{create:d("general:creating"),loading:d("general:loading"),update:d("general:updating")}[r]} ${i?K7(i,u):""}`,p;return e[0]!==l||e[1]!==c||e[2]!==o||e[3]!==m||e[4]!==a?(p=ia(dF,{loadingText:m.trim(),name:o,show:l||c,type:a}),e[0]=l,e[1]=c,e[2]=o,e[3]=m,e[4]=a,e[5]=p):p=e[5],p};function Tr(t){if(t)try{t.abort()}catch{}}function Fr(t){let e=new AbortController;if(t.current)try{t.current.abort()}catch{}return t.current=e,e}import{jsx as o8}from"react/jsx-runtime";import{createContext as r8,use as n8}from"react";var mF=r8({}),fF=({children:t,...e})=>o8(mF,{value:{...e},children:t}),Vu=()=>{let t=n8(mF);if(!t)throw new Error("useDocumentDrawerContext must be used within a DocumentDrawerProvider");return t};var gF=({id:t,collectionSlug:e,disableActions:o,drawerSlug:n,initialData:r,onDelete:s,onDuplicate:i,onSave:a,overrideEntityVisibility:l=!0,redirectAfterCreate:c,redirectAfterDelete:u,redirectAfterDuplicate:d,redirectAfterRestore:f})=>{let{getEntityConfig:m}=H(),[p]=u0(()=>m({collectionSlug:e})),h=s8.useRef(null),{closeModal:g}=ae(),{t:b}=N(),{renderDocument:C}=Lt(),[y,v]=u0(void 0),[x,I]=u0(!0),w=i8(!1),F=Gu((T,A=!1)=>{let L=Fr(h);(async()=>{A&&I(!0);try{let E=await C({collectionSlug:e,disableActions:o,docID:T,drawerSlug:n,initialData:r,overrideEntityVisibility:l,redirectAfterCreate:c,redirectAfterDelete:u!==void 0?u:!1,redirectAfterDuplicate:d!==void 0?d:!1,redirectAfterRestore:f!==void 0?f:!1,signal:L.signal});E?.Document&&(v(E.Document),I(!1))}catch(E){q.error(E?.message||b("error:unspecific")),g(n)}h.current=null})()},[e,o,n,r,u,d,f,C,c,g,l,b]),S=Gu(T=>{T.operation==="create"&&F(T.doc.id),typeof a=="function"&&a({...T,collectionConfig:p})},[a,p,F]),R=Gu(T=>{F(T.doc.id),typeof i=="function"&&i({...T,collectionConfig:p})},[i,p,F]),D=Gu(T=>{typeof s=="function"&&s({...T,collectionConfig:p}),g(n)},[s,g,n,p]),_=Gu(()=>{F(void 0,!0)},[F]);return hF(()=>{!y&&!w.current&&(F(t,!0),w.current=!0)},[y,F,t]),hF(()=>{let T=h.current;return()=>{Tr(T)}},[]),x?pF(vn,{}):pF(fF,{clearDoc:_,drawerSlug:n,onDelete:D,onDuplicate:R,onSave:S,children:y})};var bs="doc-drawer",d8=({id:t,collectionSlug:e,depth:o,uuid:n})=>`doc-drawer_${e}_${o}${t?`_${t}`:""}_${n}`,m8=t=>{let e=bF(2),{children:o,className:n,collectionSlug:r,disabled:s,drawerSlug:i,onClick:a,operation:l,...c}=t,{t:u}=N(),[d]=jp(r),f=u(l==="create"?"fields:addNewLabel":"general:editLabel",{label:d?.labels.singular}),m;return e[0]!==n?(m=[n,`${bs}__toggler`].filter(Boolean),e[0]=n,e[1]=m):m=e[1],Bp(cs,{"aria-label":f,className:m.join(" "),disabled:s,onClick:a,slug:i,...c,children:o})},d0=t=>{let{drawerSlug:e}=t;return Bp(St,{className:bs,gutter:!1,Header:null,slug:e,children:Bp(gF,{...t})})},jt=t=>{let e=bF(38),{id:o,collectionSlug:n,overrideEntityVisibility:r}=t,s=ut(),i=c8(),{closeModal:a,modalState:l,openModal:c,toggleModal:u}=ae(),[d,f]=u8(!1),m;e[0]!==n||e[1]!==s||e[2]!==o||e[3]!==i?(m=d8({id:o,collectionSlug:n,depth:s,uuid:i}),e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=m):m=e[4];let p=m,h,g;e[5]!==p||e[6]!==l?(h=()=>{f(!!l[p]?.isOpen)},g=[l,p],e[5]=p,e[6]=l,e[7]=h,e[8]=g):(h=e[7],g=e[8]),l8(h,g);let b;e[9]!==p||e[10]!==u?(b=()=>{u(p)},e[9]=p,e[10]=u,e[11]=b):b=e[11];let C=b,y;e[12]!==a||e[13]!==p?(y=()=>{a(p)},e[12]=a,e[13]=p,e[14]=y):y=e[14];let v=y,x;e[15]!==p||e[16]!==c?(x=()=>{c(p)},e[15]=p,e[16]=c,e[17]=x):x=e[17];let I=x,w;e[18]!==n||e[19]!==p||e[20]!==o||e[21]!==r?(w=A=>a8(d0,{...A,collectionSlug:n,drawerSlug:p,id:o,key:p,overrideEntityVisibility:r}),e[18]=n,e[19]=p,e[20]=o,e[21]=r,e[22]=w):w=e[22];let F=w,S;e[23]!==n||e[24]!==p||e[25]!==o?(S=A=>Bp(m8,{...A,collectionSlug:n,drawerSlug:p,operation:o?"update":"create"}),e[23]=n,e[24]=p,e[25]=o,e[26]=S):S=e[26];let R=S,D;e[27]!==v||e[28]!==p||e[29]!==s||e[30]!==d||e[31]!==I||e[32]!==C?(D={closeDrawer:v,drawerDepth:s,drawerSlug:p,isDrawerOpen:d,openDrawer:I,toggleDrawer:C},e[27]=v,e[28]=p,e[29]=s,e[30]=d,e[31]=I,e[32]=C,e[33]=D):D=e[33];let _=D,T;return e[34]!==F||e[35]!==_||e[36]!==R?(T=[F,R,_],e[34]=F,e[35]=_,e[36]=R,e[37]=T):T=e[37],T};import{c as g8}from"react/compiler-runtime";import{jsx as b8}from"react/jsx-runtime";import{appendUploadSelectFields as v8,formatAdminURL as y8}from"payload/shared";import*as yF from"qs-esm";import{createContext as C8,use as x8,useEffect as w8,useReducer as S8,useRef as I8}from"react";import{c as f8}from"react/compiler-runtime";import{useEffect as p8,useState as h8}from"react";function Cn(t,e){let o=f8(4),[n,r]=h8(t),s,i;return o[0]!==e||o[1]!==t?(s=()=>{let a=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(a)}},i=[t,e],o[0]=e,o[1]=t,o[2]=s,o[3]=i):(s=o[2],i=o[3]),p8(s,i),n}function vF(t,e){switch(e.type){case"ADD_LOADED":{let o={...t};typeof o[e.relationTo]!="object"&&(o[e.relationTo]={});let n=[...e.idsToLoad];return Array.isArray(e.docs)&&e.docs.forEach(r=>{n.splice(n.indexOf(r.id),1),o[e.relationTo][r.id]=r}),n.forEach(r=>{o[e.relationTo][r]=!1}),o}case"REQUEST":{let o={...t};return e.docs.forEach(({relationTo:n,value:r})=>{typeof o[n]!="object"&&(o[n]={}),o[n][r]=null}),o}default:return t}}var CF=C8({}),zu=t=>{let e=g8(15),{children:o}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={},e[0]=n):n=e[0];let[r,s]=S8(vF,n),i=Cn(r,100),{config:a}=H(),{collections:l,routes:c}=a,{api:u}=c,{i18n:d}=N(),{code:f}=ye(),m=I8(f),p;e[1]!==u||e[2]!==l||e[3]!==i||e[4]!==d||e[5]!==f?(p=x=>{let I=x===void 0?!1:x;Object.entries(i).forEach(async w=>{let[F,S]=w,R=[];if(Object.entries(S).forEach(D=>{let[_,T]=D;(T===null||I)&&R.push(_)}),R.length>0){let D=y8({apiRoute:u,path:`/${F}`}),_=new URLSearchParams,T={};_.append("depth","0"),_.append("limit","250");let A=l.find(B=>B.slug===F);if(A.admin.enableListViewSelectAPI){let B=A.admin.useAsTitle??"id";T[B]=!0,A.upload&&v8({collectionConfig:A,select:T})}f&&_.append("locale",f);let L=R.map(_8);_.append("where[id][in]",L.join(","));let P=`?${_.toString()}&${yF.stringify({select:T})}`,E=await fetch(`${D}${P}`,{credentials:"include",headers:{"Accept-Language":d.language}});if(E.ok){let B=await E.json();B.docs&&s({type:"ADD_LOADED",docs:B.docs,idsToLoad:R,relationTo:F})}else s({type:"ADD_LOADED",docs:[],idsToLoad:R,relationTo:F})}})},e[1]=u,e[2]=l,e[3]=i,e[4]=d,e[5]=f,e[6]=p):p=e[6];let h=p,g,b;e[7]!==h||e[8]!==f?(g=()=>{h(f&&m.current!==f),m.current=f},b=[f,h],e[7]=h,e[8]=f,e[9]=g,e[10]=b):(g=e[9],b=e[10]),w8(g,b);let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=x=>{s({type:"REQUEST",docs:x})},e[11]=C):C=e[11];let y=C,v;return e[12]!==o||e[13]!==r?(v=b8(CF,{value:{documents:r,getRelationships:y},children:o}),e[12]=o,e[13]=r,e[14]=v):v=e[14],v},m0=()=>x8(CF);function _8(t){return String(t)}import{jsx as $l}from"react/jsx-runtime";import{getTranslation as T8}from"@payloadcms/translations";var f0=({allowCreate:t,baseClass:e,buttonStyle:o,className:n,collections:r,i18n:s,icon:i,label:a,onClick:l,permissions:c,relationTo:u})=>t?Array.isArray(u)?$l("div",{className:`${e}__add-new-polymorphic-wrapper`,children:$l(it,{button:$l(oe,{buttonStyle:o,className:n,icon:i,children:a}),buttonType:"custom",horizontalAlign:"center",render:({close:f})=>$l(ve.ButtonGroup,{children:u.map(m=>c.collections[m]?.create?$l(ve.Button,{className:`${e}__relation-button--${m}`,onClick:()=>{f(),l(m)},children:T8(r.find(p=>p.slug===m).labels.singular,s)},m):null)}),size:"medium"})}):$l(oe,{buttonStyle:o,className:n,onClick:()=>l(),children:a}):null;import{c as cV}from"react/compiler-runtime";import{jsx as C0,jsxs as uV}from"react/jsx-runtime";import"react";import{c as iV}from"react/compiler-runtime";import{jsx as MF}from"react/jsx-runtime";import OF from"react";import{c as eV}from"react/compiler-runtime";import{jsx as Ml,jsxs as tV}from"react/jsx-runtime";import{getTranslation as oV}from"@payloadcms/translations";import{fieldAffectsData as rV,fieldIsID as nV}from"payload/shared";import"react";import{formatAdminURL as Mp}from"payload/shared";import{getTranslation as R8}from"@payloadcms/translations";import F8 from"react";var D8=Symbol.for("react.lazy");function Op(t){return F8.isValidElement(t)||t?.$$typeof===D8}var xF=(t,e,o)=>{if((e?.type==="select"||e?.type==="radio")&&Array.isArray(e.options)){let n=e.options.find(r=>typeof r=="object"?r.value===t:r===t);if(n)return typeof n=="object"&&"label"in n?Op(n.label)?n.label:R8(n.label,o)||n.value:n}return t};import{jsx as wF}from"react/jsx-runtime";import"react";var Vp=({cellData:t,nowrap:e})=>{let o=t?.length>100?`${t.substring(0,100)}\u2026`:t;return wF("code",{className:"code-cell",style:e?{whiteSpace:"nowrap"}:{},children:wF("span",{children:o})})};import{c as A8}from"react/compiler-runtime";import{jsx as P8}from"react/jsx-runtime";import{getTranslation as SF}from"@payloadcms/translations";import"react";var IF=t=>{let e=A8(2),{cellData:o,field:n}=t,{labels:r}=n,{i18n:s}=N(),i=o??[],a=i.length===1?`${i.length} ${SF(r?.singular||s.t("general:rows"),s)}`:`${i.length} ${SF(r?.plural||s.t("general:rows"),s)}`,l;return e[0]!==a?(l=P8("span",{children:a}),e[0]=a,e[1]=l):l=e[1],l};import{c as E8}from"react/compiler-runtime";import{jsx as N8}from"react/jsx-runtime";import{getTranslation as Gp}from"@payloadcms/translations";import"react";var _F=t=>{let e=E8(2),{cellData:o,field:n}=t,{blockReferences:r,blocks:s,labels:i}=n,{i18n:a}=N(),{config:l}=H(),c=Array.isArray(o)?o.map(L8):[],u=(r??s)?.map(p=>{let h=typeof p=="string"?l.blocksMap[p]:p;return{slug:h.slug,label:Gp(h.labels.singular,a)}}),d=`0 ${Gp(i?.plural,a)}`,f=p=>p.map(h=>u.filter(b=>b.slug===h)?.[0]?.label).join(", ");if(c.length>5){let p=c.length-5;d=`${c.length} ${Gp(i?.plural,a)} - ${a.t("fields:itemsAndMore",{count:p,items:f(c.slice(0,5))})}`}else c.length>0&&(d=`${c.length} ${Gp(c.length===1?i?.singular:i?.plural,a)} - ${f(c)}`);let m;return e[0]!==d?(m=N8("span",{children:d}),e[0]=d,e[1]=m):m=e[1],m};function L8(t){let{blockType:e}=t;return e}import{c as k8}from"react/compiler-runtime";import{jsx as TF}from"react/jsx-runtime";import"react";var FF=t=>{let e=k8(3),{cellData:o}=t,{t:n}=N(),r=`general:${o}`,s;return e[0]!==n||e[1]!==r?(s=TF("code",{className:"bool-cell",children:TF("span",{children:n(r).toLowerCase()})}),e[0]=n,e[1]=r,e[2]=s):s=e[2],s};import{jsx as j8}from"react/jsx-runtime";import{getObjectDotNotation as $8}from"payload/shared";import"react";var p0=t=>{let{cellData:e,field:o,rowData:n}=t,{name:r,accessor:s,admin:i,timezone:a}=o,{date:l}=i===void 0?{}:i,{config:c}=H(),{admin:u}=c,{dateFormat:d}=u,{i18n:f}=N(),p=`${s||r}_tz`,h=a&&n?$8(n,p,void 0):void 0,g=l?.displayFormat||d;return j8("span",{children:!!e&&zr({date:e,i18n:f,pattern:g,timezone:h})})};import{jsx as h0,jsxs as M8,Fragment as O8}from"react/jsx-runtime";import{getBestFitFromSizes as V8,isImage as G8}from"payload/shared";import"react";import{c as RF}from"react/compiler-runtime";import{jsx as Bl,jsxs as AF}from"react/jsx-runtime";import Wp from"react";import{jsx as DF,jsxs as B8}from"react/jsx-runtime";import"react";var zp=()=>B8("svg",{height:"150",style:{backgroundColor:"#333333"},viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[DF("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),DF("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]});var Hp="thumbnail",Dr=t=>{let e=RF(6),{className:o,doc:n,fileSrc:r,height:s,imageCacheTag:i,size:a,width:l}=t,c=o===void 0?"":o,{filename:u}=n===void 0?{}:n,[d,f]=Wp.useState(void 0),m=`${Hp}--size-${a||"medium"}`,p;e[0]!==c||e[1]!==m?(p=[Hp,m,c],e[0]=c,e[1]=m,e[2]=p):p=e[2];let h=p.join(" "),g,b;e[3]!==r?(g=()=>{if(!r){f(!1);return}f(void 0);let y=new Image;y.src=r,y.onload=()=>{f(!0)},y.onerror=()=>{f(!1)}},b=[r],e[3]=r,e[4]=g,e[5]=b):(g=e[4],b=e[5]),Wp.useEffect(g,b);let C=null;if(r){let y=r?.includes("?")?"&":"?";C=i?`${r}${y}${encodeURIComponent(i)}`:r}return AF("div",{className:h,children:[d===void 0&&Bl(Et,{height:"100%"}),d&&Bl("img",{alt:u,height:s,src:C,width:l}),d===!1&&Bl(zp,{})]})};function PF(t){let e=RF(12),{alt:o,className:n,filename:r,fileSrc:s,imageCacheTag:i,size:a}=t,l=n===void 0?"":n,[c,u]=Wp.useState(void 0),d=`${Hp}--size-${a||"medium"}`,f;e[0]!==l||e[1]!==d?(f=[Hp,d,l],e[0]=l,e[1]=d,e[2]=f):f=e[2];let m=f.join(" "),p,h;e[3]!==s?(p=()=>{if(!s){u(!1);return}u(void 0);let C=new Image;C.src=s,C.onload=()=>{u(!0)},C.onerror=()=>{u(!1)}},h=[s],e[3]=s,e[4]=p,e[5]=h):(p=e[4],h=e[5]),Wp.useEffect(p,h);let g="";if(s){let C=s?.includes("?")?"&":"?";g=i?`${s}${C}${encodeURIComponent(i)}`:s}let b;return e[6]!==o||e[7]!==m||e[8]!==c||e[9]!==r||e[10]!==g?(b=AF("div",{className:m,children:[c===void 0&&Bl(Et,{height:"100%"}),c&&Bl("img",{alt:o||r,src:g}),c===!1&&Bl(zp,{})]}),e[6]=o,e[7]=m,e[8]=c,e[9]=r,e[10]=g,e[11]=b):b=e[11],b}var g0="file",Up=({cellData:t,collectionConfig:e,field:o,rowData:n})=>{if(("displayPreview"in o?o.displayPreview:void 0)??e.upload?.displayPreview??!0){let i=G8(n?.mimeType),a=i?n?.thumbnailURL||n?.url:n?.thumbnailURL;return i&&(a=V8({sizes:n?.sizes,thumbnailURL:n?.thumbnailURL,url:n?.url,width:n?.width})),M8("div",{className:g0,children:[h0(Dr,{className:`${g0}__thumbnail`,collectionSlug:e?.slug,doc:{...n,filename:t},fileSrc:a,imageCacheTag:e?.upload?.cacheTags&&n?.updatedAt,size:"small",uploadConfig:e?.upload}),h0("span",{className:`${g0}__filename`,children:String(t)})]})}else return h0(O8,{children:String(t)})};import{c as z8}from"react/compiler-runtime";import{jsx as Xp}from"react/jsx-runtime";import"react";function EF(t,e){let o=JSON.stringify(t);return o.length/e>1.5?`${o.substring(0,e)}\u2026`:o}var NF=t=>{let e=z8(4),{cellData:o}=t,{t:n}=N();try{let r;if(e[0]!==o){let s=EF(o,100);r=Xp("code",{className:"json-cell",children:Xp("span",{children:s})}),e[0]=o,e[1]=r}else r=e[1];return r}catch{let s;return e[2]!==n?(s=Xp("code",{className:"json-cell",children:Xp("span",{children:n("general:error")})}),e[2]=n,e[3]=s):s=e[3],s}};import{c as W8}from"react/compiler-runtime";import{jsx as H8,jsxs as kF}from"react/jsx-runtime";import{getTranslation as U8}from"@payloadcms/translations";import X8,{useEffect as jF,useState as $F}from"react";var LF=!!(typeof window<"u"&&window.document&&window.document.createElement);var Y8="relationship-cell",Yp=3,Zp=t=>{let e=W8(39),{cellData:o,customCellProps:n,field:r,field:s}=t,{label:i}=s,a="relationTo"in r&&r.relationTo||"collection"in r&&r.collection,l="collection"in r?o?.docs:o,{config:c,getEntityConfig:u}=H(),{collections:d}=c,[f,m]=Li(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];let[h,g]=$F(p),{documents:b,getRelationships:C}=m0(),[y,v]=$F(!1),{i18n:x,t:I}=N(),w=LF?m?.boundingClientRect?.top<window.innerHeight:!1,F;e[1]!==l||e[2]!==C||e[3]!==y||e[4]!==w||e[5]!==a?(F=()=>{if((l||typeof l=="number")&&w&&!y){let T=[],A=Array.isArray(l)?l:[l];A.slice(0,A.length<Yp?A.length:Yp).forEach(L=>{typeof L=="object"&&"relationTo"in L&&"value"in L&&T.push(L),(typeof L=="number"||typeof L=="string")&&typeof a=="string"&&T.push({relationTo:a,value:L})}),C(T),v(!0),g(T)}},e[1]=l,e[2]=C,e[3]=y,e[4]=w,e[5]=a,e[6]=F):F=e[6];let S;e[7]!==l||e[8]!==d||e[9]!==C||e[10]!==y||e[11]!==w||e[12]!==a?(S=[l,a,d,w,y,C],e[7]=l,e[8]=d,e[9]=C,e[10]=y,e[11]=w,e[12]=a,e[13]=S):S=e[13],jF(F,S);let R;e[14]!==y?(R=()=>{y&&v(!1)},e[14]=y,e[15]=R):R=e[15];let D;e[16]!==l?(D=[l],e[16]=l,e[17]=D):D=e[17],jF(R,D);let _;if(e[18]!==l||e[19]!==c.admin||e[20]!==n||e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==f||e[26]!==i||e[27]!==I||e[28]!==h){let T;e[30]!==c.admin||e[31]!==n||e[32]!==b||e[33]!==r||e[34]!==u||e[35]!==x||e[36]!==I||e[37]!==h.length?(T=(A,L)=>{let{relationTo:P,value:E}=A,B=b[P][E],k=u({collectionSlug:P}),$=Jo({collectionConfig:k,data:B||null,dateFormat:c.admin.dateFormat,fallback:`${I("general:untitled")} - ID: ${E}`,i18n:x}),j=null;return r.type==="upload"&&(("displayPreview"in r?r.displayPreview:void 0)??k.upload?.displayPreview??!0)&&B&&(j=H8(Up,{cellData:$,collectionConfig:k,collectionSlug:k.slug,customCellProps:n,field:r,rowData:B})),kF(X8.Fragment,{children:[B===!1&&`${I("general:untitled")} - ID: ${E}`,B===null&&`${I("general:loading")}...`,B?j||$:null,h.length>L+1&&", "]},L)},e[30]=c.admin,e[31]=n,e[32]=b,e[33]=r,e[34]=u,e[35]=x,e[36]=I,e[37]=h.length,e[38]=T):T=e[38],_=kF("div",{className:Y8,ref:f,children:[h.map(T),Array.isArray(l)&&l.length>Yp&&I("fields:itemsAndMore",{count:l.length-Yp,items:""}),h.length===0&&I("general:noLabel",{label:U8(i||"",x)})]}),e[18]=l,e[19]=c.admin,e[20]=n,e[21]=b,e[22]=r,e[23]=u,e[24]=x,e[25]=f,e[26]=i,e[27]=I,e[28]=h,e[29]=_}else _=e[29];return _};import{c as Z8}from"react/compiler-runtime";import{jsx as J8}from"react/jsx-runtime";import{getTranslation as q8}from"@payloadcms/translations";import{optionsAreObjects as Q8}from"payload/shared";import"react";var b0=t=>{let e=Z8(7),{cellData:o,field:n}=t,{options:r}=n,{i18n:s}=N(),i;e[0]!==s||e[1]!==r?(i=c=>c.map(u=>{let d=r.filter(f=>f.value===u)?.[0]?.label;return q8(d,s)}).join(", "),e[0]=s,e[1]=r,e[2]=i):i=e[2];let a=i,l;if(e[3]!==o||e[4]!==a||e[5]!==r){let c;Q8(r)?c=Array.isArray(o)?a(o):a([o]):c=Array.isArray(o)?o.join(", "):o,l=J8("span",{children:c}),e[3]=o,e[4]=a,e[5]=r,e[6]=l}else l=e[6];return l};import{jsx as K8}from"react/jsx-runtime";import"react";var BF=({cellData:t})=>{let e=t?.length>100?`${t.substring(0,100)}\u2026`:t;return K8("span",{children:e})};var v0={array:IF,blocks:_F,checkbox:FF,code:Vp,date:p0,File:Up,join:Zp,json:NF,radio:b0,relationship:Zp,select:b0,textarea:BF,upload:Zp};var Wu=t=>{let e=eV(16),{cellData:o,className:n,collectionSlug:r,field:s,field:i,link:a,linkURL:l,onClick:c,rowData:u,viewType:d}=t,{admin:f}=i,{i18n:m}=N(),{config:p,getEntityConfig:h}=H(),{routes:g}=p,{admin:b}=g,C,y;if(e[0]!==f||e[1]!==b||e[2]!==o||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==h||e[7]!==m||e[8]!==a||e[9]!==l||e[10]!==c||e[11]!==t||e[12]!==u||e[13]!==d){y=Symbol.for("react.early_return_sentinel");e:{let v=h({collectionSlug:r}),x=f&&"className"in f?f.className:void 0,I=n||(s.admin&&"className"in s.admin?s.admin.className:null)||x,w=c,F="span",S={className:I};if(a&&(S.prefetch=!1,F=Qt,l?S.href=l:S.href=v?.slug?Mp({adminRoute:b,path:`/collections/${v?.slug}${d==="trash"?"/trash":""}/${encodeURIComponent(u.id)}`}):""),typeof w=="function"&&(F="button",S.type="button",S.onClick=()=>{w({cellData:o,collectionSlug:v?.slug,rowData:u})}),nV(s)){y=Ml(F,{...S,children:Ml(Vp,{cellData:`ID: ${o}`,collectionConfig:v,collectionSlug:r,field:{...s,type:"code"},nowrap:!0,rowData:u})});break e}let R=xF(o,s,m),D=typeof o<"u"&&v0[s.type],_=null;if(Op(R))_=R;else if(D)_=Ml(D,{cellData:o,rowData:u,...t});else if(!D)if(v?.upload&&rV(s)&&s.name==="filename"&&s.type==="text"){let T=v0.File;_=Ml(T,{cellData:o,rowData:u,...t,collectionConfig:v,field:s})}else{y=tV(F,{...S,children:[(R===""||typeof R>"u"||R===null)&&m.t("general:noLabel",{label:oV(("label"in s?s.label:null)||"data",m)}),typeof R=="string"&&R,typeof R=="number"&&R,typeof R=="object"&&R!==null&&JSON.stringify(R)]});break e}if((s.type==="select"||s.type==="radio")&&s.options.length&&o){let T=Array.isArray(o)?o.map(sV).join(" "):`selected--${o}`,A=[S.className,T].filter(Boolean).join(" ");y=Ml(F,{...S,className:A,children:_});break e}C=Ml(F,{...S,children:_})}e[0]=f,e[1]=b,e[2]=o,e[3]=n,e[4]=r,e[5]=s,e[6]=h,e[7]=m,e[8]=a,e[9]=l,e[10]=c,e[11]=t,e[12]=u,e[13]=d,e[14]=C,e[15]=y}else C=e[14],y=e[15];return y!==Symbol.for("react.early_return_sentinel")?y:C};function sV(t){return`selected--${t}`}var aV="default-cell",VF=OF.createContext(null),y0=()=>OF.use(VF),lV=t=>{let e=iV(9),{clientProps:o,columnIndex:n,isLinkedColumn:r}=t,{drawerSlug:s,onSelect:i}=_r(),{LinkedCellOverride:a}=kl(),l;if(e[0]!==a||e[1]!==o||e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==i){let c={...o,columnIndex:n};if(r&&s){c.className=`${aV}__first-cell`,c.link=!1;let u;e[7]!==i?(u=d=>{let{collectionSlug:f,rowData:m}=d;typeof i=="function"&&i({collectionSlug:f,doc:m,docID:m.id})},e[7]=i,e[8]=u):u=e[8],c.onClick=u}l=MF(VF,{value:c,children:r&&a?a:MF(Wu,{...c})}),e[0]=a,e[1]=o,e[2]=n,e[3]=s,e[4]=r,e[5]=i,e[6]=l}else l=e[6];return l};var GF=t=>{let e=cV(3),{onDrawerOpen:o}=t,n=y0(),r;return e[0]!==n||e[1]!==o?(r=uV("div",{className:"drawer-link",children:[C0(Wu,{...n,className:"drawer-link__cell",link:!1,onClick:null}),C0("button",{className:"drawer-link__doc-drawer-toggler",onClick:()=>{o(n.rowData.id,n.collectionSlug)},type:"button",children:C0(yr,{})})]}),e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as hV}from"react/compiler-runtime";import{jsx as gV}from"react/jsx-runtime";import"react";import{jsx as S0}from"react/jsx-runtime";import"react";import{jsx as zF}from"react/jsx-runtime";import"react";var x0="clickable-arrow",WF=t=>{let{direction:e="right",isDisabled:o=!1,updatePage:n}=t,r=[x0,o&&`${x0}--is-disabled`,e&&`${x0}--${e}`].filter(Boolean).join(" ");return zF("button",{className:r,disabled:o,onClick:o?void 0:n,type:"button",children:zF(He,{})})};import{jsx as dV}from"react/jsx-runtime";import"react";var Jp="paginator__page",w0=({isCurrent:t,isFirstPage:e=!1,isLastPage:o=!1,page:n=1,updatePage:r})=>{let s=[Jp,t&&`${Jp}--is-current`,e&&`${Jp}--is-first-page`,o&&`${Jp}--is-last-page`].filter(Boolean).join(" ");return dV("button",{className:s,onClick:()=>r(n),type:"button",children:n})};import{jsx as mV}from"react/jsx-runtime";import"react";var HF=()=>mV("span",{className:"paginator__separator",children:"\u2014"});var fV={ClickableArrow:WF,Page:w0,Separator:HF},pV="paginator",Hu=t=>{let{hasNextPage:e=!1,hasPrevPage:o=!1,nextPage:n=null,numberOfNeighbors:r=1,onChange:s,page:i,prevPage:a=null,totalPages:l=null}=t;if(!o&&!e)return null;let c=p=>{typeof s=="function"&&s(p)},u=Array.from({length:l},(p,h)=>h+1),d=i-1-r;d<=0&&(d=0);let f=i-1+r+1,m=u.slice(d,f);return i-r-1>=2&&m.unshift({type:"Separator"}),i>r+1&&m.unshift({type:"Page",props:{isFirstPage:!0,page:1,updatePage:c}}),i+r+1<l&&m.push({type:"Separator"}),f<l&&m.push({type:"Page",props:{isLastPage:!0,page:l,updatePage:c}}),m.unshift({type:"ClickableArrow",props:{direction:"right",isDisabled:!e,updatePage:()=>c(n??i+1)}}),m.unshift({type:"ClickableArrow",props:{direction:"left",isDisabled:!o,updatePage:()=>c(a??Math.max(1,i-1))}}),S0("div",{className:pV,children:m.map((p,h)=>{if(typeof p=="number")return S0(w0,{isCurrent:i===p,page:p,updatePage:c},h);let g=fV[p.type];return S0(g,{...p.props},h)})})};var UF=()=>{let t=hV(11),{data:e,handlePageChange:o}=mt(),n=e.nextPage||2,r;t[0]!==o?(r=l=>{o(l)},t[0]=o,t[1]=r):r=t[1];let s=e.page||1,i=e.prevPage||void 0,a;return t[2]!==e.hasNextPage||t[3]!==e.hasPrevPage||t[4]!==e.limit||t[5]!==e.totalPages||t[6]!==n||t[7]!==r||t[8]!==s||t[9]!==i?(a=gV(Hu,{hasNextPage:e.hasNextPage,hasPrevPage:e.hasPrevPage,limit:e.limit,nextPage:n,numberOfNeighbors:1,onChange:r,page:s,prevPage:i,totalPages:e.totalPages}),t[2]=e.hasNextPage,t[3]=e.hasPrevPage,t[4]=e.limit,t[5]=e.totalPages,t[6]=n,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a};var Rr="relationship-table",I0=t=>{let{AfterInput:e,allowCreate:o=!0,BeforeInput:n,disableTable:r=!1,field:s,fieldPath:i,filterOptions:a,initialData:l,initialDrawerData:c,Label:u,parent:d,relationTo:f}=t,[m,p]=vs(null),{config:h,getEntityConfig:g}=H(),{i18n:b,t:C}=N(),[y,v]=vs(),[x,I]=vs(!1),[w]=vs(()=>g({collectionSlug:f})),F=Array.isArray(f),[S,R]=vs(F?void 0:f),{permissions:D}=Ie(),_=CV(!1),[T,A]=vs(void 0),[L,,{closeDrawer:P,isDrawerOpen:E,openDrawer:B}]=jt({id:T,collectionSlug:S}),[k,$]=vs(!r),[j,M]=vs(()=>l?{...l,docs:Array.isArray(l.docs)?l.docs.reduce((J,re)=>typeof re=="string"||typeof re=="number"?[...J,{id:re}]:[...J,re],[]):[]}:void 0),[O,V]=vs(),{getTableState:W}=Lt(),Y=qp(async J=>{let re={limit:s?.defaultLimit||w?.admin?.pagination?.defaultLimit,sort:s.defaultSort||w?.defaultSort,...y||{},where:{...y?.where||{}}};a&&(re.where=bV(re.where,a));let me=s.admin.defaultColumns?s.admin.defaultColumns.map(Ue=>({accessor:Ue,active:!0})):void 0,xe=typeof s.admin.disableRowTypes=="boolean"?!s.admin.disableRowTypes:Array.isArray(f),{data:_e,state:Be,Table:Me}=await W({collectionSlug:f,columns:YF(y?.columns)||me,data:J,enableRowSelections:!1,orderableFieldName:!s.orderable||Array.isArray(s.collection)?void 0:`_${s.collection}_${s.name}_order`,parent:d,query:re,renderRowTypes:xe,tableAppearance:"condensed"});M(_e),p(Me),V(Be),$(!1)},[s.defaultLimit,s.defaultSort,s.admin.defaultColumns,s.admin.disableRowTypes,s.collection,s.name,s.orderable,w?.admin?.pagination?.defaultLimit,w?.defaultSort,y,a,W,f,d]),z=Qe((J,re)=>{!re&&(!m||J)&&Y()});Uu(()=>{z(y,r)},[y,r]);let K=qp(({doc:J,operation:re})=>{re==="create"&&P();let me=j?.docs?.findIndex(_e=>_e.id===J.id),xe={docs:[]};if(me!==-1){let _e=[...j.docs];_e[me]=J,xe.docs=_e}else xe.docs=[J,...j.docs];Y(xe)},[j?.docs,Y,P]),U=qp(J=>{let re=j.docs.filter(me=>me.id!==J.id);Y({...j,docs:re}),A(void 0)},[j,Y]),X=qp((J,re)=>{_.current=!0,A(J||void 0),R(re||void 0)},[]);Uu(()=>{_.current&&(_.current=!1,B())},[B]),Uu(()=>{E||A(void 0)},[E]);let ne=o!==!1&&D?.collections?.[F?f[0]:f]?.create;Uu(()=>{F&&S&&B()},[S,B,F]),Uu(()=>{F&&!E&&S&&R(void 0)},[E]);let Z=vV.useMemo(()=>({columns:YF(O)?.map(({accessor:J})=>J),limit:s.defaultLimit??w?.admin?.pagination?.defaultLimit,sort:s.defaultSort??w?.defaultSort}),[O,s,w]);return Ol("div",{className:Rr,children:[Ol("div",{className:`${Rr}__header`,children:[u,Ol("div",{className:`${Rr}__actions`,children:[ur(f0,{allowCreate:o!==!1,baseClass:Rr,buttonStyle:"none",className:`${Rr}__add-new${F?"-polymorphic":" doc-drawer__toggler"}`,collections:h.collections,i18n:b,icon:F?"plus":void 0,label:b.t("fields:addNew"),onClick:F?R:B,permissions:D,relationTo:f}),ur(yt,{"aria-controls":`${Rr}-columns`,"aria-expanded":x,className:`${Rr}__toggle-columns ${x?`${Rr}__buttons-active`:""}`,icon:ur(He,{direction:x?"up":"down"}),onClick:()=>I(!x),pillStyle:"light",size:"small",children:C("general:columns")})]})]}),n,k?ur("p",{children:C("general:loading")}):Ol(yV,{children:[j?.docs&&j.docs.length===0&&Ol("div",{className:`${Rr}__no-results`,children:[ur("p",{children:b.t("general:noResults",{label:F?b.t("general:documents"):XF(w?.labels?.plural,b)})}),ur(f0,{allowCreate:ne,baseClass:Rr,collections:h.collections,i18n:b,label:b.t("general:createNewLabel",{label:F?b.t("general:document"):XF(w?.labels?.singular,b)}),onClick:F?R:B,permissions:D,relationTo:f})]}),j?.docs&&j.docs.length>0&&ur(zu,{children:ur(t0,{data:j,modifySearchParams:!1,onQueryChange:v,orderableFieldName:!s.orderable||Array.isArray(s.collection)?void 0:`_${s.collection}_${i.replaceAll(".","_")}_order`,query:Z,children:Ol(Bu,{collectionSlug:F?f[0]:f,columnState:O,LinkedCellOverride:ur(GF,{currentDrawerID:T,onDrawerOpen:X}),children:[ur(Sr,{className:`${Rr}__columns`,height:x?"auto":0,id:`${Rr}-columns`,children:ur("div",{className:`${Rr}__columns-inner`,children:w&&ur(kp,{collectionSlug:w.slug})})}),m,ur(UF,{})]})})})]}),e,ur(L,{initialData:c,onDelete:U,onSave:K})]})};var JF="default"in Qp.default?Qp.default.default:Qp.default,Kp=({collectionSlug:t,config:e,docID:o,fields:n,segments:r})=>{let s=SV(n,{keepPresentationalFields:!0}),i=r[0],a=s.find(c=>c.name===i);if(!a)return null;if(a.type==="relationship"||a.type==="upload"){let c=o;return Array.isArray(a.relationTo)&&(c={relationTo:t,value:o}),{[a.name]:a.hasMany?[c]:c}}let l=r.slice(1,r.length);if(a.type==="tab"||a.type==="group"&&wV(a))return{[a.name]:Kp({collectionSlug:t,config:e,docID:o,fields:a.fields,segments:l})};if(a.type==="array"){let c=Kp({collectionSlug:t,config:e,docID:o,fields:a.fields,segments:l});return c.id=JF().toHexString(),{[a.name]:[c]}}if(a.type==="blocks")for(let c of a.blockReferences??a.blocks){let u=typeof c=="string"?e.blocksMap[c]:c,d=Kp({collectionSlug:t,config:e,docID:o,fields:u.fields,segments:l});if(d)return d.id=JF().toHexString(),d.blockType=u.slug,{[a.name]:[d]}}},IV=t=>{let{field:e,field:{admin:{allowCreate:o,description:n},collection:r,label:s,localized:i,on:a,required:l},path:c}=t,{id:u,docConfig:d}=Se(),{config:f,getEntityConfig:m}=H(),{customComponents:{AfterInput:p,BeforeInput:h,Description:g,Error:b,Label:C}={},path:y,showError:v,value:x}=Te({potentiallyStalePath:c}),I=ZF(()=>{if(!u)return null;let F=u;Array.isArray(e.targetField.relationTo)&&(F={relationTo:d.slug,value:F});let S=Array.isArray(r)?{}:{[a]:{equals:F}};return e.where?{and:[S,e.where]}:S},[u,r,e.targetField.relationTo,e.where,a,d?.slug]),w=ZF(()=>{let F=m({collectionSlug:Array.isArray(e.collection)?e.collection[0]:e.collection});return Kp({collectionSlug:d?.slug,config:f,docID:u,fields:F?.fields,segments:e.on.split(".")})},[m,e.collection,e.on,d?.slug,u,f]);return d?xV("div",{className:[Ae,v&&"error","join"].filter(Boolean).join(" "),id:`field-${y?.replace(/\./g,"__")}`,children:[aa(ue,{CustomComponent:b,Fallback:aa(Ze,{path:y,showError:v})}),aa(I0,{AfterInput:p,allowCreate:typeof u<"u"&&o,BeforeInput:h,disableTable:I===null,field:e,fieldPath:y,filterOptions:I,initialData:u&&x?x:{docs:[]},initialDrawerData:w,Label:aa("h4",{style:{margin:0},children:C||aa(Ce,{label:s,localized:i,path:y,required:l})}),parent:typeof u<"u"?{id:u,collectionSlug:d.slug,joinPath:y}:void 0,relationTo:r}),aa(ue,{CustomComponent:g,Fallback:aa(Xe,{description:n,path:y})})]}):null},Xu=ze(IV);import{jsx as la,jsxs as qF}from"react/jsx-runtime";import QF,{useCallback as eh,useEffect as _V,useMemo as TV,useState as KF}from"react";var FV="json-field",DV=t=>{let{field:e,field:{admin:{className:o,description:n,editorOptions:r,maxHeight:s}={},jsonSchema:i,label:a,localized:l,required:c},path:u,readOnly:d,validate:f}=t,{insertSpaces:m=wb.insertSpaces,tabSize:p=wb.tabSize}=r||{},h=eh(j=>{if(j!==void 0)return j===null?"":m?JSON.stringify(j,null,p):JSON.stringify(j,null," ")},[p,m]),[g,b]=KF(),C=QF.useRef("formState"),[y,v]=KF(Date.now()),x=eh((j,M)=>{if(typeof f=="function")return f(j,{...M,jsonError:g,required:c})},[f,c,g]),{customComponents:{AfterInput:I,BeforeInput:w,Description:F,Error:S,Label:R}={},disabled:D,initialValue:_,path:T,setValue:A,showError:L,value:P}=Te({potentiallyStalePath:u,validate:x}),E=QF.useRef(h(P??_)),B=eh((j,M)=>{if(!i)return;M.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...M.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],i],validate:!0});let O=i.uri,V=O.includes("?")?`${O}&${crypto.randomUUID?crypto.randomUUID():fn()}`:`${O}?${crypto.randomUUID?crypto.randomUUID():fn()}`;j.setModel(M.editor.createModel(h(P)||"","json",M.Uri.parse(V)))},[i,h,P]),k=eh(j=>{if(!(d||D)){C.current="internalEditor";try{A(j?JSON.parse(j):null),E.current=j,b(void 0)}catch(M){A(j||null),E.current=j,b(M)}}},[d,D,A]);_V(()=>{if(C.current==="formState"){let j=h(P??_);j!==E.current&&(E.current=j,v(Date.now()))}C.current="formState"},[_,T,h,P]);let $=TV(()=>et(e),[e]);return qF("div",{className:[Ae,FV,o,L&&"error",(d||D)&&"read-only"].filter(Boolean).join(" "),style:$,children:[la(ue,{CustomComponent:R,Fallback:la(Ce,{label:a,localized:l,path:T,required:c})}),qF("div",{className:`${Ae}__wrap`,children:[la(ue,{CustomComponent:S,Fallback:la(Ze,{message:g,path:T,showError:L})}),w,la(pu,{defaultLanguage:"json",maxHeight:s,onChange:k,onMount:B,options:r,readOnly:d||D,recalculatedHeightAt:y,value:E.current,wrapperProps:{id:`field-${T?.replace(/\./g,"__")}`}}),I]}),la(ue,{CustomComponent:F,Fallback:la(Xe,{description:n,path:T})})]})},Yu=ze(DV);import{jsx as ys,jsxs as eD}from"react/jsx-runtime";import{getTranslation as RV}from"@payloadcms/translations";import{isNumber as AV}from"payload/shared";import{useCallback as _0,useEffect as PV,useMemo as EV,useState as NV}from"react";var LV=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,step:s=1}={},hasMany:i=!1,label:a,localized:l,max:c=1/0,maxRows:u=1/0,min:d=-1/0,required:f},onChange:m,path:p,readOnly:h,validate:g}=t,{i18n:b,t:C}=N(),y=_0(($,j)=>{if(typeof g=="function")return g($,{...j,max:c,min:d,required:f})},[g,d,c,f]),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Error:w,Label:F}={},disabled:S,path:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:p,validate:y}),A=_0($=>{let j=parseFloat($.target.value),M=j;Number.isNaN(j)&&(M=null),typeof m=="function"&&m(M),D(M)},[m,D]),[L,P]=NV([]),E=_0($=>{if(!(h||S)){let j;$?Array.isArray($)?j=$.map(M=>Number(M.value?.value||M.value)):j=[Number($.value?.value||$.value)]:j=[],D(j)}},[h,S,D]);PV(()=>{i&&Array.isArray(T)&&P(T.map(($,j)=>({id:`${$}${j}`,label:`${$}`,value:{toString:()=>`${$}${j}`,value:$?.value||$}})))},[T,i]);let B=EV(()=>et(e),[e]),k=RV(r,b);return eD("div",{className:[Ae,"number",o,_&&"error",(h||S)&&"read-only",i&&"has-many"].filter(Boolean).join(" "),style:B,children:[ys(ue,{CustomComponent:F,Fallback:ys(Ce,{label:a,localized:l,path:R,required:f})}),eD("div",{className:`${Ae}__wrap`,children:[ys(ue,{CustomComponent:w,Fallback:ys(Ze,{path:R,showError:_})}),x,i?ys(pt,{className:`field-${R.replace(/\./g,"__")}`,disabled:h||S,filterOption:($,j)=>{let M=Array.isArray(T)&&T.length>=u;return AV(j)&&!M},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(T)&&T.length>=u?C("validation:limitReached",{max:u,value:T.length+1}):null,onChange:E,options:[],placeholder:k,showError:_,value:L}):ys("div",{children:ys("input",{disabled:h||S,id:`field-${R.replace(/\./g,"__")}`,max:c,min:d,name:R,onChange:A,onWheel:$=>{$.target.blur()},placeholder:k,step:s,type:"number",value:typeof T=="number"?T:""})}),v,ys(ue,{CustomComponent:I,Fallback:ys(Xe,{description:n,path:R})})]})]})},Zu=ze(LV);import{jsx as Mn,jsxs as Vl}from"react/jsx-runtime";import{getTranslation as T0}from"@payloadcms/translations";import{useCallback as tD,useMemo as kV}from"react";var oD="point",jV=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,step:s}={},label:i,localized:a,required:l},path:c,readOnly:u,validate:d}=t,{i18n:f,t:m}=N(),p=tD((_,T)=>{if(typeof d=="function")return d(_,{...T,required:l})},[d,l]),{customComponents:{AfterInput:h,BeforeInput:g,Description:b,Error:C,Label:y}={},disabled:v,path:x,setValue:I,showError:w,value:F=[null,null]}=Te({potentiallyStalePath:c,validate:p}),S=tD((_,T)=>{let A=parseFloat(_.target.value);Number.isNaN(A)&&(A=_.target.value);let L=[...F];L[T]=A,I(L)},[I,F]),R=_=>{let T=m(_==="longitude"?"fields:longitude":"fields:latitude"),A=i?T0(i,f):"";return`${A}${A?" - ":""}${T}`},D=kV(()=>et(e),[e]);return Vl("div",{className:[Ae,oD,o,w&&"error",(u||v)&&"read-only"].filter(Boolean).join(" "),style:D,children:[Vl("ul",{className:`${oD}__wrap`,children:[Vl("li",{children:[Mn(ue,{CustomComponent:y,Fallback:Mn(Ce,{label:R("longitude"),localized:a,path:x,required:l})}),Vl("div",{className:"input-wrapper",children:[g,Mn("input",{disabled:u||v,id:`field-longitude-${x?.replace(/\./g,"__")}`,name:`${x}.longitude`,onChange:_=>S(_,0),placeholder:T0(r,f),step:s,type:"number",value:F&&typeof F[0]=="number"?F[0]:""}),h]})]}),Vl("li",{children:[Mn(ue,{CustomComponent:y,Fallback:Mn(Ce,{label:R("latitude"),localized:a,path:x,required:l})}),Vl("div",{className:"input-wrapper",children:[Mn(ue,{CustomComponent:C,Fallback:Mn(Ze,{path:x,showError:w})}),g,Mn("input",{disabled:u||v,id:`field-latitude-${x?.replace(/\./g,"__")}`,name:`${x}.latitude`,onChange:_=>S(_,1),placeholder:T0(r,f),step:s,type:"number",value:F&&typeof F[1]=="number"?F[1]:""}),h]})]})]}),Mn(ue,{CustomComponent:b,Fallback:Mn(Xe,{description:n,path:x})})]})},Ju=ze(jV);import{jsx as Cs,jsxs as rD}from"react/jsx-runtime";import{optionIsObject as nD}from"payload/shared";import{useCallback as OV,useMemo as VV}from"react";import{c as $V}from"react/compiler-runtime";import{jsx as th,jsxs as BV}from"react/jsx-runtime";import{getTranslation as MV}from"@payloadcms/translations";import"react";var qu="radio-input",Qu=t=>{let e=$V(16),{isSelected:o,onChange:n,option:r,path:s,readOnly:i,uuid:a}=t,{i18n:l}=N(),c=ut(),u=`field-${s}-${r.value}${c>1?`-${c}`:""}${a?`-${a}`:""}`,d=o&&`${qu}--is-selected`,f;e[0]!==d?(f=[qu,d].filter(Boolean),e[0]=d,e[1]=f):f=e[1];let m=f.join(" "),p;e[2]!==n||e[3]!==r.value?(p=()=>typeof n=="function"?n(r.value):null,e[2]=n,e[3]=r.value,e[4]=p):p=e[4];let h;if(e[5]!==l||e[6]!==u||e[7]!==o||e[8]!==r.label||e[9]!==s||e[10]!==i||e[11]!==m||e[12]!==p){let g=th("input",{checked:o,disabled:i,id:u,name:s,onChange:p,type:"radio"}),b=i&&`${qu}__styled-radio--disabled`,C;e[14]!==b?(C=[`${qu}__styled-radio`,b].filter(Boolean),e[14]=b,e[15]=C):C=e[15],h=th("label",{htmlFor:u,children:BV("div",{className:m,children:[g,th("span",{className:C.join(" ")}),th("span",{className:`${qu}__label`,children:MV(r.label,l)})]})}),e[5]=l,e[6]=u,e[7]=o,e[8]=r.label,e[9]=s,e[10]=i,e[11]=m,e[12]=p,e[13]=h}else h=e[13];return h};var oh="radio-group",GV=t=>{let{disableModifyingForm:e,field:o,field:{admin:{className:n,description:r,layout:s="horizontal"}={},label:i,localized:a,options:l=[],required:c}={},onChange:u,path:d,readOnly:f,validate:m,value:p}=t,{uuid:h}=$e(),g=OV((T,A)=>{if(typeof m=="function")return m(T,{...A,options:l,required:c})},[m,l,c]),{customComponents:{AfterInput:b,BeforeInput:C,Description:y,Error:v,Label:x}={},disabled:I,path:w,setValue:F,showError:S,value:R}=Te({potentiallyStalePath:d,validate:g}),D=R||p,_=VV(()=>et(o),[o]);return rD("div",{className:[Ae,oh,n,`${oh}--layout-${s}`,S&&"error",(f||I)&&`${oh}--read-only`].filter(Boolean).join(" "),style:_,children:[Cs(ue,{CustomComponent:v,Fallback:Cs(Ze,{path:w,showError:S})}),Cs(ue,{CustomComponent:x,Fallback:Cs(Ce,{label:i,localized:a,path:w,required:c})}),rD("div",{className:`${Ae}__wrap`,children:[C,Cs("ul",{className:`${oh}--group`,id:`field-${w.replace(/\./g,"__")}`,children:l.map(T=>{let A="";nD(T)?A=T.value:A=T;let L=String(A)===String(D),P=`field-${w}-${A}${h?`-${h}`:""}`;return Cs("li",{children:Cs(Qu,{id:P,isSelected:L,onChange:()=>{typeof u=="function"&&u(A),f||I||F(A,!!e)},option:nD(T)?T:{label:T,value:T},path:w,readOnly:f||I,uuid:h})},`${w} - ${A}`)})}),b,Cs(ue,{CustomComponent:y,Fallback:Cs(Xe,{description:r,path:w})})]})]})},Ku=ze(GV);import{jsx as IG}from"react/jsx-runtime";import $0,{useCallback as B0,useMemo as _G}from"react";import{jsx as xn,jsxs as N0}from"react/jsx-runtime";import{dequal as CG}from"dequal/lite";import{formatAdminURL as L0,wordBoundariesRegex as xG}from"payload/shared";import*as k0 from"qs-esm";import{useCallback as da,useEffect as Ul,useMemo as wG,useReducer as SG,useRef as rd,useState as ri}from"react";import{c as zV}from"react/compiler-runtime";import{jsx as On,jsxs as rh}from"react/jsx-runtime";import{getTranslation as sD}from"@payloadcms/translations";import{hasAutosaveEnabled as WV}from"payload/shared";import{Fragment as F0,useEffect as nh,useState as ed}from"react";var Gl="relationship-add-new",iD=t=>{let e=zV(46),{Button:o,hasMany:n,onChange:r,path:s,relationTo:i,unstyled:a,value:l}=t,c=jp(i),{permissions:u}=Ie(),[d,f]=ed(!1),[m,p]=ed(),h=c.length>1,g;e[0]!==c[0]||e[1]!==h?(g=()=>h?void 0:c[0],e[0]=c[0],e[1]=h,e[2]=g):g=e[2];let[b,C]=ed(g),[y,v]=ed(!1),{i18n:x,t:I}=N(),[w,F]=ed(!1),S=b?.slug,R;e[3]!==S?(R={collectionSlug:S},e[3]=S,e[4]=R):R=e[4];let[D,_,T]=jt(R),{isDrawerOpen:A,toggleDrawer:L}=T,P;e[5]!==b||e[6]!==n||e[7]!==r||e[8]!==l?(P=ne=>{let{doc:Z,operation:J}=ne;if(J==="create"||J==="update"&&WV(b)){let re;l?re=Array.isArray(l)?!l.some(me=>me&&me.value===Z.id):l.value!==Z.id:re=!0,re&&r(n===!0?[...Array.isArray(l)?l:[],{relationTo:b?.slug,value:Z.id}]:{relationTo:b?.slug,value:Z.id}),p(void 0)}},e[5]=b,e[6]=n,e[7]=r,e[8]=l,e[9]=P):P=e[9];let E=P,B;e[10]===Symbol.for("react.memo_cache_sentinel")?(B=ne=>{v(ne)},e[10]=B):B=e[10];let k=B,$,j;e[11]!==u||e[12]!==c?($=()=>{u&&(c.length===1?f(u.collections[c[0]?.slug]?.create):f(c.some(ne=>u.collections[ne?.slug]?.create)))},j=[u,c],e[11]=u,e[12]=c,e[13]=$,e[14]=j):($=e[13],j=e[14]),nh($,j);let M,O;e[15]!==c||e[16]!==h||e[17]!==m?(O=()=>{h&&m&&C(c.find(ne=>ne?.slug===m))},M=[m,h,c],e[15]=c,e[16]=h,e[17]=m,e[18]=M,e[19]=O):(M=e[18],O=e[19]),nh(O,M);let V,W;e[20]!==b||e[21]!==h||e[22]!==L?(V=()=>{h&&b&&(L(),p(void 0))},W=[L,h,b],e[20]=b,e[21]=h,e[22]=L,e[23]=V,e[24]=W):(V=e[23],W=e[24]),nh(V,W);let Y,z;e[25]!==A||e[26]!==h?(Y=()=>{h&&!A&&C(void 0)},z=[A,h],e[25]=A,e[26]=h,e[27]=Y,e[28]=z):(Y=e[27],z=e[28]),nh(Y,z);let K=c[0]?.labels.singular,U,X;if(e[29]!==o||e[30]!==D||e[31]!==_||e[32]!==b||e[33]!==x||e[34]!==E||e[35]!==s||e[36]!==u||e[37]!==y||e[38]!==c||e[39]!==d||e[40]!==w||e[41]!==I||e[42]!==K||e[43]!==a){X=Symbol.for("react.early_return_sentinel");e:{let ne=I("fields:addNewLabel",{label:sD(K,x)});if(!d){X=null;break e}U=rh("div",{className:Gl,id:`${s}-add-new`,children:[c.length===1&&rh(F0,{children:[On(_,{className:[`${Gl}__add-button`,a&&`${Gl}__add-button--unstyled`].filter(Boolean).join(" "),onClick:()=>{F(!1)},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:o||rh(F0,{children:[On(Ao,{className:`${Gl}__tooltip`,show:w,children:ne}),On(ar,{})]})}),On(D,{onSave:E})]}),c.length>1&&rh(F0,{children:[On(it,{button:o||On(oe,{buttonStyle:"none",className:`${Gl}__add-button`,tooltip:y?void 0:I("fields:addNew"),children:On(ar,{})}),buttonType:"custom",horizontalAlign:"center",onToggleOpen:k,render:Z=>{let{close:J}=Z;return On(Ub,{children:c.map(re=>u.collections[re?.slug]?.create?On(Xb,{className:`${Gl}__relation-button--${re?.slug}`,onClick:()=>{J(),p(re?.slug)},children:sD(re?.labels?.singular,x)},re?.slug):null)})},size:"medium"}),b&&u.collections[b?.slug]?.create&&On(D,{onSave:E})]})]})}e[29]=o,e[30]=D,e[31]=_,e[32]=b,e[33]=x,e[34]=E,e[35]=s,e[36]=u,e[37]=y,e[38]=c,e[39]=d,e[40]=w,e[41]=I,e[42]=K,e[43]=a,e[44]=U,e[45]=X}else U=e[44],X=e[45];return X!==Symbol.for("react.early_return_sentinel")?X:U};import{c as XV}from"react/compiler-runtime";import{jsx as sh}from"react/jsx-runtime";import{createElement as YV}from"react";import{useEffect as uD,useId as ZV,useState as dD}from"react";import{jsx as aD,jsxs as HV}from"react/jsx-runtime";import{hoistQueryParamsToAnd as UV}from"payload/shared";import{useCallback as td,useEffect as lD,useState as D0}from"react";var cD=({allowCreate:t=!0,collectionSlugs:e,disableQueryPresets:o,drawerSlug:n,enableRowSelections:r,filterOptions:s,onBulkSelect:i,onSelect:a,overrideEntityVisibility:l=!0,selectedCollection:c})=>{let{closeModal:u,isModalOpen:d}=ae(),{serverFunction:f}=Lt(),[m,p]=D0(void 0),[h,g]=D0(!0),{config:{collections:b},getEntityConfig:C}=H(),y=d(n),v=b.filter(({slug:P})=>e.includes(P)),[x,I]=D0(()=>{let P=c||v[0]?.slug,E=C({collectionSlug:P});return E?{label:E.labels,value:E.slug}:void 0}),[w,F,{drawerSlug:S}]=jt({collectionSlug:x.value}),R=Qe(P=>{P&&P!==x?.value&&I({label:C({collectionSlug:P})?.labels,value:P})});lD(()=>{R(c)},[c]);let D=td(async({slug:P,query:E})=>{try{let B={...E||{},where:{...E?.where||{}}},k=s?.[P];if(s&&typeof k!="boolean"&&(B.where=UV(B.where,k)),P){let $=await f({name:"render-list",args:{collectionSlug:P,disableBulkDelete:!0,disableBulkEdit:!0,disableQueryPresets:o,drawerSlug:n,enableRowSelections:r,overrideEntityVisibility:l,query:B}});p($?.List||null)}else p(null);g(!1)}catch(B){console.error("Error rendering List View: ",B),y&&u(n)}},[f,u,n,y,r,s,l,o]);lD(()=>{m||D({slug:x?.value})},[D,m,x.value]);let _=td(({doc:P})=>{typeof a=="function"&&a({collectionSlug:x?.value,doc:P,docID:P.id}),u(S),u(n)},[u,S,n,a,x.value]),T=td(P=>{D({slug:x?.value,query:P})},[D,x.value]),A=td(P=>{I(P),D({slug:P?.value})},[D]),L=td(async P=>{P&&I({label:C({collectionSlug:P})?.labels,value:P}),await D({slug:x.value||P})},[C,D,x.value]);return h?aD(vn,{}):HV(qv,{allowCreate:t,createNewDrawerSlug:S,DocumentDrawerToggler:F,drawerSlug:n,enabledCollections:e,onBulkSelect:i,onQueryChange:T,onSelect:a,refresh:L,selectedOption:x,setSelectedOption:A,children:[m,aD(w,{onSave:_})]})};var mD="list-drawer",JV=({depth:t,uuid:e})=>`list-drawer_${t}_${e}`,qV=({children:t,className:e,disabled:o,drawerSlug:n,onClick:r,...s})=>sh(cs,{className:[e,`${mD}__toggler`].filter(Boolean).join(" "),disabled:o,onClick:r,slug:n,...s,children:t}),QV=t=>{let{drawerSlug:e}=t;return sh(St,{className:mD,gutter:!1,Header:null,slug:e,children:sh(cD,{...t})})},ca=t=>{let e=XV(42),{collectionSlugs:o,filterOptions:n,selectedCollection:r,uploads:s}=t,{config:i}=H(),{collections:a}=i,l=ut(),c=ZV(),{closeModal:u,modalState:d,openModal:f,toggleModal:m}=ae(),[p,h]=dD(!1),[g,b]=dD(o),C;e[0]!==l||e[1]!==c?(C=JV({depth:l,uuid:c}),e[0]=l,e[1]=c,e[2]=C):C=e[2];let y=C,v,x;e[3]!==y||e[4]!==d?(v=()=>{h(!!d[y]?.isOpen)},x=[d,y],e[3]=y,e[4]=d,e[5]=v,e[6]=x):(v=e[5],x=e[6]),uD(v,x);let I,w;e[7]!==g||e[8]!==a||e[9]!==s?(I=()=>{if(!g||g.length===0){let j=a.filter(M=>{let{upload:O}=M;return s?!!O:!0});b(j.map(KV))}},w=[g,s,a],e[7]=g,e[8]=a,e[9]=s,e[10]=I,e[11]=w):(I=e[10],w=e[11]),uD(I,w);let F;e[12]!==y||e[13]!==m?(F=()=>{m(y)},e[12]=y,e[13]=m,e[14]=F):F=e[14];let S=F,R;e[15]!==u||e[16]!==y?(R=()=>{u(y)},e[15]=u,e[16]=y,e[17]=R):R=e[17];let D=R,_;e[18]!==y||e[19]!==f?(_=()=>{f(y)},e[18]=y,e[19]=f,e[20]=_):_=e[20];let T=_,A;e[21]!==D||e[22]!==g||e[23]!==y||e[24]!==n||e[25]!==r||e[26]!==s?(A=j=>YV(QV,{...j,closeDrawer:D,collectionSlugs:g,drawerSlug:y,filterOptions:n,key:y,selectedCollection:r,uploads:s}),e[21]=D,e[22]=g,e[23]=y,e[24]=n,e[25]=r,e[26]=s,e[27]=A):A=e[27];let L=A,P;e[28]!==y?(P=j=>sh(qV,{...j,drawerSlug:y}),e[28]=y,e[29]=P):P=e[29];let E=P,B;e[30]!==D||e[31]!==g||e[32]!==l||e[33]!==y||e[34]!==p||e[35]!==T||e[36]!==S?(B={closeDrawer:D,collectionSlugs:g,drawerDepth:l,drawerSlug:y,isDrawerOpen:p,openDrawer:T,setCollectionSlugs:b,toggleDrawer:S},e[30]=D,e[31]=g,e[32]=l,e[33]=y,e[34]=p,e[35]=T,e[36]=S,e[37]=B):B=e[37];let k=B,$;return e[38]!==L||e[39]!==k||e[40]!==E?($=[L,E,k],e[38]=L,e[39]=k,e[40]=E,e[41]=$):$=e[41],$};function KV(t){let{slug:e}=t;return e}import{c as eG}from"react/compiler-runtime";import{useRef as tG}from"react";var R0=(t,e)=>{let o=eG(3),n=tG(void 0),r;return o[0]!==t||o[1]!==e?(r=(...s)=>{let i=s,a=()=>{clearTimeout(n.current),t(...i)};clearTimeout(n.current),n.current=setTimeout(a,e)},o[0]=t,o[1]=e,o[2]=r):r=o[2],r};import{useCallback as oG,useRef as fD}from"react";function ua(){let t=fD([]),e=fD(!1);return{queueTask:oG((n,r)=>{t.current.push(n);async function s(){if(!e.current&&!(typeof r?.beforeProcess=="function"&&r.beforeProcess()===!1))for(;t.current.length>0;){let i=t.current.pop();t.current=[],e.current=!0;try{await i()}catch(a){console.error("Error in queued function:",a)}finally{e.current=!1,typeof r?.afterProcess=="function"&&r.afterProcess()}}}s()},[])}}import{c as rG}from"react/compiler-runtime";import{jsx as nG}from"react/jsx-runtime";import{createContext as sG,use as iG,useState as aG}from"react";var pD=sG({mostRecentUpdate:null,reportUpdate:()=>null}),A0=t=>{let e=rG(3),{children:o}=t,[n,r]=aG(null),s;return e[0]!==o||e[1]!==n?(s=nG(pD,{value:{mostRecentUpdate:n,reportUpdate:r},children:o}),e[0]=o,e[1]=n,e[2]=s):s=e[2],s},xs=()=>iG(pD);var P0=t=>{for(let e in t){let o=t[e];if((e.toLowerCase()==="and"||e.toLowerCase()==="or")&&Array.isArray(o))for(let n of o)P0(n);else o&&typeof o=="object"&&"in"in o&&Array.isArray(o.in)&&o.in.length===0&&(t[e]={exists:!1})}return t};var E0=({hasMany:t,relationTo:e,value:o})=>{let n=e.reduce((r,s)=>({...r,[s]:[]}),{});if(o===null)return n;if(o){let r=(s,i)=>{(typeof i=="string"||typeof i=="number")&&typeof s=="string"&&(n[s]?n[s].push(i):n[s]=[i])};t===!0?o.forEach(s=>{s&&r(s.relationTo,s.value)}):r(o.relationTo,o.value)}return n};var hD=({allowEdit:t,options:e,value:o})=>{if(o||typeof o=="number"){if(Array.isArray(o))return o.map(r=>{let s;return e.forEach(i=>{s||(s=i.options.find(a=>a.value===r.value&&a.relationTo===r.relationTo))}),s?{allowEdit:t,...s}:void 0});let n;return e.forEach(r=>{n||(n=r.options.find(s=>s.value===o.value&&s.relationTo===o.relationTo))}),n?{allowEdit:t,...n}:void 0}};import{getTranslation as lG}from"@payloadcms/translations";var bD=t=>t.reduce((e,o)=>o.options?[...e,...bD(o.options)]:[...e,{id:o.value,relationTo:o.relationTo}],[]),gD=t=>t.sort((e,o)=>typeof e?.label?.localeCompare=="function"&&typeof o?.label?.localeCompare=="function"?e.label.localeCompare(o.label):0),vD=(t,e)=>{switch(e.type){case"ADD":{let{collection:o,config:n,docs:r,i18n:s,ids:i=[],sort:a}=e,l=o.slug,c=bD(t),u=[...t],d=u.find(m=>m.label===o.labels.plural),f=r.reduce((m,p)=>{if(c.filter(h=>h.id===p.id&&h.relationTo===l).length===0){c.push({id:p.id,relationTo:l});let h=Jo({collectionConfig:o,data:p,dateFormat:n.admin.dateFormat,fallback:`${s.t("general:untitled")} - ID: ${p.id}`,i18n:s});return[...m,{label:h,relationTo:l,value:p.id}]}return m},[]);if(i.forEach(m=>{c.filter(p=>p.id===m&&p.relationTo===l).length===0&&(c.push({id:m,relationTo:l}),f.push({allowEdit:!1,label:`${s.t("general:untitled")} - ID: ${m}`,relationTo:l,value:m}))}),d){let m=[...d.options,...f];d.options=a?gD(m):m}else u.push({label:lG(o.labels.plural,s),options:a?gD(f):f});return u}case"CLEAR":{let o=e.exemptValues?Array.isArray(e.exemptValues)?e.exemptValues:[e.exemptValues]:[];return t.filter(r=>{let s=r.options.filter(i=>o?o.some(a=>a&&i.value===a.value):!1);return r.options=s,s.length>0})}case"REMOVE":{let{id:o,collection:n}=e,r=[...t],s=r.findIndex(i=>i.label===n.labels.plural);return s===-1||(r[s]={...r[s],options:r[s].options.filter(i=>i.value!==o)}),r}case"UPDATE":{let{collection:o,config:n,doc:r,i18n:s}=e,i=o.slug,a=[...t],l=Jo({collectionConfig:o,data:r,dateFormat:n.admin.dateFormat,fallback:`${s.t("general:untitled")} - ID: ${r.id}`,i18n:s}),u=a.find(d=>d.label===o.labels.plural)?.options?.find(d=>d.value===r.id);return u&&(u.label=l,u.relationTo=i),a}default:return t}};import{jsx as od,jsxs as yD}from"react/jsx-runtime";import{Fragment as cG,useState as uG}from"react";var zl="relationship--multi-value-label",CD=t=>{let{data:e,selectProps:o}=t,{allowEdit:n,label:r,relationTo:s,value:i}=e,{customProps:a}=o===void 0?{}:o,{draggableProps:l,onDocumentOpen:c}=a===void 0?{}:a,{permissions:u}=Ie(),[d,f]=uG(!1),{t:m}=N(),p=!!u?.collections?.[s]?.read;return yD("div",{className:zl,title:r||"",children:[od("div",{className:`${zl}__content`,children:od(Fo.MultiValueLabel,{...t,innerProps:{className:`${zl}__text`,...l||{}}})}),s&&p&&n!==!1&&od(cG,{children:yD("button",{"aria-label":`Edit ${r}`,className:`${zl}__drawer-toggler`,onClick:h=>{f(!1),c({id:i,collectionSlug:s,hasReadPermission:p,openInNewTab:h.metaKey||h.ctrlKey})},onKeyDown:dG,onMouseDown:mG,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onTouchEnd:fG,type:"button",children:[od(Ao,{className:`${zl}__tooltip`,show:d,children:m("general:editLabel",{label:""})}),od(yr,{className:`${zl}__icon`})]})})]})};function dG(t){t.key==="Enter"&&t.stopPropagation()}function mG(t){return t.stopPropagation()}function fG(t){return t.stopPropagation()}import{c as pG}from"react/compiler-runtime";import{jsx as Wl,jsxs as xD}from"react/jsx-runtime";import{Fragment as hG,useState as gG}from"react";var Hl="relationship--single-value",wD=t=>{let e=pG(16),{children:o,data:n,selectProps:r}=t,{allowEdit:s,label:i,relationTo:a,value:l}=n,c;e[0]!==r?(c=r===void 0?{}:r,e[0]=r,e[1]=c):c=e[1];let{customProps:u}=c,d;e[2]!==u?(d=u===void 0?{}:u,e[2]=u,e[3]=d):d=e[3];let{onDocumentOpen:f}=d,[m,p]=gG(!1),{t:h}=N(),{permissions:g}=Ie(),b=!!g?.collections?.[a]?.read,C=i||"",y;return e[4]!==s||e[5]!==o||e[6]!==b||e[7]!==i||e[8]!==f||e[9]!==t||e[10]!==a||e[11]!==m||e[12]!==h||e[13]!==C||e[14]!==l?(y=Wl(Fo.SingleValue,{...t,className:Hl,children:Wl("div",{className:`${Hl}__label`,title:C,children:xD("div",{className:`${Hl}__label-text`,children:[Wl("div",{className:`${Hl}__text`,children:o}),a&&b&&s!==!1&&Wl(hG,{children:xD("button",{"aria-label":h("general:editLabel",{label:i}),className:`${Hl}__drawer-toggler`,onClick:v=>{p(!1),f({id:l,collectionSlug:a,hasReadPermission:b,openInNewTab:v.metaKey||v.ctrlKey})},onKeyDown:bG,onMouseDown:vG,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onTouchEnd:yG,type:"button",children:[Wl(Ao,{className:`${Hl}__tooltip`,show:m,children:h("general:edit")}),Wl(yr,{})]})})]})})}),e[4]=s,e[5]=o,e[6]=b,e[7]=i,e[8]=f,e[9]=t,e[10]=a,e[11]=m,e[12]=h,e[13]=C,e[14]=l,e[15]=y):y=e[15],y};function bG(t){t.key==="Enter"&&t.stopPropagation()}function vG(t){return t.stopPropagation()}function yG(t){return t.stopPropagation()}var nd="relationship",j0=t=>{let{AfterInput:e,allowCreate:o=!0,allowEdit:n=!0,appearance:r="select",BeforeInput:s,className:i,description:a,Description:l,Error:c,filterOptions:u,formatDisplayedOptions:d,hasMany:f,initialValue:m,isSortable:p=!0,label:h,Label:g,localized:b,maxResultsPerRequest:C=10,onChange:y,path:v,placeholder:x,readOnly:I,relationTo:w,required:F,showError:S,sortOptions:R,style:D,value:_}=t,{config:T,getEntityConfig:A}=H(),{routes:{api:L},serverURL:P}=T,{i18n:E,t:B}=N(),{permissions:k}=Ie(),{code:$}=ye(),[j,M]=ri({id:void 0,collectionSlug:void 0,hasReadPermission:!1}),[O,V]=ri(-1),[W,Y]=ri({}),[z,K]=ri(""),[U,X]=ri(""),[ne,Z]=ri(!1),[J,re]=ri(!1),[me,xe]=ri(!1),_e=rd(!1),{queueTask:Be}=ua(),[Me,Ue]=SG(vD,[]),he=rd(_),[Oe,,{drawerSlug:Ke,isDrawerOpen:le,openDrawer:we}]=jt({id:j.id,collectionSlug:j.collectionSlug}),G=wG(()=>{let ce=u;if(_){let ke=(f===!1?[_]:_).reduce((Pe,qe)=>(Pe[qe.relationTo]||(Pe[qe.relationTo]=[]),Pe[qe.relationTo].push(qe.value),Pe),{});(Array.isArray(w)?w:[w]).forEach(Pe=>{ce={...ce||{},[Pe]:{...typeof u?.[Pe]=="object"?u[Pe]:{},...ke[Pe]?{id:{not_in:ke[Pe]}}:{}}}})}return ce},[u,_,f,w]),[ie,,{closeDrawer:Q,isDrawerOpen:fe,openDrawer:de}]=ca({collectionSlugs:w,filterOptions:G}),se=da(({collectionSlug:ce,doc:ke})=>{f?y([...Array.isArray(_)?_:[],{relationTo:ce,value:ke.id}]):f===!1&&y({relationTo:ce,value:ke.id}),Q()},[f,y,Q,_]),ee=rd(!1),ge=da(({filterOptions:ce,hasMany:ke,lastFullyLoadedRelation:Pe,lastLoadedPage:qe,onSuccess:ct,search:nt,sort:Fe,value:Ve})=>{k&&Be(async()=>{let Ot=typeof Pe<"u"?Pe:-1,gt=Array.isArray(w)?w:[w],At=Ot===-1?gt:gt.slice(Ot+1),wt=0,mo=E0(ke===!0?{hasMany:!0,relationTo:w,value:Ve}:{hasMany:!1,relationTo:w,value:Ve});z||(await At.reduce(async(jr,bt)=>{let Bo=ce?.[bt],$r;if(U!==nt?$r=1:$r=(qe[bt]||0)+1,await jr,Bo===!1)return V(gt.indexOf(bt)),Promise.resolve();if(wt<10){let Mo=A({collectionSlug:bt}),Rn=Mo?.admin?.useAsTitle||"id",_i=Mo?.defaultSort||"id";typeof R=="string"?_i=R:R?.[bt]&&(_i=R[bt]);let Br={depth:0,draft:!0,limit:C,locale:$,page:$r,select:{[Rn]:!0},sort:_i,where:{and:[{id:{not_in:mo[bt]}}]}};nt&&Br.where.and.push({[Rn]:{like:nt}}),Bo&&typeof Bo!="boolean"&&Br.where.and.push(Bo),P0(Br.where);let vr=await fetch(L0({apiRoute:L,path:`/${bt}`}),{body:k0.stringify(Br),credentials:"include",headers:{"Accept-Language":E.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"});if(vr.ok){let os=await vr.json();Y(Ua=>({...Ua,[bt]:$r})),os.nextPage||V(gt.indexOf(bt)),os.docs.length>0&&(wt+=os.docs.length,Ue({type:"ADD",collection:Mo,config:T,docs:os.docs,i18n:E,sort:Fe}))}else vr.status===403?(V(gt.indexOf(bt)),Ue({type:"ADD",collection:Mo,config:T,docs:[],i18n:E,ids:mo[bt],sort:Fe})):K(B("error:unspecific"))}},Promise.resolve()),typeof ct=="function"&&ct())})},[k,Be,w,z,U,A,R,C,$,L,E,T,B]),te=R0(({hasMany:ce,search:ke,value:Pe})=>{kt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{Z(!1)},search:ke,sort:!0,...ce===!0?{hasMany:ce,value:Pe}:{hasMany:ce,value:Pe}}),X(ke)},300),pe=da(ce=>{U!==ce.search&&(Z(!0),Y({}),te(ce))},[U,te]),be=Qe(({hasMany:ce,value:ke})=>{let Pe=E0(ce===!0?{hasMany:ce,relationTo:w,value:ke}:{hasMany:ce,relationTo:w,value:ke});Object.entries(Pe).reduce(async(qe,[ct,nt])=>{await qe;let Fe=nt.filter(Ve=>!Me.find(Ot=>Ot?.options?.find(gt=>gt.value===Ve&&gt.relationTo===ct)));if(Fe.length>0){let Ve=A({collectionSlug:ct}),Ot=Ve?.admin?.useAsTitle||"id",gt={depth:0,draft:!0,limit:Fe.length,locale:$,select:{[Ot]:!0},where:{id:{in:Fe}}};if(!z){let At=await fetch(L0({apiRoute:L,path:`/${ct}`}),{body:k0.stringify(gt),credentials:"include",headers:{"Accept-Language":E.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),wt=[];At.ok&&(wt=(await At.json()).docs),Ue({type:"ADD",collection:Ve,config:T,docs:wt,i18n:E,ids:Fe,sort:!0})}}},Promise.resolve())}),{mostRecentUpdate:ot}=xs(),je=Qe(ce=>{if(!_)return!1;let ke=ce.doc.id,Pe=!1;if(ce.operation==="update"?f===!0?Pe=(Array.isArray(_)?_:[_]).some(nt=>nt.value===ke&&nt.relationTo===ce.entitySlug):f===!1&&(Pe=_?.value===ke&&_?.relationTo===ce.entitySlug):ce.operation==="create"&&(Pe=ce.drawerSlug===Ke),!Pe)return;let qe=A({collectionSlug:ce.entitySlug});if(Ue({type:"UPDATE",collection:qe,config:T,doc:ce.doc,i18n:E}),f){let nt=(_?Array.isArray(_)?_:[_]:[]).map(Fe=>({relationTo:Fe.value===ke?ce.entitySlug:Fe.relationTo,value:Fe.value}));y(nt)}else f===!1&&y({relationTo:ce.entitySlug,value:ke})});Ul(()=>{ot&&je(ot)},[ot]);let Je=da(ce=>{Ue({type:"ADD",collection:ce.collectionConfig,config:T,docs:[ce.doc],i18n:E,sort:!0}),f?y(_?_.concat({relationTo:ce.collectionConfig.slug,value:ce.doc.id}):null):f===!1&&y({relationTo:ce.collectionConfig.slug,value:ce.doc.id})},[E,T,f,y,_]),Rt=da(ce=>{Ue({id:ce.id,type:"REMOVE",collection:ce.collectionConfig,config:T,i18n:E}),y(f&&_?_.filter(ke=>ke.value!==ce.id):null)},[E,T,f,y,_]),Xt=da((ce,ke)=>{if(!ke)return!0;let Pe=xG(ke||""),qe=250,ct=String(ce.label);for(;ct.length>qe;){let nt=ct.indexOf(" ",ke.length);if(Pe.test(ct.slice(0,nt===-1?ke.length:nt+1)))return!0;ct=ct.slice(nt===-1?ke.length:nt+1)}return Pe.test(ct.slice(-qe))},[]),$o=da(({id:ce,collectionSlug:ke,hasReadPermission:Pe,openInNewTab:qe})=>{if(qe){if(Pe&&ce&&ke){let ct=L0({adminRoute:T.routes.admin,path:`/collections/${ke}/${ce}`,serverURL:P});window.open(ct,"_blank")}}else ee.current=!0,M({id:ce,collectionSlug:ke,hasReadPermission:Pe})},[T.routes.admin,P]),kt=Qe(ce=>ge(ce));Ul(()=>{_e.current&&me&&(Z(!0),kt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{_e.current=!0,Z(!1)},...f===!0?{hasMany:f,value:he.current}:{hasMany:f,value:he.current}})),Ue({type:"CLEAR",exemptValues:he.current}),V(-1),Y({})},[w,u,$,v,me,f]);let br=rd(_),De=rd(!0);Ul(()=>{(De.current||!CG(_,br.current))&&be(f===!0?{hasMany:f,value:_}:{hasMany:f,value:_}),De.current=!1,br.current=_},[_,f]),Ul(()=>{let ke=(Array.isArray(w)?w:[w]).reduce((Pe,qe)=>(A({collectionSlug:qe})?.admin?.useAsTitle||"id")==="id"&&Pe,!0);re(!ke)},[w,A]),Ul(()=>{ee.current&&(we(),ee.current=!1)},[we,j]),Ul(()=>{he.current=_},[_]);let We=hD({allowEdit:n,options:Me,value:_});return!Array.isArray(We)&&We?.value==="null"&&(We.value=null),N0("div",{className:[Ae,nd,i,S&&"error",z&&"error-loading",I&&`${nd}--read-only`,!I&&o&&`${nd}--allow-create`].filter(Boolean).join(" "),id:`field-${v.replace(/\./g,"__")}`,style:D,children:[xn(ue,{CustomComponent:g,Fallback:xn(Ce,{label:h,localized:b,path:v,required:F})}),N0("div",{className:`${Ae}__wrap`,children:[xn(ue,{CustomComponent:c,Fallback:xn(Ze,{path:v,showError:S})}),s,z?xn("div",{className:`${nd}__error-loading`,children:z}):N0("div",{className:`${nd}__wrap`,children:[xn(pt,{backspaceRemovesValue:!(le||fe),components:{MultiValueLabel:CD,SingleValue:wD,...r!=="select"&&{DropdownIndicator:null}},customProps:{disableKeyDown:le||fe,disableMouseDown:le||fe,onDocumentOpen:$o},disabled:I||le||fe,filterOption:J?Xt:void 0,getOptionValue:ce=>{if(ce)return f&&Array.isArray(w)?`${ce.relationTo}_${ce.value}`:ce.value},isLoading:r==="select"&&ne,isMulti:f,isSearchable:r==="select",isSortable:p,menuIsOpen:r==="select"?me:!1,onChange:I?void 0:ce=>{f?ce===null?(he.current=[],y([])):(he.current=ce,y(ce)):f===!1&&(ce===null?(he.current=null,y(null)):(he.current=ce,y(ce)))},onInputChange:ce=>pe({search:ce,...f===!0?{hasMany:f,value:_}:{hasMany:f,value:_}}),onMenuClose:()=>{xe(!1)},onMenuOpen:()=>{r==="drawer"?de():r==="select"&&(xe(!0),_e.current||(Z(!0),kt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{_e.current=!0,Z(!1)},...f===!0?{hasMany:f,value:_}:{hasMany:f,value:_}})))},onMenuScrollToBottom:()=>{Z(!0),kt({filterOptions:u,lastFullyLoadedRelation:O,lastLoadedPage:W,onSuccess:()=>{Z(!1)},search:U,sort:!1,...f===!0?{hasMany:f,value:m}:{hasMany:f,value:m}})},options:typeof d=="function"?d(Me):Me,placeholder:x,showError:S,value:We??null}),!I&&o&&xn(iD,{path:v,relationTo:w,...f===!0?{hasMany:f,onChange:y,value:_}:{hasMany:f,onChange:y,value:_}})]}),e,xn(ue,{CustomComponent:l,Fallback:xn(Xe,{description:a,path:v})})]}),j.collectionSlug&&j.hasReadPermission&&xn(Oe,{onDelete:Rt,onDuplicate:Je}),r==="drawer"&&!I&&xn(ie,{allowCreate:o,enableRowSelections:!1,onSelect:se})]})};var TG=t=>{let{field:e,field:{admin:{allowCreate:o=!0,allowEdit:n=!0,appearance:r="select",className:s,description:i,isSortable:a=!0,placeholder:l,sortOptions:c}={},hasMany:u,label:d,localized:f,relationTo:m,required:p},path:h,readOnly:g,validate:b}=t,C=B0((M,O)=>{if(typeof b=="function")return b(M,{...O,required:p})},[b,p]),{customComponents:{AfterInput:y,BeforeInput:v,Description:x,Error:I,Label:w}={},disabled:F,filterOptions:S,initialValue:R,path:D,setValue:_,showError:T,value:A}=Te({potentiallyStalePath:h,validate:C}),L=_G(()=>et(e),[e]),P=Array.isArray(m),[E]=$0.useState(()=>Array.isArray(m)?m:[m]),B=B0(M=>{if(!M){_(null,M===A);return}let O=!1;P?O=Array.isArray(A)&&Array.isArray(M)&&A.length===M.length&&A.every((W,Y)=>{let z=M[Y];return W.value===z.value&&W.relationTo===z.relationTo}):O=Array.isArray(A)&&Array.isArray(M)&&A.length===M.length&&A.every((W,Y)=>W===M[Y].value);let V=M.map(W=>P?W:W.value);_(V,O)},[P,_,A]),k=B0(M=>{if(!M){_(null,M===A);return}let O=!1;P?O=A&&M&&A.value===M.value&&A.relationTo===M.relationTo:O=A&&M&&A===M.value;let V=P?M:M.value;_(V,O)},[P,_,A]),$=$0.useMemo(()=>u===!0?Array.isArray(A)?A.map(M=>P?M:{relationTo:Array.isArray(E)?E[0]:E,value:M}):A:A&&(P?A:{relationTo:Array.isArray(E)?E[0]:E,value:A}),[u,A,P,E]),j=$0.useMemo(()=>u===!0?Array.isArray(R)?R.map(M=>P?M:{relationTo:Array.isArray(E)?E[0]:E,value:M}):R:R&&(P?R:{relationTo:Array.isArray(E)?E[0]:E,value:R}),[R,P,E,u]);return IG(j0,{AfterInput:y,allowCreate:o,allowEdit:n,appearance:r,BeforeInput:v,className:s,Description:x,description:i,Error:I,filterOptions:S,formatDisplayedOptions:P?void 0:M=>M.map(O=>O.options).flat(),isSortable:a,Label:w,label:d,localized:f,maxResultsPerRequest:10,maxRows:e?.maxRows,minRows:e?.minRows,path:D,placeholder:l,readOnly:g||F,relationTo:E,required:p,showError:T,sortOptions:c,style:L,...u===!0?{hasMany:!0,initialValue:j,onChange:B,value:$}:{hasMany:!1,initialValue:j,onChange:k,value:$}})},sd=ze(TG);var id=()=>null;import{jsx as M0}from"react/jsx-runtime";import"react";var SD="row",FG=t=>{let{field:{admin:{className:e,style:o}={},fields:n},forceRender:r=!1,indexPath:s="",parentPath:i="",parentSchemaPath:a="",permissions:l,readOnly:c}=t;return M0(LT,{children:M0("div",{className:[Ae,SD,e].filter(Boolean).join(" "),style:o||void 0,children:M0(Lo,{className:`${SD}__fields`,fields:n,forceRender:r,margins:!1,parentIndexPath:s,parentPath:i,parentSchemaPath:a,permissions:l,readOnly:c})})})},ad=ze(FG);import{jsx as RG}from"react/jsx-runtime";import AG,{useCallback as _D,useMemo as PG}from"react";import{c as DG}from"react/compiler-runtime";import{jsx as ma,jsxs as ID}from"react/jsx-runtime";import{getTranslation as O0}from"@payloadcms/translations";import"react";var Zr=t=>{let e=DG(37),{id:o,AfterInput:n,BeforeInput:r,className:s,Description:i,description:a,Error:l,filterOption:c,hasMany:u,isClearable:d,isSortable:f,label:m,Label:p,localized:h,onChange:g,onInputChange:b,options:C,path:y,placeholder:v,readOnly:x,required:I,showError:w,style:F,value:S}=t,R=u===void 0?!1:u,D=d===void 0?!0:d,_=f===void 0?!0:f,{i18n:T}=N(),A;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==l||e[4]!==p||e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==R||e[9]!==T||e[10]!==o||e[11]!==D||e[12]!==_||e[13]!==m||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==C||e[18]!==y||e[19]!==v||e[20]!==x||e[21]!==I||e[22]!==w||e[23]!==F||e[24]!==S){let L;if(R&&Array.isArray(S)){let $;e[26]!==T||e[27]!==C?($=j=>{let M=C.find(O=>O.value===j);return{label:M?O0(M.label,T):j,value:M?.value??j}},e[26]=T,e[27]=C,e[28]=$):$=e[28],L=S.map($)}else if(S){let $;e[29]!==S?($=M=>M.value===S,e[29]=S,e[30]=$):$=e[30];let j=C.find($);L={label:j?O0(j.label,T):S,value:j?.value??S}}else L=null;let P=w&&"error",E=x&&"read-only",B;e[31]!==s||e[32]!==P||e[33]!==E?(B=[Ae,"select",s,P,E].filter(Boolean),e[31]=s,e[32]=P,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==T?(k=$=>({...$,label:O0($.label,T)}),e[35]=T,e[36]=k):k=e[36],A=ID("div",{className:B.join(" "),id:`field-${y.replace(/\./g,"__")}`,style:F,children:[ma(ue,{CustomComponent:p,Fallback:ma(Ce,{label:m,localized:h,path:y,required:I})}),ID("div",{className:`${Ae}__wrap`,children:[ma(ue,{CustomComponent:l,Fallback:ma(Ze,{path:y,showError:w})}),r,ma(pt,{disabled:x,filterOption:c,id:o,isClearable:D,isMulti:R,isSortable:_,onChange:g,onInputChange:b,options:C.map(k),placeholder:v,showError:w,value:L}),n]}),ma(ue,{CustomComponent:i,Fallback:ma(Xe,{description:a,path:y})})]}),e[0]=n,e[1]=r,e[2]=i,e[3]=l,e[4]=p,e[5]=s,e[6]=a,e[7]=c,e[8]=R,e[9]=T,e[10]=o,e[11]=D,e[12]=_,e[13]=m,e[14]=h,e[15]=g,e[16]=b,e[17]=C,e[18]=y,e[19]=v,e[20]=x,e[21]=I,e[22]=w,e[23]=F,e[24]=S,e[25]=A}else A=e[25];return A};var ih=t=>t.map(e=>typeof e=="object"&&(e.value||e.value==="")?e:{label:e,value:e}),EG=t=>{let{field:e,field:{name:o,admin:{className:n,description:r,isClearable:s=!0,isSortable:i=!0,placeholder:a}={},hasMany:l=!1,label:c,localized:u,options:d=[],required:f},onChange:m,path:p,readOnly:h,validate:g}=t,b=AG.useMemo(()=>ih(d),[d]),C=_D((P,E)=>{if(typeof g=="function")return g(P,{...E,hasMany:l,options:b,required:f})},[g,f,l,b]),{customComponents:{AfterInput:y,BeforeInput:v,Description:x,Error:I,Label:w}={},disabled:F,path:S,selectFilterOptions:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:p,validate:C}),A=_D(P=>{if(!h||F){let E=null;P&&l?Array.isArray(P)?E=P.map(B=>B.value):E=[]:P&&!Array.isArray(P)&&(E=P.value),typeof m=="function"&&m(E),D(E)}},[h,F,l,D,m]),L=PG(()=>et(e),[e]);return RG(Zr,{AfterInput:y,BeforeInput:v,className:n,Description:x,description:r,Error:I,filterOption:R?({label:P,value:E},B)=>R?.some(k=>(typeof k=="string"?k:k.value)===E)&&P.toLowerCase().includes(B.toLowerCase()):void 0,hasMany:l,isClearable:s,isSortable:i,Label:w,label:c,localized:u,name:o,onChange:A,options:b,path:S,placeholder:a,readOnly:h||F,required:f,showError:_,style:L,value:T})},ld=ze(EG);import{c as zD}from"react/compiler-runtime";import{jsx as Ss,jsxs as WD}from"react/jsx-runtime";import{getTranslation as yz}from"@payloadcms/translations";import{getFieldPaths as Cz,toKebabCase as xz}from"payload/shared";import{useEffect as GD,useState as wz}from"react";var BD=Ri(z0(),1);import{jsx as wn}from"react/jsx-runtime";import{dequal as jD}from"dequal/lite";import{useRouter as az}from"next/navigation.js";import{deepCopyObjectSimpleWithoutReactComponents as $D,getDataByPath as lz,getSiblingData as cz,hasDraftValidationEnabled as uz,reduceFieldsToValues as X0,wait as dz}from"payload/shared";import mz,{useCallback as Go,useEffect as pa,useReducer as fz,useRef as ha,useState as ni}from"react";import{c as $G}from"react/compiler-runtime";import{jsx as W0,jsxs as BG}from"react/jsx-runtime";import MG from"react";function OG(t){let e=[];for(let o of t)if(o){let n=o.split(" \u2192 "),r=!1;for(let s=0;s<e.length;s++)if(e[s].startsWith(n[0])){e.splice(s+1,0,o),r=!0;break}r||e.push(o)}return e}function VG(t){let[e,o]=t.split(":");if(!o)return{message:e};let n=o.split(",").map(r=>r.replaceAll(" > "," \u2192 ").trim());return n.length===1?{errors:n,message:`${e}: `}:{errors:OG(n),message:`${e} (${n.length}):`}}function RD(t){let e=$G(5),{errorMessage:o}=t,n;e[0]!==o?(n=()=>VG(o),e[0]=o,e[1]=n):n=e[1];let[r]=MG.useState(n),{errors:s,message:i}=r,a;return e[2]!==s||e[3]!==i?(a=BG("div",{children:[i,Array.isArray(s)&&s.length>0?s.length===1?W0("span",{"data-testid":"field-error",children:s[0]}):W0("ul",{"data-testid":"field-errors",children:s.map(GG)}):null]}),e[2]=s,e[3]=i,e[4]=a):a=e[4],a}function GG(t,e){return W0("li",{children:t},e)}import{c as zG}from"react/compiler-runtime";import{useEffect as AD,useState as WG}from"react";function H0(t,e,o){let n=zG(11),r;n[0]!==t?(r=()=>t,n[0]=t,n[1]=r):r=n[1];let[s,i]=WG(r),a;n[2]!==o||n[3]!==t?(a=()=>{let d=setTimeout(()=>{i(()=>t)},o);return()=>{clearTimeout(d)}},n[2]=o,n[3]=t,n[4]=a):a=n[4];let l;n[5]!==o||n[6]!==e?(l=[...e,o],n[5]=o,n[6]=e,n[7]=l):l=n[7],AD(a,l);let c,u;n[8]!==s?(c=()=>{s()},u=[s],n[8]=s,n[9]=c,n[10]=u):(c=n[9],u=n[10]),AD(c,u)}import{c as HG}from"react/compiler-runtime";import{jsx as UG}from"react/jsx-runtime";import PD,{useState as XG}from"react";var ED=PD.createContext(null),U0=t=>{let e=HG(6),{children:o}=t,[n,r]=XG(YG),s;e[0]!==n?(s=u=>{let{collectionSlug:d}=u;return n.get(d)},e[0]=n,e[1]=s):s=e[1];let i=s,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u=>{let{collectionSlug:d,handler:f}=u;r(m=>{let p=new Map(m);return p.set(d,f),p})},e[2]=a):a=e[2];let l=a,c;return e[3]!==o||e[4]!==i?(c=UG(ED,{value:{getUploadHandler:i,setUploadHandler:l},children:o}),e[3]=o,e[4]=i,e[5]=c):c=e[5],c},cd=()=>{let t=PD.use(ED);if(t===null)throw new Error("useUploadHandlers must be used within UploadHandlersProvider");return t};function YG(){return new Map}var ND={413:"Your request was too large to submit successfully."};var lh=Ri(Jv(),1);import{dequal as JG}from"dequal/lite";import{deepCopyObjectSimpleWithoutReactComponents as kD}from"payload/shared";import{dequal as ZG}from"dequal/lite";var LD=({acceptValues:t,currentState:e={},incomingState:o})=>{let n={...e};for(let[r,s]of Object.entries(o||{})){if(!(r in e)&&!s.addedByServer)continue;let i=s.addedByServer||t===!0||typeof t=="object"&&t!==null&&t.overrideLocalChanges===!1&&!e[r]?.isModified,a=s;if(!i){let{initialValue:l,value:c,...u}=s;a=u}n[r]={...e[r],...a},e[r]&&"errorPaths"in e[r]&&!("errorPaths"in s)&&(n[r].errorPaths=[]),Array.isArray(s.rows)&&r in e&&(n[r].rows=[...e[r]?.rows||[]],s.rows.forEach(l=>{let c=e[r].rows?.findIndex(u=>u.id===l.id);if(c>-1)n[r].rows[c]={...e[r].rows[c],...l};else if(l.addedByServer){let u={...l};delete u.addedByServer,n[r].rows.push(u)}})),s.valid!==!1&&(n[r].valid=!0),s.passesCondition!==!1&&(n[r].passesCondition=!0),s.blocksFilterOptions||delete n[r].blocksFilterOptions,delete n[r].addedByServer}return ZG(n,e)?e:n};var Xl=(t,e)=>{let o={},n=Object.entries(e).reduce((r,[s,i])=>{let a=r;if(s.indexOf(`${t}.`)===0){let[l]=s.replace(`${t}.`,"").split(".");a[l]||(a[l]={}),a[l][s.replace(`${t}.${String(l)}.`,"")]={...i}}else o[s]=i;return a},[]);return{remainingFields:o,rows:n}},Yl=(t,e)=>e.reduce((o,n,r)=>({...o,...Object.entries(n).reduce((s,[i,a])=>({...s,[`${t}.${r}.${i}`]:{...a}}),{})}),{});var ud="default"in lh.default?lh.default.default:lh.default;function dd(t,e){switch(e.type){case"ADD_ROW":{let{blockType:o,path:n,rowIndex:r,subFieldState:s={}}=e,i=typeof r=="number"?r:t[n]?.rows?.length||0,a=[...t[n]?.rows||[]],l={id:s?.id?.value||new ud().toHexString(),isLoading:!0};o&&(l.blockType=o),a.splice(i,0,l),o&&(s.blockType={initialValue:o,valid:!0,value:o});let{remainingFields:c,rows:u}=Xl(n,t);return u.splice(i,0,s),{...c,...Yl(n,u),[`${n}.${i}.id`]:{initialValue:l.id,passesCondition:!0,valid:!0,value:l.id},[n]:{...t[n],disableFormData:!0,rows:a,value:u.length}}}case"ADD_SERVER_ERRORS":{let o={...t},n=[];return e.errors.forEach(({message:r,path:s})=>{o[s]={...o[s]||{initialValue:null,value:null},errorMessage:r,valid:!1};let i=s.split(".");i.length>1&&n.push({fieldErrorPath:s,parentPath:i.slice(0,i.length-1).join(".")})}),o=Object.entries(o).reduce((r,[s,i])=>{let a=n.reduce((c,{fieldErrorPath:u,parentPath:d})=>(d.startsWith(s)&&c.push(u),c),[]),l=!1;if(a.length>0){let c=Array.isArray(i.errorPaths)?i.errorPaths:[];a.forEach(u=>{c.includes(u)||(c.push(u),l=!0)}),l&&(r[s]={...i,errorPaths:c})}return l||(r[s]=i),r},{}),o}case"DUPLICATE_ROW":{let{path:o,rowIndex:n}=e,{remainingFields:r,rows:s}=Xl(o,t),i=[...t[o].rows||[]],a=kD(i[n]),l=new ud().toHexString();a.id&&(a.id=l),i[n]?.customComponents?.RowLabel&&(a.customComponents={RowLabel:i[n].customComponents.RowLabel});let c=kD(s[n]);c.id&&(c.id.value=l,c.id.initialValue=l);for(let d of Object.keys(c).filter(f=>f.endsWith(".id"))){let f=c[d],m=new ud().toHexString();if(f&&typeof f.value=="string"&&ud.isValid(f.value)){c[d].value=m,c[d].initialValue=m;let p=d.split("."),h=parseInt(p[p.length-2],10),g=p.slice(0,p.length-2).join("."),b=c?.[g]?.rows;c[g]&&Array.isArray(b)&&(b[h]?b[h].id=m:b[h]={id:m})}}return Object.keys(c).length>0&&(s.splice(n+1,0,c),i.splice(n+1,0,a)),{...r,...Yl(o,s),[o]:{...t[o],disableFormData:!0,rows:i,value:s.length}}}case"MERGE_SERVER_STATE":{let{acceptValues:o,prevStateRef:n,serverState:r}=e,s=LD({acceptValues:o,currentState:t||{},incomingState:r});return n.current=s,s}case"MOVE_ROW":{let{moveFromIndex:o,moveToIndex:n,path:r}=e,{remainingFields:s,rows:i}=Xl(r,t),a=i[o];i.splice(o,1),i.splice(n,0,a);let l=[...t[r]?.rows||[]],c={...l[o]};return l.splice(o,1),l.splice(n,0,c),{...s,...Yl(r,i),[r]:{...t[r],rows:l}}}case"REMOVE":{let o={...t};return o[e.path]&&delete o[e.path],o}case"REMOVE_ROW":{let{path:o,rowIndex:n}=e,{remainingFields:r,rows:s}=Xl(o,t),i=[...t[o]?.rows||[]];return s.splice(n,1),i.splice(n,1),{...r,[o]:{...t[o],disableFormData:s.length>0,rows:i,value:s.length},...Yl(o,s)}}case"REPLACE_ROW":{let{blockType:o,path:n,rowIndex:r,subFieldState:s={}}=e,{remainingFields:i,rows:a}=Xl(n,t),l=Math.max(0,Math.min(r,a?.length-1||0)),c=[...t[n]?.rows||[]];return c[l]={id:new ud().toHexString(),blockType:o||void 0,collapsed:!1},o&&(s.blockType={initialValue:o,valid:!0,value:o}),a[l]=s,{...i,...Yl(n,a),[n]:{...t[n],disableFormData:!0,rows:c,value:a.length}}}case"REPLACE_STATE":{if(e.optimize!==!1){let o={};for(let[n,r]of Object.entries(e.state)){let s=t[n];r.valid!==!1&&(r.valid=!0),r.passesCondition!==!1&&(r.passesCondition=!0),JG(s,r)?s&&(o[n]=s):o[n]=r}return o}if(e.sanitize)for(let o of Object.values(e.state))o.valid!==!1&&(o.valid=!0),o.passesCondition!==!1&&(o.passesCondition=!0);return e.state}case"SET_ALL_ROWS_COLLAPSED":{let{path:o,updatedRows:n}=e;return{...t,[o]:{...t[o],rows:n}}}case"SET_ROW_COLLAPSED":{let{path:o,updatedRows:n}=e;return{...t,[o]:{...t[o],rows:n}}}case"UPDATE":{let o=Object.entries(e).reduce((r,[s,i])=>["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(s)?{...r,[s]:i,...s==="value"?{isModified:!0}:{}}:r,t?.[e.path]||{}),n={...t,[e.path]:o};if("value"in e)for(let[r,s]of Object.entries(n))r!==e.path&&"isModified"in s&&delete n[r].isModified;return n}case"UPDATE_MANY":{let o={...t};return Object.entries(e.formState).forEach(([n,r])=>{o[n]=r}),o}default:return t}}var qG=()=>{},QG=()=>{},KG=()=>{},ez=()=>{},tz=()=>{},oz=()=>{},rz=()=>{},nz=()=>{},sz=()=>{},iz=()=>{},ch={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:tz,disabled:!1,dispatchFields:KG,fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:QG,initializing:void 0,isValid:!0,moveFieldRow:()=>{},removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:iz,setBackgroundProcessing:nz,setDisabled:()=>{},setIsValid:()=>{},setModified:oz,setProcessing:rz,setSubmitted:sz,submit:qG,validateForm:ez};var pz="form",ws=t=>{let{id:e,collectionSlug:o,docConfig:n,docPermissions:r,getDocPreferences:s,globalSlug:i}=Se(),a=uz(n),{action:l,beforeSubmit:c,children:u,className:d,disabled:f,disableSuccessStatus:m,disableValidationOnSubmit:p,el:h,handleResponse:g,initialState:b,isDocumentForm:C,isInitializing:y,onChange:v,onSubmit:x,onSuccess:I,redirect:w,submitted:F,uuid:S,waitForAutocomplete:R}=t,D="method"in t?t?.method:void 0,_=az(),T=Qa(),{code:A}=ye(),{i18n:L,t:P}=N(),{refreshCookie:E,user:B}=Ie(),k=xr(),{queueTask:$}=ua(),{getFormState:j}=Lt(),{startRouteTransition:M}=Ye(),{getUploadHandler:O}=cd(),{config:V}=H(),[W,Y]=ni(f||!1),[z,K]=ni(!1),[U,X]=ni(!1),[ne,Z]=ni(!0),[J,re]=ni(y),[me,xe]=ni(!1),[_e,Be]=ni(!1),Me=ha(_e),Ue=ha(!1),he=Go(Fe=>{Me.current=Fe,Be(Fe)},[]),[Oe,Ke]=ni(!1),le=Go(Fe=>{Me.current&&(Ue.current=!0),Ke(Fe)},[]),we=ha(null),G=ha({}),ie=ha(null),Q=ha(!0),fe=fz(dd,{},()=>b),[de,se]=fe;G.current.fields=de;let ee=ha(de),ge=Go(async()=>{let Fe={},Ve=!0,Ot=G.current.getData(),gt=Object.entries(G.current.fields).map(async([At,wt])=>{let mo=wt,jr=At?At.split("."):[];if(wt.passesCondition!==!1){let bt=mo.valid;if("validate"in wt&&typeof wt.validate=="function"){let Bo=wt.value;wt?.rows&&Array.isArray(wt.rows)&&(Bo=G.current.getDataByPath(At)),bt=await wt.validate(Bo,{...wt,id:e,collectionSlug:o,blockData:void 0,data:T?.getData?T.getData():Ot,event:"submit",operation:k,path:jr,preferences:{},req:{payload:{config:V},t:P,user:B},siblingData:G.current.getSiblingData(At)}),typeof bt=="string"?(mo.errorMessage=bt,mo.valid=!1):(mo.valid=!0,mo.errorMessage=void 0)}mo.valid===!1&&(Ve=!1)}Fe[At]=mo});return await Promise.all(gt),jD(G.current.fields,Fe)||se({type:"REPLACE_STATE",state:Fe}),Z(Ve),Ve},[o,V,se,e,k,P,B,T]),te=Go(async(Fe,Ve)=>{let{acceptValues:Ot=!0,action:gt=l,context:At,disableFormWhileProcessing:wt=!0,disableSuccessStatus:mo,method:jr=D,overrides:bt={},skipValidation:Bo}=Fe||{},$r=mo??m;if(W){Ve&&Ve.preventDefault();return}let Mo,Rn,_i=new Promise((Pt,So)=>{Rn=Pt,Mo=So}),Br=gt||typeof l=="string"||typeof l=="function";w||$r||!Br?(Rn=Pt=>q.success(Pt),Mo=Pt=>q.error(Pt)):q.promise(_i,{error:Pt=>Pt,loading:P("general:submitting"),success:Pt=>Pt}),Ve&&(Ve.stopPropagation(),Ve.preventDefault()),wt&&(xe(!0),Y(!0)),R&&await dz(100);let vr=X0(G.current.fields,!0),os=$D(G.current.fields,{excludeFiles:!0});if(Array.isArray(c)){let Pt;await c.reduce(async(Bs,Ti)=>{await Bs,Pt=await Ti({formState:os})},Promise.resolve());let So=Object.entries(Pt).every(([,Bs])=>Bs.valid!==!1);if(Z(So),!So)return xe(!1),X(!0),Y(!1),se({type:"REPLACE_STATE",state:Pt})}let Ua=Bo||p?!0:await G.current.validateForm();if(Z(Ua),!Ua){Mo(P("error:correctInvalidFields")),xe(!1),X(!0),Y(!1);return}let Xa={};if(typeof bt=="function"?Xa=bt(G.current.fields):typeof bt=="object"&&(Xa=bt),x){for(let[Pt,So]of Object.entries(Xa))vr[Pt]=So;x(G.current.fields,vr)}if(!Br){xe(!1),X(!0),Y(!1);return}try{let Pt=await G.current.createFormData(Xa,{data:vr,mergeOverrideData:typeof bt!="function"}),So;if(typeof gt=="string"?So=await Ge[jr.toLowerCase()](gt,{body:Pt,headers:{"Accept-Language":L.language}}):typeof l=="function"&&(So=await l(Pt)),Ue.current?Ue.current=!1:le(!1),Y(!1),typeof g=="function"){g(So,Rn,Mo);return}let Bs=So.headers.get("content-type"),Ti=Bs&&Bs.indexOf("application/json")!==-1,on={};if(Ti&&(on=await So.json()),So.status<400){if(typeof I=="function"){let Ya=await I(on,{context:At,formState:os});Ya&&se({type:"MERGE_SERVER_STATE",acceptValues:Ot,prevStateRef:ee,serverState:Ya})}X(!1),xe(!1),w?M(()=>_.push(w)):$r||Rn(on.message||P("general:submissionSuccessful"))}else{if(xe(!1),X(!0),bt._status==="draft"&&(le(!0),a||X(!1)),G.current={...G.current},on.message){Mo(on.message);return}if(Array.isArray(on.errors)){let[pb,hb]=on.errors.reduce(([Za,gb],Fi)=>{let Ec=[],st=[];return Fi?.message&&st.push(Fi),Array.isArray(Fi?.data?.errors)&&Fi.data?.errors.forEach(rr=>{rr?.path?Ec.push(rr):st.push(rr)}),[[...Za,...Ec],[...gb,...st]]},[[],[]]);Z(!1),se({type:"ADD_SERVER_ERRORS",errors:pb}),hb.forEach(Za=>{Mo(wn(RD,{errorMessage:Za.message||P("error:unknown")}))});return}let Ya=ND?.[So.status]||So?.statusText||P("error:unknown");Mo(Ya)}return{formState:G.current.fields,res:So}}catch(Pt){console.error("Error submitting form",Pt),xe(!1),X(!0),Y(!1),Mo(Pt.message)}},[c,M,l,m,p,W,se,g,D,x,I,w,_,P,L,a,R,le,X]),pe=Go(()=>G.current.fields,[]),be=Go(Fe=>G.current.fields[Fe],[]),ot=Go(()=>X0(G.current.fields,!0),[]),je=Go(Fe=>cz(G.current.fields,Fe),[]),Je=Go(Fe=>lz(G.current.fields,Fe),[]),Rt=Go(async(Fe,{data:Ve,mergeOverrideData:Ot=!0})=>{let gt=Ve||X0(G.current.fields,!0),At=gt?.file;if(n&&"upload"in n&&n.upload&&At){delete gt.file;let jr=O({collectionSlug:o});if(typeof jr=="function"){let bt=At.name,Bo=await jr({file:At,updateFilename:$r=>{bt=$r}});At=JSON.stringify({clientUploadContext:Bo,collectionSlug:o,filename:bt,mimeType:At.type,size:At.size})}}Ot?gt={...gt,...Fe}:gt=Fe;let wt={_payload:JSON.stringify(gt)};return n&&"upload"in n&&n.upload&&At&&(wt.file=At),(0,BD.serialize)(wt,{indices:!0,nullsAsUndefineds:!1})},[o,n,O]),Xt=Go(async Fe=>{let Ve=Fr(ie),Ot=await s(),{state:gt}=await j({id:e,collectionSlug:o,data:Fe,docPermissions:r,docPreferences:Ot,globalSlug:i,locale:A,operation:k,renderAllFields:!0,schemaPath:o||i,signal:Ve.signal,skipValidation:!0});G.current={...ch},le(!1),se({type:"REPLACE_STATE",state:gt}),ie.current=null},[o,se,i,e,k,j,r,s,A,le]),$o=Go(Fe=>{G.current={...ch},le(!1),se({type:"REPLACE_STATE",state:Fe})},[se,le]),kt=Go(({blockType:Fe,path:Ve,rowIndex:Ot,subFieldState:gt})=>{let At=Je(Ve)||[],wt=Ot===void 0?At.length:Ot;se({type:"ADD_ROW",blockType:Fe,path:Ve,rowIndex:wt,subFieldState:gt}),le(!0)},[se,Je,le]),br=Go(({moveFromIndex:Fe,moveToIndex:Ve,path:Ot})=>{se({type:"MOVE_ROW",moveFromIndex:Fe,moveToIndex:Ve,path:Ot}),le(!0)},[se,le]),De=Go(({path:Fe,rowIndex:Ve})=>{se({type:"REMOVE_ROW",path:Fe,rowIndex:Ve}),le(!0)},[se,le]),We=Go(({blockType:Fe,path:Ve,rowIndex:Ot,subFieldState:gt})=>{let At=Je(Ve),wt=Ot===void 0?At.length:Ot;se({type:"REPLACE_ROW",blockType:Fe,path:Ve,rowIndex:wt,subFieldState:gt}),le(!0)},[se,Je,le]);pa(()=>{let Fe=ie.current;return()=>{Tr(Fe)}},[]),pa(()=>{y!==void 0&&re(y)},[y]),G.current.submit=te,G.current.getFields=pe,G.current.getField=be,G.current.getData=ot,G.current.getSiblingData=je,G.current.getDataByPath=Je,G.current.validateForm=ge,G.current.createFormData=Rt,G.current.setModified=le,G.current.setProcessing=xe,G.current.setBackgroundProcessing=he,G.current.setSubmitted=X,G.current.setIsValid=Z,G.current.disabled=W,G.current.setDisabled=Y,G.current.formRef=we,G.current.reset=Xt,G.current.replaceState=$o,G.current.dispatchFields=se,G.current.addFieldRow=kt,G.current.removeFieldRow=De,G.current.moveFieldRow=br,G.current.replaceFieldRow=We,G.current.uuid=S,G.current.initializing=J,G.current.isValid=ne,pa(()=>{K(!0)},[]),pa(()=>{typeof f=="boolean"&&Y(f)},[f]),pa(()=>{typeof F=="boolean"&&X(F)},[F]),pa(()=>{b&&(G.current={...ch},se({type:"REPLACE_STATE",optimize:!1,sanitize:!0,state:b}))},[b,se]),zi(()=>{E()},15e3,[de]);let ce=Qe(()=>{G.current={...G.current},le(!1)});pa(()=>{ce()},[A]);let ke=[d,pz].filter(Boolean).join(" "),Pe=Qe(Fe=>{$(async()=>{if(Array.isArray(v)){let Ve;for(let Ot of v)Ve=await Ot({formState:$D(de,{excludeFiles:!0}),submitted:Fe});se({type:"MERGE_SERVER_STATE",prevStateRef:ee,serverState:Ve})}})});H0(()=>{(Q.current||!jD(de,ee.current))&&Oe&&Pe(U),ee.current=de,Q.current=!1},[Oe,U,de],250);let qe=C?Jm:mz.Fragment,ct=C?{value:G.current}:{};return wn(h||"form",{action:typeof l=="function"?void 0:l,className:ke,"data-form-ready":!me&&z&&!J,method:D,noValidate:!0,onSubmit:Fe=>{G.current.submit({},Fe)},ref:we,children:wn(qe,{...ct,children:wn(Zm,{value:G.current,children:wn(qm,{value:{fields:de,...G.current},children:wn(Qm,{value:U,children:wn(Nb,{value:!z||z&&J,children:wn(Km,{value:me,children:wn(Eb,{value:_e,children:wn(ef,{value:Oe,children:wn(Mc.Provider,{value:fe,children:u})})})})})})})})})})};import{c as hz}from"react/compiler-runtime";import{jsx as MD,jsxs as OD}from"react/jsx-runtime";import{getTranslation as gz}from"@payloadcms/translations";import{tabHasName as VD}from"payload/shared";import bz,{useState as vz}from"react";var uh="tabs-field__tab-button",Y0=t=>{let e=hz(12),{hidden:o,isActive:n,parentPath:r,setIsActive:s,tab:i}=t,{i18n:a}=N(),[l,c]=vz(void 0),u;if(e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==i){let d=[...r?r.split(".").slice(0,-1):[],...VD(i)?[i.name]:[]],f=l>0,m=MD(qi,{fields:i.fields,path:d,setErrorCount:c}),p=f&&`${uh}--has-error`,h=n&&`${uh}--active`,g=o&&`${uh}--hidden`,b;e[8]!==p||e[9]!==h||e[10]!==g?(b=[uh,p,h,g].filter(Boolean),e[8]=p,e[9]=h,e[10]=g,e[11]=b):b=e[11],u=OD(bz.Fragment,{children:[m,OD("button",{className:b.join(" "),onClick:s,type:"button",children:[i.label?gz(i.label,a):VD(i)?i.name:"",f&&MD(Io,{count:l,i18n:a})]})]}),e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=s,e[6]=i,e[7]=u}else u=e[7];return u};var Is="tabs-field";var Sz=t=>{let e=zD(44),{field:o,forceRender:n,indexPath:r,parentPath:s,parentSchemaPath:i,path:a,permissions:l,readOnly:c,schemaPath:u}=t,{admin:d,tabs:f}=o,m;e[0]!==d?(m=d===void 0?{}:d,e[0]=d,e[1]=m):m=e[1];let{className:p}=m,h;e[2]!==f?(h=f===void 0?[]:f,e[2]=f,e[3]=h):h=e[3];let g=h,b=n===void 0?!1:n,C=r===void 0?"":r,y=s===void 0?"":s,v=i===void 0?"":i,x=a===void 0?"":a,I=u===void 0?"":u,{getPreference:w,setPreference:F}=so(),{preferencesKey:S}=Se(),{i18n:R}=N(),{isWithinCollapsible:D}=Zs(),_;e[4]!==g?(_=J=>{let[re]=J;return g.map((me,xe)=>{let _e=me?.id;return{index:xe,passesCondition:re?.[_e]?.passesCondition??!0,tab:me}})},e[4]=g,e[5]=_):_=e[5];let T=Vt(_),A;e[6]!==T?(A=()=>T.filter(_z)?.[0]?.index??0,e[6]=T,e[7]=A):A=e[7];let[L,P]=wz(A),E=`tabs-${C}`,B=T[L],k=B?.tab,$=k?.admin?.description??k?.description,j=typeof $=="function"?$({i18n:R,t:R.t}):$,M=T.some(Tz),O;e[8]!==w||e[9]!==x||e[10]!==S||e[11]!==F||e[12]!==E?(O=async J=>{P(J);let re=await w(S);S&&F(S,{...re,...x?{fields:{...re?.fields||{},[x]:{...re?.fields?.[x],tabIndex:J}}}:{fields:{...re?.fields,[E]:{...re?.fields?.[E],tabIndex:J}}}})},e[8]=w,e[9]=x,e[10]=S,e[11]=F,e[12]=E,e[13]=O):O=e[13];let V=O,W;e[14]!==w||e[15]!==x||e[16]!==S||e[17]!==T.length||e[18]!==E?(W=()=>{S&&(async()=>{let re=await w(S),me=x?re?.fields?.[x]?.tabIndex:re?.fields?.[E]?.tabIndex,xe=typeof me=="number"&&me<T.length?me:0;P(xe)})()},e[14]=w,e[15]=x,e[16]=S,e[17]=T.length,e[18]=E,e[19]=W):W=e[19];let Y;e[20]!==w||e[21]!==y||e[22]!==v||e[23]!==x||e[24]!==S||e[25]!==g||e[26]!==E?(Y=[x,w,S,E,g,y,v],e[20]=w,e[21]=y,e[22]=v,e[23]=x,e[24]=S,e[25]=g,e[26]=E,e[27]=Y):Y=e[27],GD(W,Y);let z;e[28]!==B?.passesCondition||e[29]!==V||e[30]!==T?(z=()=>{if(B?.passesCondition===!1){let J=T.find(Fz);J&&V(J.index)}},e[28]=B?.passesCondition,e[29]=V,e[30]=T,e[31]=z):z=e[31];let K;e[32]!==B||e[33]!==V||e[34]!==T?(K=[B,T,V],e[32]=B,e[33]=V,e[34]=T,e[35]=K):K=e[35],GD(z,K);let U=D&&`${Is}--within-collapsible`,X=!M&&`${Is}--hidden`,ne;e[36]!==p||e[37]!==U||e[38]!==X?(ne=[Ae,p,Is,U,X].filter(Boolean),e[36]=p,e[37]=U,e[38]=X,e[39]=ne):ne=e[39];let Z;return e[40]!==L||e[41]!==V||e[42]!==x?(Z=J=>{let{index:re,passesCondition:me,tab:xe}=J;return Ss(Y0,{hidden:!me,isActive:L===re,parentPath:x,setIsActive:()=>{V(re)},tab:xe},re)},e[40]=L,e[41]=V,e[42]=x,e[43]=Z):Z=e[43],Ss("div",{className:ne.join(" "),children:WD(Yv,{children:[Ss("div",{className:`${Is}__tabs-wrap`,children:Ss("div",{className:`${Is}__tabs`,children:T.map(Z)})}),Ss("div",{className:`${Is}__content-wrap`,children:k&&Ss(Iz,{description:j,field:k,forceRender:b,hidden:!1,parentIndexPath:C,parentPath:x,parentSchemaPath:I,path:x,permissions:l&&typeof l=="object"&&"name"in k?l[k.name]&&typeof l[k.name]=="object"&&"fields"in l[k.name]?l[k.name].fields:l[k.name]:l,readOnly:c,tabIndex:L})})]})})},md=ze(Sz);function Iz(t){let e=zD(21),{description:o,field:n,forceRender:r,hidden:s,label:i,parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:u,readOnly:d,tabIndex:f}=t,{i18n:m}=N(),{customComponents:p}=Te(),h,g;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==m||e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==p||e[12]!==f){g=Symbol.for("react.early_return_sentinel");e:{let{AfterInput:b,BeforeInput:C,Description:y,Field:v}=p===void 0?{}:p;if(v){g=v;break e}let{indexPath:x,path:I,schemaPath:w}=Cz({field:n,index:f,parentIndexPath:a,parentPath:l,parentSchemaPath:c}),F=s&&`${Is}__tab--hidden`,S;e[15]!==m||e[16]!==i?(S=i&&`${Is}__tabConfigLabel-${xz(yz(i,m))}`,e[15]=m,e[16]=i,e[17]=S):S=e[17];let R;e[18]!==F||e[19]!==S?(R=[F,`${Is}__tab`,S].filter(Boolean),e[18]=F,e[19]=S,e[20]=R):R=e[20],h=WD("div",{className:R.join(" "),children:[Ss(ue,{CustomComponent:y,Fallback:Ss(Xe,{description:o,marginPlacement:"bottom",path:l})}),C,Ss(Lo,{fields:n.fields,forceRender:r,parentIndexPath:x,parentPath:I,parentSchemaPath:w,permissions:u,readOnly:d}),b]})}e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=m,e[5]=i,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=g}else h=e[13],g=e[14];return g!==Symbol.for("react.early_return_sentinel")?g:h}function _z(t){let{passesCondition:e}=t;return e}function Tz(t){let{passesCondition:e}=t;return e}function Fz(t){let{passesCondition:e}=t;return e}import{jsx as Ez}from"react/jsx-runtime";import{useCallback as UD,useEffect as Nz,useMemo as Lz,useState as kz}from"react";import{c as Dz}from"react/compiler-runtime";import{jsx as si,jsxs as HD}from"react/jsx-runtime";import{getTranslation as Rz}from"@payloadcms/translations";import"react";var fd=t=>{let e=Dz(32),{AfterInput:o,BeforeInput:n,className:r,Description:s,description:i,Error:a,hasMany:l,htmlAttributes:c,inputRef:u,Label:d,label:f,localized:m,maxRows:p,onChange:h,onKeyDown:g,path:b,placeholder:C,readOnly:y,required:v,rtl:x,showError:I,style:w,value:F,valueToRender:S}=t,{i18n:R,t:D}=N(),_=Pz,T;if(e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==a||e[4]!==d||e[5]!==r||e[6]!==i||e[7]!==l||e[8]!==c||e[9]!==R||e[10]!==u||e[11]!==f||e[12]!==m||e[13]!==p||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==C||e[18]!==y||e[19]!==v||e[20]!==x||e[21]!==I||e[22]!==w||e[23]!==D||e[24]!==F||e[25]!==S){let A=Rz(C,R),L=I&&"error",P=y&&"read-only",E=l&&"has-many",B;e[27]!==r||e[28]!==L||e[29]!==P||e[30]!==E?(B=[Ae,"text",r,L,P,E].filter(Boolean),e[27]=r,e[28]=L,e[29]=P,e[30]=E,e[31]=B):B=e[31],T=HD("div",{className:B.join(" "),style:w,children:[si(ue,{CustomComponent:d,Fallback:si(Ce,{label:f,localized:m,path:b,required:v})}),HD("div",{className:`${Ae}__wrap`,children:[si(ue,{CustomComponent:a,Fallback:si(Ze,{path:b,showError:I})}),n,l?si(pt,{className:`field-${b.replace(/\./g,"__")}`,components:{DropdownIndicator:null},customProps:{editableProps:_},disabled:y,filterOption:()=>p?!(Array.isArray(F)&&p&&F.length>=p):!0,isClearable:!1,isCreatable:!0,isMulti:!0,isSortable:!0,menuIsOpen:!1,noOptionsMessage:()=>Array.isArray(F)&&F.length>=p?D("validation:limitReached",{max:p,value:F.length+1}):null,onChange:h,options:[],placeholder:A,showError:I,value:S}):si("input",{"data-rtl":x,disabled:y,id:`field-${b?.replace(/\./g,"__")}`,name:b,onChange:h,onKeyDown:g,placeholder:A,ref:u,type:"text",value:F||"",...c??{}}),o,si(ue,{CustomComponent:s,Fallback:si(Xe,{description:i,path:b})})]})]}),e[0]=o,e[1]=n,e[2]=s,e[3]=a,e[4]=d,e[5]=r,e[6]=i,e[7]=l,e[8]=c,e[9]=R,e[10]=u,e[11]=f,e[12]=m,e[13]=p,e[14]=h,e[15]=g,e[16]=b,e[17]=C,e[18]=y,e[19]=v,e[20]=x,e[21]=I,e[22]=w,e[23]=D,e[24]=F,e[25]=S,e[26]=T}else T=e[26];return T};function Az(t){t.currentTarget.contentEditable="false"}function Pz(t,e,o){let n=`${e}--editable`;return{onBlur:Az,onClick:r=>{r.currentTarget.contentEditable="true",r.currentTarget.classList.add(n),r.currentTarget.focus()},onKeyDown:r=>{if(!r.nativeEvent.isComposing&&(r.key==="Enter"||r.key==="Tab"||r.key==="Escape")){if(r.currentTarget.contentEditable="false",r.currentTarget.classList.remove(n),t.value.value=r.currentTarget.innerText,t.label=r.currentTarget.innerText,t.value.value.replaceAll(`
54
54
  `,""))o.onChange(o.value,{action:"create-option",option:t});else if(Array.isArray(o.value)){let s=o.value.filter(i=>i.id!==t.id);o.onChange(s,{action:"pop-value",removedValue:t})}r.preventDefault()}r.stopPropagation()}}}var jz=t=>{let{field:e,field:{admin:{autoComplete:o,className:n,description:r,placeholder:s,rtl:i}={},hasMany:a,label:l,localized:c,maxLength:u,maxRows:d,minLength:f,minRows:m,required:p},inputRef:h,path:g,readOnly:b,validate:C}=t,y=ye(),{config:{localization:v}}=H(),x=UD((j,M)=>{if(typeof C=="function")return C(j,{...M,maxLength:u,minLength:f,required:p})},[C,f,u,p]),{customComponents:{AfterInput:I,BeforeInput:w,Description:F,Error:S,Label:R}={},disabled:D,path:_,setValue:T,showError:A,value:L}=Te({potentiallyStalePath:g,validate:x}),P=bl({fieldLocalized:c,fieldRTL:i,locale:y,localizationConfig:v||void 0}),[E,B]=kz([]),k=UD(j=>{if(!(b||D)){let M;j?Array.isArray(j)?M=j.map(O=>O.value?.value||O.value):M=[j.value?.value||j.value]:M=[],T(M)}},[b,T,D]);Nz(()=>{a&&Array.isArray(L)&&B(L.map((j,M)=>({id:`${j}${M}`,label:`${j}`,value:{toString:()=>`${j}${M}`,value:j?.value||j}})))},[L,a]);let $=Lz(()=>et(e),[e]);return Ez(fd,{AfterInput:I,BeforeInput:w,className:n,Description:F,description:r,Error:S,hasMany:a,htmlAttributes:{autoComplete:o||void 0},inputRef:h,Label:R,label:l,localized:c,maxRows:d,minRows:m,onChange:a?k:j=>{T(j.target.value)},path:_,placeholder:s,readOnly:b||D,required:p,rtl:P,showError:A,style:$,value:L||"",valueToRender:E})},ga=ze(jz);import{jsx as Mz}from"react/jsx-runtime";import{getTranslation as Oz}from"@payloadcms/translations";import{useCallback as Vz,useMemo as Gz}from"react";import{c as $z}from"react/compiler-runtime";import{jsx as ii,jsxs as XD}from"react/jsx-runtime";import{getTranslation as Bz}from"@payloadcms/translations";import"react";var Z0=t=>{let e=$z(26),{AfterInput:o,BeforeInput:n,className:r,Description:s,description:i,Error:a,Label:l,label:c,localized:u,onChange:d,path:f,placeholder:m,readOnly:p,required:h,rows:g,rtl:b,showError:C,style:y,value:v}=t,{i18n:x}=N(),I=C&&"error",w=p&&"read-only",F;e[0]!==r||e[1]!==I||e[2]!==w?(F=[Ae,"textarea",r,I,w].filter(Boolean),e[0]=r,e[1]=I,e[2]=w,e[3]=F):F=e[3];let S=F.join(" "),R=`field-${f.replace(/\./g,"__")}`,D;return e[4]!==o||e[5]!==n||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==i||e[10]!==x||e[11]!==c||e[12]!==u||e[13]!==d||e[14]!==f||e[15]!==m||e[16]!==p||e[17]!==h||e[18]!==g||e[19]!==b||e[20]!==C||e[21]!==y||e[22]!==S||e[23]!==R||e[24]!==v?(D=XD("div",{className:S,style:y,children:[ii(ue,{CustomComponent:l,Fallback:ii(Ce,{htmlFor:R,label:c,localized:u,path:f,required:h})}),XD("div",{className:`${Ae}__wrap`,children:[ii(ue,{CustomComponent:a,Fallback:ii(Ze,{path:f,showError:C})}),n,ii("div",{className:"textarea-outer",children:ii("textarea",{"data-rtl":b,disabled:p,id:`field-${f.replace(/\./g,"__")}`,name:f,onChange:d,placeholder:Bz(m,x),rows:g,style:{"--rows":g},value:v||""})}),o,ii(ue,{CustomComponent:s,Fallback:ii(Xe,{description:i,path:f})})]})]}),e[4]=o,e[5]=n,e[6]=s,e[7]=a,e[8]=l,e[9]=i,e[10]=x,e[11]=c,e[12]=u,e[13]=d,e[14]=f,e[15]=m,e[16]=p,e[17]=h,e[18]=g,e[19]=b,e[20]=C,e[21]=y,e[22]=S,e[23]=R,e[24]=v,e[25]=D):D=e[25],D};var zz=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,rows:s,rtl:i}={},label:a,localized:l,maxLength:c,minLength:u,required:d},path:f,readOnly:m,validate:p}=t,{i18n:h}=N(),{config:{localization:g}}=H(),b=ye(),C=bl({fieldLocalized:l,fieldRTL:i,locale:b,localizationConfig:g||void 0}),y=Vz((L,P)=>{if(typeof p=="function")return p(L,{...P,maxLength:c,minLength:u,required:d})},[p,d,c,u]),{customComponents:{AfterInput:v,BeforeInput:x,Description:I,Error:w,Label:F}={},disabled:S,path:R,setValue:D,showError:_,value:T}=Te({potentiallyStalePath:f,validate:y}),A=Gz(()=>et(e),[e]);return Mz(Z0,{AfterInput:v,BeforeInput:x,className:o,Description:I,description:n,Error:w,Label:F,label:a,localized:l,onChange:L=>{D(L.target.value)},path:R,placeholder:Oz(r,h),readOnly:m||S,required:d,rows:s,rtl:C,showError:_,style:A,value:T})},pd=ze(zz);var hd=()=>null;import{jsx as RA}from"react/jsx-runtime";import AA,{useMemo as SU}from"react";import{c as vA}from"react/compiler-runtime";import{jsx as Ts,jsxs as tU}from"react/jsx-runtime";import{validateMimeType as oU}from"payload/shared";import Pr,{useEffect as rU}from"react";import{c as Wz}from"react/compiler-runtime";import{jsx as Hz}from"react/jsx-runtime";import{createContext as Uz,use as Xz,useState as J0}from"react";var YD=Uz(void 0),Zl=t=>{let e=Wz(5),{children:o}=t,[n,r]=J0(null),[s,i]=J0(""),[a,l]=J0(null),c;return e[0]!==o||e[1]!==a||e[2]!==n||e[3]!==s?(c=Hz(YD,{value:{setUploadControlFile:l,setUploadControlFileName:r,setUploadControlFileUrl:i,uploadControlFile:a,uploadControlFileName:n,uploadControlFileUrl:s},children:o}),e[0]=o,e[1]=a,e[2]=n,e[3]=s,e[4]=c):c=e[4],c},q0=()=>{let t=Xz(YD);if(!t)throw new Error("useUploadControls must be used within an UploadControlsProvider");return t};import{jsx as mh,jsxs as Q0}from"react/jsx-runtime";import eW from"react";import{jsx as Yz}from"react/jsx-runtime";import ai from"react";var ZD=t=>{t.preventDefault(),t.stopPropagation()},Zz="dropzone";function ba({children:t,className:e,disabled:o=!1,dropzoneStyle:n="default",multipleFiles:r,onChange:s}){let i=ai.useRef(null),[a,l]=ai.useState(!1),c=ai.useCallback(h=>{if(!r&&h.length>1){let g=new DataTransfer;g.items.add(h[0]),s(g.files)}else s(h)},[r,s]),u=ai.useCallback(h=>{h.preventDefault(),h.stopPropagation(),h.clipboardData.files&&h.clipboardData.files.length>0&&c(h.clipboardData.files)},[c]),d=ai.useCallback(h=>{h.preventDefault(),h.stopPropagation(),l(!0)},[]),f=ai.useCallback(h=>{h.preventDefault(),h.stopPropagation(),l(!1)},[]),m=ai.useCallback(h=>{if(h.preventDefault(),h.stopPropagation(),l(!1),h.dataTransfer.files&&h.dataTransfer.files.length>0){c(h.dataTransfer.files),l(!1);try{h.dataTransfer.clearData()}catch{}}},[c]);ai.useEffect(()=>{let h=i.current;return h&&!o?(h.addEventListener("dragenter",d),h.addEventListener("dragleave",f),h.addEventListener("dragover",ZD),h.addEventListener("drop",m),h.addEventListener("paste",u),()=>{h.removeEventListener("dragenter",d),h.removeEventListener("dragleave",f),h.removeEventListener("dragover",ZD),h.removeEventListener("drop",m),h.removeEventListener("paste",u)}):()=>null},[o,d,f,m,u]);let p=[Zz,e,a?"dragging":"",`dropzoneStyle--${n}`].filter(Boolean).join(" ");return Yz("div",{className:p,ref:i,children:t})}import{jsx as qD,jsxs as Qz}from"react/jsx-runtime";import"react";import{c as Jz}from"react/compiler-runtime";import{jsx as JD}from"react/jsx-runtime";import"react";var qz="drawer-close-button";function dh(t){let e=Jz(3),{onClick:o}=t,{t:n}=N(),r;return e[0]!==o||e[1]!==n?(r=JD("button",{"aria-label":n("general:close"),className:qz,onClick:o,type:"button",children:JD(vt,{})}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r}var Kz="bulk-upload--drawer-header";function li({onClose:t,title:e}){return Qz("div",{className:Kz,children:[qD("h2",{title:e,children:e}),qD(dh,{onClick:t})]})}var fh="bulk-upload--add-files";function ph({acceptMimeTypes:t,onCancel:e,onDrop:o}){let{t:n}=N(),r=eW.useRef(null);return Q0("div",{className:fh,children:[mh(li,{onClose:e,title:n("upload:addFiles")}),mh("div",{className:`${fh}__dropArea`,children:Q0(ba,{multipleFiles:!0,onChange:o,children:[mh(oe,{buttonStyle:"subtle",iconPosition:"left",onClick:()=>{r.current&&r.current.click()},size:"small",children:n("upload:selectFile")}),mh("input",{accept:t,"aria-hidden":"true",className:`${fh}__hidden-input`,hidden:!0,multiple:!0,onChange:s=>{s.target.files&&s.target.files.length>0&&o(s.target.files)},ref:r,type:"file"}),Q0("p",{className:`${fh}__dragAndDropText`,children:[n("general:or")," ",n("upload:dragAndDrop")]})]})})]})}import{c as QH}from"react/compiler-runtime";import{jsx as kd,jsxs as hy}from"react/jsx-runtime";import{getTranslation as KH}from"@payloadcms/translations";import{reduceFieldsToValues as eU}from"payload/shared";import"react";import{c as mR}from"react/compiler-runtime";import{jsx as Sn,jsxs as bd}from"react/jsx-runtime";import"react";import{c as yW}from"react/compiler-runtime";import{jsx as yh,jsxs as CW}from"react/jsx-runtime";import"react";import{jsx as oW,jsxs as rW}from"react/jsx-runtime";import{formatAdminURL as nW}from"payload/shared";import*as hh from"qs-esm";import _t from"react";var QD=Ri(z0(),1);import{reduceFieldsToValues as tW}from"payload/shared";async function KD(t={},e={},o,n){let r=tW(t,!0),s=r?.file;if(s&&delete r.file,s&&typeof n=="function"){let l=s.name,c=await n({file:s,updateFilename:u=>{l=u}});s=JSON.stringify({clientUploadContext:c,collectionSlug:o,filename:l,mimeType:s.type,size:s.size})}let i={...r,...e},a={_payload:JSON.stringify(i),file:s};return(0,QD.serialize)(a,{indices:!0,nullsAsUndefineds:!1})}function eR(t,e){switch(e.type){case"ADD_FORMS":{let o=[];for(let n=0;n<e.forms.length;n++)o[n]={errorCount:0,formID:e.forms[n].formID??(crypto.randomUUID?crypto.randomUUID():fn()),formState:{...e.forms[n].initialState||{},file:{initialValue:e.forms[n].file,valid:!0,value:e.forms[n].file}},uploadEdits:{}};return{...t,activeIndex:0,forms:[...o,...t.forms]}}case"REMOVE_FORM":{let o=[...t.forms],[n]=o.splice(e.index,1),r=t.activeIndex>=e.index,s=t.activeIndex===e.index?e.index:r?t.activeIndex-1:t.activeIndex,i=Math.min(o.length-1,s);return{...t,activeIndex:r?i:t.activeIndex,forms:o,totalErrorCount:t.totalErrorCount-n.errorCount}}case"REPLACE":return{...t,...e.state};case"SET_ACTIVE_INDEX":return{...t,activeIndex:e.index};case"UPDATE_ERROR_COUNT":{let o=[...t.forms];return o[e.index].errorCount=e.count,{...t,forms:o,totalErrorCount:o.reduce((n,r)=>n+r.errorCount,0)}}case"UPDATE_FORM":{let o=[...t.forms];return o[e.index].errorCount=e.errorCount,o[e.index]={...o[e.index],formState:{...o[e.index].formState,...e.formState},uploadEdits:{...o[e.index].uploadEdits,...e.uploadEdits}},{...t,forms:o,totalErrorCount:o.reduce((n,r)=>n+r.errorCount,0)}}default:return t}}var tR=_t.createContext({activeIndex:0,addFiles:()=>Promise.resolve(),bulkUpdateForm:()=>null,collectionSlug:"",docPermissions:void 0,documentSlots:{},forms:[],getFormDataRef:{current:()=>({})},hasPublishPermission:!1,hasSavePermission:!1,hasSubmitted:!1,isInitializing:!1,removeFile:()=>{},saveAllDocs:()=>Promise.resolve(),setActiveIndex:()=>0,setFormTotalErrorCount:()=>{},totalErrorCount:0,updateUploadEdits:()=>{}}),sW={activeIndex:0,forms:[],totalErrorCount:0};function oR({children:t}){let{config:e}=H(),{routes:{api:o}}=e,{code:n}=ye(),{i18n:r,t:s}=N(),{getDocumentSlots:i,getFormState:a}=Lt(),{getUploadHandler:l}=cd(),[c,u]=_t.useState({}),[d,f]=_t.useState(!1),[m,p]=_t.useState(),[h,g]=_t.useState(!1),[b,C]=_t.useState(!1),[y,v]=_t.useState(!1),[x,I]=_t.useState(!1),[w,F]=_t.useState(!1),[S,R]=_t.useReducer(eR,sW),{activeIndex:D,forms:_,totalErrorCount:T}=S,A=_t.useRef(_);A.current=_;let{toggleLoadingOverlay:L}=$p(),{closeModal:P}=ae(),{collectionSlug:E,drawerSlug:B,initialFiles:k,initialForms:$,onSuccess:j,setInitialFiles:M,setInitialForms:O,setSuccessfullyUploaded:V}=Wo(),[W,Y]=_t.useState(!1),[z,K]=_t.useState(""),U=_t.useRef(!1),X=_t.useRef(null),ne=_t.useRef(()=>({})),Z=nW({apiRoute:o,path:""}),J=`${Z}/${E}`,re=_t.useCallback(async()=>{let G={locale:n||void 0},ie=`/${E}/access`,fe=await(await fetch(`${Z}${ie}?${hh.stringify(G)}`,{credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"post"})).json(),de=await fetch(`${Z}${ie}?${hh.stringify(G)}`,{body:JSON.stringify({_status:"published"}),credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"POST"}).then(se=>se.json());p(fe),g(tu({collectionSlug:E,docPermissions:fe,isEditing:!1})),C(de?.update),I(!0)},[Z,n,E,r.language]),me=_t.useCallback(async G=>{G?.signal&&G.abort("aborting previous fetch for initial form state without files");let ie=await i({collectionSlug:E});u(ie);try{let{state:Q}=await a({collectionSlug:E,docPermissions:m,docPreferences:{fields:{}},locale:n,operation:"create",renderAllFields:!0,schemaPath:E,skipValidation:!0});X.current=Q,v(!0)}catch{}},[i,E,a,m,n]),xe=_t.useCallback(G=>{let ie=ne.current();R({type:"REPLACE",state:{activeIndex:G,forms:_.map((Q,fe)=>fe===D?{errorCount:Q.errorCount,formID:Q.formID,formState:ie,uploadEdits:Q.uploadEdits}:Q)}})},[_,D]),_e=_t.useCallback(async G=>{_.length&&R({type:"UPDATE_FORM",errorCount:_[D].errorCount,formState:ne.current(),index:D}),L({isLoading:!0,key:"addingDocs"}),y||await me(),R({type:"ADD_FORMS",forms:Array.from(G).map(ie=>({file:ie,initialState:X.current}))}),L({isLoading:!1,key:"addingDocs"})},[me,y,L,D,_]),Be=Qe(_e),Me=Qe(async G=>{L({isLoading:!0,key:"addingDocs"}),y||await me(),R({type:"ADD_FORMS",forms:G.map(ie=>({...ie,initialState:ie?.initialState||X.current}))}),L({isLoading:!1,key:"addingDocs"})}),Ue=_t.useCallback(G=>{R({type:"REMOVE_FORM",index:G})},[]),he=_t.useCallback(({errorCount:G,index:ie})=>{R({type:"UPDATE_ERROR_COUNT",count:G,index:ie})},[]),Oe=_t.useCallback(async({overrides:G}={})=>{let ie=ne.current(),Q=[..._];Q[D]={errorCount:Q[D].errorCount,formID:Q[D].formID,formState:ie,uploadEdits:Q[D].uploadEdits};let fe=Q[D]?.formID,de=[];Y(!0);for(let te=0;te<Q.length;te++)try{let pe=Q[te],be=pe.formState?.file?.value;K(s("general:uploadingBulk",{current:te+1,total:Q.length}));let ot=`${J}${hh.stringify({locale:n,uploadEdits:pe?.uploadEdits||void 0},{addQueryPrefix:!0})}`,je=await fetch(ot,{body:await KD(pe.formState,G,E,l({collectionSlug:E})),credentials:"include",method:"POST"}),Je=await je.json();je.status===201&&Je?.doc&&de.push({collectionSlug:E,doc:Je.doc,formID:pe.formID});let[Rt,Xt]=(Je?.errors||[]).reduce(([De,We],ce)=>{let ke=[],Pe=[];return ce?.message&&Pe.push(ce),Array.isArray(ce?.data?.errors)&&ce.data?.errors.forEach(qe=>{qe?.path?ke.push(qe):Pe.push(qe)}),[[...De,...ke],[...We,...Pe]]},[[],[]]),$o=!be&&je.status===400,kt=be&&je.status===413,br=be&&typeof be=="object"&&"name"in be&&(!be.name||be.name==="");if($o||kt||br){Q[te].formState.file.valid=!1;let{state:De}=await a({collectionSlug:E,docPermissions:m,docPreferences:null,formState:Q[te].formState,operation:"update",schemaPath:E});Q[te]={errorCount:Object.values(De).reduce((We,ce)=>ce?.valid===!1?We+1:We,0),formID:Q[te].formID,formState:De},q.error(Xt[0]?.message)}else Q[te]={errorCount:Rt.length,formID:Q[te].formID,formState:dd(Q[te].formState,{type:"ADD_SERVER_ERRORS",errors:Rt})}}catch{}f(!0),K(""),Y(!1);let se=[];Q.forEach(({errorCount:te},pe)=>{te&&se.push(Q[pe])});let ee=Math.max(0,Q.length-se.length),ge=Q.length-ee;ee&&(q.success(`Successfully saved ${ee} files`),V(!0),typeof j=="function"&&j(de,ge)),ge?q.error(`Failed to save ${ge} files`):P(B),R({type:"REPLACE",state:{activeIndex:se.reduce((te,{formID:pe},be)=>pe===fe?be:te,0),forms:se,totalErrorCount:se.reduce((te,{errorCount:pe})=>te+pe,0)}}),se.length===0&&(M(void 0),O(void 0))},[_,D,s,J,n,E,l,a,m,V,j,P,B,M,O]),Ke=_t.useCallback(async(G,ie)=>{for(let Q=0;Q<_.length;Q++)if(Object.entries(G).forEach(([fe,de])=>{_[Q].formState[fe]&&(_[Q].formState[fe].value=de,R({type:"UPDATE_FORM",errorCount:_[Q].errorCount,formState:_[Q].formState,index:Q}))}),typeof ie=="function"&&ie(),d){let{state:fe}=await a({collectionSlug:E,docPermissions:m,docPreferences:null,formState:_[Q].formState,operation:"create",schemaPath:E}),de=Object.values(fe).reduce((se,ee)=>ee?.valid===!1?se+1:se,0);R({type:"UPDATE_FORM",errorCount:de,formState:fe,index:Q})}},[E,m,_,a,d]),le=_t.useCallback(G=>{R({type:"UPDATE_FORM",errorCount:_[D].errorCount,formState:_[D].formState,index:D,uploadEdits:G})},[D,_]),we=_t.useCallback(()=>{R({type:"REPLACE",state:{forms:_.map(G=>({...G,uploadEdits:{}}))}})},[_]);return _t.useEffect(()=>{E&&(y||me(),x||re(),(k||$)&&F(!y||!x),y&&($?.length||k?.length)&&!U.current&&($?.length&&Me($),k?.length&&Be(k),U.current=!0))},[k,me,re,E,y,x,$]),rW(tR,{value:{activeIndex:S.activeIndex,addFiles:_e,bulkUpdateForm:Ke,collectionSlug:E,docPermissions:m,documentSlots:c,forms:_,getFormDataRef:ne,hasPublishPermission:b,hasSavePermission:h,hasSubmitted:d,isInitializing:w,removeFile:Ue,resetUploadEdits:we,saveAllDocs:Oe,setActiveIndex:xe,setFormTotalErrorCount:he,totalErrorCount:T,updateUploadEdits:le},children:[W&&oW(vn,{animationDuration:"250ms",loadingText:z,overlayType:"fullscreen",show:!0}),t]})}function zo(){return _t.use(tR)}import{jsx as Jr,jsxs as K0}from"react/jsx-runtime";import{getTranslation as hW}from"@payloadcms/translations";import{unflatten as lR}from"payload/shared";import gW,{useCallback as ey,useEffect as bW,useMemo as vW,useState as cR}from"react";import{c as uW}from"react/compiler-runtime";import{jsx as aR,jsxs as dW}from"react/jsx-runtime";import{useState as mW}from"react";var rR=t=>{let e=["file","mimeType","thumbnailURL","width","height","filesize","filename","url","focalX","focalY","sizes"];return t.filter(o=>!e.includes("name"in o&&o.name))};import{fieldAffectsData as iW,fieldHasSubFields as aW,fieldIsHiddenOrDisabled as lW,getFieldPermissions as cW}from"payload/shared";import{fieldAffectsData as nR}from"payload/shared";var Jl=(t,e)=>t?nR(e)&&e.name?`${t}.${e.name}`:t:nR(e)?e.name:"";import{jsx as gh,jsxs as sR}from"react/jsx-runtime";import{Fragment as iR}from"react";var gd=({CustomLabel:t,field:e,prefix:o})=>sR(iR,{children:[o?sR(iR,{children:[gh("span",{style:{display:"inline-block"},children:o})," > "]}):null,gh("span",{style:{display:"inline-block"},children:gh(ue,{CustomComponent:t,Fallback:gh(Ce,{label:"label"in e&&e.label})})})]});var bh=({fields:t,formState:e,labelPrefix:o=null,parentPath:n="",path:r="",permissions:s})=>{if(!t)return[];let i=e?.[r]?.customComponents?.Label;return t?.reduce((a,l)=>{let{operation:c,permissions:u,read:d}=cW({field:l,operation:"update",parentName:n?.includes(".")?n.split(".")[n.split(".").length-1]:n,permissions:s});if((iW(l)||l.type==="ui")&&(l.admin?.disableBulkEdit||l.unique||lW(l)||"readOnly"in l&&l.readOnly||!c||!d))return a;if(!(l.type==="array"||l.type==="blocks")&&aW(l))return[...a,...bh({fields:l.fields,labelPrefix:gd({CustomLabel:i,field:l,prefix:o}),parentPath:r,path:Jl(r,l),permissions:u})];if(l.type==="tabs"&&"tabs"in l)return[...a,...l.tabs.reduce((m,p)=>{if("fields"in p){let h="name"in p&&p.name;return[...m,...bh({fields:p.fields,labelPrefix:o,parentPath:r,path:h?Jl(r,l):r,permissions:u})]}},[])];let f={label:gd({CustomLabel:i,field:l,prefix:o}),value:{field:l,fieldPermissions:u,path:Jl(r,l)}};return[...a,f]},[])};var fW="field-select",vh=t=>{let e=uW(14),{fields:o,onChange:n,permissions:r}=t,{t:s}=N(),{dispatchFields:i,getFields:a}=$e(),l;e[0]!==o||e[1]!==a||e[2]!==r?(l=()=>bh({fields:rR(o),formState:a(),permissions:r}),e[0]=o,e[1]=a,e[2]=r,e[3]=l):l=e[3];let[c]=mW(l),u;if(e[4]!==i||e[5]!==a||e[6]!==n||e[7]!==c||e[8]!==s){let d;e[10]!==i||e[11]!==a||e[12]!==n?(d=f=>n({dispatchFields:i,formState:a(),selected:f}),e[10]=i,e[11]=a,e[12]=n,e[13]=d):d=e[13],u=dW("div",{className:fW,children:[aR(Ce,{label:s("fields:selectFieldsToEdit")}),aR(pt,{getOptionValue:pW,isMulti:!0,onChange:d,options:c})]}),e[4]=i,e[5]=a,e[6]=n,e[7]=c,e[8]=s,e[9]=u}else u=e[9];return u};function pW(t){return typeof t.value=="object"&&"path"in t.value?String(t.value.path):String(t.value)}var uR=t=>{let{collection:{fields:e,labels:{plural:o,singular:n}}={},collection:r,drawerSlug:s,forms:i}=t,[a,l]=cR(!1),{permissions:c}=Ie(),{i18n:u,t:d}=N(),{closeModal:f}=ae(),{bulkUpdateForm:m}=zo(),{getFormState:p}=Lt(),h=gW.useRef(null),[g,b]=cR([]),C=c?.collections?.[r.slug],y=vW(()=>lR(g.reduce((w,F)=>(w[F.value.path]=!0,w),{})),[g]),v=ey(async({formState:w,submitted:F})=>{let S=Fr(h),{state:R}=await p({collectionSlug:r.slug,docPermissions:C,docPreferences:null,formState:w,operation:"update",schemaPath:r.slug,select:y,signal:S.signal,skipValidation:!F});return h.current=null,R},[p,r,C,y]);bW(()=>{let w=h.current;return()=>{Tr(w)}},[]);let x=ey(w=>{let F=g.reduce((S,R)=>(w[R.value.path]&&(S[R.value.path]=w[R.value.path].value),S),{});m(F,()=>f(s))},[f,s,m,g]),I=ey(async({dispatchFields:w,formState:F,selected:S})=>{l(!0),b(S||[]);let{state:R}=await p({collectionSlug:r.slug,docPermissions:C,docPreferences:null,formState:F,operation:"update",schemaPath:r.slug,select:lR(S.reduce((D,_)=>(D[_.value.path]=!0,D),{})),skipValidation:!0});w({type:"UPDATE_MANY",formState:R}),l(!1)},[p,r,C]);return K0("div",{className:`${qr}__main`,children:[K0("div",{className:`${qr}__header`,children:[Jr("h2",{className:`${qr}__header__title`,children:d("general:editingLabel",{count:i.length,label:hW(i.length>1?o:n,u)})}),Jr("button",{"aria-label":d("general:close"),className:`${qr}__header__close`,id:`close-drawer__${s}`,onClick:()=>f(s),type:"button",children:Jr(vt,{})})]}),K0(ws,{className:`${qr}__form`,isInitializing:a,onChange:[v],onSubmit:x,children:[Jr(vh,{fields:e,onChange:I,permissions:C.fields}),g.length===0?null:Jr("div",{className:"render-fields",children:Jr(ms,{value:void 0,children:g.map((w,F)=>{let{value:{field:S,fieldPermissions:R,path:D}}=w;return Jr(ql,{clientFieldConfig:S,indexPath:"",parentPath:"",parentSchemaPath:"",path:D,permissions:R},`${D}-${F}`)})})}),Jr("div",{className:`${qr}__sidebar-wrap`,children:Jr("div",{className:`${qr}__sidebar`,children:Jr("div",{className:`${qr}__sidebar-sticky-wrap`,children:Jr("div",{className:`${qr}__document-actions`,children:Jr(oe,{type:"submit",children:d("general:applyChanges")})})})})})]})]})};var qr="edit-many-bulk-uploads",dR=t=>{let e=yW(5),{collection:o,collection:n}=t,{slug:r}=o===void 0?{}:o,{permissions:s}=Ie(),{t:i}=N(),{forms:a}=zo(),c=s?.collections?.[r]?.update,u=`edit-${r}-bulk-uploads`;if(!c)return null;let d;return e[0]!==n||e[1]!==u||e[2]!==a||e[3]!==i?(d=CW("div",{className:qr,children:[yh(cs,{"aria-label":i("general:editAll"),className:`${qr}__toggle`,slug:u,children:i("general:editAll")}),yh(ns,{children:yh(St,{Header:null,slug:u,children:yh(uR,{collection:n,drawerSlug:u,forms:a})})})]}),e[0]=n,e[1]=u,e[2]=a,e[3]=i,e[4]=d):d=e[4],d};var Ql="bulk-upload--actions-bar";function fR(t){let e=mR(15),{collectionConfig:o}=t,{activeIndex:n,forms:r,setActiveIndex:s}=zo(),{t:i}=N(),a=n+1,l;if(e[0]!==n||e[1]!==o||e[2]!==r.length||e[3]!==s||e[4]!==i||e[5]!==a){let c;e[7]!==n||e[8]!==r.length||e[9]!==s?(c=()=>{let d=n-1;d<0?s(r.length-1):s(d)},e[7]=n,e[8]=r.length,e[9]=s,e[10]=c):c=e[10];let u;e[11]!==n||e[12]!==r.length||e[13]!==s?(u=()=>{let d=n+1;d===r.length?s(0):s(d)},e[11]=n,e[12]=r.length,e[13]=s,e[14]=u):u=e[14],l=bd("div",{className:Ql,children:[bd("div",{className:`${Ql}__navigation`,children:[bd("p",{className:`${Ql}__locationText`,children:[Sn("strong",{children:a}),` ${i("general:of")} `,Sn("strong",{children:r.length})]}),bd("div",{className:`${Ql}__controls`,children:[Sn(oe,{"aria-label":i("general:previous"),buttonStyle:"none",onClick:c,type:"button",children:Sn(He,{direction:"left"})}),Sn(oe,{"aria-label":i("general:next"),buttonStyle:"none",onClick:u,type:"button",children:Sn(He,{direction:"right"})})]}),Sn(dR,{collection:o})]}),Sn(ty,{className:`${Ql}__saveButtons`})]}),e[0]=n,e[1]=o,e[2]=r.length,e[3]=s,e[4]=i,e[5]=a,e[6]=l}else l=e[6];return l}function ty(t){let e=mR(12),{className:o}=t,{getEntityConfig:n}=H(),{t:r}=N(),{collectionSlug:s,hasPublishPermission:i,hasSavePermission:a,saveAllDocs:l}=zo(),c;e[0]!==s||e[1]!==n?(c=n({collectionSlug:s}),e[0]=s,e[1]=n,e[2]=c):c=e[2];let u=c,d;e[3]!==o?(d=[`${Ql}__buttons`,o].filter(Boolean),e[3]=o,e[4]=d):d=e[4];let f=d.join(" "),m;return e[5]!==u?.versions?.drafts||e[6]!==i||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==f?(m=bd("div",{className:f,children:[u?.versions?.drafts&&a?Sn(oe,{buttonStyle:"secondary",onClick:()=>{l({overrides:{_status:"draft"}})},children:r("version:saveDraft")}):null,u?.versions?.drafts&&i?Sn(oe,{onClick:()=>{l({overrides:{_status:"published"}})},children:r("version:publish")}):null,!u?.versions?.drafts&&a?Sn(oe,{onClick:()=>{l()},children:r("general:save")}):null]}),e[5]=u?.versions?.drafts,e[6]=i,e[7]=a,e[8]=l,e[9]=r,e[10]=f,e[11]=m):m=e[11],m}import{c as xW}from"react/compiler-runtime";import{jsx as wW}from"react/jsx-runtime";import"react";var vd="bulk-upload--discard-without-saving";function pR(){let t=xW(9),{t:e}=N(),{closeModal:o}=ae(),{drawerSlug:n}=Wo(),r;t[0]!==o?(r=()=>{o(vd)},t[0]=o,t[1]=r):r=t[1];let s=r,i;t[2]!==o||t[3]!==n?(i=()=>{o(n),o(vd)},t[2]=o,t[3]=n,t[4]=i):i=t[4];let a=i,l;return t[5]!==s||t[6]!==a||t[7]!==e?(l=wW(rt,{body:e("general:changesNotSaved"),cancelLabel:e("general:stayOnThisPage"),confirmLabel:e("general:leaveAnyway"),heading:e("general:leaveWithoutSaving"),modalSlug:vd,onCancel:s,onConfirm:a}),t[5]=s,t[6]=a,t[7]=e,t[8]=l):l=t[8],l}import{c as NH}from"react/compiler-runtime";import{jsx as pi,jsxs as LH}from"react/jsx-runtime";import Ld,{useCallback as nA,useEffect as sA,useMemo as kH}from"react";import{jsx as va,jsxs as yR}from"react/jsx-runtime";import{fieldIsSidebar as TW}from"payload/shared";import{useMemo as FW}from"react";import{jsx as bR,jsxs as SW}from"react/jsx-runtime";import{getTranslation as IW}from"@payloadcms/translations";import"react";import{jsx as hR}from"react/jsx-runtime";import"react";function gR({className:t}){return hR("svg",{className:[t,"icon icon--trash"].filter(Boolean).join(" "),fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:hR("path",{d:"M4.1499 6.1H15.8499M14.5499 6.1V15.2C14.5499 15.85 13.8999 16.5 13.2499 16.5H6.7499C6.0999 16.5 5.4499 15.85 5.4499 15.2V6.1M7.3999 6.1V4.8C7.3999 4.15 8.0499 3.5 8.6999 3.5H11.2999C11.9499 3.5 12.5999 4.15 12.5999 4.8V6.1M8.6999 9.35V13.25M11.2999 9.35V13.25",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}var _W="trash-banner",vR=()=>{let{getEntityConfig:t}=H(),{collectionSlug:e}=Se(),o=t({collectionSlug:e}),{labels:n}=o,{i18n:r}=N();return SW("div",{className:_W,children:[bR(gR,{}),bR("p",{children:r.t("general:documentIsTrashed",{label:`${IW(n?.singular,r)}`})})]})};var Vn="document-fields",yd=({AfterFields:t,BeforeFields:e,docPermissions:o,fields:n,forceSidebarWrap:r,isTrashed:s=!1,readOnly:i,schemaPathSegments:a})=>{let{hasSidebarFields:l,mainFields:c,sidebarFields:u}=FW(()=>n.reduce((d,f)=>(TW(f)?(d.sidebarFields.push(f),d.mainFields.push(null),d.hasSidebarFields=!0):(d.mainFields.push(f),d.sidebarFields.push(null)),d),{hasSidebarFields:!1,mainFields:[],sidebarFields:[]}),[n]);return yR("div",{className:[Vn,l?`${Vn}--has-sidebar`:`${Vn}--no-sidebar`,r&&`${Vn}--force-sidebar-wrap`].filter(Boolean).join(" "),children:[va("div",{className:`${Vn}__main`,children:yR(_o,{className:`${Vn}__edit`,children:[s&&va(vR,{}),e,va(Lo,{className:`${Vn}__fields`,fields:c,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:a.join("."),permissions:o?.fields,readOnly:i}),t]})}),l?va("div",{className:`${Vn}__sidebar-wrap`,children:va("div",{className:`${Vn}__sidebar`,children:va("div",{className:`${Vn}__sidebar-fields`,children:va(Lo,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:a.join("."),permissions:o?.fields,readOnly:i})})})}):null]})};import{c as $R}from"react/compiler-runtime";import{jsx as Th,jsxs as uH,Fragment as dH}from"react/jsx-runtime";import{getTranslation as mH}from"@payloadcms/translations";import{formatAdminURL as fH}from"payload/shared";import jR,{useId as pH}from"react";import{jsx as CR}from"react/jsx-runtime";import"react";function Cd({className:t}){return CR("svg",{className:[t,"icon icon--folder"].filter(Boolean).join(" "),fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",children:CR("path",{d:"M13.3333 13.3333C13.6869 13.3333 14.026 13.1929 14.2761 12.9428C14.5261 12.6928 14.6666 12.3536 14.6666 12V5.33333C14.6666 4.97971 14.5261 4.64057 14.2761 4.39052C14.026 4.14048 13.6869 4 13.3333 4H8.06659C7.84359 4.00219 7.62362 3.94841 7.42679 3.84359C7.22996 3.73877 7.06256 3.58625 6.93992 3.4L6.39992 2.6C6.27851 2.41565 6.11323 2.26432 5.91892 2.1596C5.7246 2.05488 5.50732 2.00004 5.28659 2H2.66659C2.31296 2 1.97382 2.14048 1.72378 2.39052C1.47373 2.64057 1.33325 2.97971 1.33325 3.33333V12C1.33325 12.3536 1.47373 12.6928 1.72378 12.9428C1.97382 13.1929 2.31296 13.3333 2.66659 13.3333H13.3333Z",fill:"currentColor"})})}import{c as iy}from"react/compiler-runtime";import{jsx as Ft,jsxs as wd,Fragment as NR}from"react/jsx-runtime";import{getTranslation as LR}from"@payloadcms/translations";import{extractID as QW}from"payload/shared";import Qr from"react";import{jsx as DW}from"react/jsx-runtime";import{useRouter as RW,useSearchParams as AW}from"next/navigation.js";import{extractID as wR,formatAdminURL as Ch,formatFolderOrDocumentItem as PW}from"payload/shared";import*as xd from"qs-esm";import Tt from"react";function xR(t){return t.reduce((e,o)=>(e[o.relationTo]||(e[o.relationTo]=[]),e[o.relationTo].push(o.value.id),e),{})}var SR=Tt.createContext({activeCollectionFolderSlugs:[],allCollectionFolderSlugs:[],allowCreateCollectionSlugs:[],breadcrumbs:[],checkIfItemIsDisabled:()=>!1,clearSelections:()=>{},currentFolder:null,documents:[],dragOverlayItem:void 0,focusedRowIndex:-1,folderCollectionConfig:null,folderCollectionSlug:"",folderFieldName:"folder",folderID:void 0,FolderResultsComponent:null,folderType:void 0,getFolderRoute:()=>"",getSelectedItems:()=>[],isDragging:!1,itemKeysToMove:void 0,moveToFolder:()=>Promise.resolve(void 0),onItemClick:()=>{},onItemKeyPress:()=>{},refineFolderData:()=>{},search:"",selectedFolderCollections:void 0,selectedItemKeys:new Set,setBreadcrumbs:()=>{},setFocusedRowIndex:()=>-1,setIsDragging:()=>!1,sort:"name",subfolders:[]});function ya({activeCollectionFolderSlugs:t,allCollectionFolderSlugs:e=[],allowCreateCollectionSlugs:o,allowMultiSelection:n=!0,baseFolderPath:r,breadcrumbs:s=[],children:i,documents:a,folderFieldName:l,folderID:c,FolderResultsComponent:u,onItemClick:d,search:f,sort:m="name",subfolders:p}){let h=zt(),{config:g}=H(),{routes:b}=g,C=Gr(),{t:y}=N(),v=RW(),{startRouteTransition:x}=Ye(),I=ye(),w=I?I.code:void 0,F=Tt.useRef(new Set),[S,R]=Tt.useState([]),[D,_]=Tt.useState(u||(()=>null)),[T]=Tt.useState(()=>g.collections.find(le=>g.folders&&le.slug===g.folders.slug)),A=T.slug,L=AW(),P=Tt.useMemo(()=>Yt(L),[L]),[E,B]=Tt.useState(P),[k,$]=Tt.useState(!1),[j,M]=Tt.useState(()=>new Set),[O,V]=Tt.useState(-1),[W,Y]=Tt.useState(),[z,K]=Tt.useState(s),U=Tt.useRef(null),X=p.length+a.length,ne=Tt.useCallback(()=>{V(-1),M(new Set),Y(void 0),F.current=new Set},[]),Z=Tt.useCallback((le={})=>{let we="page"in le?le.page:E?.page;return"search"in le&&(we="1"),{...E,...le,locale:w,page:we,relationTo:"relationTo"in le?le.relationTo:E?.relationTo,search:"search"in le?le.search:E?.search,sort:"sort"in le?le.sort:E?.sort??void 0}},[E,w]),J=Tt.useCallback(({query:le,updateURL:we})=>{if(we){let G=Z(le);x(()=>v.replace(`${xd.stringify({...G,relationTo:JSON.stringify(G.relationTo)},{addQueryPrefix:!0})}`)),B(G)}},[Z,v,x]),re=Tt.useCallback(le=>{let we=xd.stringify(Z({page:"1",search:""}),{addQueryPrefix:!0});return Ch({adminRoute:g.routes.admin,path:`${r}${le?`/${le}`:""}${we}`})},[r,g.routes.admin,Z]),me=Tt.useCallback(le=>[...p,...a].find(we=>we.itemKey===le),[a,p]),xe=Tt.useCallback(()=>Array.from(j).reduce((le,we)=>{let G=me(we);return G&&le.push(G),le},[]),[j,me]),_e=Tt.useCallback(({collectionSlug:le,docID:we})=>{C===1?le===A?x(()=>{v.push(re(we)),ne()}):le&&x(()=>{v.push(Ch({adminRoute:g.routes.admin,path:`/collections/${le}/${we}`})),ne()}):ne(),typeof d=="function"&&d(me(`${le}-${we}`))},[ne,g.routes.admin,C,A,re,me,d,v,x]),Be=Tt.useCallback(le=>{let G=[...p,...a].reduce((te,pe,be)=>(j.has(pe.itemKey)&&te.push(be),te),[]);if(G.length===0)return[le];let ie=Math.min(...G),Q=Math.max(...G),fe=le>=ie&&le<=Q,de=le;if(fe)if(le===ie||le===Q)de=le;else{let te=Math.abs(le-ie),pe=Math.abs(le-Q);de=te>=pe?ie:Q}else{let te=Math.abs(le-ie),pe=Math.abs(le-Q);de=te<=pe?ie:Q}let se=Math.min(de,le),ee=Math.max(de,le),ge=Array.from({length:ee-se+1},(te,pe)=>se+pe);return fe?ge:[...new Set([...G,...ge])]},[p,a,j]),Me=Tt.useCallback(({indexes:le})=>{let we=[...p,...a],{newSelectedFolderCollections:G,newSelectedItemKeys:ie}=we.reduce((Q,fe,de)=>(le.includes(de)&&(Q.newSelectedItemKeys.add(fe.itemKey),fe.relationTo===A?fe.value.folderType?.forEach(se=>{Q.newSelectedFolderCollections.includes(se)||Q.newSelectedFolderCollections.push(se)}):Q.newSelectedFolderCollections.includes(fe.relationTo)||Q.newSelectedFolderCollections.push(fe.relationTo)),Q),{newSelectedFolderCollections:[],newSelectedItemKeys:new Set});R(G),M(ie)},[a,A,p]),Ue=Tt.useCallback(({event:le,item:we})=>{let{code:G,ctrlKey:ie,metaKey:Q,shiftKey:fe}=le,de=fe,se=ie||Q,ee=j.has(we.itemKey),ge=[...p,...a],te=ge.findIndex(pe=>pe.itemKey===we.itemKey);switch(G){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":{if(le.preventDefault(),te===-1)break;let be=G==="ArrowLeft"||G==="ArrowUp"?te-1:te+1;if(be<0||be>X-1)return;if(V(be),se)break;if(de&&n){let ot=Be(be);Me({indexes:ot});return}if(!de){let ot=ge[be];M(new Set([ot.itemKey]))}break}case"Enter":{if(j.size===1){V(void 0),_e({collectionSlug:we.relationTo,docID:wR(we.value)});return}break}case"Escape":{ne();break}case"KeyA":{n&&se&&(le.preventDefault(),V(X-1),Me({indexes:Array.from({length:X},(pe,be)=>be)}));break}case"Space":{if(n&&de){le.preventDefault();let pe=[...p,...a];Me({indexes:pe.reduce((be,ot,je)=>{if(ot.itemKey===we.itemKey){if(ee)return be;be.push(je)}else j.has(ot.itemKey)&&be.push(je);return be},[])})}else le.preventDefault(),Me({indexes:ee?[]:[te]});break}case"Tab":{if(n&&de){let pe=te-1;pe<0&&j?.size>0&&V(pe)}else te+1===X&&j.size>0&&V(X-1);break}}},[j,p,a,n,Be,Me,_e,ne,X]),he=Tt.useCallback(({event:le,item:we})=>{let G=!1,ie=le.ctrlKey||le.metaKey,Q=le.shiftKey,fe=j.has(we.itemKey),de=[...p,...a],se=de.findIndex(ee=>ee.itemKey===we.itemKey);if(n&&ie){le.preventDefault();let ee,ge=de.reduce((te,pe,be)=>{if(pe.itemKey===we.itemKey){if(fe&&le.type!=="pointermove")return te;te.push(be),ee=pe.itemKey}else j.has(pe.itemKey)&&te.push(be);return te},[]);Me({indexes:ge}),ee&&Y(me(ee))}else if(n&&Q){if(se!==-1){let ee=Be(se);Me({indexes:ee})}}else if(n&&le.type==="pointermove")fe||Me({indexes:de.reduce((ee,ge,te)=>(ge.itemKey===we.itemKey&&ee.push(te),ee),[])}),Y(me(we.itemKey));else{let ee=Date.now();G=ee-U.current<400&&W?.itemKey===we.itemKey,U.current=ee,G||Me({indexes:fe&&j.size===1?[]:[se]}),Y(me(we.itemKey))}G&&_e({collectionSlug:we.relationTo,docID:wR(we.value)})},[j,p,a,n,W,me,Me,_e,Be]),Oe=Tt.useCallback(async le=>{let{itemsToMove:we,toFolderID:G}=le;if(!we.length)return;if(we.length===1&&we[0].relationTo===A&&we[0].value.id===c){let Q=xd.stringify({depth:0,locale:w},{addQueryPrefix:!0});(await fetch(Ch({apiRoute:b.api,path:`/${A}/${c}${Q}`}),{body:JSON.stringify({[l]:G||null}),credentials:"include",headers:{"content-type":"application/json"},method:"PATCH"})).status!==200&&q.error(y("general:error"))}else for(let[Q,fe]of Object.entries(xR(we))){let de=xd.stringify({depth:0,limit:0,locale:w,where:{id:{in:fe}}},{addQueryPrefix:!0});try{await fetch(Ch({apiRoute:b.api,path:`/${Q}${de}`}),{body:JSON.stringify({[l]:G||null}),credentials:"include",headers:{"content-type":"application/json"},method:"PATCH"})}catch(se){q.error(y("general:error")),console.error(se);continue}}ne()},[c,ne,A,l,b.api,y,w]),Ke=Tt.useCallback(le=>{function we({item:G,selectedFolderCollections:ie}){return!G.value.folderType||Array.isArray(G.value.folderType)&&G.value.folderType.length===0?!1:ie.length===0?!!(G.value.folderType||G.value.folderType.length>0):ie.some(Q=>!G.value.folderType.includes(Q))}if(k)return j.has(le.itemKey)?!0:le.relationTo===A?we({item:le,selectedFolderCollections:S}):!0;if(h?.selectedItemKeys?.size)return h.selectedItemKeys.has(le.itemKey)?!0:le.relationTo===A?we({item:le,selectedFolderCollections:h.selectedFolderCollections}):!0},[S,k,j,A,h?.selectedFolderCollections,h?.selectedItemKeys]);return Tt.useEffect(()=>{u&&_(u)},[u]),DW(SR,{value:{activeCollectionFolderSlugs:t||e,allCollectionFolderSlugs:e,allowCreateCollectionSlugs:o,breadcrumbs:z,checkIfItemIsDisabled:Ke,clearSelections:ne,currentFolder:z?.[z.length-1]?.id!==void 0?PW({folderFieldName:l,isUpload:!1,relationTo:A,useAsTitle:T.admin.useAsTitle,value:z[z.length-1]}):null,documents:a,dragOverlayItem:W,focusedRowIndex:O,folderCollectionConfig:T,folderCollectionSlug:A,folderFieldName:l,folderID:c,FolderResultsComponent:D,folderType:z?.[z.length-1]?.folderType,getFolderRoute:re,getSelectedItems:xe,isDragging:k,itemKeysToMove:h.selectedItemKeys,moveToFolder:Oe,onItemClick:he,onItemKeyPress:Ue,refineFolderData:J,search:f,selectedFolderCollections:S,selectedItemKeys:j,setBreadcrumbs:K,setFocusedRowIndex:V,setIsDragging:$,sort:m,subfolders:p},children:i})}function zt(){let t=Tt.use(SR);if(t===void 0)throw new Error("useFolder must be used within a FolderProvider");return t}import{c as EW}from"react/compiler-runtime";import{jsx as NW}from"react/jsx-runtime";import{usePathname as LW,useRouter as kW}from"next/navigation.js";import{createContext as jW,use as $W,useEffect as IR,useRef as BW}from"react";var _R=jW({cachingEnabled:!0,clearRouteCache:()=>{}}),oy=t=>{let e=EW(17),{cachingEnabled:o,children:n}=t,r=o===void 0?!0:o,s=LW(),i=kW(),a=BW(!1),l;e[0]!==i?(l=()=>{i.refresh()},e[0]=i,e[1]=l):l=e[1];let c=l,u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{let b=()=>{a.current=!0};return window.addEventListener("popstate",b),()=>{window.removeEventListener("popstate",b)}},e[2]=u):u=e[2];let d;e[3]!==i?(d=[i],e[3]=i,e[4]=d):d=e[4],IR(u,d);let f;e[5]!==r||e[6]!==c?(f=b=>{(r||a.current)&&(a.current=!1,c())},e[5]=r,e[6]=c,e[7]=f):f=e[7];let m=Qe(f),p;e[8]!==m||e[9]!==s?(p=()=>{m(s)},e[8]=m,e[9]=s,e[10]=p):p=e[10];let h;e[11]!==s?(h=[s],e[11]=s,e[12]=h):h=e[12],IR(p,h);let g;return e[13]!==r||e[14]!==n||e[15]!==c?(g=NW(_R,{value:{cachingEnabled:r,clearRouteCache:c},children:n}),e[13]=r,e[14]=n,e[15]=c,e[16]=g):g=e[16],g},ht=()=>$W(_R);import{c as OW}from"react/compiler-runtime";import{jsx as xh,jsxs as FR}from"react/jsx-runtime";import"react";import{jsx as TR}from"react/jsx-runtime";import"react";var MW="form-submit",Ar=t=>{let{type:e="submit",buttonId:o,children:n,disabled:r,onClick:s,programmaticSubmit:i,ref:a}=t,l=Or(),c=Lb(),u=Ei(),{disabled:d,submit:f}=$e();return TR("div",{className:MW,children:TR(oe,{ref:a,...t,disabled:!(r||u||l||c||d)?void 0:!0,id:o,onClick:s??(i?()=>{f()}:void 0),type:e,children:n})})};var wh="drawer-action-header",DR=t=>{let e=OW(10),{cancelLabel:o,className:n,onCancel:r,onSave:s,saveLabel:i,title:a}=t,{t:l}=N(),c;e[0]!==n?(c=[wh,n].filter(Boolean),e[0]=n,e[1]=c):c=e[1];let u=c.join(" "),d;return e[2]!==o||e[3]!==r||e[4]!==s||e[5]!==i||e[6]!==l||e[7]!==u||e[8]!==a?(d=xh("div",{className:u,children:FR("div",{className:`${wh}__content`,children:[xh("h1",{className:`${wh}__title`,children:a}),FR("div",{className:`${wh}__actions`,children:[xh(oe,{"aria-label":l("general:cancel"),buttonStyle:"secondary",onClick:r,children:o||l("general:cancel")}),xh(Ar,{"aria-label":l("general:applyChanges"),onClick:s,children:i||l("general:applyChanges")})]})]})}),e[2]=o,e[3]=r,e[4]=s,e[5]=i,e[6]=l,e[7]=u,e[8]=a,e[9]=d):d=e[9],d};import{jsx as VW}from"react/jsx-runtime";import"react";var GW="drawer-content-container";function ry({children:t,className:e}){return VW("div",{className:[GW,e].filter(Boolean).join(" "),children:t})}import{c as zW}from"react/compiler-runtime";import{jsx as Ca,jsxs as WW}from"react/jsx-runtime";import{getTranslation as HW}from"@payloadcms/translations";import ny from"react";var sy="create-new-doc-in-folder";function In(t){let e=zW(24),{buttonLabel:o,buttonSize:n,buttonStyle:r,collectionSlugs:s,folderAssignedCollections:i,onCreateSuccess:a,slugPrefix:l}=t,c=n===void 0?"small":n,u=r===void 0?"pill":r,d=`${l}-new-doc-in-folder-drawer`,{i18n:f}=N(),{closeModal:m,openModal:p}=ae(),{config:h}=H(),{folderCollectionConfig:g,folderCollectionSlug:b,folderFieldName:C,folderID:y}=zt(),v;e[0]!==b?(v={collectionSlug:b},e[0]=b,e[1]=v):v=e[1];let[x,,I]=jt(v),{closeDrawer:w,openDrawer:F}=I,[S,R]=ny.useState(),D;e[2]!==s||e[3]!==h?(D=()=>s.reduce((A,L)=>{let P=h.collections.find(E=>{let{slug:B}=E;return B===L});return P&&A.push(P),A},[]),e[2]=s,e[3]=h,e[4]=D):D=e[4];let[_]=ny.useState(D);if(_.length===0)return null;let T;return e[5]!==x||e[6]!==o||e[7]!==c||e[8]!==u||e[9]!==w||e[10]!==m||e[11]!==s||e[12]!==S||e[13]!==_||e[14]!==i||e[15]!==g.slug||e[16]!==C||e[17]!==y||e[18]!==f||e[19]!==d||e[20]!==a||e[21]!==F||e[22]!==p?(T=WW(ny.Fragment,{children:[_.length===1?Ca(oe,{buttonStyle:u,className:`${sy}__button`,el:"div",onClick:()=>{_[0].slug===g.slug?F():(R(_[0].slug),p(d))},size:c,children:o}):Ca(it,{button:Ca(oe,{buttonStyle:u,className:`${sy}__popup-button`,el:"div",icon:"chevron",size:c,children:o}),buttonType:"default",className:`${sy}__action-popup`,children:Ca(ve.ButtonGroup,{children:_.map((A,L)=>Ca(ve.Button,{onClick:()=>{A.slug===g.slug?F():(R(A.slug),p(d))},children:HW(A.labels.singular,f)},L))})}),S&&Ca(d0,{collectionSlug:S,drawerSlug:d,initialData:{[C]:y},onSave:async A=>{let{doc:L}=A;await a({collectionSlug:S,doc:L}),m(d)},redirectAfterCreate:!1}),s.includes(g.slug)&&Ca(x,{initialData:{[C]:y,folderType:S?i||[S]:i},onSave:async A=>{await a({collectionSlug:g.slug,doc:A.doc}),w()},redirectAfterCreate:!1})]}),e[5]=x,e[6]=o,e[7]=c,e[8]=u,e[9]=w,e[10]=m,e[11]=s,e[12]=S,e[13]=_,e[14]=i,e[15]=g.slug,e[16]=C,e[17]=y,e[18]=f,e[19]=d,e[20]=a,e[21]=F,e[22]=p,e[23]=T):T=e[23],T}import{jsx as RR,jsxs as UW}from"react/jsx-runtime";import XW from"react";var AR="no-results";function ci({Actions:t,Message:e}){return UW("div",{className:AR,children:[e,t&&t.length>0&&RR("div",{className:`${AR}__actions`,children:t.map((o,n)=>RR(XW.Fragment,{children:o},n))})]})}import{jsx as Sh}from"react/jsx-runtime";import"react";var PR=({elements:t,translationString:e})=>{let o=/(<[^>]+>.*?<\/[^>]+>)/g,n=e.split(o);return Sh("span",{children:n.map((r,s)=>{if(t&&r.startsWith("<")&&r.endsWith(">")){let i=r[1],a=t[i];if(a){let l=new RegExp(`<${i}>(.*?)</${i}>`,"g"),c=r.replace(l,(u,d)=>d);return Sh(a,{children:Sh(PR,{translationString:c})},s)}}return r})})},to=({elements:t,i18nKey:e,t:o,variables:n})=>{let r=o(e,n||{});return t?Sh(PR,{elements:t,translationString:r}):r};import{c as YW}from"react/compiler-runtime";import{jsx as _h,jsxs as ZW}from"react/jsx-runtime";import{useDroppable as JW}from"@dnd-kit/core";import"react";var Ih="folderBreadcrumbs";function ER({breadcrumbs:t,className:e}){return _h("div",{className:`${Ih} ${e||""}`.trim(),children:t?.map((o,n)=>ZW("div",{className:`${Ih}__crumb`,children:[o.onClick?_h(xa,{className:`${Ih}__crumb-item`,id:o.id,onClick:o.onClick,children:o.name}):o.name,t.length>0&&n!==t.length-1&&_h(He,{className:`${Ih}__crumb-chevron`,direction:"right"})]},n))})}function xa(t){let e=YW(13),{id:o,children:n,className:r,onClick:s}=t,i=`folder-${o}`,a;e[0]!==o?(a={id:o,type:"folder"},e[0]=o,e[1]=a):a=e[1];let l;e[2]!==i||e[3]!==a?(l={id:i,data:a},e[2]=i,e[3]=a,e[4]=l):l=e[4];let{isOver:c,setNodeRef:u}=JW(l),d=c&&"droppable-button--hover",f;e[5]!==r||e[6]!==d?(f=["droppable-button",r,d].filter(Boolean),e[5]=r,e[6]=d,e[7]=f):f=e[7];let m=f.join(" "),p;return e[8]!==n||e[9]!==s||e[10]!==u||e[11]!==m?(p=_h("button",{className:m,onClick:s,ref:u,type:"button",children:n}),e[8]=n,e[9]=s,e[10]=u,e[11]=m,e[12]=p):p=e[12],p}import{jsx as qW}from"react/jsx-runtime";function dr(){return qW(Cd,{className:"colored-folder-icon"})}var Sd="move-folder-drawer",KW="move-folder-drawer",kR=`${KW}-confirm-move`;function Kl(t){return Ft(St,{gutter:!1,Header:null,slug:t.drawerSlug,children:Ft(eH,{...t})})}function eH(t){let{permissions:e}=Ie(),[o,n]=Qr.useState([]),[r,s]=Qr.useState([]),[i,a]=Qr.useState([]),[l,c]=Qr.useState(null),[u,d]=Qr.useState(!1),[f,m]=Qr.useState(t.fromFolderID||null),p=Qr.useRef(!1),{getFolderResultsComponentAndData:h}=Lt(),g=Qr.useCallback(async b=>{try{let C=await h({browseByFolder:!1,collectionsToDisplay:[t.folderCollectionSlug],displayAs:"grid",folderAssignedCollections:t.folderAssignedCollections,folderID:b,sort:"name"});a(C.breadcrumbs||[]),n(C?.subfolders||[]),s(C?.documents||[]),c(C.FolderResultsComponent||null),m(b),d(!0)}catch{a([]),n([]),s([])}p.current=!0},[h,t.folderAssignedCollections,t.folderCollectionSlug]);return Qr.useEffect(()=>{p.current||g(t.fromFolderID)},[g,t.fromFolderID]),u?Ft(ya,{allCollectionFolderSlugs:[t.folderCollectionSlug],allowCreateCollectionSlugs:e.collections[t.folderCollectionSlug]?.create?[t.folderCollectionSlug]:[],allowMultiSelection:!1,breadcrumbs:i,documents:r,folderFieldName:t.folderFieldName,folderID:f,FolderResultsComponent:l,onItemClick:async b=>{await g(b.value.id)},subfolders:o,children:Ft(tH,{...t,populateMoveToFolderDrawer:g})},f):Ft(vn,{})}function tH(t){let e=iy(34),{drawerSlug:o,fromFolderID:n,fromFolderName:r,itemsToMove:s,onConfirm:i,populateMoveToFolderDrawer:a,skipConfirmModal:l,...c}=t,{clearRouteCache:u}=ht(),{closeModal:d,isModalOpen:f,openModal:m}=ae(),p;e[0]!==s?(p=()=>s.length,e[0]=s,e[1]=p):p=e[1];let[h]=Qr.useState(p),[g,b]=Qr.useState(!1),{i18n:C,t:y}=N(),{breadcrumbs:v,folderCollectionConfig:x,folderCollectionSlug:I,folderFieldName:w,folderID:F,FolderResultsComponent:S,folderType:R,getSelectedItems:D,subfolders:_}=zt(),T;e[2]!==I?(T={collectionSlug:I},e[2]=I,e[3]=T):T=e[3];let[A,,L]=jt(T),{closeDrawer:P,openDrawer:E}=L,B;e[4]!==v||e[5]!==D?(B=()=>{let X=D();if(X.length===0){let ne=v?.[v.length-1];return{id:ne?.id||null,name:ne?.name||null}}else return{id:X[0].value.id,name:X[0].value._folderOrDocumentTitle}},e[4]=v,e[5]=D,e[6]=B):B=e[6];let k=B,$;e[7]!==I||e[8]!==F||e[9]!==n||e[10]!==a?($=async X=>{let{collectionSlug:ne,doc:Z}=X;await a(F),ne===I&&(Z?.folder&&n===QW(Z?.folder)||!n&&!Z?.folder)&&b(!0)},e[7]=I,e[8]=F,e[9]=n,e[10]=a,e[11]=$):$=e[11];let j=$,M;e[12]!==k||e[13]!==i?(M=()=>{typeof i=="function"&&i(k())},e[12]=k,e[13]=i,e[14]=M):M=e[14];let O=M,V,W;e[15]!==u||e[16]!==o||e[17]!==g||e[18]!==f?(V=()=>{!f(o)&&g&&(b(!1),u())},W=[o,f,u,g],e[15]=u,e[16]=o,e[17]=g,e[18]=f,e[19]=V,e[20]=W):(V=e[19],W=e[20]),Qr.useEffect(V,W);let Y;e[21]!==d||e[22]!==o?(Y=()=>{d(o)},e[21]=d,e[22]=o,e[23]=Y):Y=e[23];let z;e[24]!==O||e[25]!==m||e[26]!==l?(z=()=>{l?O():m(kR)},e[24]=O,e[25]=m,e[26]=l,e[27]=z):z=e[27];let K;e[28]!==v.length||e[29]!==a?(K=v.length?()=>{a(null)}:void 0,e[28]=v.length,e[29]=a,e[30]=K):K=e[30];let U;return e[31]!==v.length||e[32]!==a?(U=(X,ne)=>({id:X.id,name:X.name,onClick:ne!==v.length-1?()=>{a(X.id)}:void 0}),e[31]=v.length,e[32]=a,e[33]=U):U=e[33],wd("div",{className:Sd,children:[Ft(DR,{onCancel:Y,onSave:z,saveLabel:y("general:select"),title:Ft(oH,{action:c.action,count:h,fromFolderName:n?r:void 0,title:c.action==="moveItemToFolder"?c.title:void 0})}),wd("div",{className:`${Sd}__breadcrumbs-section`,children:[Ft(ER,{breadcrumbs:[{id:null,name:wd("span",{className:`${Sd}__folder-breadcrumbs-root`,children:[Ft(dr,{}),y("folder:folders")]}),onClick:K},...v.map(U)]}),_.length>0&&wd(NR,{children:[Ft(oe,{buttonStyle:"pill",className:`${Sd}__add-folder-button`,margin:!1,onClick:()=>{E()},children:y("fields:addLabel",{label:LR(x.labels?.singular,C)})}),Ft(A,{initialData:{[w]:F,folderType:R},onSave:X=>{j({collectionSlug:x.slug,doc:X.doc}),P()},redirectAfterCreate:!1})]})]}),Ft(ry,{className:`${Sd}__body-section`,children:_.length>0?S:Ft(ci,{Actions:[Ft(In,{buttonLabel:`${y("general:create")} ${LR(x.labels?.singular,C).toLowerCase()}`,buttonSize:"medium",buttonStyle:"primary",collectionSlugs:[I],folderAssignedCollections:c.folderAssignedCollections,onCreateSuccess:j,slugPrefix:"create-new-folder-from-drawer--no-results"},"create-folder")],Message:wd(NR,{children:[Ft("h3",{children:C.t("general:noResultsFound")}),Ft("p",{children:C.t("general:noResultsDescription")})]})})}),!l&&Ft(rt,{body:Ft(rH,{action:c.action,count:h,fromFolderName:r,title:c.action==="moveItemToFolder"?c.title:void 0,toFolderName:k().name}),confirmingLabel:y("general:moving"),confirmLabel:y("general:move"),heading:y("general:confirmMove"),modalSlug:kR,onConfirm:O})]})}function oH(t){let e=iy(14),{t:o}=N();switch(t.action){case"moveItemToFolder":if(t.fromFolderName){let n;return e[0]!==t.fromFolderName||e[1]!==t.title||e[2]!==o?(n=o("folder:movingFromFolder",{fromFolder:t.fromFolderName,title:t.title}),e[0]=t.fromFolderName,e[1]=t.title,e[2]=o,e[3]=n):n=e[3],n}else{let n;return e[4]!==t.title||e[5]!==o?(n=o("folder:selectFolderForItem",{title:t.title}),e[4]=t.title,e[5]=o,e[6]=n):n=e[6],n}case"moveItemsToFolder":if(t.fromFolderName){let n=`${t.count} ${t.count>1?o("general:items"):o("general:item")}`,r;return e[7]!==t.fromFolderName||e[8]!==o||e[9]!==n?(r=o("folder:movingFromFolder",{fromFolder:t.fromFolderName,title:n}),e[7]=t.fromFolderName,e[8]=o,e[9]=n,e[10]=r):r=e[10],r}else{let n=`${t.count} ${t.count>1?o("general:items"):o("general:item")}`,r;return e[11]!==o||e[12]!==n?(r=o("folder:selectFolderForItem",{title:n}),e[11]=o,e[12]=n,e[13]=r):r=e[13],r}}}function rH(t){let e=iy(14),{t:o}=N();switch(t.action){case"moveItemToFolder":if(t.toFolderName){let n;return e[0]!==t.title||e[1]!==t.toFolderName||e[2]!==o?(n=Ft(to,{elements:{1:cH,2:lH},i18nKey:"folder:moveItemToFolderConfirmation",t:o,variables:{title:t.title,toFolder:t.toFolderName}}),e[0]=t.title,e[1]=t.toFolderName,e[2]=o,e[3]=n):n=e[3],n}else{let n;return e[4]!==t.title||e[5]!==o?(n=Ft(to,{elements:{1:aH},i18nKey:"folder:moveItemToRootConfirmation",t:o,variables:{title:t.title}}),e[4]=t.title,e[5]=o,e[6]=n):n=e[6],n}case"moveItemsToFolder":if(t.toFolderName){let n;return e[7]!==t.count||e[8]!==t.toFolderName||e[9]!==o?(n=Ft(to,{elements:{1:iH,2:sH},i18nKey:"folder:moveItemsToFolderConfirmation",t:o,variables:{count:t.count,label:t.count>1?o("general:items"):o("general:item"),toFolder:t.toFolderName}}),e[7]=t.count,e[8]=t.toFolderName,e[9]=o,e[10]=n):n=e[10],n}else{let n;return e[11]!==t.count||e[12]!==o?(n=Ft(to,{elements:{1:nH},i18nKey:"folder:moveItemsToRootConfirmation",t:o,variables:{count:t.count,label:t.count>1?o("general:items"):o("general:item")}}),e[11]=t.count,e[12]=o,e[13]=n):n=e[13],n}}}function nH(t){let{children:e}=t;return Ft("strong",{children:e})}function sH(t){let{children:e}=t;return Ft("strong",{children:e})}function iH(t){let{children:e}=t;return Ft("strong",{children:e})}function aH(t){let{children:e}=t;return Ft("strong",{children:e})}function lH(t){let{children:e}=t;return Ft("strong",{children:e})}function cH(t){let{children:e}=t;return Ft("strong",{children:e})}var hH="move-doc-to-folder";function Id(t){let e=$R(29),{buttonProps:o,className:n,folderCollectionSlug:r,folderFieldName:s}=t,i=n===void 0?"":n,{t:a}=N(),l=Vt(gH),c;e[0]!==s?(c=_=>{let[T]=_;return T&&T?.[s]||null},e[0]=s,e[1]=c):c=e[1];let u=Vt(c),d=u?.value,{id:f,collectionSlug:m,initialData:p,title:h}=Se(),{setModified:g}=$e(),b;e[2]!==a?(b=()=>`${a("general:loading")}...`,e[2]=a,e[3]=b):b=e[3];let[C,y]=jR.useState(b),{config:v}=H(),x=pH(),I,w;e[4]!==v.routes.api||e[5]!==r||e[6]!==d||e[7]!==a?(I=()=>{(async function(){if(d&&(typeof d=="string"||typeof d=="number")){let L=await(await fetch(fH({apiRoute:v.routes.api,path:`/${r}/${d}`}))).json();y(L?.name||a("folder:noFolder"))}else y(a("folder:noFolder"))})()},w=[r,v.routes.api,d,a],e[4]=v.routes.api,e[5]=r,e[6]=d,e[7]=a,e[8]=I,e[9]=w):(I=e[8],w=e[9]),jR.useEffect(I,w);let F=`move-to-folder-${x}`,S;e[10]!==u||e[11]!==l||e[12]!==s||e[13]!==g?(S=_=>{let{id:T}=_;u.value!==T&&(l({type:"UPDATE",path:s,value:T}),g(!0))},e[10]=u,e[11]=l,e[12]=s,e[13]=g,e[14]=S):S=e[14];let R=!u?.value,D;return e[15]!==o||e[16]!==i||e[17]!==m||e[18]!==r||e[19]!==s||e[20]!==d||e[21]!==C||e[22]!==f||e[23]!==p||e[24]!==F||e[25]!==S||e[26]!==R||e[27]!==h?(D=Th(BR,{buttonProps:o,className:i,collectionSlug:m,docData:p,docID:f,docTitle:h,folderCollectionSlug:r,folderFieldName:s,fromFolderID:d,fromFolderName:C,modalSlug:F,onConfirm:S,skipConfirmModal:R}),e[15]=o,e[16]=i,e[17]=m,e[18]=r,e[19]=s,e[20]=d,e[21]=C,e[22]=f,e[23]=p,e[24]=F,e[25]=S,e[26]=R,e[27]=h,e[28]=D):D=e[28],D}function gH(t){let[,e]=t;return e}var BR=t=>{let e=$R(22),{buttonProps:o,className:n,collectionSlug:r,docData:s,docID:i,docTitle:a,folderCollectionSlug:l,folderFieldName:c,fromFolderID:u,fromFolderName:d,modalSlug:f,onConfirm:m,skipConfirmModal:p}=t,{getEntityConfig:h}=H(),{i18n:g,t:b}=N(),{closeModal:C,openModal:y}=ae(),v=Gr(),x;if(e[0]!==o||e[1]!==n||e[2]!==C||e[3]!==r||e[4]!==s||e[5]!==i||e[6]!==a||e[7]!==v||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==d||e[12]!==h||e[13]!==g||e[14]!==f||e[15]!==m||e[16]!==y||e[17]!==p||e[18]!==b){let I=qc({slug:f,depth:v}),w=a||mH(h({collectionSlug:r}).labels.singular,g),F;e[20]!==n?(F=[hH,n].filter(Boolean),e[20]=n,e[21]=F):F=e[21],x=uH(dH,{children:[Th(oe,{buttonStyle:"subtle",className:F.join(" "),icon:Th(Cd,{}),iconPosition:"left",onClick:()=>{y(I)},...o,children:d}),Th(Kl,{action:"moveItemToFolder",drawerSlug:I,folderAssignedCollections:[r],folderCollectionSlug:l,folderFieldName:c,fromFolderID:u,fromFolderName:d,itemsToMove:[{itemKey:`${r}-${i}`,relationTo:r,value:{...s,id:i}}],onConfirm:async S=>{if(u!==S.id&&typeof m=="function")try{await m(S),S.id?q.success(b("folder:itemHasBeenMoved",{folderName:`"${S.name}"`,title:w})):q.success(b("folder:itemHasBeenMovedToRoot",{title:w}))}catch(R){let D=R}C(I)},skipConfirmModal:p,title:w})]}),e[0]=o,e[1]=n,e[2]=C,e[3]=r,e[4]=s,e[5]=i,e[6]=a,e[7]=v,e[8]=l,e[9]=c,e[10]=u,e[11]=d,e[12]=h,e[13]=g,e[14]=f,e[15]=m,e[16]=y,e[17]=p,e[18]=b,e[19]=x}else x=e[19];return x};import{c as tA}from"react/compiler-runtime";import{jsx as Bt,jsxs as en}from"react/jsx-runtime";import{formatAdminURL as RH,isImage as oA}from"payload/shared";import Nd,{Fragment as AH,useCallback as Ad,useEffect as Pd,useRef as eA,useState as Ed}from"react";import{jsx as Wt,jsxs as er}from"react/jsx-runtime";import Rh,{useRef as rc,useState as mi}from"react";import ao,{PureComponent as bH,createRef as MR}from"react";var Fh={x:0,y:0,width:0,height:0,unit:"px"},ec=(t,e,o)=>Math.min(Math.max(t,e),o),vH=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),OR=(t,e)=>t===e||t.width===e.width&&t.height===e.height&&t.x===e.x&&t.y===e.y&&t.unit===e.unit;function tc(t,e,o){return t.unit==="%"?{...Fh,...t,unit:"%"}:{unit:"%",x:t.x?t.x/e*100:0,y:t.y?t.y/o*100:0,width:t.width?t.width/e*100:0,height:t.height?t.height/o*100:0}}function ui(t,e,o){return t.unit?t.unit==="px"?{...Fh,...t,unit:"px"}:{unit:"px",x:t.x?t.x*e/100:0,y:t.y?t.y*o/100:0,width:t.width?t.width*e/100:0,height:t.height?t.height*o/100:0}:{...Fh,...t,unit:"px"}}function VR(t,e,o,n,r,s=0,i=0,a=n,l=r){let c={...t},u=Math.min(s,n),d=Math.min(i,r),f=Math.min(a,n),m=Math.min(l,r);e&&(e>1?(u=i?i*e:u,d=u/e,f=a*e):(d=s?s/e:d,u=d*e,m=l/e)),c.y<0&&(c.height=Math.max(c.height+c.y,d),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,u),c.x=0);let p=n-(c.x+c.width);p<0&&(c.x=Math.min(c.x,n-u),c.width+=p);let h=r-(c.y+c.height);if(h<0&&(c.y=Math.min(c.y,r-d),c.height+=h),c.width<u&&((o==="sw"||o=="nw")&&(c.x-=u-c.width),c.width=u),c.height<d&&((o==="nw"||o=="ne")&&(c.y-=d-c.height),c.height=d),c.width>f&&((o==="sw"||o=="nw")&&(c.x-=f-c.width),c.width=f),c.height>m&&((o==="nw"||o=="ne")&&(c.y-=m-c.height),c.height=m),e){let g=c.width/c.height;if(g<e){let b=Math.max(c.width/e,d);(o==="nw"||o=="ne")&&(c.y-=b-c.height),c.height=b}else if(g>e){let b=Math.max(c.height*e,u);(o==="sw"||o=="nw")&&(c.x-=b-c.width),c.width=b}}return c}function yH(t,e,o,n){let r={...t};return e==="ArrowLeft"?n==="nw"?(r.x-=o,r.y-=o,r.width+=o,r.height+=o):n==="w"?(r.x-=o,r.width+=o):n==="sw"?(r.x-=o,r.width+=o,r.height+=o):n==="ne"?(r.y+=o,r.width-=o,r.height-=o):n==="e"?r.width-=o:n==="se"&&(r.width-=o,r.height-=o):e==="ArrowRight"&&(n==="nw"?(r.x+=o,r.y+=o,r.width-=o,r.height-=o):n==="w"?(r.x+=o,r.width-=o):n==="sw"?(r.x+=o,r.width-=o,r.height-=o):n==="ne"?(r.y-=o,r.width+=o,r.height+=o):n==="e"?r.width+=o:n==="se"&&(r.width+=o,r.height+=o)),e==="ArrowUp"?n==="nw"?(r.x-=o,r.y-=o,r.width+=o,r.height+=o):n==="n"?(r.y-=o,r.height+=o):n==="ne"?(r.y-=o,r.width+=o,r.height+=o):n==="sw"?(r.x+=o,r.width-=o,r.height-=o):n==="s"?r.height-=o:n==="se"&&(r.width-=o,r.height-=o):e==="ArrowDown"&&(n==="nw"?(r.x+=o,r.y+=o,r.width-=o,r.height-=o):n==="n"?(r.y+=o,r.height-=o):n==="ne"?(r.y+=o,r.width-=o,r.height-=o):n==="sw"?(r.x-=o,r.width+=o,r.height+=o):n==="s"?r.height+=o:n==="se"&&(r.width+=o,r.height+=o)),r}var oc={capture:!0,passive:!1},di=class _n extends bH{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=MR(),this.mediaRef=MR(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{let{crop:o,disabled:n}=this.props,r=this.getBox();if(!o)return;let s=ui(o,r.width,r.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let i=e.target.dataset.ord,a=!!i,l=e.clientX,c=e.clientY,u=s.x,d=s.y;if(i){let f=e.clientX-r.x,m=e.clientY-r.y,p=0,h=0;i==="ne"||i=="e"?(p=f-(s.x+s.width),h=m-s.y,u=s.x,d=s.y+s.height):i==="se"||i==="s"?(p=f-(s.x+s.width),h=m-(s.y+s.height),u=s.x,d=s.y):i==="sw"||i=="w"?(p=f-s.x,h=m-(s.y+s.height),u=s.x+s.width,d=s.y):(i==="nw"||i=="n")&&(p=f-s.x,h=m-s.y,u=s.x+s.width,d=s.y+s.height),l=u+r.x+p,c=d+r.y+h}this.evData={startClientX:l,startClientY:c,startCropX:u,startCropY:d,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:i},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{let{crop:o,disabled:n,locked:r,keepSelection:s,onChange:i}=this.props,a=this.getBox();if(n||r||s&&o)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let l=e.clientX-a.x,c=e.clientY-a.y,u={unit:"px",x:l,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:l,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,i(ui(u,a.width,a.height),tc(u,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{let{crop:o,disabled:n,onChange:r,onDragStart:s}=this.props,i=this.getBox();if(n||!o||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));let{evData:a}=this;a.clientX=e.clientX,a.clientY=e.clientY;let l;a.isResize?l=this.resizeCrop():l=this.dragCrop(),OR(o,l)||r(ui(l,i.width,i.height),tc(l,i.width,i.height))},this.onComponentKeyDown=e=>{let{crop:o,disabled:n,onChange:r,onComplete:s}=this.props;if(n)return;let i=e.key,a=!1;if(!o)return;let l=this.getBox(),c=this.makePixelCrop(l),u=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?_n.nudgeStepLarge:e.shiftKey?_n.nudgeStepMedium:_n.nudgeStep;if(i==="ArrowLeft"?(c.x-=u,a=!0):i==="ArrowRight"?(c.x+=u,a=!0):i==="ArrowUp"?(c.y-=u,a=!0):i==="ArrowDown"&&(c.y+=u,a=!0),a){e.cancelable&&e.preventDefault(),c.x=ec(c.x,0,l.width-c.width),c.y=ec(c.y,0,l.height-c.height);let d=ui(c,l.width,l.height),f=tc(c,l.width,l.height);r(d,f),s&&s(d,f)}},this.onHandlerKeyDown=(e,o)=>{let{aspect:n=0,crop:r,disabled:s,minWidth:i=0,minHeight:a=0,maxWidth:l,maxHeight:c,onChange:u,onComplete:d}=this.props,f=this.getBox();if(s||!r)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;let m=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?_n.nudgeStepLarge:e.shiftKey?_n.nudgeStepMedium:_n.nudgeStep,p=ui(r,f.width,f.height),h=yH(p,e.key,m,o),g=VR(h,n,o,f.width,f.height,i,a,l,c);if(!OR(r,g)){let b=tc(g,f.width,f.height);u(g,b),d&&d(g,b)}},this.onDocPointerDone=e=>{let{crop:o,disabled:n,onComplete:r,onDragEnd:s}=this.props,i=this.getBox();this.unbindDocMove(),!(n||!o)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,s&&s(e),r&&r(ui(o,i.width,i.height),tc(o,i.width,i.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=e=>{var o;(o=this.componentRef.current)==null||o.scrollTo(0,0)}}get document(){return document}getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:o,y:n,width:r,height:s}=e.getBoundingClientRect();return{x:o,y:n,width:r,height:s}}componentDidUpdate(e){let{crop:o,onComplete:n}=this.props;if(n&&!e.crop&&o){let{width:r,height:s}=this.getBox();r&&s&&n(ui(o,r,s),tc(o,r,s))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,oc),this.document.addEventListener("pointerup",this.onDocPointerDone,oc),this.document.addEventListener("pointercancel",this.onDocPointerDone,oc),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,oc),this.document.removeEventListener("pointerup",this.onDocPointerDone,oc),this.document.removeEventListener("pointercancel",this.onDocPointerDone,oc),this.docMoveBound=!1)}getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,o=this.getBox(),n=this.makePixelCrop(o),r=e.clientX-e.startClientX,s=e.clientY-e.startClientY;return n.x=ec(e.startCropX+r,0,o.width-n.width),n.y=ec(e.startCropY+s,0,o.height-n.height),n}getPointRegion(e,o,n,r){let{evData:s}=this,i=s.clientX-e.x,a=s.clientY-e.y,l;r&&o?l=o==="nw"||o==="n"||o==="ne":l=a<s.startCropY;let c;return n&&o?c=o==="nw"||o==="w"||o==="sw":c=i<s.startCropX,c?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(e,o,n=0,r=0){let s=Math.min(n,e.width),i=Math.min(r,e.height);return!o||!s&&!i?[s,i]:o>1?s?[s,s/o]:[i*o,i]:i?[i*o,i]:[s,s/o]}resizeCrop(){let{evData:e}=this,{aspect:o=0,maxWidth:n,maxHeight:r}=this.props,s=this.getBox(),[i,a]=this.resolveMinDimensions(s,o,this.props.minWidth,this.props.minHeight),l=this.makePixelCrop(s),c=this.getPointRegion(s,e.ord,i,a),u=e.ord||c,d=e.clientX-e.startClientX,f=e.clientY-e.startClientY;(i&&u==="nw"||u==="w"||u==="sw")&&(d=Math.min(d,-i)),(a&&u==="nw"||u==="n"||u==="ne")&&(f=Math.min(f,-a));let m={unit:"px",x:0,y:0,width:0,height:0};c==="ne"?(m.x=e.startCropX,m.width=d,o?(m.height=m.width/o,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY-m.height)):c==="se"?(m.x=e.startCropX,m.y=e.startCropY,m.width=d,o?m.height=m.width/o:m.height=f):c==="sw"?(m.x=e.startCropX+d,m.y=e.startCropY,m.width=Math.abs(d),o?m.height=m.width/o:m.height=f):c==="nw"&&(m.x=e.startCropX+d,m.width=Math.abs(d),o?(m.height=m.width/o,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY+f));let p=VR(m,o,c,s.width,s.height,i,a,n,r);return o||_n.xyOrds.indexOf(u)>-1?l=p:_n.xOrds.indexOf(u)>-1?(l.x=p.x,l.width=p.width):_n.yOrds.indexOf(u)>-1&&(l.y=p.y,l.height=p.height),l.x=ec(l.x,0,s.width-l.width),l.y=ec(l.y,0,s.height-l.height),l}createCropSelection(){let{ariaLabels:e=_n.defaultProps.ariaLabels,disabled:o,locked:n,renderSelectionAddon:r,ruleOfThirds:s,crop:i}=this.props,a=this.getCropStyle();if(i)return ao.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!o&&!n&&ao.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},ao.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),ao.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),ao.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),ao.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"nw"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"n"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"ne"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"e"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"se"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"s"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"sw"),role:"button"}),ao.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"w"),role:"button"})),r&&ao.createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:l=>l.stopPropagation()},r(this.state)),s&&ao.createElement(ao.Fragment,null,ao.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),ao.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){let o={...Fh,...this.props.crop||{}};return ui(o,e.width,e.height)}render(){let{aspect:e,children:o,circularCrop:n,className:r,crop:s,disabled:i,locked:a,style:l,ruleOfThirds:c}=this.props,{cropIsActive:u,newCropIsBeingDrawn:d}=this.state,f=s?this.createCropSelection():null,m=vH("ReactCrop",r,u&&"ReactCrop--active",i&&"ReactCrop--disabled",a&&"ReactCrop--locked",d&&"ReactCrop--new-crop",s&&e&&"ReactCrop--fixed-aspect",s&&n&&"ReactCrop--circular-crop",s&&c&&"ReactCrop--rule-of-thirds",!this.dragStarted&&s&&!s.width&&!s.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return ao.createElement("div",{ref:this.componentRef,className:m,style:l},ao.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},o),f)}};di.xOrds=["e","w"];di.yOrds=["n","s"];di.xyOrds=["nw","ne","se","sw"];di.nudgeStep=1;di.nudgeStepMedium=10;di.nudgeStepLarge=100;di.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};var GR=di;import"react-image-crop/dist/ReactCrop.css";var $t="edit-upload",Dh=t=>{let{name:e,onChange:o,ref:n,value:r}=t;return er("div",{className:`${$t}__input`,children:[e,Wt("input",{name:e,onChange:s=>o(s.target.value),ref:n,type:"number",value:r})]})},CH={height:100,unit:"%",width:100,x:0,y:0},ay=({fileName:t,fileSrc:e,imageCacheTag:o,initialCrop:n,initialFocalPoint:r,onSave:s,showCrop:i,showFocalPoint:a})=>{let{closeModal:l}=ae(),{t:c}=N(),[u,d]=mi(()=>({...CH,...n||{}})),f={x:50,y:50},[m,p]=mi(()=>({...f,...r})),[h,g]=mi(!1),[b,C]=mi(0),[y,v]=mi(0),x=rc(void 0),I=rc(void 0),w=rc(void 0),F=rc(null),S=rc(null),[R,D]=mi(!1),_=k=>{C(k.currentTarget.naturalHeight),v(k.currentTarget.naturalWidth),D(!0)},T=({dimension:k,value:$})=>{let M=100*(parseInt($)/(k==="width"?y:b));if(M<=0||M>100)return null;d({...u,[k]:M})},A=({coordinate:k,value:$})=>{let j=parseInt($);j>=0&&j<=100&&p(M=>({...M,[k]:j}))},L=()=>{typeof s=="function"&&s({crop:u||void 0,focalPoint:m,heightInPixels:Number(F?.current?.value??b),widthInPixels:Number(S?.current?.value??y)}),l(_d)},P=Rh.useCallback(({x:k,y:$})=>{p({x:k,y:$}),g(!1)},[]),E=()=>{let k=x.current.getBoundingClientRect(),$=i?w.current.getBoundingClientRect():I.current.getBoundingClientRect(),j=($.left-k.left+$.width/2)/k.width*100,M=($.top-k.top+$.height/2)/k.height*100;p({x:j,y:M})},B=o?`${e}?${encodeURIComponent(o)}`:e;return er("div",{className:$t,children:[er("div",{className:`${$t}__header`,children:[er("h2",{title:`${c("general:editing")} ${t}`,children:[c("general:editing")," ",t]}),er("div",{className:`${$t}__actions`,children:[Wt(oe,{"aria-label":c("general:cancel"),buttonStyle:"secondary",className:`${$t}__cancel`,onClick:()=>l(_d),children:c("general:cancel")}),Wt(oe,{"aria-label":c("general:applyChanges"),buttonStyle:"primary",className:`${$t}__save`,disabled:!R,onClick:L,children:c("general:applyChanges")})]})]}),er("div",{className:`${$t}__toolWrap`,children:[Wt("div",{className:`${$t}__crop`,children:er("div",{className:`${$t}__focal-wrapper`,ref:x,style:{aspectRatio:`${y/b}`},children:[i?Wt(GR,{className:`${$t}__reactCrop`,crop:u,onChange:(k,$)=>d($),onComplete:()=>g(!0),renderSelectionAddon:()=>Wt("div",{className:`${$t}__crop-window`,ref:w}),children:Wt("img",{alt:c("upload:setCropArea"),onLoad:_,ref:I,src:B})}):Wt("img",{alt:c("upload:setFocalPoint"),onLoad:_,ref:I,src:B}),a&&Wt(xH,{boundsRef:i?w:I,checkBounds:i?h:!1,className:`${$t}__focalPoint`,containerRef:x,initialPosition:m,onDragEnd:P,setCheckBounds:i?g:!1,children:Wt(ar,{})})]})}),(i||a)&&er("div",{className:`${$t}__sidebar`,children:[i&&er("div",{className:`${$t}__groupWrap`,children:[Wt("div",{children:er("div",{className:`${$t}__titleWrap`,children:[Wt("h3",{children:c("upload:crop")}),Wt(oe,{buttonStyle:"none",className:`${$t}__reset`,onClick:()=>d({height:100,unit:"%",width:100,x:0,y:0}),children:c("general:reset")})]})}),Wt("span",{className:`${$t}__description`,children:c("upload:cropToolDescription")}),er("div",{className:`${$t}__inputsWrap`,children:[Wt(Dh,{name:`${c("upload:width")} (px)`,onChange:k=>T({dimension:"width",value:k}),ref:S,value:(u.width/100*y).toFixed(0)}),Wt(Dh,{name:`${c("upload:height")} (px)`,onChange:k=>T({dimension:"height",value:k}),ref:F,value:(u.height/100*b).toFixed(0)})]})]}),a&&er("div",{className:`${$t}__groupWrap`,children:[Wt("div",{children:er("div",{className:`${$t}__titleWrap`,children:[Wt("h3",{children:c("upload:focalPoint")}),Wt(oe,{buttonStyle:"none",className:`${$t}__reset`,onClick:E,children:c("general:reset")})]})}),Wt("span",{className:`${$t}__description`,children:c("upload:focalPointDescription")}),er("div",{className:`${$t}__inputsWrap`,children:[Wt(Dh,{name:"X %",onChange:k=>A({coordinate:"x",value:k}),value:m.x.toFixed(0)}),Wt(Dh,{name:"Y %",onChange:k=>A({coordinate:"y",value:k}),value:m.y.toFixed(0)})]})]})]})]})]})},xH=({boundsRef:t,checkBounds:e,children:o,className:n,containerRef:r,initialPosition:s={x:50,y:50},onDragEnd:i,setCheckBounds:a})=>{let[l,c]=mi({x:s.x,y:s.y}),[u,d]=mi(!1),f=rc(void 0),m=Rh.useCallback((b,C,y)=>{let v=r.current.getBoundingClientRect(),x=t.current.getBoundingClientRect(),I=b??x.left,w=C??x.top,F=I<x.left||I>x.right,S=w<x.top||w>x.bottom,R=(I-v.left)/v.width*100,D=(w-v.top)/v.height*100,_=(x.left-v.left+x.width/2)/v.width*100,T=(x.top-v.top+x.height/2)/v.height*100;return(F||S)&&(d(!1),I<x.left?R=(x.left-v.left)/v.width*100:I>x.right&&(R=(v.width-(v.right-x.right))/v.width*100),w<x.top?D=(x.top-v.top)/v.height*100:w>x.bottom&&(D=(v.height-(v.bottom-x.bottom))/v.height*100),y&&(R=F?_:R,D=S?T:D)),{x:R,y:D}},[t,r]),p=b=>{b.preventDefault(),d(!0)},h=b=>{if(!u)return null;let{x:C,y}=m(b.clientX,b.clientY);c({x:C,y})},g=()=>{d(!1),i(l)};return Rh.useEffect(()=>{if(!(u||!f.current)&&e){let{height:b,left:C,top:y,width:v}=f.current.getBoundingClientRect(),{x,y:I}=m(C+v/2,y+b/2,!0);i({x,y:I}),c({x,y:I}),a(!1);return}},[m,u,e,a,l.x,l.y,i]),Rh.useEffect(()=>{c({x:s.x,y:s.y})},[s.x,s.y]),er("div",{className:[`${$t}__draggable-container`,u&&`${$t}__draggable-container--dragging`].filter(Boolean).join(" "),onMouseMove:h,children:[Wt("button",{className:[`${$t}__draggable`,n].filter(Boolean).join(" "),onMouseDown:p,onMouseUp:g,ref:f,style:{left:`${l.x}%`,top:`${l.y}%`},type:"button",children:o}),Wt("div",{})]})};import{jsx as JR}from"react/jsx-runtime";import"react";import{c as wH}from"react/compiler-runtime";import{jsx as _s,jsxs as ly}from"react/jsx-runtime";import"react";var fi="file-details-draggable",zR=t=>{let e=wH(20),{collectionSlug:o,doc:n,hideRemoveFile:r,imageCacheTag:s,isSortable:i,removeItem:a,rowIndex:l,uploadConfig:c}=t,{id:u,filename:d,thumbnailURL:f,url:m}=n,p;e[0]!==o||e[1]!==u?(p={id:u,collectionSlug:o},e[0]=o,e[1]=u,e[2]=p):p=e[2];let[h,g]=jt(p),b;e[3]!==h||e[4]!==g||e[5]!==o||e[6]!==n||e[7]!==d||e[8]!==r||e[9]!==s||e[10]!==i||e[11]!==a||e[12]!==l||e[13]!==f||e[14]!==c||e[15]!==m?(b=y=>ly("div",{className:[fi,y&&i&&`${fi}--has-drag-handle`].filter(Boolean).join(" "),ref:y.setNodeRef,style:{transform:y.transform,transition:y.transition,zIndex:y.isDragging?1:void 0},children:[ly("div",{className:`${fi}--drag-wrapper`,children:[i&&y&&_s("div",{className:`${fi}__drag`,...y.attributes,...y.listeners,children:_s(dn,{})}),_s(Dr,{className:`${fi}__thumbnail`,collectionSlug:o,doc:n,fileSrc:f||m,imageCacheTag:s,uploadConfig:c})]}),_s("div",{className:`${fi}__main-detail`,children:d}),ly("div",{className:`${fi}__actions`,children:[_s(h,{}),_s(g,{children:_s(yr,{})}),!r&&a&&_s(oe,{buttonStyle:"icon-label",className:`${fi}__remove`,icon:"x",iconStyle:"none",onClick:()=>a(l),round:!0})]})]}),e[3]=h,e[4]=g,e[5]=o,e[6]=n,e[7]=d,e[8]=r,e[9]=s,e[10]=i,e[11]=a,e[12]=l,e[13]=f,e[14]=c,e[15]=m,e[16]=b):b=e[16];let C;return e[17]!==u||e[18]!==b?(C=_s(Nn,{id:u,children:b},u),e[17]=u,e[18]=b,e[19]=C):C=e[19],C};import{jsx as Rd,jsxs as YR}from"react/jsx-runtime";import"react";import{jsx as UR,jsxs as Fd}from"react/jsx-runtime";import{formatFilesize as TH}from"payload/shared";import XR from"react";import{c as SH}from"react/compiler-runtime";import{jsx as IH,jsxs as WR}from"react/jsx-runtime";import{useState as HR}from"react";var _H="copy-to-clipboard",Td=t=>{let e=SH(11),{defaultMessage:o,successMessage:n,value:r}=t,[s,i]=HR(!1),[a,l]=HR(!1),{t:c}=N();if(r){let u;e[0]!==r?(u=async()=>{await navigator.clipboard.writeText(r),i(!0)},e[0]=r,e[1]=u):u=e[1];let d,f;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{l(!0),i(!1)},f=()=>{l(!1),i(!1)},e[2]=d,e[3]=f):(d=e[2],f=e[3]);let m;return e[4]!==s||e[5]!==o||e[6]!==a||e[7]!==n||e[8]!==c||e[9]!==u?(m=WR("button",{className:_H,onClick:u,onMouseEnter:d,onMouseLeave:f,type:"button",children:[IH(ki,{}),WR(Ao,{delay:s?0:void 0,show:a||s,children:[s&&(n??c("general:copied")),!s&&(o??c("general:copy"))]})]}),e[4]=s,e[5]=o,e[6]=a,e[7]=n,e[8]=c,e[9]=u,e[10]=m):m=e[10],m}return null};var cy="file-meta",Dd=t=>{let{filename:e,filesize:o,height:n,mimeType:r,url:s,width:i}=t;return Fd("div",{className:cy,children:[Fd("div",{className:`${cy}__url`,children:[UR("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:e}),UR(Td,{defaultMessage:"Copy URL",value:s})]}),Fd("div",{className:`${cy}__size-type`,children:[TH(o),typeof i=="number"&&typeof n=="number"&&Fd(XR.Fragment,{children:["\xA0-\xA0",i,"x",n]}),r&&Fd(XR.Fragment,{children:["\xA0-\xA0",r]})]})]})};var Ah="file-details",ZR=t=>{let{customUploadActions:e,doc:o,enableAdjustments:n,handleRemove:r,hasImageSizes:s,hideRemoveFile:i,imageCacheTag:a,uploadConfig:l}=t,{filename:c,filesize:u,height:d,mimeType:f,thumbnailURL:m,url:p,width:h}=o,g=l.displayPreview??!0;return Rd("div",{className:Ah,children:YR("header",{children:[g&&Rd(Dr,{className:`${Ah}__thumbnail`,doc:o,fileSrc:m||p,imageCacheTag:a,uploadConfig:l}),YR("div",{className:`${Ah}__main-detail`,children:[Rd(Dd,{filename:c,filesize:u,height:d,mimeType:f,url:p,width:h}),(n||s&&o.filename||e)&&Rd(uy,{customActions:e,enableAdjustments:!!n,enablePreviewSizes:s&&o.filename,mimeType:f})]}),!i&&r&&Rd(oe,{buttonStyle:"icon-label",className:`${Ah}__remove`,icon:"x",iconStyle:"with-border",onClick:r,round:!0})]})})};var dy=t=>{let{hasMany:e}=t;return e?JR(zR,{...t}):JR(ZR,{...t})};import{jsx as Gn,jsxs as nc}from"react/jsx-runtime";import{useEffect as FH,useMemo as DH,useState as qR}from"react";var Kr="preview-sizes",QR=(t,e)=>{if(!e||e.length===0)return t;let o={};return e.forEach(({name:n})=>{t[n]&&(o[n]=t[n])}),o},KR=({name:t,active:e,alt:o,meta:n,onClick:r,previewSrc:s})=>nc("div",{className:[`${Kr}__sizeOption`,e&&`${Kr}--selected`].filter(Boolean).join(" "),onClick:typeof r=="function"?r:void 0,onKeyDown:i=>{typeof r=="function"&&i.key==="Enter"&&r()},role:"button",tabIndex:0,children:[Gn("div",{className:`${Kr}__image`,children:Gn("img",{alt:o,src:s})}),nc("div",{className:`${Kr}__sizeMeta`,children:[Gn("div",{className:`${Kr}__sizeName`,children:t}),Gn(Dd,{...n})]})]}),my=({doc:t,imageCacheTag:e,uploadConfig:o})=>{let{imageSizes:n}=o,{sizes:r}=t,s=t?.alt||t.filename||"",[i,a]=qR(()=>QR(r,n)),[l,c]=qR(null),u=p=>{if(!p.filename)return null;if(p.url)return`${p.url}${e?`?${encodeURIComponent(e)}`:""}`};FH(()=>{a(QR(r,n))},[r,n,e]);let d=u(l?t.sizes[l]:t),f=DH(()=>({filename:t.filename,filesize:t.filesize,height:t.height,mimeType:t.mimeType,url:t.url,width:t.width}),[t]),m="Original";return nc("div",{className:Kr,children:[nc("div",{className:`${Kr}__imageWrap`,children:[nc("div",{className:`${Kr}__meta`,children:[Gn("div",{className:`${Kr}__sizeName`,children:l||m}),Gn(Dd,{...l?i[l]:f})]}),Gn("img",{alt:s,className:`${Kr}__preview`,src:d})]}),Gn("div",{className:`${Kr}__listWrap`,children:nc("div",{className:`${Kr}__list`,children:[Gn(KR,{active:!l,alt:s,meta:f,name:m,onClick:()=>c(null),previewSrc:u(t)}),Object.entries(i).map(([p,h])=>{let g=l===p,b=u(h);return b?Gn(KR,{active:g,alt:s,meta:h,name:p,onClick:()=>c(p),previewSrc:b},p):null})]})})]})};var vo="file-field",_d="edit-upload",rA="preview-sizes",PH=t=>!t&&t!==void 0?"A file is required.":t&&(!t.name||t.name==="")?"A file name is required.":!0,uy=t=>{let e=tA(8),{customActions:o,enableAdjustments:n,enablePreviewSizes:r,mimeType:s}=t,{t:i}=N(),{openModal:a}=ae(),l,c;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==i){c=Symbol.for("react.early_return_sentinel");e:{let u=oA(s)&&s!=="image/svg+xml"&&s!=="image/jxl";if(!u&&(!o||o.length===0)){c=null;break e}l=en("div",{className:`${vo}__upload-actions`,children:[u&&en(Nd.Fragment,{children:[r&&Bt(oe,{buttonStyle:"pill",className:`${vo}__previewSizes`,margin:!1,onClick:()=>{a(rA)},size:"small",children:i("upload:previewSizes")}),n&&Bt(oe,{buttonStyle:"pill",className:`${vo}__edit`,margin:!1,onClick:()=>{a(_d)},size:"small",children:i("upload:editImage")})]}),o&&o.map(EH)]})}e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=i,e[6]=l,e[7]=c}else l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:l},fy=t=>{let e=tA(5),{resetUploadEdits:o,updateUploadEdits:n,uploadEdits:r}=Ui(),s;return e[0]!==t||e[1]!==o||e[2]!==n||e[3]!==r?(s=Bt(Zl,{children:Bt(py,{...t,resetUploadEdits:o,updateUploadEdits:n,uploadEdits:r})}),e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=s):s=e[4],s},py=t=>{let{collectionSlug:e,customActions:o,initialState:n,onChange:r,resetUploadEdits:s,updateUploadEdits:i,uploadConfig:a,UploadControls:l,uploadEdits:c}=t,{setUploadControlFile:u,setUploadControlFileName:d,setUploadControlFileUrl:f,uploadControlFile:m,uploadControlFileName:p,uploadControlFileUrl:h}=q0(),{config:{routes:{api:g}}}=H(),{t:b}=N(),{setModified:C}=$e(),{id:y,data:v,docPermissions:x,setUploadStatus:I}=Se(),w=Or(),{errorMessage:F,setValue:S,showError:R,value:D}=Te({path:"file",validate:PH}),[_,T]=Ed(null),[A,L]=Ed(!1),[P,E]=Ed(D?.name||""),[B,k]=Ed(!1),[$,j]=Ed(""),M=eA(null),O=eA(null),V=typeof a?.pasteURL=="object"&&a.pasteURL.allowList?.length>0,W=Ad(({file:he,isNewFile:Oe=!0})=>{Oe&&he instanceof File&&T(URL.createObjectURL(he)),S(he),k(!1),f(""),d(null),u(null),typeof r=="function"&&r(he)},[r,S,u,d,f]),Y=(he,Oe)=>new File([he],Oe,{type:he.type,lastModified:he.lastModified}),z=Nd.useCallback(he=>{let Oe=he.target.value;D&&(W({file:Y(D,Oe),isNewFile:!1}),E(Oe))},[W,D]),K=Ad(he=>{let Oe=he?.[0];W({file:Oe})},[W]),U=Ad(()=>{L(!0),W({file:null}),T(""),j(""),s(),k(!1),f(""),d(null),u(null)},[W,s,u,d,f]),X=Ad(he=>{C(!0),i(he)},[C,i]),ne=Ad(async()=>{if(!(!$||a?.pasteURL===!1)){I("uploading");try{let he=await fetch($);if(!he.ok)throw new Error(`Fetch failed with status: ${he.status}`);let Oe=await he.blob(),Ke=p||decodeURIComponent($.split("/").pop()||""),le=new File([Oe],Ke,{type:Oe.type});W({file:le}),I("idle");return}catch{if(!V){q.error("Failed to fetch the file."),I("failed");return}}try{let he=`/${e}/paste-url${y?`/${y}?`:"?"}src=${encodeURIComponent($)}`,Oe=await fetch(RH({apiRoute:g,path:he}));if(!Oe.ok)throw new Error(`Fetch failed with status: ${Oe.status}`);let Ke=await Oe.blob(),le=decodeURIComponent($.split("/").pop()||""),we=new File([Ke],le,{type:Ke.type});W({file:we}),I("idle")}catch{q.error("The provided URL is not allowed."),I("failed")}}},[g,e,$,W,y,I,a,p,V]);Pd(()=>{n?.file?.value instanceof File&&(T(URL.createObjectURL(n.file.value)),L(!1))},[n]),Pd(()=>{B&&M.current},[B]),Pd(()=>{w&&L(!1)},[w]);let Z=x?.update,J=a?.imageSizes?.length>0,re=!!a?.resizeOptions,me=a?.focalPoint===!0,{crop:xe=!0,focalPoint:_e=!0}=a,Be=_e&&(J||re||me),Me=a.mimeTypes?.join(", "),Ue=a?.cacheTags&&v?.updatedAt;return Pd(()=>{(async()=>h&&(j(h),await ne()))()},[h,ne]),Pd(()=>{m&&W({file:m})},[m,W]),en("div",{className:[Ae,vo].filter(Boolean).join(" "),children:[Bt(Ze,{message:F,showError:R}),v&&v.filename&&!A&&Bt(dy,{collectionSlug:e,customUploadActions:o,doc:v,enableAdjustments:xe||Be,handleRemove:Z?U:void 0,hasImageSizes:J,hideRemoveFile:a.hideRemoveFile,imageCacheTag:Ue,uploadConfig:a}),(!a.hideFileInputOnCreate&&!v?.filename||A)&&en("div",{className:`${vo}__upload`,children:[!D&&!B&&Bt(ba,{onChange:K,children:en("div",{className:`${vo}__dropzoneContent`,children:[en("div",{className:`${vo}__dropzoneButtons`,children:[Bt(oe,{buttonStyle:"pill",onClick:()=>{O.current&&O.current.click()},size:"small",children:b("upload:selectFile")}),Bt("input",{accept:Me,"aria-hidden":"true",className:`${vo}__hidden-input`,hidden:!0,onChange:he=>{he.target.files&&he.target.files.length>0&&K(he.target.files)},ref:O,type:"file"}),a?.pasteURL!==!1&&en(AH,{children:[Bt("span",{className:`${vo}__orText`,children:b("general:or")}),Bt(oe,{buttonStyle:"pill",onClick:()=>{k(!0),f(""),u(null),d(null)},size:"small",children:b("upload:pasteURL")})]}),l||null]}),en("p",{className:`${vo}__dragAndDropText`,children:[b("general:or")," ",b("upload:dragAndDrop")]})]})}),B&&en(Nd.Fragment,{children:[en("div",{className:`${vo}__remote-file-wrap`,children:[Bt("input",{className:`${vo}__remote-file`,onChange:he=>{j(he.target.value)},ref:M,title:$,type:"text",value:$}),Bt("div",{className:`${vo}__add-file-wrap`,children:Bt("button",{className:`${vo}__add-file`,onClick:()=>{ne()},type:"button",children:b("upload:addFile")})})]}),Bt(oe,{buttonStyle:"icon-label",className:`${vo}__remove`,icon:"x",iconStyle:"with-border",onClick:()=>{k(!1),f(""),u(null),d(null)},round:!0,tooltip:b("general:cancel")})]}),D&&_&&en(Nd.Fragment,{children:[Bt("div",{className:`${vo}__thumbnail-wrap`,children:Bt(Dr,{collectionSlug:e,fileSrc:oA(D.type)?_:null})}),en("div",{className:`${vo}__file-adjustments`,children:[Bt("input",{className:`${vo}__filename`,onChange:z,title:P||D.name,type:"text",value:P||D.name}),Bt(uy,{customActions:o,enableAdjustments:xe||Be,enablePreviewSizes:J&&v?.filename&&!A,mimeType:D.type})]}),Bt(oe,{buttonStyle:"icon-label",className:`${vo}__remove`,icon:"x",iconStyle:"with-border",onClick:U,round:!0,tooltip:b("general:cancel")})]})]}),(D||v?.filename)&&Bt(ns,{children:Bt(St,{Header:null,slug:_d,children:Bt(ay,{fileName:D?.name||v?.filename,fileSrc:v?.url||_,imageCacheTag:Ue,initialCrop:c?.crop??void 0,initialFocalPoint:{x:c?.focalPoint?.x||v?.focalX||50,y:c?.focalPoint?.y||v?.focalY||50},onSave:X,showCrop:xe,showFocalPoint:Be})})}),v&&J&&Bt(St,{className:`${vo}__previewDrawer`,hoverTitle:!0,slug:rA,title:b("upload:sizesFor",{label:v.filename}),children:Bt(my,{doc:v,imageCacheTag:Ue,uploadConfig:a})})]})};function EH(t,e){return Bt(Nd.Fragment,{children:t},e)}var jH="collection-edit";function iA({resetUploadEdits:t,submitted:e,updateUploadEdits:o,uploadEdits:n}){let{action:r,collectionSlug:s,docPermissions:i,getDocPreferences:a,hasSavePermission:l,initialState:c,isInitializing:u,Upload:d}=Se(),{drawerSlug:f,onSave:m}=Vu(),{getFormState:p}=Lt(),{config:{folders:h},getEntityConfig:g}=H(),b=Ld.useRef(null),C=g({collectionSlug:s}),{reportUpdate:y}=xs(),v=C.slug,[x]=Ld.useState(v),I=nA(F=>{y({doc:F?.doc||F?.result,drawerSlug:f,entitySlug:v,operation:"create",updatedAt:F?.result?.updatedAt||new Date().toISOString()}),typeof m=="function"&&m({...F,operation:"create"}),t()},[v,m,y,t,f]),w=nA(async({formState:F,submitted:S})=>{let R=Fr(b),D=await a(),{state:_}=await p({collectionSlug:v,docPermissions:i,docPreferences:D,formState:F,operation:"create",schemaPath:x,signal:R.signal,skipValidation:!S});return b.current=null,_},[v,x,a,p,i]);return sA(()=>{let F=b.current;return()=>{Tr(F)}},[]),pi(nu,{operation:"create",children:LH(ws,{action:r,className:`${jH}__form`,disabled:u||!l,initialState:u?void 0:c,isInitializing:u,method:"POST",onChange:[w],onSuccess:I,submitted:e,children:[pi(yd,{BeforeFields:pi(Ld.Fragment,{children:d||pi(py,{collectionSlug:C.slug,customActions:[h&&C.folders&&pi(Id,{buttonProps:{buttonStyle:"pill",size:"small"},folderCollectionSlug:h.slug,folderFieldName:h.fieldName},"move-doc-to-folder")].filter(Boolean),initialState:c,resetUploadEdits:t,updateUploadEdits:o,uploadConfig:C.upload,uploadEdits:n})}),docPermissions:i,fields:C.fields,schemaPathSegments:[C.slug]}),pi(BH,{}),pi($H,{})]})})}function $H(){let t=NH(7),{getField:e,getFields:o}=$e(),{getFormDataRef:n}=zo(),r;t[0]!==o||t[1]!==n?(r=()=>{n.current=o},t[0]=o,t[1]=n,t[2]=r):r=t[2];let s;return t[3]!==e||t[4]!==o||t[5]!==n?(s=[o,e,n],t[3]=e,t[4]=o,t[5]=n,t[6]=s):s=t[6],sA(r,s),null}function BH(){let{docConfig:t}=Se(),{activeIndex:e,forms:o,setFormTotalErrorCount:n}=zo(),r=Ld.useRef(0),s=kH(()=>o[e]?.formState?.file?.valid??!0,[e,o]),i=Ld.useCallback(a=>{let l=a;s||(l+=1),l!==r.current&&(n({errorCount:l,index:e}),r.current=l)},[e,n,s]);return t?pi(qi,{fields:t.fields,path:[],setErrorCount:i}):null}import{c as UH}from"react/compiler-runtime";import{jsx as Gt,jsxs as Tn}from"react/jsx-runtime";var hi={};cw(hi,{WindowInfo:()=>cA,WindowInfoContext:()=>sc,WindowInfoProvider:()=>mA,useWindowInfo:()=>mr,withWindowInfo:()=>fA});import{useContext as OH}from"react";import{createContext as MH}from"react";var sc=MH({});var mr=()=>OH(sc);import aA,{Fragment as lA}from"react";var cA=t=>{let{children:e}=t,o=mr();return e?typeof e=="function"?aA.createElement(lA,null,e(o)):aA.createElement(lA,null,e):null};import VH,{useCallback as uA,useEffect as dA,useReducer as GH,useRef as zH}from"react";var WH=(t,e)=>{let{payload:{breakpoints:o,animationRef:n}}=e;n.current=null;let{eventsFired:r}=t,{documentElement:{style:s,clientWidth:i,clientHeight:a}}=document,{innerWidth:l,innerHeight:c}=window,u=`${i/100}px`,d=`${a/100}px`,f=o?Object.keys(o).reduce((p,h)=>Object.assign(Object.assign({},p),{[h]:window.matchMedia(o[h]).matches}),{}):{},m={width:l,height:c,"--vw":u,"--vh":d,breakpoints:f,eventsFired:r+1};return s.setProperty("--vw",u),s.setProperty("--vh",d),m},mA=t=>{let{breakpoints:e,children:o}=t,n=zH(null),[r,s]=GH(WH,{width:void 0,height:void 0,"--vw":"","--vh":"",breakpoints:{},eventsFired:0}),i=uA(()=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>s({type:"UPDATE",payload:{breakpoints:e,animationRef:n}}))},[e]),a=uA(()=>{setTimeout(()=>{i()},500)},[i]);return dA(()=>(window.addEventListener("resize",i),window.addEventListener("orientationchange",a),()=>{window.removeEventListener("resize",i),window.removeEventListener("orientationchange",a)}),[i,a]),dA(()=>{r.eventsFired===0&&s({type:"UPDATE",payload:{breakpoints:e,animationRef:n}})},[e,r]),VH.createElement(sc.Provider,{value:Object.assign({},r)},o&&o)};import HH from"react";var fA=t=>o=>{let n=mr();return HH.createElement(t,Object.assign({},o,{windowInfo:n}))};import{isImage as XH}from"payload/shared";import Eh from"react";var pA=t=>new Promise((e,o)=>{let n=new Image;n.src=URL.createObjectURL(t),n.onload=()=>{let s,i,a=n.width/n.height;a>1?(i=280,s=280/a):(i=280*a,s=280);let l=new OffscreenCanvas(i,s),c=l.getContext("2d"),u=t.type==="image/png"?"image/png":"image/jpeg",d=t.type==="image/png"?void 0:.8;c.drawImage(n,0,0,i,s),l.convertToBlob({type:u,...d&&{quality:d}}).then(f=>{URL.revokeObjectURL(n.src);let m=new FileReader;m.onload=()=>e(m.result),m.onerror=o,m.readAsDataURL(f)}).catch(o)},n.onerror=r=>{URL.revokeObjectURL(n.src),o(r)}});var Ph="bulk-upload-drawer--add-more-files",Dt="file-selections";function hA(){let t=UH(39),{activeIndex:e,addFiles:o,forms:n,isInitializing:r,removeFile:s,setActiveIndex:i,totalErrorCount:a}=zo(),{initialFiles:l,initialForms:c,maxFiles:u}=Wo(),{i18n:d,t:f}=N(),{closeModal:m,openModal:p}=ae(),[h,g]=Eh.useState(!1),{breakpoints:b}=mr(),C;t[0]!==s?(C=P=>{s(P)},t[0]=s,t[1]=C):C=t[1];let y=C,v;t[2]!==o||t[3]!==m?(v=P=>{o(P),m(Ph)},t[2]=o,t[3]=m,t[4]=v):v=t[4];let x=v,I=JH,w=r?l?.length??c?.length:n.length,{collectionSlug:F,selectableCollections:S,setCollectionSlug:R}=Wo(),{getEntityConfig:D}=H(),_=h&&`${Dt}__showingFiles`,T;t[5]!==_?(T=[Dt,_].filter(Boolean),t[5]=_,t[6]=T):T=t[6];let A=T.join(" "),L;if(t[7]!==e||t[8]!==b.m||t[9]!==F||t[10]!==m||t[11]!==n||t[12]!==D||t[13]!==x||t[14]!==y||t[15]!==d||t[16]!==l||t[17]!==c||t[18]!==r||t[19]!==u||t[20]!==p||t[21]!==S||t[22]!==i||t[23]!==R||t[24]!==h||t[25]!==f||t[26]!==A||t[27]!==a||t[28]!==w){let P;t[30]===Symbol.for("react.memo_cache_sentinel")?(P=()=>g(ZH),t[30]=P):P=t[30];let E;t[31]!==m?(E=()=>m(Ph),t[31]=m,t[32]=E):E=t[32];let B;t[33]!==e||t[34]!==y||t[35]!==d||t[36]!==i||t[37]!==f?(B=(k,$)=>{let{errorCount:j,formID:M,formState:O}=k,V=O?.file?.value||{};return Tn("div",{className:[`${Dt}__fileRowContainer`,$===e&&`${Dt}__fileRowContainer--active`,j&&j>0&&`${Dt}__fileRowContainer--error`].filter(Boolean).join(" "),children:[Tn("button",{className:`${Dt}__fileRow`,onClick:()=>i($),type:"button",children:[Gt(qH,{file:V,formID:M}),Gt("div",{className:`${Dt}__fileDetails`,children:Gt("p",{className:`${Dt}__fileName`,title:V.name,children:V.name||f("upload:noFile")})}),V instanceof File?Gt("p",{className:`${Dt}__fileSize`,children:I(V)}):null,Gt("div",{className:`${Dt}__remove ${Dt}__remove--underlay`,children:Gt(vt,{})}),j?Gt(Io,{className:`${Dt}__errorCount`,count:j,i18n:d}):null]}),Gt("button",{"aria-label":f("general:remove"),className:`${Dt}__remove ${Dt}__remove--overlay`,onClick:()=>y($),type:"button",children:Gt(vt,{})})]},M)},t[33]=e,t[34]=y,t[35]=d,t[36]=i,t[37]=f,t[38]=B):B=t[38],L=Tn("div",{className:A,children:[b.m&&h?Gt("div",{className:`${Dt}__mobileBlur`}):null,Tn("div",{className:`${Dt}__header`,children:[S?.length>1&&Gt(Zr,{className:`${Dt}__collectionSelect`,isClearable:!1,name:"groupBy",onChange:k=>{let $=typeof k=="object"&&"value"in k?k?.value:k;R($)},options:S?.map(k=>{let $=D({collectionSlug:k});return{label:$.labels.singular,value:$.slug}})||[],path:"groupBy",required:!0,value:F}),Tn("div",{className:`${Dt}__headerTopRow`,children:[Tn("div",{className:`${Dt}__header__text`,children:[Gt(Io,{count:a,i18n:d,withMessage:!0}),Gt("p",{children:Tn("strong",{title:`${w} ${f(w>1?"upload:filesToUpload":"upload:fileToUpload")}`,children:[w," ",f(w>1?"upload:filesToUpload":"upload:fileToUpload")]})})]}),Tn("div",{className:`${Dt}__header__actions`,children:[typeof u!="number"||w<u?Gt(yt,{className:`${Dt}__header__addFile`,onClick:()=>p(Ph),size:"small",children:f("upload:addFile")}):null,Tn(oe,{buttonStyle:"transparent",className:`${Dt}__toggler`,onClick:P,children:[Gt("span",{className:`${Dt}__toggler__label`,children:Tn("strong",{title:`${w} ${f(w>1?"upload:filesToUpload":"upload:fileToUpload")}`,children:[w," ",f(w>1?"upload:filesToUpload":"upload:fileToUpload")]})}),Gt(He,{direction:h?"down":"up"})]}),Gt(St,{gutter:!1,Header:null,slug:Ph,children:Gt(ph,{onCancel:E,onDrop:x})})]})]}),Gt("div",{className:`${Dt}__header__mobileDocActions`,children:Gt(ty,{})})]}),Gt("div",{className:`${Dt}__animateWrapper`,children:Gt(Sr,{height:!b.m||h?"auto":0,children:Tn("div",{className:`${Dt}__filesContainer`,children:[r&&n.length===0&&(l?.length>0||c?.length>0)?(l?Array.from(l):c).map(YH):null,n.map(B)]})})})]}),t[7]=e,t[8]=b.m,t[9]=F,t[10]=m,t[11]=n,t[12]=D,t[13]=x,t[14]=y,t[15]=d,t[16]=l,t[17]=c,t[18]=r,t[19]=u,t[20]=p,t[21]=S,t[22]=i,t[23]=R,t[24]=h,t[25]=f,t[26]=A,t[27]=a,t[28]=w,t[29]=L}else L=t[29];return L}function YH(t,e){return Gt(Et,{animationDelay:`calc(${e} * 60ms)`,height:"35px"},e)}function ZH(t){return!t}function JH(t){let e=t.size,o=e===0?0:Math.floor(Math.log(e)/Math.log(1024)),n=o>1?1:0;return(e/Math.pow(1024,o)).toFixed(n)+" "+["B","kB","MB","GB","TB"][o]}function qH({file:t,formID:e}){let[o,n]=Eh.useState(null),[r,s]=Eh.useState(!0);return Eh.useEffect(()=>{let i=!1;async function a(){s(!0),n(null);try{if(XH(t.type)){let l=await pA(t);i||n(l)}else n(null)}catch{i||n(null)}finally{i||s(!1)}}return a(),()=>{i=!0}},[t]),r?Gt(Et,{className:`${Dt}__thumbnail-shimmer`,disableInlineStyles:!0}):Gt(Dr,{className:`${Dt}__thumbnail`,fileSrc:o},`${e}-${o||"placeholder"}`)}var gA="bulk-upload--file-manager";function bA(){let t=QH(18),{activeIndex:e,collectionSlug:o,docPermissions:n,documentSlots:r,forms:s,hasPublishPermission:i,hasSavePermission:a,hasSubmitted:l,resetUploadEdits:c,updateUploadEdits:u}=zo(),d=s[e],{getEntityConfig:f}=H(),{i18n:m}=N(),{user:p}=Ie(),{openModal:h}=ae(),g;if(t[0]!==d||t[1]!==e||t[2]!==o||t[3]!==n||t[4]!==r||t[5]!==s.length||t[6]!==f||t[7]!==i||t[8]!==a||t[9]!==l||t[10]!==m||t[11]!==h||t[12]!==c||t[13]!==u||t[14]!==p){let b=f({collectionSlug:o}),C;t[16]!==h?(C=()=>h(vd),t[16]=h,t[17]=C):C=t[17],g=hy("div",{className:gA,children:[kd(hA,{}),hy("div",{className:`${gA}__editView`,children:[kd(li,{onClose:C,title:KH(b.labels.singular,m)}),d?hy(ru,{collectionSlug:o,currentEditor:p,docPermissions:n,hasPublishedDoc:!1,hasPublishPermission:i,hasSavePermission:a,id:null,initialData:eU(d.formState,!0),initialState:d.formState,isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,Upload:r.Upload,versionCount:0,children:[kd(fR,{collectionConfig:b}),kd(iA,{resetUploadEdits:c,submitted:l,updateUploadEdits:u,uploadEdits:d?.uploadEdits})]},`${e}-${s.length}`):null]}),kd(pR,{})]}),t[0]=d,t[1]=e,t[2]=o,t[3]=n,t[4]=r,t[5]=s.length,t[6]=f,t[7]=i,t[8]=a,t[9]=l,t[10]=m,t[11]=h,t[12]=c,t[13]=u,t[14]=p,t[15]=g}else g=t[15];return g}var nU="bulk-upload-drawer-slug";function sU(){let{addFiles:t,forms:e,isInitializing:o}=zo(),{closeModal:n}=ae(),{collectionSlug:r,drawerSlug:s}=Wo(),{getEntityConfig:i}=H(),{t:a}=N(),u=i({collectionSlug:r})?.upload?.mimeTypes,d=Pr.useCallback(f=>{let m=new DataTransfer;for(let p of f)(u===void 0||u.length===0||oU(p.type,u))&&m.items.add(p);m.files.length===0?q.error(a("error:invalidFileType")):t(m.files)},[t,a,u]);return r?!e.length&&!o?Ts(ph,{acceptMimeTypes:u?.join(", "),onCancel:()=>n(s),onDrop:d}):Ts(bA,{}):null}function yA(){let t=vA(17),{drawerSlug:e,onCancel:o,setInitialFiles:n,setInitialForms:r,setOnCancel:s,setOnSuccess:i,setSelectableCollections:a,setSuccessfullyUploaded:l,successfullyUploaded:c}=Wo(),{modalState:u}=ae(),d=Pr.useRef(u),f;t[0]!==e||t[1]!==o||t[2]!==n||t[3]!==r||t[4]!==s||t[5]!==i||t[6]!==a||t[7]!==l||t[8]!==c?(f=b=>{let C=d.current[e],y=b[e];typeof y>"u"&&typeof C>"u"||(C?.isOpen!==y?.isOpen&&(y?.isOpen||(c||typeof o=="function"&&o(),n(void 0),r(void 0),s(lU),i(iU),a(null),l(!1))),d.current=b)},t[0]=e,t[1]=o,t[2]=n,t[3]=r,t[4]=s,t[5]=i,t[6]=a,t[7]=l,t[8]=c,t[9]=f):f=t[9];let m=Qe(f),p;t[10]!==u||t[11]!==m?(p=()=>{m(u)},t[10]=u,t[11]=m,t[12]=p):p=t[12];let h;t[13]!==u?(h=[u],t[13]=u,t[14]=h):h=t[14],rU(p,h);let g;return t[15]!==e?(g=Ts(St,{gutter:!1,Header:null,slug:e,children:Ts(oR,{children:Ts(Zl,{children:Ts(ns,{children:Ts(sU,{})})})})}),t[15]=e,t[16]=g):g=t[16],g}function iU(){return aU}function aU(){return null}function lU(){return cU}function cU(){return null}var CA=Pr.createContext({collectionSlug:"",drawerSlug:"",initialFiles:void 0,initialForms:[],maxFiles:void 0,onCancel:()=>null,onSuccess:()=>null,selectableCollections:null,setCollectionSlug:()=>null,setInitialFiles:()=>null,setInitialForms:()=>null,setMaxFiles:()=>null,setOnCancel:()=>null,setOnSuccess:()=>null,setSelectableCollections:()=>null,setSuccessfullyUploaded:()=>!1,successfullyUploaded:!1});function gy(t){let e=vA(17),{children:o,drawerSlugPrefix:n}=t,[r,s]=Pr.useState(null),[i,a]=Pr.useState(),[l,c]=Pr.useState(),[u,d]=Pr.useState(),[f,m]=Pr.useState(void 0),[p,h]=Pr.useState(void 0),[g,b]=Pr.useState(void 0),[C,y]=Pr.useState(!1),v=`${n?`${n}-`:""}${xA()}`,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{c(()=>_)},e[0]=x):x=e[0];let I=x,w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=_=>{d(()=>_)},e[1]=w):w=e[1];let F=w,S;e[2]!==u?(S=()=>{typeof u=="function"&&u()},e[2]=u,e[3]=S):S=e[3];let R;e[4]!==l?(R=(_,T)=>{typeof l=="function"&&l(_,T)},e[4]=l,e[5]=R):R=e[5];let D;return e[6]!==o||e[7]!==i||e[8]!==v||e[9]!==f||e[10]!==p||e[11]!==g||e[12]!==r||e[13]!==C||e[14]!==S||e[15]!==R?(D=Ts(CA,{value:{collectionSlug:i,drawerSlug:v,initialFiles:f,initialForms:p,maxFiles:g,onCancel:S,onSuccess:R,selectableCollections:r,setCollectionSlug:a,setInitialFiles:m,setInitialForms:h,setMaxFiles:b,setOnCancel:F,setOnSuccess:I,setSelectableCollections:s,setSuccessfullyUploaded:y,successfullyUploaded:C},children:tU(Pr.Fragment,{children:[o,Ts(yA,{})]})}),e[6]=o,e[7]=i,e[8]=v,e[9]=f,e[10]=p,e[11]=g,e[12]=r,e[13]=C,e[14]=S,e[15]=R,e[16]=D):D=e[16],D}var Wo=()=>Pr.use(CA);function xA(){let t=Gr();return`${nU}-${t||1}`}import{jsx as oo,jsxs as Sa,Fragment as $d}from"react/jsx-runtime";import{formatAdminURL as wU}from"payload/shared";import*as DA from"qs-esm";import Fn,{useCallback as by,useEffect as FA,useMemo as vy}from"react";function wA(t,e){let o=Array.isArray(e);if(typeof t=="string"||typeof t=="number")return t;if(t&&typeof t=="object"&&"relationTo"in t&&"value"in t){let n=t.value;for(;n&&typeof n=="object"&&n!==null&&"value"in n;)n=n.value;return n&&typeof n=="object"&&n!==null&&"id"in n&&(n=n.id),o?{relationTo:t.relationTo,value:n}:n}return t&&typeof t=="object"&&"id"in t?t.id:t}import{c as pU}from"react/compiler-runtime";import{jsx as wa,jsxs as hU}from"react/jsx-runtime";import"react";import{c as uU}from"react/compiler-runtime";import{jsx as gi,jsxs as Nh}from"react/jsx-runtime";import{getTranslation as dU}from"@payloadcms/translations";import{formatFilesize as mU}from"payload/shared";import"react";var Fs="upload-relationship-details";function Lh(t){let e=uU(11),{id:o,allowEdit:n,allowRemove:r,alt:s,byteSize:i,className:a,collectionSlug:l,displayPreview:c,filename:u,mimeType:d,onRemove:f,reloadDoc:m,showCollectionSlug:p,src:h,thumbnailSrc:g,updatedAt:b,withMeta:C,x:y,y:v}=t,x=p===void 0?!1:p,I=C===void 0?!0:C,{config:w}=H(),{i18n:F}=N(),S="collections"in w?w.collections.find(M=>M.slug===l):void 0,R=o??void 0,D;e[0]!==l||e[1]!==R?(D={id:R,collectionSlug:l},e[0]=l,e[1]=R,e[2]=D):D=e[2];let[_,,T]=jt(D),{openDrawer:A}=T,L;e[3]!==l||e[4]!==m?(L=async M=>{let{doc:O}=M;return m(O.id,l)},e[3]=l,e[4]=m,e[5]=L):L=e[5];let P=L,E;e[6]!==y||e[7]!==v?(E=function(O,V){let W=[];return V&&W.push(mU(V)),y&&v&&W.push(`${y}x${v}`),O&&W.push(O),W.join(" \u2014 ")},e[6]=y,e[7]=v,e[8]=E):E=e[8];let k=I?E(d,i):"",$=c??S?.upload?.displayPreview??!0,j;return e[9]!==a?(j=[Fs,a].filter(Boolean),e[9]=a,e[10]=j):j=e[10],Nh("div",{className:j.join(" "),children:[Nh("div",{className:`${Fs}__imageAndDetails`,children:[$&&gi(PF,{alt:s,className:`${Fs}__thumbnail`,filename:u,fileSrc:g,imageCacheTag:S?.upload?.cacheTags&&b,size:"small"}),x&&S?gi(yt,{size:"small",children:dU(S.labels.singular,F)}):null,Nh("div",{className:`${Fs}__details`,children:[gi("p",{className:`${Fs}__filename`,children:h?gi("a",{href:h,target:"_blank",children:u}):u}),I?gi("p",{className:`${Fs}__meta`,children:k}):null]})]}),n!==!1||r!==!1?Nh("div",{className:`${Fs}__actions`,children:[n!==!1?gi(oe,{buttonStyle:"icon-label",className:`${Fs}__edit`,icon:"edit",iconStyle:"none",onClick:A}):null,r!==!1?gi(oe,{buttonStyle:"icon-label",className:`${Fs}__remove`,icon:"x",iconStyle:"none",onClick:()=>f()}):null,gi(_,{onSave:P})]}):null]})}import{jsx as fU}from"react/jsx-runtime";import"react";var SA="upload-field-card";function kh({children:t,className:e,size:o="medium"}){return fU("div",{className:[SA,e,`${SA}--size-${o}`].filter(Boolean).join(" "),children:t})}import{getBestFitFromSizes as gU,isImage as bU}from"payload/shared";var jd="upload upload--has-many";function IA(t){let e=pU(29),{className:o,displayPreview:n,fileDocs:r,isSortable:s,onRemove:i,onReorder:a,readonly:l,reloadDoc:c,serverURL:u,showCollectionSlug:d}=t,f=d===void 0?!1:d,m;e[0]!==r||e[1]!==a?(m=(v,x)=>{if(v===x)return;let I=[...r],[w]=I.splice(v,1);I.splice(x,0,w),a(I)},e[0]=r,e[1]=a,e[2]=m):m=e[2];let p=m,h;e[3]!==r||e[4]!==i?(h=v=>{let x=[...r||[]];x.splice(v,1),i(x.length===0?[]:x)},e[3]=r,e[4]=i,e[5]=h):h=e[5];let g=h,b;e[6]!==o?(b=[jd,o].filter(Boolean),e[6]=o,e[7]=b):b=e[7];let C=b.join(" "),y;if(e[8]!==n||e[9]!==r||e[10]!==s||e[11]!==p||e[12]!==l||e[13]!==c||e[14]!==g||e[15]!==u||e[16]!==f||e[17]!==C){let v;e[19]!==p?(v=I=>{let{moveFromIndex:w,moveToIndex:F}=I;return p(w,F)},e[19]=p,e[20]=v):v=e[20];let x;e[21]!==n||e[22]!==s||e[23]!==l||e[24]!==c||e[25]!==g||e[26]!==u||e[27]!==f?(x=(I,w)=>{let{relationTo:F,value:S}=I,R=String(S.id),D,_;if(S.url)try{D=new URL(S.url,u).toString()}catch{D=`${u}${S.url}`}if(S.thumbnailURL)try{_=new URL(S.thumbnailURL,u).toString()}catch{_=`${u}${S.thumbnailURL}`}return bU(S.mimeType)&&(_=gU({sizes:S.sizes,thumbnailURL:_,url:D,width:S.width})),wa(Nn,{disabled:!s||l,id:R,children:T=>wa("div",{className:[`${jd}__dragItem`,T&&s&&`${jd}--has-drag-handle`].filter(Boolean).join(" "),ref:T.setNodeRef,style:{transform:T.transform,transition:T.transition,zIndex:T.isDragging?1:void 0},children:hU(kh,{size:"small",children:[T&&wa("div",{className:`${jd}__drag`,...T.attributes,...T.listeners,children:wa(dn,{})}),wa(Lh,{allowEdit:!l,allowRemove:!l,alt:S?.alt||S?.filename,byteSize:S.filesize,collectionSlug:F,displayPreview:n,filename:S.filename,id:R,mimeType:S?.mimeType,onRemove:()=>g(w),reloadDoc:c,showCollectionSlug:f,src:D,thumbnailSrc:_,updatedAt:S.updatedAt,withMeta:!1,x:S?.width,y:S?.height})]})})},R)},e[21]=n,e[22]=s,e[23]=l,e[24]=c,e[25]=g,e[26]=u,e[27]=f,e[28]=x):x=e[28],y=wa("div",{className:C,children:wa(Vr,{className:`${jd}__draggable-rows`,ids:r?.map(vU),onDragEnd:v,children:r.map(x)})}),e[8]=n,e[9]=r,e[10]=s,e[11]=p,e[12]=l,e[13]=c,e[14]=g,e[15]=u,e[16]=f,e[17]=C,e[18]=y}else y=e[18];return y}function vU(t){let{value:e}=t;return String(e.id)}import{jsx as _A}from"react/jsx-runtime";import{getBestFitFromSizes as yU,isImage as CU}from"payload/shared";import"react";var xU="upload upload--has-one";function TA(t){let{className:e,displayPreview:o,fileDoc:n,onRemove:r,readonly:s,reloadDoc:i,serverURL:a,showCollectionSlug:l=!1}=t,{relationTo:c,value:u}=n,d=String(u?.id),f,m;if(u.url)try{f=new URL(u.url,a).toString()}catch{f=`${a}${u.url}`}if(u.thumbnailURL)try{m=new URL(u.thumbnailURL,a).toString()}catch{m=`${a}${u.thumbnailURL}`}return CU(u.mimeType)&&(m=yU({sizes:u.sizes,thumbnailURL:m,url:f,width:u.width})),_A(kh,{className:[xU,e].filter(Boolean).join(" "),children:_A(Lh,{allowEdit:!s,allowRemove:!s,alt:u?.alt||u?.filename,byteSize:u.filesize,collectionSlug:c,displayPreview:o,filename:u.filename,id:d,mimeType:u?.mimeType,onRemove:r,reloadDoc:i,showCollectionSlug:l,src:f,thumbnailSrc:m,updatedAt:u.updatedAt,x:u?.width,y:u?.height})})}var zn="upload";function jh(t){let{AfterInput:e,allowCreate:o,api:n,BeforeInput:r,className:s,Description:i,description:a,displayPreview:l,Error:c,filterOptions:u,hasMany:d,isSortable:f,Label:m,label:p,localized:h,maxRows:g,onChange:b,path:C,readOnly:y,relationTo:v,required:x,serverURL:I,showError:w,style:F,value:S}=t,[R,D]=Fn.useState(),[_]=Fn.useState(Array.isArray(v)?v[0]:v),{openModal:T}=ae(),{drawerSlug:A,setCollectionSlug:L,setInitialFiles:P,setMaxFiles:E,setOnSuccess:B,setSelectableCollections:k}=Wo(),{permissions:$}=Ie(),{code:j}=ye(),{i18n:M,t:O}=N(),V=vy(()=>Array.isArray(v)?v.filter(G=>$?.collections&&$.collections?.[G]?.create):[],[v,$]),W=vy(()=>{let G=Array.isArray(v);if(!S)return u;let ie={},Q=Array.isArray(S)?S:[S];for(let se of Q)if(G&&typeof se=="object"&&"relationTo"in se)ie[se.relationTo]||(ie[se.relationTo]=[]),ie[se.relationTo].push(se.value);else if(!G){let ee=v;ie[ee]||(ie[ee]=[]);let ge=typeof se=="object"&&"value"in se?se.value:se;(typeof ge=="string"||typeof ge=="number")&&ie[ee].push(ge)}let fe={...u};return(G?v:[v]).forEach(se=>{let ee=ie[se]||[];fe[se]={...u?.[se]||{},id:{...u?.[se]?.id||{},not_in:(u?.[se]?.id?.not_in||[]).concat(ee)}}}),fe},[S,u,v]),[Y,,{closeDrawer:z,openDrawer:K}]=ca({collectionSlugs:typeof v=="string"?[v]:v,filterOptions:W}),[U,,{closeDrawer:X,openDrawer:ne}]=jt({collectionSlug:_}),Z=Fn.useRef(null),J=vy(()=>o?!!(typeof _=="string"&&$?.collections&&$.collections?.[_]?.create):!1,[_,$,o]),re=Fn.useCallback(G=>{typeof b=="function"&&b(G)},[b]),me=Fn.useCallback(async G=>{if(!G?.length)return[];let ie={};G.forEach(({relationTo:ee,value:ge})=>{ie[ee]||(ie[ee]=[]);let te=ge;ge&&typeof ge=="object"&&"value"in ge&&(te=ge.value),ie[ee].push(te)});let Q=Object.entries(ie).map(async([ee,ge])=>{let te={depth:0,draft:!0,limit:ge.length,locale:j,where:{and:[{id:{in:ge}}]}},pe=await fetch(wU({apiRoute:n,path:`/${ee}`}),{body:DA.stringify(te),credentials:"include",headers:{"Accept-Language":M.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),be=[];pe.ok&&(be=(await pe.json()).docs);let ot=be.reduce((je,Je)=>(je[Je.id]=Je,je),{});return{collection:ee,docsById:ot}}),fe=await Promise.all(Q),de={};return fe.forEach(({collection:ee,docsById:ge})=>{de[ee]=ge}),G.map(({relationTo:ee,value:ge})=>{let te=de[ee]?.[ge]||{id:ge,filename:`${O("general:untitled")} - ID: ${ge}`,isPlaceholder:!0};return{relationTo:ee,value:te}})},[n,j,M.language,O]),xe=by(G=>wA(G,v),[v]),_e=by(G=>{let ie=Array.isArray(v);if(d){let Q=G.map(se=>ie?{relationTo:se.collectionSlug,value:se.doc.id}:se.doc.id),de=[...Array.isArray(S)?S.map(xe):[],...Q];re(de),D(se=>[...se||[],...G.map(ee=>({relationTo:ee.collectionSlug,value:ee.doc}))])}else{let Q=G[0],fe=ie?{relationTo:Q.collectionSlug,value:Q.doc.id}:Q.doc.id;re(fe),D([{relationTo:Q.collectionSlug,value:Q.doc}])}},[S,re,d,v,xe]),Be=Fn.useCallback(G=>{let ie=G;if(!d&&G&&G.length>1){let fe=new DataTransfer;fe.items.add(G[0]),ie=fe.files}ie&&P(ie);let Q=Array.isArray(v)?_:v;L(Q),Array.isArray(V)&&k(V),typeof g=="number"&&E(g),T(A)},[d,v,_,L,V,g,T,A,P,k,E]),Me=Fn.useCallback(async G=>{let ie=Array.isArray(v),Q=[];for(let[ge,te]of G)te&&Q.push(ge);let fe=Q.map(ge=>({relationTo:_,value:ge})),de=await me(fe);de&&D(ge=>[...ge||[],...de]);let se=Q.map(ge=>ie?{relationTo:_,value:ge}:ge),ee=Array.isArray(S)?S.map(xe):[];re([...ee,...se]),z()},[_,z,re,me,S,v,xe]),Ue=Fn.useCallback(G=>{let ie=Array.isArray(v);if(G.doc){D(fe=>[...fe||[],{relationTo:_,value:G.doc}]);let Q=ie?{relationTo:_,value:G.doc.id}:G.doc.id;re(Q)}X()},[X,_,re,v]),he=by(async({collectionSlug:G,doc:ie})=>{let Q=Array.isArray(v),de=(await me([{relationTo:G,value:ie.id}]))?.[0]||null;if(D(se=>de?d?[...se||[],de]:[de]:se),d){let se=Q?{relationTo:G,value:ie.id}:ie.id,ge=[...Array.isArray(S)?S.map(xe):[],se];re(ge)}else{let se=Q?{relationTo:G,value:ie.id}:ie.id;re(se)}z()},[z,d,me,re,S,v,xe]),Oe=Fn.useCallback(async(G,ie)=>{let Q=await me([{relationTo:ie,value:G}]);if(Q[0]){let fe=[];D(de=>{let se=de?.findIndex(ee=>(ee.value?.id===Q[0].value.id||ee.value?.isPlaceholder)&&ee.relationTo===ie);if(se>-1){let ee=[...de];return ee[se]=Q[0],fe=ee,ee}return de}),fe.length&&d&&re(fe.map(de=>de.value?.id))}},[me,re,d]),Ke=Fn.useCallback(G=>{let ie=Array.isArray(v),Q=G.map(({relationTo:fe,value:de})=>ie?{relationTo:fe,value:de.id}:de.id);re(Q),D(G)},[re,v]),le=Fn.useCallback(G=>{let ie=Array.isArray(v);if(!G||G.length===0){re(d?[]:null),D(d?[]:null);return}let Q=G.map(({relationTo:fe,value:de})=>ie?{relationTo:fe,value:de.id}:de.id);re(d?Q:Q[0]),D(G)},[re,d,v]);FA(()=>{async function G(){if(S){let Q=[];if(Array.isArray(v)&&(typeof S=="object"&&"relationTo"in S||Array.isArray(S)&&S.length>0&&typeof S[0]=="object"&&"relationTo"in S[0])?Q=(Array.isArray(S)?S:[S]).filter(de=>typeof de=="object"&&"relationTo"in de).map(de=>{let se=de.value;for(;se&&typeof se=="object"&&se!==null&&"value"in se;)se=se.value;return{relationTo:de.relationTo,value:se}}):Array.isArray(v)||(Q=(Array.isArray(S)?S:[S]).map(de=>{let se=de;for(;se&&typeof se=="object"&&se!==null&&"value"in se;)se=se.value;return{relationTo:v,value:se}})),Q.length>0){let fe=await me(Q);fe&&(D(fe),Z.current=S)}}else D([]),Z.current=null}Z.current!==S&&G()},[me,S,v]),FA(()=>{B(_e)},[S,C,_e,B]);let we=!S||d&&Array.isArray(S)&&(typeof g!="number"||S.length<g)||!d&&R?.[0]&&typeof R[0].value>"u";return Sa("div",{className:[Ae,zn,s,w&&"error",y&&"read-only"].filter(Boolean).join(" "),id:`field-${C?.replace(/\./g,"__")}`,style:F,children:[oo(ue,{CustomComponent:m,Fallback:oo(Ce,{label:p,localized:h,path:C,required:x})}),oo("div",{className:`${zn}__wrap`,children:oo(ue,{CustomComponent:c,Fallback:oo(Ze,{path:C,showError:w})})}),r,Sa("div",{className:`${zn}__dropzoneAndUpload`,children:[d&&Array.isArray(S)&&S.length>0?oo($d,{children:R&&R?.length>0?oo(IA,{displayPreview:l,fileDocs:R,isSortable:f&&!y,onRemove:le,onReorder:Ke,readonly:y,reloadDoc:Oe,serverURL:I,showCollectionSlug:Array.isArray(v)}):oo("div",{className:`${zn}__loadingRows`,children:S.map(G=>oo(Et,{height:"40px"},typeof G=="object"?G.value:G))})}):null,!d&&S?oo($d,{children:R&&R?.length>0&&R[0].value?oo(TA,{displayPreview:l,fileDoc:R[0],onRemove:le,readonly:y,reloadDoc:Oe,serverURL:I,showCollectionSlug:Array.isArray(v)}):R&&S&&!R?.[0]?.value?Sa($d,{children:[O("general:untitled")," - ID: ",S]}):oo(Et,{height:"62px"})}):null,we?oo(ba,{disabled:y||!J,multipleFiles:d,onChange:Be,children:Sa("div",{className:`${zn}__dropzoneContent`,children:[Sa("div",{className:`${zn}__dropzoneContent__buttons`,children:[J&&Sa($d,{children:[oo(oe,{buttonStyle:"pill",className:`${zn}__createNewToggler`,disabled:y||!J,onClick:()=>{y||(d?Be():ne())},size:"small",children:O("general:createNew")}),oo("span",{className:`${zn}__dropzoneContent__orText`,children:O("general:or")})]}),oo(oe,{buttonStyle:"pill",className:`${zn}__listToggler`,disabled:y,onClick:K,size:"small",children:O("fields:chooseFromExisting")}),oo(U,{onSave:Ue}),oo(Y,{allowCreate:J,enableRowSelections:d,onBulkSelect:Me,onSelect:he})]}),J&&!y&&Sa("p",{className:`${zn}__dragAndDropText`,children:[O("general:or")," ",O("upload:dragAndDrop")]})]})}):oo($d,{children:!y&&!R&&(!S||typeof g!="number"||Array.isArray(S)&&S.length<g)?oo(Et,{height:"40px"}):null})]}),e,oo(ue,{CustomComponent:i,Fallback:oo(Xe,{description:a,path:C})})]})}function IU(t){let{field:e,field:{admin:{allowCreate:o,className:n,description:r,isSortable:s}={},hasMany:i,label:a,localized:l,maxRows:c,relationTo:u,required:d},path:f,readOnly:m,validate:p}=t,{config:h}=H(),g=e.displayPreview,b=AA.useCallback((P,E)=>{if(typeof p=="function")return p(P,{...E,required:d})},[p,d]),{customComponents:{AfterInput:C,BeforeInput:y,Description:v,Error:x,Label:I}={},disabled:w,filterOptions:F,path:S,setValue:R,showError:D,value:_}=Te({potentiallyStalePath:f,validate:b}),T=Array.isArray(u),A=AA.useMemo(()=>i===!0&&Array.isArray(_)?_.map(P=>T?P:{relationTo:Array.isArray(u)?u[0]:u,value:P}):_,[i,_,T,u]),L=SU(()=>et(e),[e]);return RA(gy,{drawerSlugPrefix:f,children:RA(jh,{AfterInput:C,allowCreate:o!==!1,api:h.routes.api,BeforeInput:y,className:n,Description:v,description:r,displayPreview:g,Error:x,filterOptions:F,hasMany:i,isSortable:s,label:a,Label:I,localized:l,maxRows:c,onChange:R,path:S,readOnly:m||w,relationTo:u,required:d,serverURL:h.serverURL,showError:D,style:L,value:A})})}var Bd=ze(IU);function ql(t){let e=_U(13),{clientFieldConfig:o,forceRender:n,indexPath:r,parentPath:s,parentSchemaPath:i,path:a,permissions:l,readOnly:c,schemaPath:u}=t,d;e[0]!==a?(d=p=>{let[h]=p;return h&&h?.[a]?.customComponents?.Field},e[0]=a,e[1]=d):d=e[1];let f=Vt(d),m;if(e[2]!==f||e[3]!==o||e[4]!==n||e[5]!==r||e[6]!==s||e[7]!==i||e[8]!==a||e[9]!==l||e[10]!==c||e[11]!==u){m=Symbol.for("react.early_return_sentinel");e:{let p={forceRender:n,permissions:l,readOnly:c,schemaPath:u};if(o.admin?.hidden){m=Zt(ku,{...p,path:a});break e}if(f!==void 0){m=f||null;break e}let h={...p,indexPath:r,parentPath:s,parentSchemaPath:i};switch(o.type){case"array":{m=Zt(Md,{...h,field:o,path:a});break e}case"blocks":{m=Zt(fu,{...h,field:o,path:a});break e}case"checkbox":{m=Zt(Wr,{...p,field:o,path:a});break e}case"code":{m=Zt(hu,{...p,field:o,path:a});break e}case"collapsible":{m=Zt(bu,{...h,field:o,path:a});break e}case"date":{m=Zt(Nu,{...p,field:o,path:a});break e}case"email":{m=Zt(sa,{...p,field:o,path:a});break e}case"group":{m=Zt(Lu,{...h,field:o,path:a});break e}case"join":{m=Zt(Xu,{...p,field:o,path:a});break e}case"json":{m=Zt(Yu,{...p,field:o,path:a});break e}case"number":{m=Zt(Zu,{...p,field:o,path:a});break e}case"point":{m=Zt(Ju,{...p,field:o,path:a});break e}case"radio":{m=Zt(Ku,{...p,field:o,path:a});break e}case"relationship":{m=Zt(sd,{...p,field:o,path:a});break e}case"richText":{m=Zt(id,{...p,field:o,path:a});break e}case"row":{m=Zt(ad,{...h,field:o});break e}case"select":{m=Zt(ld,{...p,field:o,path:a});break e}case"tabs":{m=Zt(md,{...h,field:o,path:a});break e}case"text":{m=Zt(ga,{...p,field:o,path:a});break e}case"textarea":{m=Zt(pd,{...p,field:o,path:a});break e}case"ui":{m=Zt(hd,{});break e}case"upload":{m=Zt(Bd,{...p,field:o,path:a});break e}}}e[2]=f,e[3]=o,e[4]=n,e[5]=r,e[6]=s,e[7]=i,e[8]=a,e[9]=l,e[10]=c,e[11]=u,e[12]=m}else m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m}var Cy="render-fields",Lo=t=>{let e=TU(22),{className:o,fields:n,forceRender:r,margins:s,parentIndexPath:i,parentPath:a,parentSchemaPath:l,permissions:c,readOnly:u}=t,d=xr();if(n&&n.length>0){let f=s&&`${Cy}--margins-${s}`,m=s===!1&&`${Cy}--margins-none`,p;e[0]!==o||e[1]!==f||e[2]!==m?(p=[Cy,o,f,m].filter(Boolean),e[0]=o,e[1]=f,e[2]=m,e[3]=p):p=e[3];let h=p.join(" "),g;if(e[4]!==n||e[5]!==r||e[6]!==d||e[7]!==i||e[8]!==a||e[9]!==l||e[10]!==c||e[11]!==u||e[12]!==h){let b;e[14]!==r||e[15]!==d||e[16]!==i||e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=(C,y)=>{if(!C||FU(C))return null;let{operation:v,permissions:x,read:I}=RU({field:C,operation:d,parentName:a?.includes(".")?a.split(".")[a.split(".").length-1]:a,permissions:c});if("name"in C&&!I)return null;let w=u||C?.admin?.readOnly;w&&C.admin?.readOnly===!1&&(w=!1),"name"in C&&!v&&(w=!0);let{indexPath:F,path:S,schemaPath:R}=DU({field:C,index:y,parentIndexPath:i,parentPath:a,parentSchemaPath:l});return yy(ms,{value:S,children:yy(ql,{clientFieldConfig:C,forceRender:r,indexPath:F,parentPath:a,parentSchemaPath:l,path:S,permissions:x,readOnly:w,schemaPath:R})},`${S}-${y}`)},e[14]=r,e[15]=d,e[16]=i,e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],g=yy(pS,{className:h,forceRender:r,children:n.map(b)}),e[4]=n,e[5]=r,e[6]=d,e[7]=i,e[8]=a,e[9]=l,e[10]=c,e[11]=u,e[12]=h,e[13]=g}else g=e[13];return g}return null};var Od="array-field",PA=t=>{let e=AU(41),{addRow:o,attributes:n,copyRow:r,CustomRowLabel:s,duplicateRow:i,errorCount:a,fields:l,forceRender:c,hasMaxRows:u,isDragging:d,isLoading:f,isSortable:m,labels:p,listeners:h,moveRow:g,parentPath:b,pasteRow:C,path:y,permissions:v,readOnly:x,removeRow:I,row:w,rowCount:F,rowIndex:S,schemaPath:R,scrollIdPrefix:D,setCollapse:_,setNodeRef:T,transform:A,transition:L}=t,P=c===void 0?!1:c,E=Xf(f,500),{i18n:B}=N(),k=fo(),$=`${EU(p.singular,B)} ${String(S+1).padStart(2,"0")}`,j=a>0&&k,M=j?`${Od}__row--has-errors`:`${Od}__row--no-errors`,O;e[0]!==M?(O=[`${Od}__row`,M].filter(Boolean),e[0]=M,e[1]=O):O=e[1];let V=O.join(" "),W=`${b.split(".").join("-")}-row-${S}`,Y=d?1:void 0,z;if(e[2]!==s||e[3]!==o||e[4]!==n||e[5]!==V||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==$||e[10]!==j||e[11]!==l||e[12]!==P||e[13]!==u||e[14]!==B||e[15]!==E||e[16]!==m||e[17]!==h||e[18]!==g||e[19]!==b||e[20]!==C||e[21]!==y||e[22]!==v||e[23]!==x||e[24]!==I||e[25]!==w.collapsed||e[26]!==w.id||e[27]!==F||e[28]!==S||e[29]!==R||e[30]!==D||e[31]!==_||e[32]!==T||e[33]!==W||e[34]!==Y||e[35]!==A||e[36]!==L){let K;e[38]!==w.id||e[39]!==_?(K=U=>_(w.id,U),e[38]=w.id,e[39]=_,e[40]=K):K=e[40],z=bi("div",{id:W,ref:T,style:{transform:A,transition:L,zIndex:Y},children:bi(Yi,{actions:x?void 0:bi(Hf,{addRow:o,copyRow:r,duplicateRow:i,hasMaxRows:u,index:S,isSortable:m,moveRow:g,pasteRow:C,removeRow:I,rowCount:F}),className:V,collapsibleStyle:j?"error":"default",dragHandleProps:m?{id:w.id,attributes:n,listeners:h}:void 0,header:PU("div",{className:`${Od}__row-header`,id:`${D}-row-${S}`,children:[E?bi(Et,{height:"1rem",width:"8rem"}):bi(rs,{CustomComponent:s,label:$,path:y,rowNumber:S}),j&&bi(Io,{count:a,i18n:B,withMessage:!0})]}),isCollapsed:w.collapsed,onToggle:K,children:E?bi(Et,{}):bi(Lo,{className:`${Od}__fields`,fields:l,forceRender:P,margins:"small",parentIndexPath:"",parentPath:y,parentSchemaPath:R,permissions:v===!0?v:v?.fields,readOnly:x})})},`${b}-row-${w.id}`),e[2]=s,e[3]=o,e[4]=n,e[5]=V,e[6]=r,e[7]=i,e[8]=a,e[9]=$,e[10]=j,e[11]=l,e[12]=P,e[13]=u,e[14]=B,e[15]=E,e[16]=m,e[17]=h,e[18]=g,e[19]=b,e[20]=C,e[21]=y,e[22]=v,e[23]=x,e[24]=I,e[25]=w.collapsed,e[26]=w.id,e[27]=F,e[28]=S,e[29]=R,e[30]=D,e[31]=_,e[32]=T,e[33]=W,e[34]=Y,e[35]=A,e[36]=L,e[37]=z}else z=e[37];return z};var Er="array-field",jU=t=>{let{field:e,field:{name:o,type:n,admin:{className:r,description:s,isSortable:i=!0}={},fields:a,label:l,localized:c,maxRows:u,minRows:d,required:f},forceRender:m=!1,path:p,permissions:h,readOnly:g,schemaPath:b,validate:C}=t,y=b??o,v=d??(f?1:0),{setDocFieldPreferences:x}=Se(),{addFieldRow:I,dispatchFields:w,getFields:F,moveFieldRow:S,removeFieldRow:R,replaceState:D,setModified:_}=$e(),T=fo(),{code:A}=ye(),{i18n:L,t:P}=N(),{config:{localization:E}}=H(),B=(()=>{if(E&&E.fallback){let ee=E.defaultLocale;return A===ee}return!0})(),$=(ee=>"labels"in ee&&ee?.labels?ee.labels:"labels"in ee.field&&ee.field.labels?{plural:ee.field.labels?.plural,singular:ee.field.labels?.singular}:"label"in ee.field&&ee.field.label?{plural:void 0,singular:ee.field.label}:{plural:P("general:rows"),singular:P("general:row")})(t),j=Dn((ee,ge)=>{if(!B&&ee===null)return!0;if(typeof C=="function")return C(ee,{...ge,maxRows:u,minRows:v,required:f})},[u,v,f,C,B]),{customComponents:{AfterInput:M,BeforeInput:O,Description:V,Error:W,Label:Y}={},disabled:z,errorPaths:K,path:U,rows:X=[],showError:ne,valid:Z,value:J}=Te({hasRows:!0,potentiallyStalePath:p,validate:j}),re=kU(),me=EA(()=>`scroll-${re}`,[re]),xe=Dn(ee=>{I({path:U,rowIndex:ee,schemaPath:y}),setTimeout(()=>{vl(`${me}-row-${ee}`)},0)},[I,U,y,me]),_e=Dn(ee=>{w({type:"DUPLICATE_ROW",path:U,rowIndex:ee}),_(!0),setTimeout(()=>{vl(`${me}-row-${ee}`)},0)},[w,U,me,_]),Be=Dn(ee=>{R({path:U,rowIndex:ee})},[R,U]),Me=Dn((ee,ge)=>{S({moveFromIndex:ee,moveToIndex:ge,path:U})},[U,S]),Ue=Dn(ee=>{let{collapsedIDs:ge,updatedRows:te}=kf({collapsed:ee,rows:X});x(U,{collapsed:ge}),w({type:"SET_ALL_ROWS_COLLAPSED",path:U,updatedRows:te})},[w,U,X,x]),he=Dn((ee,ge)=>{let{collapsedIDs:te,updatedRows:pe}=Lf({collapsed:ge,rowID:ee,rows:X});w({type:"SET_ROW_COLLAPSED",path:U,updatedRows:pe}),x(U,{collapsed:te})},[w,U,X,x]),Oe=Dn(ee=>{let ge={...F()},te=el({type:n,fields:a,getDataToCopy:()=>nl({formState:ge,path:U,rowIndex:ee}),path:U,rowIndex:ee,t:P});typeof te=="string"?q.error(te):q.success(P("general:copied"))},[a,F,U,P,n]),Ke=Dn(ee=>{let ge={...F()},pe=tl({onPaste:be=>{let ot=sl({dataFromClipboard:be,formState:ge,path:U,rowIndex:ee});D(ot),_(!0)},path:U,schemaFields:a,t:P});typeof pe=="string"&&q.error(pe)},[a,F,U,D,_,P]),le=Dn(ee=>{let ge={...F()},te=sl({dataFromClipboard:ee,formState:ge,path:U});D(te),_(!0)},[F,U,D,_]),we=Dn(()=>nl({formState:{...F()},path:U}),[F,U]),G=u&&X.length>=u,ie=K.length,Q=T&&K.length>0,fe=(g||z)&&X.length===0,de=X.length&&X.length<v||f&&X.length===0,se=EA(()=>et(e),[e]);return vi("div",{className:[Ae,Er,r,Q?`${Er}--has-error`:`${Er}--has-no-error`].filter(Boolean).join(" "),id:`field-${U.replace(/\./g,"__")}`,style:se,children:[ne&&yo(ue,{CustomComponent:W,Fallback:yo(Ze,{path:U,showError:ne})}),vi("header",{className:`${Er}__header`,children:[vi("div",{className:`${Er}__header-wrap`,children:[vi("div",{className:`${Er}__header-content`,children:[yo("h3",{className:`${Er}__title`,children:yo(ue,{CustomComponent:Y,Fallback:yo(Ce,{as:"span",label:l,localized:c,path:U,required:f})})}),Q&&ie>0&&yo(Io,{count:ie,i18n:L,withMessage:!0})]}),vi("ul",{className:`${Er}__header-actions`,children:[X?.length>0&&vi(LU,{children:[yo("li",{children:yo("button",{className:`${Er}__header-action`,onClick:()=>Ue(!0),type:"button",children:P("fields:collapseAll")})}),yo("li",{children:yo("button",{className:`${Er}__header-action`,onClick:()=>Ue(!1),type:"button",children:P("fields:showAll")})})]}),yo("li",{children:yo(cf,{allowCopy:X?.length>0,allowPaste:!g,className:`${Er}__header-action`,disabled:z,fields:a,getDataToCopy:we,onPaste:le,path:U,type:n})})]})]}),yo(ue,{CustomComponent:V,Fallback:yo(Xe,{description:s,path:U})})]}),yo(lu,{fieldValue:J,localized:c,path:U,readOnly:g}),O,(X?.length>0||!Z&&(fe||de))&&vi(Vr,{className:`${Er}__draggable-rows`,ids:X.map(ee=>ee.id),onDragEnd:({moveFromIndex:ee,moveToIndex:ge})=>Me(ee,ge),children:[X.map((ee,ge)=>{let{id:te,isLoading:pe}=ee,be=`${U}.${ge}`,ot=K?.filter(je=>je.startsWith(be+".")).length;return yo(Nn,{disabled:g||z||!i,id:te,children:je=>yo(PA,{...je,addRow:xe,copyRow:Oe,CustomRowLabel:X?.[ge]?.customComponents?.RowLabel,duplicateRow:_e,errorCount:ot,fields:a,forceRender:m,hasMaxRows:G,isLoading:pe,isSortable:i,labels:$,moveRow:Me,parentPath:U,pasteRow:Ke,path:be,permissions:h,readOnly:g||z,removeRow:Be,row:ee,rowCount:X?.length,rowIndex:ge,schemaPath:y,scrollIdPrefix:me,setCollapse:he})},te)}),!Z&&vi(NU.Fragment,{children:[fe&&yo(an,{children:P("validation:fieldHasNo",{label:xy($.plural,L)})}),de&&yo(an,{type:"error",children:P("validation:requiresAtLeast",{count:v,label:xy(v>1?$.plural:$.singular,L)||P(v>1?"general:rows":"general:row")})})]})]}),!G&&!g&&yo(oe,{buttonStyle:"icon-label",className:`${Er}__add-row`,disabled:z,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{xe(J||0)},children:P("fields:addLabel",{label:xy($.singular,L)})}),M]})},Md=ze(jU);import{c as $U}from"react/compiler-runtime";import{jsx as wy,jsxs as NA}from"react/jsx-runtime";import{confirmPassword as BU}from"payload/shared";import"react";var Vd=t=>{let e=$U(12),{disabled:o,path:n}=t,r=n===void 0?"confirm-password":n,{t:s}=N(),i;e[0]!==r?(i={path:r,validate:MU},e[0]=r,e[1]=i):i=e[1];let{disabled:a,setValue:l,showError:c,value:u}=Te(i),d=c&&"error",f;e[2]!==d?(f=[Ae,"confirm-password",d].filter(Boolean),e[2]=d,e[3]=f):f=e[3];let m=f.join(" "),p;return e[4]!==a||e[5]!==o||e[6]!==r||e[7]!==l||e[8]!==s||e[9]!==m||e[10]!==u?(p=NA("div",{className:m,children:[wy(Ce,{htmlFor:"field-confirm-password",label:s("authentication:confirmPassword"),required:!0}),NA("div",{className:`${Ae}__wrap`,children:[wy(Ze,{path:r}),wy("input",{"aria-label":s("authentication:confirmPassword"),autoComplete:"off",disabled:!!(a||o),id:"field-confirm-password",name:"confirm-password",onChange:l,type:"password",value:u||""})]})]}),e[4]=a,e[5]=o,e[6]=r,e[7]=l,e[8]=s,e[9]=m,e[10]=u,e[11]=p):p=e[11],p};function MU(t,e){return BU(t,{name:"confirm-password",type:"text",required:!0,...e})}import{jsx as VU}from"react/jsx-runtime";import{password as GU}from"payload/shared";import{useCallback as zU,useMemo as WU}from"react";import{c as OU}from"react/compiler-runtime";import{jsx as Ia,jsxs as Sy}from"react/jsx-runtime";import{getTranslation as LA}from"@payloadcms/translations";import"react";var kA=t=>{let e=OU(28),{AfterInput:o,autoComplete:n,BeforeInput:r,className:s,description:i,Description:a,Error:l,inputRef:c,Label:u,label:d,localized:f,onChange:m,onKeyDown:p,path:h,placeholder:g,readOnly:b,required:C,rtl:y,showError:v,style:x,value:I,width:w}=t,F=n===void 0?"off":n,{i18n:S}=N(),R=v&&"error",D=b&&"read-only",_;e[0]!==s||e[1]!==R||e[2]!==D?(_=[Ae,"password",s,R,D].filter(Boolean),e[0]=s,e[1]=R,e[2]=D,e[3]=_):_=e[3];let T=_.join(" "),A;return e[4]!==o||e[5]!==r||e[6]!==a||e[7]!==l||e[8]!==u||e[9]!==F||e[10]!==i||e[11]!==S||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==m||e[16]!==p||e[17]!==h||e[18]!==g||e[19]!==b||e[20]!==C||e[21]!==y||e[22]!==v||e[23]!==x||e[24]!==T||e[25]!==I||e[26]!==w?(A=Sy("div",{className:T,style:{...x,width:w},children:[Ia(ue,{CustomComponent:u,Fallback:Ia(Ce,{label:d,localized:f,path:h,required:C})}),Sy("div",{className:`${Ae}__wrap`,children:[Ia(ue,{CustomComponent:l,Fallback:Ia(Ze,{path:h,showError:v})}),Sy("div",{children:[r,Ia("input",{"aria-label":LA(d,S),autoComplete:F,"data-rtl":y,disabled:b,id:`field-${h.replace(/\./g,"__")}`,name:h,onChange:m,onKeyDown:p,placeholder:LA(g,S),ref:c,type:"password",value:I||""}),o]}),Ia(ue,{CustomComponent:a,Fallback:Ia(Xe,{description:i,path:h})})]})]}),e[4]=o,e[5]=r,e[6]=a,e[7]=l,e[8]=u,e[9]=F,e[10]=i,e[11]=S,e[12]=c,e[13]=d,e[14]=f,e[15]=m,e[16]=p,e[17]=h,e[18]=g,e[19]=b,e[20]=C,e[21]=y,e[22]=v,e[23]=x,e[24]=T,e[25]=I,e[26]=w,e[27]=A):A=e[27],A};var HU=t=>{let{autoComplete:e,field:o,field:{admin:{className:n,disabled:r,placeholder:s,rtl:i}={},label:a,localized:l,required:c}={},inputRef:u,path:d,validate:f}=t,{t:m}=N(),p=ye(),{config:h}=H(),g=zU((_,T)=>{let A=d?d.split("."):[];return typeof f=="function"?f(_,{...T,required:c}):GU(_,{name:"password",type:"text",blockData:{},data:{},event:"onChange",path:A,preferences:{fields:{}},req:{payload:{config:h},t:m},required:!0,siblingData:{}})},[f,h,m,c,d]),{customComponents:{AfterInput:b,BeforeInput:C,Description:y,Error:v,Label:x}={},disabled:I,setValue:w,showError:F,value:S}=Te({path:d,validate:g}),R=bl({fieldLocalized:!1,fieldRTL:i,locale:p,localizationConfig:h.localization||void 0}),D=WU(()=>et(o),[o]);return VU(kA,{AfterInput:b,autoComplete:e,BeforeInput:C,className:n,Description:y,Error:v,inputRef:u,Label:x,label:a,localized:l,onChange:_=>{w(_.target.value)},path:d,placeholder:s,readOnly:I||r,required:c,rtl:R,showError:F,style:D,value:S||""})},Gd=ze(HU);var jA={array:Md,blocks:fu,checkbox:Wr,code:hu,collapsible:bu,confirmPassword:Vd,date:Nu,email:sa,group:Lu,hidden:ku,join:Xu,json:Yu,number:Zu,password:Gd,point:Ju,radio:Ku,relationship:sd,richText:id,row:ad,select:ld,tabs:md,text:ga,textarea:pd,ui:hd,upload:Bd},UU={...jA,Description:Xe,Error:Ze,Label:Ce,RowLabel:rs};import{c as XU}from"react/compiler-runtime";import{setsAreEqual as YU}from"payload/shared";import{useEffect as ZU}from"react";var Ds=new Map([]),JU={altleft:"alt",altright:"alt",controlleft:"ctrl",controlright:"ctrl",ctrlleft:"ctrl",ctrlright:"ctrl",escape:"esc",metaleft:"meta",metaright:"meta",osleft:"meta",osright:"meta",shiftleft:"shift",shiftright:"shift"},$A=t=>(JU[t.toLowerCase()]||t).trim().toLowerCase().replace("key",""),qU=t=>{let e=$A(t);e==="meta"&&Ds.forEach((o,n)=>n!=="meta"&&Ds.delete(n)),Ds.set(e,Date.now())},QU=t=>{let e=$A(t);e==="meta"&&Ds.clear(),Ds.delete(e)},_a=(t,e)=>{let o=XU(9),{cmdCtrlKey:n,editDepth:r,keyCodes:s}=t,{modalState:i}=ae(),a;o[0]!==n||o[1]!==r||o[2]!==e||o[3]!==s||o[4]!==i?(a=f=>{let m=f.detail?.key?f.detail:f;if(m.key===void 0)return;Ds.forEach(KU),m.code&&qU(m.code);let p=window.navigator.userAgent.includes("Mac OS X"),h=[...Ds.keys()].filter(eX);if(YU(new Set(h),new Set(s))&&(!n||p&&Ds.has("meta")||!p&&m.ctrlKey)){if((Object.keys(i).filter(b=>i[b]?.isOpen)?.length+1||1)!==r)return;e(m)}},o[0]=n,o[1]=r,o[2]=e,o[3]=s,o[4]=i,o[5]=a):a=o[5];let l=a,c=tX,u,d;o[6]!==l?(u=()=>(document.addEventListener("keydown",l,!1),document.addEventListener("bypassKeyDown",l,!1),document.addEventListener("keyup",c,!1),()=>{document.removeEventListener("keydown",l),document.removeEventListener("bypassKeyDown",l),document.removeEventListener("keyup",c)}),d=[l,c],o[6]=l,o[7]=u,o[8]=d):(u=o[7],d=o[8]),ZU(u,d)};function KU(t,e){Date.now()-t>3e3&&Ds.delete(e)}function eX(t){return!["alt","ctrl","meta","shift"].includes(t)}function tX(t){t.code&&QU(t.code)}import{c as oX}from"react/compiler-runtime";import*as MA from"qs-esm";import{useEffect as BA,useRef as rX,useState as $h}from"react";var nX=(t,e)=>{let o=oX(30),n;o[0]!==e?(n=e===void 0?{}:e,o[0]=e,o[1]=n):n=o[1];let r=n,{initialData:s,initialParams:i}=r,a;o[2]!==i?(a=i===void 0?{}:i,o[2]=i,o[3]=a):a=o[3];let l=a,{i18n:c}=N(),u;o[4]!==s?(u=s||{},o[4]=s,o[5]=u):u=o[5];let[d,f]=$h(u),[m,p]=$h(l),[h,g]=$h(!s),[b,C]=$h(!1),{code:y}=ye(),v=rX(!1),x;o[6]!==y||o[7]!==m?(x=MA.stringify({locale:y,...typeof m=="object"?m:{}},{addQueryPrefix:!0}),o[6]=y,o[7]=m,o[8]=x):x=o[8];let I=x,w;o[9]!==c.language||o[10]!==s||o[11]!==I||o[12]!==t?(w=()=>{if(s&&!v.current){v.current=!0;return}let A=new AbortController;return t?(async()=>{C(!1),g(!0);try{let P=await Ge.get(`${t}${I}`,{headers:{"Accept-Language":c.language},signal:A.signal});P.status>201&&C(!0);let E=await P.json();f(E),g(!1)}catch{A.signal.aborted||(C(!0),g(!1))}})():(C(!1),g(!1)),()=>{try{A.abort()}catch(P){let E=P}}},o[9]=c.language,o[10]=s,o[11]=I,o[12]=t,o[13]=w):w=o[13];let F;o[14]!==c.language||o[15]!==s||o[16]!==y||o[17]!==I||o[18]!==t?(F=[t,y,I,c.language,s],o[14]=c.language,o[15]=s,o[16]=y,o[17]=I,o[18]=t,o[19]=F):F=o[19],BA(w,F);let S,R;o[20]!==s?(S=()=>{s&&v.current&&f(s)},R=[s],o[20]=s,o[21]=S,o[22]=R):(S=o[21],R=o[22]),BA(S,R);let D;o[23]!==d||o[24]!==b||o[25]!==h?(D={data:d,isError:b,isLoading:h},o[23]=d,o[24]=b,o[25]=h,o[26]=D):D=o[26];let _;o[27]===Symbol.for("react.memo_cache_sentinel")?(_={setParams:p},o[27]=_):_=o[27];let T;return o[28]!==D?(T=[D,_],o[28]=D,o[29]=T):T=o[29],T};import{c as sX}from"react/compiler-runtime";import{useEffect as iX,useState as aX}from"react";var Bh=t=>{let e=sX(5),[o,n]=aX(),r,s;e[0]!==t?(r=()=>{let a;return t&&(a=new ResizeObserver(l=>{l.forEach(c=>{let{contentBoxSize:u,contentRect:d}=c,f=0,m=0;if(u){let p=Array.isArray(u)?u[0]:u;if(p){let{blockSize:h,inlineSize:g}=p;f=g,m=h}}else if(d){let{height:p,width:h}=d;f=h,m=p}n({height:m,width:f})})}),a.observe(t)),()=>{a&&a.unobserve(t)}},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),iX(r,s);let i;return e[3]!==o?(i={size:o},e[3]=o,e[4]=i):i=e[4],i};import{c as lX}from"react/compiler-runtime";import{flattenTopLevelFields as cX}from"payload/shared";var Iy=t=>{let e=lX(4),{admin:o,fields:n}=t,{useAsTitle:r}=o,{i18n:s}=N(),i;return e[0]!==n||e[1]!==s||e[2]!==r?(i=cX(n,{i18n:s,moveSubFieldsToTop:!0})?.find(l=>"name"in l&&l.name===r),e[0]=n,e[1]=s,e[2]=r,e[3]=i):i=e[3],i};import{c as OA}from"react/compiler-runtime";import{jsx as Oh}from"react/jsx-runtime";import"react";import{jsx as Mh}from"react/jsx-runtime";import"react";var zd=({className:t})=>Mh("svg",{className:"icon icon--sort",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mh("path",{className:"fill",d:"M2.5 13.3333L5.83333 16.6667M5.83333 16.6667L9.16667 13.3333M5.83333 16.6667V3.33333M9.16667 7.08333H17.5M9.16667 10.4167H15M11.6667 13.75H12.5",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})}),_y=({className:t})=>Mh("svg",{className:"icon icon--sort",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mh("path",{className:"fill",d:"M2.5 6.66668L5.83333 3.33334M5.83333 3.33334L9.16667 6.66668M5.83333 3.33334V16.6667M11.6667 7.08354H17.5M9.16667 10.4169H15M9.16667 13.7502H12.5",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})});var Wd="sort-header";function uX(){let t=OA(7),{handleSortChange:e,orderableFieldName:o,query:n}=mt(),s=(Array.isArray(n.sort)?n.sort[0]:n.sort)===o,i;t[0]!==e||t[1]!==s||t[2]!==o?(i=()=>{s||e(o)},t[0]=e,t[1]=s,t[2]=o,t[3]=i):i=t[3];let a=i,l;return t[4]!==a||t[5]!==s?(l={handleSortPress:a,isActive:s},t[4]=a,t[5]=s,t[6]=l):l=t[6],l}var dX=t=>{let e=OA(7),{appearance:o}=t,{handleSortPress:n,isActive:r}=uX(),{t:s}=N(),i=o&&`${Wd}--appearance-${o}`,a;e[0]!==i?(a=[Wd,i].filter(Boolean),e[0]=i,e[1]=a):a=e[1];let l=a.join(" "),c;return e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==l?(c=Oh("div",{className:l,children:Oh("div",{className:`${Wd}__buttons`,children:Oh("button",{"aria-label":s("general:sortByLabelDirection",{direction:s("general:ascending"),label:"Order"}),className:`${Wd}__button ${r?`${Wd}--active`:""}`,onClick:n,type:"button",children:Oh(zd,{})})})}),e[2]=n,e[3]=r,e[4]=s,e[5]=l,e[6]=c):c=e[6],c};import{c as mX}from"react/compiler-runtime";import{jsx as VA}from"react/jsx-runtime";import"react";var GA="sort-row",fX=()=>{let t=mX(2),{orderableFieldName:e,query:o}=mt(),n=o.sort===e||o.sort===`-${e}`,r=`${GA} ${n?"active":""}`,s;return t[0]!==r?(s=VA("div",{className:r,role:"button",tabIndex:0,children:VA(dn,{className:`${GA}__icon`})}),t[0]=r,t[1]=s):s=t[1],s};import{jsx as Wn,jsxs as Dy}from"react/jsx-runtime";import{DragOverlay as pX}from"@dnd-kit/core";import{formatAdminURL as hX}from"payload/shared";import{useEffect as gX,useState as Ry}from"react";import{jsx as Vh}from"react/jsx-runtime";var Ty=({cellMap:t,columns:e,dragAttributes:o={},dragListeners:n={},rowId:r,...s})=>Vh("tr",{...s,children:e.map((i,a)=>{let{accessor:l}=i,c=i.renderedCells[t[r]];return l==="_dragHandle"?Vh("td",{className:`cell-${l}`,children:Vh("div",{...o,...n,children:c})},a):Vh("td",{className:`cell-${l}`,children:c},a)})});import{jsx as Fy}from"react/jsx-runtime";var zA=({children:t,className:e,rowId:o})=>typeof o>"u"?null:Fy("div",{className:e,children:Fy("table",{cellPadding:0,cellSpacing:0,children:Fy("tbody",{children:t})})});var Gh="table",bX=({appearance:t="default",BeforeTable:e,collection:o,columns:n,data:r})=>{let{config:s}=H(),{data:i,orderableFieldName:a,query:l}=mt(),{code:c}=ye(),u=i?.docs||r,[d,f]=Ry(u),[m,p]=Ry({}),[h,g]=Ry();gX(()=>{f(u),p(Object.fromEntries(u.map((x,I)=>[String(x.id??x._id),I])))},[u]);let b=n?.filter(x=>x?.active);if(!b||b.filter(x=>!["_dragHandle","_select"].includes(x.accessor)).length===0)return Wn("div",{children:"No columns selected"});let C=async({moveFromIndex:x,moveToIndex:I})=>{if(l.sort!==a&&l.sort!==`-${a}`){q.warning('To reorder the rows you must first sort them by the "Order" column'),g(void 0);return}if(x===I){g(void 0);return}let w=d[x].id??d[x]._id,F=I>x?d[I]:d[I-1],S=I>x?d[I+1]:d[I],R=[...d];f(D=>{let _=[...D];return _[x][a]="pending",_.splice(I,0,_.splice(x,1)[0]),_});try{let D=F?{id:F.id??F._id,key:F[a]}:{id:S.id??S._id,key:S[a]},_=F&&l.sort===a||!F&&l.sort===`-${a}`?"greater":"less",T={collectionSlug:o.slug,docsToMove:[w],newKeyWillBe:_,orderableFieldName:a,target:D},A=await fetch(hX({apiRoute:s.routes.api,path:`/reorder?locale=${c}`}),{body:JSON.stringify(T),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(A.status===403)throw new Error("You do not have permission to reorder these rows");if(!A.ok)throw new Error("Failed to reorder. This can happen if you reorder several rows too quickly. Please try again.");if(A.status===200&&(await A.json()).message==="initial migration")throw new Error('You have enabled "orderable" on a collection with existing documentsand this is the first time you have sorted documents. We have run an automatic migration to add an initial order to the documents. Please refresh the page and try again.')}catch(D){let _=D instanceof Error?D.message:String(D);f(R),q.error(_)}finally{g(void 0)}},y=({id:x})=>{g(x)},v=d.map(x=>x.id??x._id);return Dy("div",{className:[Gh,t&&`${Gh}--appearance-${t}`].filter(Boolean).join(" "),children:[e,Dy(Vr,{ids:v,onDragEnd:C,onDragStart:y,children:[Dy("table",{cellPadding:"0",cellSpacing:"0",children:[Wn("thead",{children:Wn("tr",{children:b.map((x,I)=>Wn("th",{id:`heading-${x.accessor}`,children:x.Heading},I))})}),Wn("tbody",{children:d.map((x,I)=>Wn(Nn,{id:v[I],children:({attributes:w,isDragging:F,listeners:S,setNodeRef:R,transform:D,transition:_})=>Wn(Ty,{cellMap:m,className:`row-${I+1}`,columns:b,dragAttributes:w,dragListeners:S,ref:R,rowId:x.id??x._id,style:{opacity:F?0:1,transform:D,transition:_}})},v[I]))})]}),Wn(pX,{children:Wn(zA,{className:[Gh,`${Gh}--drag-preview`].join(" "),rowId:h,children:Wn(Ty,{cellMap:m,columns:b,rowId:h})})})]})]})};import{jsx as WA}from"react/jsx-runtime";import{toWords as vX,transformColumnsToSearchParams as yX}from"payload/shared";import"react";var CX="query-preset-columns-cell",xX=({cellData:t})=>WA("div",{className:CX,children:t?yX(t).map((e,o)=>{let n=!e.startsWith("-");return n?WA(yt,{pillStyle:n?"always-white":"light",size:"small",children:vX(e)},o):null}):"No columns selected"});import{jsx as wX}from"react/jsx-runtime";import{toWords as zh}from"payload/shared";import"react";var SX=t=>{if(t.or&&t.or.length>0&&t.or[0].and&&t.or[0].and.length>0){let o=t.or[0]?.and?.[0];if(!o||typeof o!="object")return"No where query";let n=Object.keys(o)[0];if(!n||!o[n]||typeof o[n]!="object")return"No where query";let r=Object.keys(o[n])[0],s=o[n][r];if(typeof s=="string")return`${zh(n)} ${r} ${zh(s)}`;if(Array.isArray(s))return`${zh(n)} ${r} ${s.map(i=>zh(i)).join(" or ")}`}return""},IX=({cellData:t})=>wX("div",{children:t?SX(t):"No where query"});import{jsx as HA,jsxs as UA}from"react/jsx-runtime";import{toWords as XA}from"payload/shared";import{Fragment as _X}from"react";var TX=({cellData:t})=>{let e=["read","update","delete"];return HA("p",{children:e.reduce((o,n,r)=>{let s=t?.[n];return s&&s.constraint&&o.push(UA(_X,{children:[UA("span",{children:[HA("strong",{children:XA(n)}),": ",XA(s.constraint)]}),r!==e.length-1&&", "]},n)),o},[])})};import{jsx as AX,jsxs as PX}from"react/jsx-runtime";import{toWords as EX}from"payload/shared";import{useMemo as e4}from"react";import{getTranslation as Xd}from"@payloadcms/translations";import{fieldAffectsData as qA,fieldIsHiddenOrDisabled as RX,fieldIsID as QA,tabHasName as KA}from"payload/shared";var Wh=[{label:"equals",value:"equals"},{label:"isNotEqualTo",value:"not_equals"}],FX=[{label:"isIn",value:"in"},{label:"isNotIn",value:"not_in"}],ac={label:"exists",value:"exists"},tn=[...Wh,...FX,ac],YA=[...tn,{label:"isGreaterThan",value:"greater_than"},{label:"isLessThan",value:"less_than"},{label:"isLessThanOrEqualTo",value:"less_than_equal"},{label:"isGreaterThanOrEqualTo",value:"greater_than_equal"}],DX=[...Wh,{label:"near",value:"near"}],ZA={label:"within",value:"within"},JA={label:"intersects",value:"intersects"},Hd={label:"isLike",value:"like"},Ud={label:"isNotLike",value:"not_like"},ic={label:"contains",value:"contains"},lc={checkbox:{component:"Text",operators:[...Wh,ac]},code:{component:"Text",operators:[...tn,Hd,Ud,ic]},date:{component:"Date",operators:[...YA,ac]},email:{component:"Text",operators:[...tn,ic]},json:{component:"Text",operators:[...tn,Hd,ic,Ud,ZA,JA]},number:{component:"Number",operators:[...YA,ac]},point:{component:"Point",operators:[...DX,ac,ZA,JA]},radio:{component:"Select",operators:[...tn]},relationship:{component:"Relationship",operators:[...tn]},richText:{component:"Text",operators:[...tn,Hd,Ud,ic]},select:{component:"Select",operators:[...tn]},text:{component:"Text",operators:[...tn,Hd,Ud,ic]},textarea:{component:"Text",operators:[...tn,Hd,Ud,ic]},upload:{component:"Relationship",operators:[...tn]}},Hh=({field:t,operator:e})=>{let o=[];return t.type==="relationship"&&Array.isArray(t.relationTo)?"hasMany"in t&&t.hasMany?o=[...Wh,ac]:o=[...tn]:o=[...lc[t.type].operators],{validOperator:e&&o.find(({value:n})=>n===e)?e:o[0].value,validOperators:o}};var fr=({fieldPermissions:t,fields:e,i18n:o,labelPrefix:n,pathPrefix:r})=>e.reduce((s,i)=>{let a=r;if(RX(i)&&!QA(i)||"virtual"in i&&i.virtual===!0)return s;let l=!1;if("virtual"in i&&typeof i.virtual=="string"&&(a=a?a+"."+i.virtual:i.virtual,qA(i)&&(l=!0)),i.type==="tabs"&&"tabs"in i)return i.tabs.forEach(u=>{if(typeof u.label!="boolean"){let d=Xd(u.label,o),f=n?n+" > "+d:d,m=KA(u)&&u.name?a?a+"."+u.name:u.name:a;typeof d=="string"&&s.push(...fr({fieldPermissions:typeof t=="boolean"?t:KA(u)&&u.name?t?.[u.name]?.fields||t?.[u.name]:t,fields:u.fields,i18n:o,labelPrefix:f,pathPrefix:m}))}}),s;if(i.type==="row"&&"fields"in i)return s.push(...fr({fieldPermissions:t,fields:i.fields,i18n:o,labelPrefix:n,pathPrefix:a})),s;if(i.type==="collapsible"&&"fields"in i){let c=Xd(i.label||"",o),u=n?n+" > "+c:c;return s.push(...fr({fieldPermissions:t,fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:a})),s}if(i.type==="group"&&"fields"in i){let c=Xd(i.label||"",o),u=n?c?n+" > "+c:n:c;if(qA(i)){let d=i.name?a?a+"."+i.name:i.name:a;s.push(...fr({fieldPermissions:typeof t=="boolean"?t:t?.[i.name]?.fields||t?.[i.name],fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:d}))}else s.push(...fr({fieldPermissions:t,fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:a}));return s}if(i.type==="array"&&"fields"in i){let c=Xd(i.label||"",o),u=n?c?n+" > "+c:n:c,d=i.name?a?a+"."+i.name:i.name:a;return s.push(...fr({fieldPermissions:typeof t=="boolean"?t:t?.[i.name]?.fields||t?.[i.name],fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:d})),s}if(typeof lc[i.type]=="object"&&(QA(i)||t===!0||t?.[i.name]===!0||t?.[i.name]?.read===!0)){let c=new Set,{validOperators:u}=Hh({field:i}),d=u.reduce((g,b)=>{if(!c.has(b.value)){c.add(b.value);let C=`operators:${b.label}`;g.push({...b,label:o.t(C)})}return g},[]),f=Xd(i.label||"",o),m=n?gd({field:i,prefix:n}):f,p;l?p=a:a?p=Jl(a,i):p=i.name;let h={label:m,plainTextLabel:`${n?n+" > ":""}${f}`,value:p,...lc[i.type],field:i,operators:d};return s.push(h),s}return s},[]);var NX=({cellData:t,rowData:e})=>{let{i18n:o}=N(),{permissions:n}=Ie(),{config:r}=H(),s=e?.relatedCollection,i=e4(()=>s?r.collections?.find(m=>m.slug===s):null,[s,r.collections]),a=e4(()=>{if(!i)return[];let m=n?.collections?.[s]?.fields;return fr({fieldPermissions:m,fields:i.fields,i18n:o})},[i,n,s,o]);if(!t||typeof t!="string")return AX("div",{children:"No group by selected"});let l=t.startsWith("-"),c=l?t.slice(1):t,u=l?"descending":"ascending",f=a.find(m=>m.value===c)?.label||EX(c);return PX("div",{children:[f," (",u,")"]})};import{jsx as Zd,jsxs as i4}from"react/jsx-runtime";import BX,{useId as MX,useMemo as Jd}from"react";import{fieldAffectsData as n4,flattenTopLevelFields as $X}from"payload/shared";import{fieldAffectsData as LX,fieldIsHiddenOrDisabled as kX,fieldIsID as t4}from"payload/shared";var jX=t=>t.type!=="ui"&&kX(t)&&!t4(t)||t?.admin?.disableListColumn===!0,Yd=({fieldPermissions:t,fields:e})=>(e??[]).reduce((o,n)=>{if(jX(n))return o;if(n.type==="tabs"&&"tabs"in n){let r={...n,tabs:n.tabs.map(s=>({...s,fields:Yd({fieldPermissions:typeof t=="boolean"?t:"name"in s&&s.name?t[s.name]?.fields||t[s.name]:t,fields:s.fields})}))};return o.push(r),o}if("fields"in n&&Array.isArray(n.fields)){let r={...n,fields:Yd({fieldPermissions:typeof t=="boolean"?t:"name"in n&&n.name?t?.[n.name]?.fields||t?.[n.name]:t,fields:n.fields})};return o.push(r),o}if(t===!0)return o.push(n),o;if(LX(n)){let r=t?.[n.name];return(t4(n)||r===!0||r?.read===!0)&&o.push(n),o}return o.push(n),o},[]);import{fieldAffectsData as o4}from"payload/shared";var Ay=(t,e)=>t?.reduce((o,n)=>o4(n)&&n.name===e?o:!o4(n)&&"fields"in n?[...o,...Ay(n.fields,e)]:n.type==="tabs"&&"tabs"in n?[...o,...n.tabs.reduce((r,s)=>[...r,..."name"in s?[s.name]:Ay(s.fields,e)],[])]:[...o,n.name],[]),r4=(t,e,o)=>{let n=[];if(Array.isArray(o)&&o.length>=1)n=o;else{e&&n.push(e);let r=Ay(t,e);n=n.concat(r),n=n.slice(0,4)}return n.map(r=>({accessor:r,active:!0}))};var s4=({clientConfig:t,collectionConfig:e,collectionSlug:o,columns:n,i18n:r,permissions:s})=>{let i=Array.isArray(o),a=i?[]:e?.fields??[];if(i)for(let l of o){let c=t.collections.find(u=>u.slug===l);for(let u of Yd({fieldPermissions:s?.collections?.[l]?.fields||!0,fields:c.fields}))n4(u)&&a.some(d=>n4(d)&&d.name===u.name)||a.push(u)}return n?.length?n?.filter(l=>$X(a,{i18n:r,keepPresentationalFields:!0,moveSubFieldsToTop:!0})?.some(c=>("accessor"in c?c.accessor:"name"in c?c.name:void 0)===l.accessor)):r4(i?a:Yd({fieldPermissions:typeof o=="string"&&s?.collections?.[o]?.fields?s.collections[o].fields:!0,fields:a}),e?.admin?.useAsTitle,i?[]:e?.admin?.defaultColumns)};var OX=({field:{label:t,required:e}})=>{let{path:o,setValue:n,value:r}=Te(),i=Te({path:"relatedCollection"}).value,{config:a,getEntityConfig:l}=H(),{i18n:c}=N(),{permissions:u}=Ie(),d=MX(),f=Jd(()=>i?l({collectionSlug:i}):null,[i,l]),m=Jd(()=>!i||!f?[]:s4({clientConfig:a,collectionConfig:f,collectionSlug:i,columns:r??[],i18n:c,permissions:u}),[a,f,i,r,c,u]),p=Jd(()=>f?.fields?fr({fieldPermissions:u?.collections?.[i]?.fields??!0,fields:f.fields,i18n:c}):[],[f,c,u,i]),h=Jd(()=>{let y={};for(let v of p)y[String(v.value)]=v.label;return y},[p]),g=Jd(()=>m.map((y,v)=>({name:y.accessor,key:`${i}-${y.accessor}-${v}-${d}`,Label:h[y.accessor]??y.accessor,selected:y.active})),[h,m,i,d]),b=r??m,C=BX.useCallback(({pill:y})=>{let v=b.map(x=>x.accessor===y.name?{...x,active:!x.active}:x);n(v.length?v:void 0)},[b,n]);return i?i4("div",{className:"field-type query-preset-columns-field",children:[Zd(Ce,{as:"h3",label:t,path:o,required:e}),g.length>0?Zd(Ou,{onClick:C,pills:g}):Zd("p",{className:"query-preset-columns-field__hint",children:"No columns available for this collection."})]}):i4("div",{className:"field-type query-preset-columns-field",children:[Zd(Ce,{as:"h3",label:t,path:o,required:e}),Zd("p",{className:"query-preset-columns-field__hint",children:"Select the related collection to configure columns."})]})};import{c as cY}from"react/compiler-runtime";import{jsx as Jh,jsxs as _4}from"react/jsx-runtime";import"react";import{jsx as Ps,jsxs as qd}from"react/jsx-runtime";import{getTranslation as iY}from"@payloadcms/translations";import{dequal as aY}from"dequal/lite";import{transformWhereQuery as lY,validateWhereQuery as I4}from"payload/shared";import Yh,{useMemo as Oy}from"react";import{jsx as Rs,jsxs as My}from"react/jsx-runtime";import{useCallback as w4,useEffect as nY,useState as sY}from"react";import{jsx as cc}from"react/jsx-runtime";import"react";import{jsx as a4}from"react/jsx-runtime";import{getTranslation as VX}from"@payloadcms/translations";import"react";var GX="condition-value-date",Py=t=>{let{disabled:e,field:o,onChange:n,value:r}=t,{admin:s}=o,{date:i}=s||{},{i18n:a,t:l}=N();return a4("div",{className:GX,children:a4(Cl,{...i,onChange:n,placeholder:VX(s.placeholder,a)||l("general:enterAValue"),readOnly:e,value:r})})};import{c as zX}from"react/compiler-runtime";import{jsx as l4}from"react/jsx-runtime";import{getTranslation as WX}from"@payloadcms/translations";import c4 from"react";var HX="condition-value-number",Ey=t=>{let e=zX(20),{disabled:o,field:n,onChange:r,operator:s,value:i}=t,{admin:a,hasMany:l}=n,{i18n:c,t:u}=N(),d;e[0]!==l||e[1]!==s?(d=["in","not_in"].includes(s)||l,e[0]=l,e[1]=s,e[2]=d):d=e[2];let f=d,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[3]=m):m=e[3];let[p,h]=c4.useState(m),g;e[4]!==f||e[5]!==r?(g=x=>{let I;x?f&&(Array.isArray(x)?I=x.map(UX):I=[Number(x.value?.value||x.value)]):I=[],r(I)},e[4]=f,e[5]=r,e[6]=g):g=e[6];let b=g,C,y;e[7]!==i?(C=()=>{Array.isArray(i)?h(i.map(XX)):h([])},y=[i],e[7]=i,e[8]=C,e[9]=y):(C=e[8],y=e[9]),c4.useEffect(C,y);let v;if(e[10]!==a?.placeholder||e[11]!==o||e[12]!==c||e[13]!==f||e[14]!==r||e[15]!==b||e[16]!==u||e[17]!==i||e[18]!==p){let x=WX(a?.placeholder,c)||u("general:enterAValue");v=f?l4(pt,{disabled:o,isClearable:!0,isCreatable:!0,isMulti:f,isSortable:!0,numberOnly:!0,onChange:b,options:[],placeholder:x,value:p||[]}):l4("input",{className:HX,disabled:o,onChange:I=>r(I.target.value),placeholder:x,type:"number",value:i}),e[10]=a?.placeholder,e[11]=o,e[12]=c,e[13]=f,e[14]=r,e[15]=b,e[16]=u,e[17]=i,e[18]=p,e[19]=v}else v=e[19];return v};function UX(t){return Number(t.value?.value||t.value)}function XX(t,e){return{id:`${t}${e}`,label:`${t}`,value:{toString:()=>`${t}${e}`,value:t?.value||t}}}import{jsx as Ny}from"react/jsx-runtime";import{formatAdminURL as f4}from"payload/shared";import*as b4 from"qs-esm";import p4,{useCallback as Uh,useEffect as h4,useReducer as ZX,useState as Ly}from"react";import{getTranslation as u4}from"@payloadcms/translations";var d4=t=>t.reduce((e,o)=>o.options?[...e,...d4(o.options)]:[...e,o.id],[]),YX=(t,e)=>{switch(e.type){case"ADD":{let{collection:o,data:n,hasMultipleRelations:r,i18n:s,relation:i}=e,a=o.admin.useAsTitle||"id",l=d4(t);if(!r)return[...t,...n.docs.reduce((f,m)=>l.indexOf(m.id)===-1?(l.push(m.id),[...f,{label:m[a],value:m.id}]):f,[])];let c=[...t],u=c.find(f=>f.label===u4(o.labels.plural,s)),d=n.docs.reduce((f,m)=>l.indexOf(m.id)===-1?(l.push(m.id),[...f,{label:m[a],relationTo:i,value:m.id}]):f,[]);return u?u.options=[...u.options,...d]:c.push({label:u4(o.labels.plural,s),options:d,value:void 0}),c}case"CLEAR":return e.required?[]:[{label:e.i18n.t("general:none"),value:"null"}];default:return t}},m4=YX;var g4="condition-value-relationship",JX=10,Xh=t=>{let{disabled:e,field:{admin:o={},hasMany:n,relationTo:r},filterOptions:s,onChange:i,value:a}=t,l="placeholder"in o?o?.placeholder:void 0,c=o?.isSortable,{config:{routes:{api:u}},getEntityConfig:d}=H(),f=Array.isArray(r),[m,p]=ZX(m4,[]),[h,g]=Ly(""),b=Cn(h,300),[C,y]=Ly(""),[v,x]=Ly(!1),{i18n:I,t:w}=N(),F=ye(),S=f?r:[r],R=p4.useRef(new Map(S.map(k=>[k,{hasLoadedAll:!1,nextPage:1}]))),D=Uh((k,$)=>{let j=d({collectionSlug:$});p({type:"ADD",collection:j,data:k,hasMultipleRelations:f,i18n:I,relation:$})},[f,I,d]),_=Qe(async({abortController:k,relationSlug:$})=>{let j=R.current.get($);if($&&!j.hasLoadedAll){let O=d({collectionSlug:$})?.admin?.useAsTitle||"id",V={and:[]},W={depth:0,limit:JX,locale:F.code,page:j.nextPage,select:{[O]:!0},where:V};s&&s?.[$]&&W.where.and.push(s[$]),b&&W.where.and.push({[O]:{like:b}});try{let Y=await fetch(f4({apiRoute:u,path:`/${$}${b4.stringify(W,{addQueryPrefix:!0})}`}),{credentials:"include",headers:{"Accept-Language":I.language},signal:k.signal});if(Y.ok){let z=await Y.json();z.docs.length>0&&(D(z,$),z.nextPage?R.current.set($,{hasLoadedAll:!1,nextPage:z.nextPage}):R.current.set($,{hasLoadedAll:!0,nextPage:null}))}else y(w("error:unspecific"))}catch(Y){k.signal.aborted||console.error(Y)}}x(!0)}),T=p4.useCallback(()=>{let k=R.current.entries().next().value;if(k[0]&&!k[1].hasLoadedAll){let $=new AbortController;_({abortController:$,relationSlug:k[0]})}},[]),A=Uh(()=>{if(a){if(n)return Array.isArray(a)?a.map(k=>{if(f){let $;return m.forEach(j=>{j.options&&j.options.some(M=>M?.value==k.value?($=M,!0):!1)}),$}return m.find($=>$.value==k)}):void 0;if(f){let k,$=a;return m.forEach(j=>{j?.options&&j.options.some(M=>M?.value==$.value?(k=M,!0):!1)}),k}return m.find(k=>k.value==a)}},[n,f,a,m]),L=Uh(k=>{if(k!==h){p({type:"CLEAR",i18n:I,required:!1});let $=Array.isArray(r)?r:[r];R.current=new Map($.map(j=>[j,{hasLoadedAll:!1,nextPage:1}])),g(k)}},[I,r,h]),P=Uh(async(k,$)=>{if(!C&&k!=="null"&&k&&$){let j=await fetch(f4({apiRoute:u,path:`/${$}/${k}?depth=0`}),{credentials:"include",headers:{"Accept-Language":I.language}});if(j.ok){let M=await j.json();D({docs:[M]},$)}else console.error(w("error:loadingDocument",{id:k}))}},[I,D,u,C,w]);h4(()=>{let k=Array.isArray(r)?r:[r];R.current=new Map(k.map(j=>[j,{hasLoadedAll:!1,nextPage:1}])),p({type:"CLEAR",i18n:I,required:!1}),x(!1);let $=[];return k.forEach(j=>{let M=new AbortController;_({abortController:M,relationSlug:j}),$.push(M)}),()=>{$.forEach(j=>{if(j.signal)try{j.abort()}catch{}})}},[I,r,b,s]),h4(()=>{if(a&&v){if(n)(A()||[]).forEach(($,j)=>{$||(f?P(a[j].value,a[j].relationTo):P(a[j],r))});else if(!A())if(f){let $=a;P($.value,$.relationTo)}else P(a,r)}},[P,A,n,f,r,a,v]);let E=["field-type",g4,C&&"error-loading"].filter(Boolean).join(" "),B=A()||a;return Ny("div",{className:E,children:C?Ny("div",{className:`${g4}__error-loading`,children:C}):Ny(pt,{disabled:e,isMulti:n,isSortable:c,onChange:k=>{if(!k){i(null);return}n&&Array.isArray(k)?i(k?k.map($=>f?{relationTo:$?.relationTo,value:$?.value}:$?.value):null):f&&!Array.isArray(k)?i({relationTo:k?.relationTo,value:k?.value}):Array.isArray(k)||i(k?.value)},onInputChange:L,onMenuScrollToBottom:T,options:m,placeholder:l,value:B})})};import{c as qX}from"react/compiler-runtime";import{jsx as QX}from"react/jsx-runtime";import{getTranslation as ky}from"@payloadcms/translations";import jy from"react";var $y=t=>{let e=qX(21),{disabled:o,field:n,isClearable:r,onChange:s,operator:i,options:a,value:l}=t,{admin:c}=n,{placeholder:u}=c,{i18n:d}=N(),f;e[0]!==a?(f=Pu(a),e[0]=a,e[1]=f):f=e[1];let[m,p]=jy.useState(f),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=["in","not_in"],e[2]=h):h=e[2];let g=h.includes(i),b;if(g&&Array.isArray(l)){let S;e[3]!==d||e[4]!==m?(S=R=>{let D=m.find(_=>_.value===R);return{label:D?ky(D.label,d):R,value:D?.value??R}},e[3]=d,e[4]=m,e[5]=S):S=e[5],b=l.map(S)}else if(l){let S;e[6]!==l?(S=D=>D.value===l,e[6]=l,e[7]=S):S=e[7];let R=m.find(S);b={label:R?ky(R.label,d):l,value:R?.value??l}}let C;e[8]!==g||e[9]!==s?(C=S=>{let R;S?g?Array.isArray(S)?R=S.map(KX):R=[]:R=S.value:R=null,s(R)},e[8]=g,e[9]=s,e[10]=C):C=e[10];let y=C,v,x;e[11]!==a?(v=()=>{p(Pu(a))},x=[a],e[11]=a,e[12]=v,e[13]=x):(v=e[12],x=e[13]),jy.useEffect(v,x);let I,w;e[14]!==g||e[15]!==s||e[16]!==l?(I=()=>{!g&&Array.isArray(l)&&s(l[0])},w=[g,s,l],e[14]=g,e[15]=s,e[16]=l,e[17]=I,e[18]=w):(I=e[17],w=e[18]),jy.useEffect(I,w);let F;return e[19]!==d?(F=S=>({...S,label:ky(S.label,d)}),e[19]=d,e[20]=F):F=e[20],QX(pt,{disabled:o,isClearable:r,isMulti:g,onChange:y,options:m.map(F),placeholder:u,value:b})};function KX(t){return t.value}import{c as eY}from"react/compiler-runtime";import{jsx as v4}from"react/jsx-runtime";import y4 from"react";var tY="condition-value-text",By=t=>{let e=eY(18),{disabled:o,field:n,onChange:r,operator:s,value:i}=t,{t:a}=N(),l=n?.hasMany??!1,c;e[0]!==l||e[1]!==s?(c=["in","not_in"].includes(s)||l,e[0]=l,e[1]=s,e[2]=c):c=e[2];let u=c,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[3]=d):d=e[3];let[f,m]=y4.useState(d),p;e[4]!==u||e[5]!==r?(p=y=>{let v;y?u&&(Array.isArray(y)?v=y.map(oY):v=[y.value?.value||y.value]):v=[],r(v)},e[4]=u,e[5]=r,e[6]=p):p=e[6];let h=p,g,b;e[7]!==i?(g=()=>{Array.isArray(i)?m(i.map(rY)):m([])},b=[i],e[7]=i,e[8]=g,e[9]=b):(g=e[8],b=e[9]),y4.useEffect(g,b);let C;return e[10]!==o||e[11]!==u||e[12]!==r||e[13]!==h||e[14]!==a||e[15]!==i||e[16]!==f?(C=u?v4(pt,{disabled:o,isClearable:!0,isCreatable:!0,isMulti:u,isSortable:!0,onChange:h,options:[],placeholder:a("general:enterAValue"),value:f||[]}):v4("input",{className:tY,disabled:o,onChange:y=>r(y.target.value),placeholder:a("general:enterAValue"),type:"text",value:i||""}),e[10]=o,e[11]=u,e[12]=r,e[13]=h,e[14]=a,e[15]=i,e[16]=f,e[17]=C):C=e[17],C};function oY(t){return t.value?.value||t.value}function rY(t,e){return{id:`${t}${e}`,label:`${t}`,value:{toString:()=>`${t}${e}`,value:t?.value||t}}}var C4=({booleanSelect:t,disabled:e,filterOptions:o,internalField:n,onChange:r,operator:s,options:i,value:a})=>{if(t||["radio","select"].includes(n?.field?.type))return cc($y,{disabled:e,field:n.field,isClearable:!t,onChange:r,operator:s,options:i,value:a});switch(n?.field?.type){case"date":return cc(Py,{disabled:e,field:n.field,onChange:r,operator:s,value:a});case"number":return cc(Ey,{disabled:e,field:n.field,onChange:r,operator:s,value:a});case"relationship":return cc(Xh,{disabled:e,field:n.field,filterOptions:o??{},onChange:r,operator:s,value:a});case"upload":return cc(Xh,{disabled:e,field:n.field,filterOptions:o??{},onChange:r,operator:s,value:a});default:return cc(By,{disabled:e,field:n?.field,onChange:r,operator:s,value:a})}};var x4=t=>({all:"any",contains:"string",equals:"any",exists:"boolean",greater_than:t==="date"?"object":"string",greater_than_equal:t==="date"?"object":"string",in:"any",intersects:"any",less_than:t==="date"?"object":"string",less_than_equal:t==="date"?"object":"string",like:"string",near:"any",not_equals:"any",not_in:"any",not_like:"string",within:"any"});var As="condition",S4=t=>{let{addCondition:e,andIndex:o,fieldPath:n,filterOptions:r,operator:s,orIndex:i,reducedFields:a,removeCondition:l,RenderedFilter:c,updateCondition:u,value:d}=t,{t:f}=N(),m=a.find(w=>w.value===n),[p,h]=sY(d),g=Cn(p,300),b=["exists"].includes(s)||m?.field?.type==="checkbox",C=[];b?C=[{label:f("general:true"),value:"true"},{label:f("general:false"),value:"false"}]:m?.field&&"options"in m.field&&(C=m.field.options);let y=Qe(async w=>{s&&await u({type:"value",andIndex:o,field:m,operator:s,orIndex:i,value:w===null||w===""?void 0:w})});nY(()=>{y(g)},[g]);let v=!m?.value&&typeof m?.value!="number"||m?.field?.admin?.disableListFilter,x=w4(async w=>{h(void 0),await u({type:"field",andIndex:o,field:a.find(F=>F.value===w.value),operator:s,orIndex:i,value:void 0})},[o,s,i,a,u]),I=w4(async w=>{let S=x4(m.field.type)[w.value]||"any",R=S==="any"||typeof d===S||S==="boolean"&&(d==="true"||d==="false");R||h(void 0),await u({type:"operator",andIndex:o,field:m,operator:w.value,orIndex:i,value:R?d:void 0})},[o,m,i,u,d]);return Rs("div",{className:As,children:My("div",{className:`${As}__wrap`,children:[My("div",{className:`${As}__inputs`,children:[Rs("div",{className:`${As}__field`,children:Rs(pt,{disabled:v,filterOption:(w,F)=>(w?.data?.plainTextLabel||w.label).toLowerCase().includes(F.toLowerCase()),isClearable:!1,onChange:x,options:a.filter(w=>!w.field.admin.disableListFilter),value:m||{value:m?.value}})}),Rs("div",{className:`${As}__operator`,children:Rs(pt,{disabled:v,isClearable:!1,onChange:I,options:m?.operators,value:m?.operators.find(w=>s===w.value)||null})}),Rs("div",{className:`${As}__value`,children:c||Rs(C4,{booleanSelect:b,disabled:!s||!m||m?.field?.admin?.disableListFilter,filterOptions:r,internalField:m,onChange:h,operator:s,options:C,value:p??""})})]}),My("div",{className:`${As}__actions`,children:[Rs(oe,{buttonStyle:"icon-label",className:`${As}__actions-remove`,icon:"x",iconStyle:"with-border",onClick:()=>l({andIndex:o,orIndex:i}),round:!0}),Rs(oe,{buttonStyle:"icon-label",className:`${As}__actions-add`,icon:"plus",iconStyle:"with-border",onClick:()=>e({andIndex:o+1,field:a.find(w=>!w.field.admin?.disableListFilter),orIndex:i,relation:"and"}),round:!0})]})]})})};var Hn="where-builder",Zh=t=>{let{collectionPluralLabel:e,collectionSlug:o,fields:n,onChange:r,renderedFilters:s=void 0,resolvedFilterOptions:i=void 0,value:a}=t,{i18n:l,t:c}=N(),{permissions:u}=Ie(),{getEntityConfig:d}=H(),f=mt(),m=typeof r=="function",p=Oy(()=>m?d({collectionSlug:o}):null,[m,o,d]),h=m?p?.labels?.plural??o:e??o,b=(m?p?.fields:n)??[],C=u?.collections?.[o]?.fields,y=Oy(()=>fr({fieldPermissions:C,fields:b,i18n:l}),[C,b,l]),v=Oy(()=>{let S=m?a:f.query?.where;if(S){if(I4(S))return S.or??[];let R=lY(S);if(I4(R))return R.or??[];m||console.warn(`Invalid where query in URL: ${JSON.stringify(S)}`)}return[]},[m,a,f.query?.where]),x=m?S=>{r?.(S)}:f.handleWhereChange,I=Yh.useCallback(async({andIndex:S,field:R,orIndex:D,relation:_})=>{let T=[...v],A=lc[R.field.type].operators[0].value;_==="and"?T[D].and.splice(S,0,{[String(R.value)]:{[A]:void 0}}):T.push({and:[{[String(R.value)]:{[A]:void 0}}]}),await x({or:T})},[v,x]),w=Yh.useCallback(async({andIndex:S,field:R,operator:D,orIndex:_,value:T})=>{let A=v[_].and[S];if(typeof A=="object"&&R.value){let{validOperator:L}=Hh({field:R.field,operator:D}),P=A[String(R.value)]?.[L];if(typeof P<"u"&&P===T)return;let E={[String(R.value)]:{[L]:T}};if(aY(A,E))return;let B=[...v];B[_].and[S]=E,await x({or:B})}},[v,x]),F=Yh.useCallback(async({andIndex:S,orIndex:R})=>{let D=[...v];D[R].and.splice(S,1),D[R].and.length===0&&D.splice(R,1),await x({or:D})},[v,x]);return qd("div",{className:Hn,children:[v.length>0&&qd(Yh.Fragment,{children:[Ps("p",{className:`${Hn}__label`,children:c("general:filterWhere",{label:iY(h,l)})}),Ps("ul",{className:`${Hn}__or-filters`,children:v.map((S,R)=>{let D=`${R}_${Array.isArray(S?.and)?S.and.length:""}`;return qd("li",{children:[R!==0&&Ps("div",{className:`${Hn}__label`,children:c("general:or")}),Ps("ul",{className:`${Hn}__and-filters`,children:Array.isArray(S?.and)&&S.and.map((_,T)=>{let A=v[R].and[T],L=Object.keys(A)[0],P=Object.keys(A?.[L]||{})?.[0]||void 0,E=A?.[L]?.[P]||void 0;return qd("li",{children:[T!==0&&Ps("div",{className:`${Hn}__label`,children:c("general:and")}),Ps(S4,{addCondition:I,andIndex:T,fieldPath:L,filterOptions:i?.get(L),operator:P,orIndex:R,reducedFields:y,removeCondition:F,RenderedFilter:s?.get(L),updateCondition:w,value:E})]},T)})})]},D)})}),Ps(oe,{buttonStyle:"icon-label",className:`${Hn}__add-or`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:async()=>{await I({andIndex:0,field:y.find(S=>!S.field.admin?.disableListFilter),orIndex:v.length,relation:"or"})},children:c("general:or")})]}),v.length===0&&qd("div",{className:`${Hn}__no-filters`,children:[Ps("div",{className:`${Hn}__label`,children:c("general:noFiltersSet")}),Ps(oe,{buttonStyle:"icon-label",className:`${Hn}__add-first-filter`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:async()=>{y.length>0&&await I({andIndex:0,field:y.find(S=>!S.field.admin?.disableListFilter),orIndex:v.length,relation:"or"})},children:c("general:addFilter")})]})]})};var uY=t=>{let e=cY(14),{field:o}=t,{label:n,required:r}=o,{path:s,setValue:i,value:a}=Te(),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={path:"relatedCollection"},e[0]=l):l=e[0];let u=Te(l).value;if(!u){let f;return e[1]!==n||e[2]!==s||e[3]!==r?(f=_4("div",{className:"field-type query-preset-where-field",children:[Jh(Ce,{as:"h3",label:n,path:s,required:r}),Jh("p",{className:"query-preset-where-field__hint",children:"Select the related collection to configure filters."})]}),e[1]=n,e[2]=s,e[3]=r,e[4]=f):f=e[4],f}let d;if(e[5]!==n||e[6]!==s||e[7]!==u||e[8]!==r||e[9]!==i||e[10]!==a){let f;e[12]!==i?(f=m=>i(m),e[12]=i,e[13]=f):f=e[13],d=_4("div",{className:"field-type query-preset-where-field",children:[Jh(Ce,{as:"h3",label:n,path:s,required:r}),Jh(Zh,{collectionSlug:u,onChange:f,value:a??void 0})]}),e[5]=n,e[6]=s,e[7]=u,e[8]=r,e[9]=i,e[10]=a,e[11]=d}else d=e[11];return d};import{jsx as tg,jsxs as T4}from"react/jsx-runtime";import{useMemo as mY}from"react";import{jsx as qh,jsxs as Vy}from"react/jsx-runtime";import{useMemo as Qh}from"react";var Kh="group-by-builder",dY=["text","textarea","number","select","relationship","date","checkbox","radio","email","number","upload"],eg=({collectionSlug:t,fields:e,onChange:o,value:n})=>{let{i18n:r,t:s}=N(),{permissions:i}=Ie(),a=mt(),l=typeof o=="function",c=l?n:a.query?.groupBy,u=c?.replace(/^-/,""),d=i?.collections?.[t]?.fields,f=Qh(()=>fr({fieldPermissions:d,fields:e,i18n:r}),[e,d,r]),m=f.find(C=>C.value===u),p=Qh(()=>l?C=>{let y=C===null?void 0:C.value,v=y?c?.startsWith("-")?`-${y}`:y:"";o?.(v)}:C=>{(async()=>{if(typeof a.refineListData!="function")return;let y=C===null?void 0:C.value;C===null?await a.refineListData({groupBy:"",page:1}):await a.refineListData({groupBy:y?a.query?.groupBy?.startsWith("-")?`-${y}`:y:void 0,page:1})})()},[l,c,a,o]),h=Qh(()=>l?()=>o?.(""):()=>{(async()=>typeof a.refineListData=="function"&&await a.refineListData({groupBy:""}))()},[l,a,o]),g=Qh(()=>l?({value:C})=>{u&&o?.(C==="asc"?u:`-${u}`)}:({value:C})=>{(async()=>!u||typeof a.refineListData!="function"||await a.refineListData({groupBy:C==="asc"?u:`-${u}`,page:1}))()},[u,l,a,o]),b=!c||typeof c!="string"?"asc":c.startsWith("-")?"desc":"asc";return Vy("div",{className:Kh,children:[Vy("div",{className:`${Kh}__header`,children:[qh("p",{children:s("general:groupByLabel",{label:""})}),c&&qh("button",{className:`${Kh}__clear-button`,id:"group-by--reset",onClick:()=>{h()},type:"button",children:s("general:clear")})]}),Vy("div",{className:`${Kh}__inputs`,children:[qh(pt,{filterOption:(C,y)=>(C?.data?.plainTextLabel||C.label).toLowerCase().includes(y.toLowerCase()),id:"group-by--field-select",isClearable:!0,isMulti:!1,onChange:p,options:f.filter(C=>!C.field.admin?.disableGroupBy&&C.value!=="id"&&dY.includes(C.field.type)),value:{label:m?.label||s("general:selectValue"),value:u||""}}),qh(Zr,{id:"group-by--sort",isClearable:!1,name:"direction",onChange:g,options:[{label:s("general:ascending"),value:"asc"},{label:s("general:descending"),value:"desc"}],path:"direction",readOnly:!u,value:b})]})]})};var fY=({field:{label:t,required:e}})=>{let{path:o,setValue:n,value:r}=Te(),i=Te({path:"relatedCollection"}).value,{config:a}=H(),c=mY(()=>i?a.collections?.find(u=>u.slug===i):null,[i,a.collections])?.fields??[];return i?T4("div",{className:"field-type query-preset-group-by-field",children:[tg(Ce,{as:"h3",label:t,path:o,required:e}),tg(eg,{collectionSlug:i,fields:c,onChange:u=>n(u||null),value:r??void 0})]}):T4("div",{className:"field-type query-preset-group-by-field",children:[tg(Ce,{as:"h3",label:t,path:o,required:e}),tg("p",{className:"query-preset-group-by-field__hint",children:"Select the related collection to configure group by."})]})};import{c as D4}from"react/compiler-runtime";import{jsx as R4}from"react/jsx-runtime";import CY from"react";import{c as pY}from"react/compiler-runtime";import{useRouter as hY}from"next/navigation.js";import{useEffect as Gy,useRef as gY}from"react";function bY(t,...e){t&&t.addEventListener&&t.addEventListener(...e)}function vY(t,...e){t&&t.removeEventListener&&t.removeEventListener(...e)}var yY=(t,e)=>{let o=pY(7),n=t===void 0?!0:t,r;o[0]!==n||o[1]!==e?(r=l=>{if(typeof n!="function"||n())return l.preventDefault(),e&&(l.returnValue=e),e},o[0]=n,o[1]=e,o[2]=r):r=o[2];let s=r,i,a;o[3]!==n||o[4]!==s?(i=()=>{if(n)return bY(window,"beforeunload",s),()=>vY(window,"beforeunload",s)},a=[n,s],o[3]=n,o[4]=s,o[5]=i,o[6]=a):(i=o[5],a=o[6]),Gy(i,a)},F4=({hasAccepted:t=!1,message:e="Are you sure want to leave this page?",onAccept:o,onPrevent:n,prevent:r=!0})=>{yY(r,e);let{startRouteTransition:s}=Ye(),i=hY(),a=gY("");Gy(()=>{function l(d,f){try{let m=new URL(d),p=new URL(f);if(m.hostname===p.hostname&&m.pathname===p.pathname&&m.search===p.search){let h=m.hash,g=p.hash;return h!==g&&m.href.replace(h,"")===p.href.replace(g,"")}}catch(m){console.log("Unexpected exception thrown in LeaveWithoutSaving:isAnchorOfCurrentUrl",m)}return!1}function c(d){for(;d&&d.tagName.toLowerCase()!=="a";)d=d.parentElement;return d}function u(d){try{let f=d.target,m=c(f);if(m){let p=window.location.href,h=m.href,g=l(p,h),b=m.download!=="",C=m.target==="_blank"||d.metaKey||d.ctrlKey;!(h===p||g||b||C)&&r&&(n||!window.confirm(e))&&(a.current=h,d.preventDefault(),d.stopPropagation(),typeof n=="function"&&n())}}catch(f){console.log("Unexpected exception thrown in LeaveWithoutSaving:usePreventLeave",f)}}return r&&document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)}},[n,r,e]),Gy(()=>{t&&a.current&&(o&&o(),s(()=>i.push(a.current)))},[t,o,i,s])};var Qd="leave-without-saving",Kd=t=>{let e=D4(17),{disablePreventLeave:o,onConfirm:n,onPrevent:r}=t,s=o===void 0?!1:o,i=Qd,{closeModal:a,openModal:l}=ae(),c=po(),{isValid:u}=$e(),{user:d}=Ie(),[f,m]=CY.useState(!1),p=!s&&!!((c||!u)&&d),h;e[0]!==r||e[1]!==l?(h=()=>{let S=document.activeElement?.href||null;r&&r(S),l(Qd)},e[0]=r,e[1]=l,e[2]=h):h=e[2];let g=h,b;e[3]!==a?(b=()=>{a(Qd)},e[3]=a,e[4]=b):b=e[4];let C=b,y;e[5]!==C||e[6]!==g||e[7]!==f||e[8]!==p?(y={hasAccepted:f,onAccept:C,onPrevent:g,prevent:p},e[5]=C,e[6]=g,e[7]=f,e[8]=p,e[9]=y):y=e[9],F4(y);let v;e[10]!==a?(v=()=>{a(Qd)},e[10]=a,e[11]=v):v=e[11];let x=v,I;e[12]!==n?(I=async()=>{if(n)try{await n()}catch(S){console.error("Error in LeaveWithoutSaving onConfirm:",S)}m(!0)},e[12]=n,e[13]=I):I=e[13];let w=I,F;return e[14]!==w||e[15]!==x?(F=R4(zy,{modalSlug:Qd,onCancel:x,onConfirm:w}),e[14]=w,e[15]=x,e[16]=F):F=e[16],F},zy=t=>{let e=D4(5),{modalSlug:o,onCancel:n,onConfirm:r}=t,{t:s}=N(),i;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s?(i=R4(rt,{body:s("general:changesNotSaved"),cancelLabel:s("general:stayOnThisPage"),confirmLabel:s("general:leaveAnyway"),heading:s("general:leaveWithoutSaving"),modalSlug:o,onCancel:n,onConfirm:r}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i):i=e[4],i};import{c as xY}from"react/compiler-runtime";import{jsx as em,jsxs as Wy}from"react/jsx-runtime";import{useEffect as wY}from"react";var uc="document-take-over",og="document-take-over",Hy=t=>{let e=xY(19),{handleBackToDashboard:o,isActive:n,onReadOnly:r}=t,{closeModal:s,openModal:i}=ae(),{t:a}=N(),{startRouteTransition:l}=Ye(),{clearRouteCache:c}=ht(),u,d;e[0]!==s||e[1]!==n||e[2]!==i?(u=()=>{n?i(uc):s(uc)},d=[n,i,s],e[0]=s,e[1]=n,e[2]=i,e[3]=u,e[4]=d):(u=e[3],d=e[4]),wY(u,d);let f;if(e[5]!==c||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==l||e[10]!==a){let m;e[12]!==o||e[13]!==l?(m=()=>{l(()=>o())},e[12]=o,e[13]=l,e[14]=m):m=e[14];let p;e[15]!==c||e[16]!==s||e[17]!==r?(p=()=>{r(),s(uc),c()},e[15]=c,e[16]=s,e[17]=r,e[18]=p):p=e[18],f=em(Zo,{className:og,closeOnBlur:!1,slug:uc,children:Wy("div",{className:`${og}__wrapper`,children:[Wy("div",{className:`${og}__content`,children:[em("h1",{children:a("general:editingTakenOver")}),em("p",{children:a("general:anotherUserTakenOver")})]}),Wy("div",{className:`${og}__controls`,children:[em(oe,{buttonStyle:"primary",id:`${uc}-back-to-dashboard`,onClick:m,size:"large",children:a("general:backToDashboard")}),em(oe,{buttonStyle:"secondary",id:`${uc}-view-read-only`,onClick:p,size:"large",children:a("general:viewReadOnly")})]})]})}),e[5]=c,e[6]=s,e[7]=o,e[8]=r,e[9]=l,e[10]=a,e[11]=f}else f=e[11];return f};import{c as SY}from"react/compiler-runtime";import{jsx as Ta,jsxs as tm}from"react/jsx-runtime";import{useEffect as IY}from"react";var rg=t=>t&&typeof t=="object";var Es="document-locked",ng="document-locked",_Y=t=>t?new Intl.DateTimeFormat("en-US",{day:"numeric",hour:"numeric",hour12:!0,minute:"numeric",month:"short",year:"numeric"}).format(new Date(t)):"",Uy=t=>{let e=SY(33),{handleGoBack:o,isActive:n,onReadOnly:r,onTakeOver:s,updatedAt:i,user:a}=t,{closeModal:l,openModal:c}=ae(),{t:u}=N(),{clearRouteCache:d}=ht(),{startRouteTransition:f}=Ye(),m,p;e[0]!==l||e[1]!==n||e[2]!==c?(m=()=>{n?c(Es):l(Es)},p=[n,c,l],e[0]=l,e[1]=n,e[2]=c,e[3]=m,e[4]=p):(m=e[3],p=e[4]),IY(m,p);let h;e[5]!==o||e[6]!==f?(h=()=>{f(()=>o())},e[5]=o,e[6]=f,e[7]=h):h=e[7];let g;if(e[8]!==d||e[9]!==l||e[10]!==o||e[11]!==r||e[12]!==s||e[13]!==f||e[14]!==u||e[15]!==h||e[16]!==i||e[17]!==a){let b;e[19]!==u||e[20]!==a?(b=rg(a)?a.email??a.id:`${u("general:user")}: ${a}`,e[19]=u,e[20]=a,e[21]=b):b=e[21];let C;e[22]!==l||e[23]!==o||e[24]!==f?(C=()=>{l(Es),f(()=>o())},e[22]=l,e[23]=o,e[24]=f,e[25]=C):C=e[25];let y;e[26]!==d||e[27]!==l||e[28]!==r?(y=()=>{r(),l(Es),d()},e[26]=d,e[27]=l,e[28]=r,e[29]=y):y=e[29];let v;e[30]!==l||e[31]!==s?(v=()=>{s(),l(Es)},e[30]=l,e[31]=s,e[32]=v):v=e[32],g=Ta(Zo,{className:ng,closeOnBlur:!1,onClose:h,slug:Es,children:tm("div",{className:`${ng}__wrapper`,children:[tm("div",{className:`${ng}__content`,children:[Ta("h1",{children:u("general:documentLocked")}),tm("p",{children:[Ta("strong",{children:b})," ",u("general:currentlyEditing")]}),tm("p",{children:[u("general:editedSince")," ",Ta("strong",{children:_Y(i)})]})]}),tm("div",{className:`${ng}__controls`,children:[Ta(oe,{buttonStyle:"secondary",id:`${Es}-go-back`,onClick:C,size:"large",children:u("general:goBack")}),Ta(oe,{buttonStyle:"secondary",id:`${Es}-view-read-only`,onClick:y,size:"large",children:u("general:viewReadOnly")}),Ta(oe,{buttonStyle:"primary",id:`${Es}-take-over`,onClick:v,size:"large",children:u("general:takeOver")})]})]})}),e[8]=d,e[9]=l,e[10]=o,e[11]=r,e[12]=s,e[13]=f,e[14]=u,e[15]=h,e[16]=i,e[17]=a,e[18]=g}else g=e[18];return g};import{c as TY}from"react/compiler-runtime";import{jsx as FY}from"react/jsx-runtime";import{getTranslation as DY}from"@payloadcms/translations";import pze from"react";function Xy(t){let e=TY(3),{i18n:o}=N(),{description:n}=t;if(n){let r;return e[0]!==n||e[1]!==o?(r=FY("div",{className:"custom-view-description",children:DY(n,o)}),e[0]=n,e[1]=o,e[2]=r):r=e[2],r}return null}import{jsx as pr,jsxs as cg}from"react/jsx-runtime";import{formatAdminURL as hZ}from"payload/shared";import{useEffect as gZ,useRef as bZ,useState as vZ}from"react";import{c as NY}from"react/compiler-runtime";import{jsx as V4}from"react/jsx-runtime";import{usePathname as LY}from"next/navigation.js";import{formatAdminURL as kY}from"payload/shared";import"react";import{jsx as Yy,jsxs as RY}from"react/jsx-runtime";import"react";var om="graphic-account",A4=t=>RY("svg",{className:[om,t?.active&&`${om}--active`].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[Yy("circle",{className:`${om}__bg`,cx:"12.5",cy:"12.5",r:"11.5"}),Yy("circle",{className:`${om}__head`,cx:"12.5",cy:"10.73",r:"3.98"}),Yy("path",{className:`${om}__body`,d:"M12.5,24a11.44,11.44,0,0,0,7.66-2.94c-.5-2.71-3.73-4.8-7.66-4.8s-7.16,2.09-7.66,4.8A11.44,11.44,0,0,0,12.5,24Z"})]});var M4=Ri(B4(),1);import{c as PY}from"react/compiler-runtime";import{jsx as EY}from"react/jsx-runtime";import"react";var O4=()=>{let t=PY(2),{user:e}=Ie(),o=(0,M4.default)(e.email.trim().toLowerCase()),r=`?${new URLSearchParams({default:"mp",r:"g",s:"50"}).toString()}`,s=`https://www.gravatar.com/avatar/${o}${r}`,i;return t[0]!==s?(i=EY("img",{alt:"yas",className:"gravatar-account",height:25,src:s,style:{borderRadius:"50%"},width:25}),t[0]=s,t[1]=i):i=t[1],i};var qy=()=>{let t=NY(3),{config:e}=H(),{admin:o,routes:n}=e,{avatar:r,routes:s}=o,{account:i}=s,{admin:a}=n,{user:l}=Ie(),u=LY()===kY({adminRoute:a,path:i});if(!l?.email||r==="default"){let d;return t[0]!==u?(d=V4(A4,{active:u}),t[0]=u,t[1]=d):d=t[1],d}if(r==="gravatar"){let d;return t[2]===Symbol.for("react.memo_cache_sentinel")?(d=V4(O4,{}),t[2]=d):d=t[2],d}};import{c as jY}from"react/compiler-runtime";import{jsx as $Y}from"react/jsx-runtime";import{createContext as BY,use as MY,useState as OY}from"react";var G4=BY({Actions:{},setViewActions:()=>{}}),Qy=()=>MY(G4),VY=t=>{let e=jY(4),{Actions:o,children:n}=t,[r,s]=OY(o),i;return e[0]!==o||e[1]!==n||e[2]!==r?(i=$Y(G4,{value:{Actions:{...r,...o},setViewActions:s},children:n}),e[0]=o,e[1]=n,e[2]=r,e[3]=i):i=e[3],i};import{c as GY}from"react/compiler-runtime";import{jsx as sg,jsxs as H4}from"react/jsx-runtime";import"react";import{jsx as z4}from"react/jsx-runtime";import"react";var Ky=()=>z4("svg",{className:"icon icon--close-menu",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:z4("path",{className:"stroke",d:"M14 6L6 14M6 6L14 14",strokeLinecap:"square"})});import{jsx as W4}from"react/jsx-runtime";import"react";var eC=()=>W4("svg",{className:"icon icon--menu",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:W4("path",{className:"stroke",d:"M4.66667 10H15.3333M4.66667 6H15.3333M4.66667 14H15.3333",strokeLinecap:"square"})});var tC="hamburger",oC=t=>{let e=GY(4),{t:o}=N(),{closeIcon:n,isActive:r}=t,s=n===void 0?"x":n,i=r===void 0?!1:r,a;return e[0]!==s||e[1]!==i||e[2]!==o?(a=H4("div",{className:tC,children:[!i&&sg("div",{"aria-label":o("general:open"),className:`${tC}__open-icon`,title:o("general:open"),children:sg(eC,{})}),i&&H4("div",{"aria-label":o(s==="collapse"?"general:collapse":"general:close"),className:`${tC}__close-icon`,title:o(s==="collapse"?"general:collapse":"general:close"),children:[s==="x"&&sg(Ky,{}),s==="collapse"&&sg(He,{direction:"left"})]})]}),e[0]=s,e[1]=i,e[2]=o,e[3]=a):a=e[3],a};import{c as HY}from"react/compiler-runtime";import{jsx as Fa,jsxs as UY}from"react/jsx-runtime";import{getTranslation as XY}from"@payloadcms/translations";import{useRouter as YY}from"next/navigation.js";import*as ag from"qs-esm";import{Fragment as ZY}from"react";import{c as zY}from"react/compiler-runtime";import{jsx as U4,jsxs as rC}from"react/jsx-runtime";import{getTranslation as WY}from"@payloadcms/translations";import"react";var rm="localizer-button",ig=t=>{let e=zY(8),{ariaLabel:o,className:n}=t,r=ye(),{i18n:s,t:i}=N(),a;if(e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){let l;e[6]!==n?(l=[rm,n].filter(Boolean),e[6]=n,e[7]=l):l=e[7],a=rC("div",{"aria-label":o||i("general:locale"),className:l.join(" "),"data-locale":r?r.code:void 0,children:[rC("div",{className:`${rm}__label`,children:[`${i("general:locale")}:`,"\xA0"]}),rC("div",{className:`${rm}__current`,children:[U4("span",{className:`${rm}__current-label`,children:`${WY(r.label,s)}`}),U4(He,{className:`${rm}__chevron`})]})]}),e[0]=o,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=a}else a=e[5];return a};var nC="localizer",X4=t=>{let e=HY(17),{className:o}=t,{config:n}=H(),{localization:r}=n,s=YY(),{startRouteTransition:i}=Ye(),{setLocaleIsLoading:a}=Ef(),{i18n:l}=N(),c=ye();if(r){let{locales:u}=r,d;e[0]!==o?(d=[nC,o].filter(Boolean),e[0]=o,e[1]=d):d=e[1];let f=d.join(" "),m;if(e[2]!==l||e[3]!==c||e[4]!==u||e[5]!==s||e[6]!==a||e[7]!==i||e[8]!==f){let p;e[10]!==l||e[11]!==c||e[12]!==u||e[13]!==s||e[14]!==a||e[15]!==i?(p=h=>{let{close:g}=h;return Fa(ve.ButtonGroup,{children:u.map(b=>{let C=XY(b.label,l);return Fa(ve.Button,{active:c.code===b.code,disabled:c.code===b.code,onClick:()=>{a(!0),g();let y=new URLSearchParams(window.location.search),v=ag.stringify({...ag.parse(y.toString(),{depth:10,ignoreQueryPrefix:!0}),locale:b.code},{addQueryPrefix:!0});i(()=>{s.push(v)})},children:C!==b.code?UY(ZY,{children:[C,"\xA0",Fa("span",{className:`${nC}__locale-code`,"data-locale":b.code,children:`(${b.code})`})]}):Fa("span",{className:`${nC}__locale-code`,"data-locale":b.code,children:C})},b.code)})})},e[10]=l,e[11]=c,e[12]=u,e[13]=s,e[14]=a,e[15]=i,e[16]=p):p=e[16],m=Fa("div",{className:f,children:Fa(it,{button:Fa(ig,{}),horizontalAlign:"right",render:p,showScrollbar:!0,size:"large"})}),e[2]=l,e[3]=c,e[4]=u,e[5]=s,e[6]=a,e[7]=i,e[8]=f,e[9]=m}else m=e[9];return m}return null};import{jsx as JY}from"react/jsx-runtime";import{usePathname as qY}from"next/navigation.js";import{PREFERENCE_KEYS as QY}from"payload/shared";import sm,{useEffect as nm,useRef as KY}from"react";var sC=sm.createContext({hydrated:!1,navOpen:!0,navRef:null,setNavOpen:()=>{},shouldAnimate:!1}),Da=()=>sm.use(sC),eZ=async t=>{let o=(await t(QY.NAV))?.open;return typeof o=="boolean"?o:!0},iC=({children:t,initialIsOpen:e})=>{let{breakpoints:{l:o,m:n,s:r}}=mr(),s=qY(),{getPreference:i}=so(),a=KY(null),[l,c]=sm.useState(e),[u,d]=sm.useState(!1),[f,m]=sm.useState(!1);return nm(()=>{o===!1&&(async()=>{let h=await eZ(i);c(h)})()},[o,i,c]),nm(()=>{r===!0&&c(!1)},[s]),nm(()=>{a.current&&(l&&n?a.current.style.overscrollBehavior="contain":a.current.style.overscrollBehavior="auto")},[l,n]),nm(()=>{(o===!0||n===!0||r===!0)&&c(!1),m(!0);let p=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(p)}},[o,n,r]),nm(()=>()=>{a.current&&(a.current.style.overscrollBehavior="auto")},[]),JY(sC,{value:{hydrated:f,navOpen:l,navRef:a,setNavOpen:c,shouldAnimate:u},children:t})};import{c as tZ}from"react/compiler-runtime";import{jsx as oZ}from"react/jsx-runtime";import{PREFERENCE_KEYS as rZ}from"payload/shared";import"react";var Y4="nav-toggler",aC=t=>{let e=tZ(15),{id:o,children:n,className:r,tabIndex:s}=t,i=s===void 0?0:s,{t:a}=N(),{setPreference:l}=so(),{navOpen:c,setNavOpen:u}=Da(),{breakpoints:d}=mr(),{l:f}=d,m=`${a(c?"general:close":"general:open")} ${a("general:menu")}`,p=c&&`${Y4}--is-open`,h;e[0]!==r||e[1]!==p?(h=[Y4,p,r].filter(Boolean),e[0]=r,e[1]=p,e[2]=h):h=e[2];let g=h.join(" "),b;e[3]!==f||e[4]!==c||e[5]!==u||e[6]!==l?(b=async()=>{u(!c),f||await l(rZ.NAV,{open:!c},!0)},e[3]=f,e[4]=c,e[5]=u,e[6]=l,e[7]=b):b=e[7];let C;return e[8]!==n||e[9]!==o||e[10]!==m||e[11]!==g||e[12]!==b||e[13]!==i?(C=oZ("button",{"aria-label":m,className:g,id:o,onClick:b,tabIndex:i,type:"button",children:n}),e[8]=n,e[9]=o,e[10]=m,e[11]=g,e[12]=b,e[13]=i,e[14]=C):C=e[14],C};import{c as fZ}from"react/compiler-runtime";import{jsx as Ho,jsxs as q4}from"react/jsx-runtime";import{getTranslation as pZ}from"@payloadcms/translations";import{Fragment as Q4}from"react";import{jsx as Z4,jsxs as nZ}from"react/jsx-runtime";import"react";var lg=({fill:t})=>{let e=t||"var(--theme-elevation-1000)";return nZ("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[Z4("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:e}),Z4("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:e})]})};import{c as sZ}from"react/compiler-runtime";import{jsx as iZ}from"react/jsx-runtime";import{createContext as aZ,use as lZ,useState as cZ}from"react";var Nr=()=>lZ(J4),J4=aZ({setStepNav:()=>{},stepNav:[]}),lC=t=>{let e=sZ(4),{children:o}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let[r,s]=cZ(n),i;return e[1]!==o||e[2]!==r?(i=iZ(J4,{value:{setStepNav:s,stepNav:r},children:o}),e[1]=o,e[2]=r,e[3]=i):i=e[3],i};import{c as uZ}from"react/compiler-runtime";import{useEffect as dZ}from"react";var mZ=t=>{let e=uZ(4),{nav:o}=t,{setStepNav:n}=Nr(),r,s;return e[0]!==o||e[1]!==n?(r=()=>{n(o)},s=[n,o],e[0]=o,e[1]=n,e[2]=r,e[3]=s):(r=e[2],s=e[3]),dZ(r,s),null};var im="step-nav",K4=t=>{let e=fZ(7),{className:o,CustomIcon:n}=t,{i18n:r}=N(),{stepNav:s}=Nr(),{config:i}=H(),{routes:a}=i,{admin:l}=a,{t:c}=N(),u;return e[0]!==n||e[1]!==l||e[2]!==o||e[3]!==r||e[4]!==s||e[5]!==c?(u=Ho(Q4,{children:s.length>0?q4("nav",{className:[im,o].filter(Boolean).join(" "),children:[Ho(Qt,{className:`${im}__home`,href:l,prefetch:!1,tabIndex:0,children:Ho("span",{title:c("general:dashboard"),children:Ho(ue,{CustomComponent:n,Fallback:Ho(lg,{})})})}),Ho("span",{children:"/"}),s.map((d,f)=>{let m=pZ(d.label,r);return s.length===f+1?Ho("span",{className:`${im}__last`,children:m},f):q4(Q4,{children:[d.url?Ho(Qt,{href:d.url,prefetch:!1,children:Ho("span",{children:m},f)}):Ho("span",{children:m},f),Ho("span",{children:"/"})]},f)})]}):Ho("div",{className:[im,o].filter(Boolean).join(" "),children:Ho("div",{className:`${im}__home`,children:Ho("span",{title:c("general:dashboard"),children:Ho(ue,{CustomComponent:n,Fallback:Ho(lg,{})})})})})}),e[0]=n,e[1]=l,e[2]=o,e[3]=r,e[4]=s,e[5]=c,e[6]=u):u=e[6],u};var Uo="app-header";function yZ({CustomAvatar:t,CustomIcon:e}){let{t:o}=N(),{Actions:n}=Qy(),{config:{admin:{routes:{account:r}},localization:s,routes:{admin:i},serverURL:a}}=H(),{navOpen:l}=Da(),c=bZ(null),[u,d]=vZ(!1);gZ(()=>{let m=()=>{let p=c.current;if(p){let h=p.scrollWidth>p.clientWidth;d(h)}};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[n]);let f=n?Object.values(n):[];return cg("header",{className:[Uo,l&&`${Uo}--nav-open`].filter(Boolean).join(" "),children:[pr("div",{className:`${Uo}__bg`}),pr("div",{className:`${Uo}__content`,children:cg("div",{className:`${Uo}__wrapper`,children:[pr(aC,{className:`${Uo}__mobile-nav-toggler`,tabIndex:-1,children:pr(oC,{})}),cg("div",{className:`${Uo}__controls-wrapper`,children:[pr("div",{className:`${Uo}__step-nav-wrapper`,children:pr(K4,{className:`${Uo}__step-nav`,CustomIcon:e})}),cg("div",{className:`${Uo}__actions-wrapper`,children:[pr("div",{className:`${Uo}__actions`,ref:c,children:f.map((m,p)=>pr("div",{className:u&&p===f.length-1?`${Uo}__last-action`:"",children:m},p))}),u&&pr("div",{className:`${Uo}__gradient-placeholder`})]}),s&&pr(ig,{ariaLabel:"invisible",className:`${Uo}__localizer-spacing`}),pr(Qt,{"aria-label":o("authentication:account"),className:`${Uo}__account`,href:hZ({adminRoute:i,path:r}),prefetch:!1,tabIndex:0,children:pr(ue,{CustomComponent:t,Fallback:pr(qy,{})})})]})]})}),pr(X4,{className:`${Uo}__localizer`})]})}import{jsx as cC,jsxs as CZ}from"react/jsx-runtime";import"react";var am="card",xZ=t=>{let{id:e,actions:o,buttonAriaLabel:n,href:r,onClick:s,title:i,titleAs:a}=t,l=[am,e,(s||r)&&`${am}--has-onclick`].filter(Boolean).join(" ");return CZ("div",{className:l,id:e,children:[cC(a??"div",{className:`${am}__title`,children:i}),o&&cC("div",{className:`${am}__actions`,children:o}),(s||r)&&cC(oe,{"aria-label":n,buttonStyle:"none",className:`${am}__click`,el:"link",onClick:s,to:r})]})};import{c as wZ}from"react/compiler-runtime";import{jsx as yi,jsxs as ug}from"react/jsx-runtime";import{getTranslation as SZ}from"@payloadcms/translations";import{useRouter as IZ}from"next/navigation.js";import{formatAdminURL as _Z}from"payload/shared";import dc from"react";var dg="copy-locale-data",mg="copy-locale",uC=()=>{let t=wZ(36),{config:e}=H(),{localization:o,routes:n}=e,{admin:r}=n,{code:s}=ye(),{id:i,collectionSlug:a,globalSlug:l}=Se(),{i18n:c,t:u}=N(),d=po(),{toggleModal:f}=ae(),{copyDataFromLocale:m}=Lt(),p=IZ(),{startRouteTransition:h}=Ye(),g=o&&o.locales.map(TZ)||[],b;t[0]!==s?(b=O=>O.value!==s,t[0]=s,t[1]=b):b=t[1];let C=g.filter(b),y;t[2]!==c||t[3]!==o?(y=O=>{let V=o&&o.locales.find(W=>W.code===O);return V&&V.label?SZ(V.label,c):O},t[2]=c,t[3]=o,t[4]=y):y=t[4];let v=y,[x,I]=dc.useState(!1),[w,F]=dc.useState(null),[S,R]=dc.useState(s),[D,_]=dc.useState(!1),T,A;t[5]!==s||t[6]!==S?(T=()=>{S!==s&&R(s)},A=[s,S],t[5]=s,t[6]=S,t[7]=T,t[8]=A):(T=t[7],A=t[8]),dc.useEffect(T,A);let L;t[9]!==r||t[10]!==a||t[11]!==m||t[12]!==l||t[13]!==i||t[14]!==D||t[15]!==p||t[16]!==h||t[17]!==u||t[18]!==f?(L=async O=>{let{from:V,to:W}=O;I(!0);try{await m({collectionSlug:a,docID:i,fromLocale:V,globalSlug:l,overrideData:D,toLocale:W}),I(!1),h(()=>p.push(_Z({adminRoute:r,path:`/${a?`collections/${a}/${i}`:`globals/${l}`}`})+`?locale=${W}`)),f(mg)}catch(Y){let z=Y;I(!1);let K=z.message||"error:unknown",U=K.startsWith("error:")?u(K):K;q.error(U)}},t[9]=r,t[10]=a,t[11]=m,t[12]=l,t[13]=i,t[14]=D,t[15]=p,t[16]=h,t[17]=u,t[18]=f,t[19]=L):L=t[19];let P=L;if(!i&&!l)return null;let E;t[20]!==d||t[21]!==u||t[22]!==f?(E=()=>{d?q.info(u("general:unsavedChanges")):f(mg)},t[20]=d,t[21]=u,t[22]=f,t[23]=E):E=t[23];let B;t[24]!==f?(B=()=>{f(mg)},t[24]=f,t[25]=B):B=t[25];let k;t[26]!==P||t[27]!==x||t[28]!==S||t[29]!==u||t[30]!==w?(k=async()=>{if(S===w){q.error(u("localization:cannotCopySameLocale"));return}x||await P({from:S,to:w})},t[26]=P,t[27]=x,t[28]=S,t[29]=u,t[30]=w,t[31]=k):k=t[31];let $;t[32]===Symbol.for("react.memo_cache_sentinel")?($=O=>{O?.value&&R(O.value)},t[32]=$):$=t[32];let j;t[33]===Symbol.for("react.memo_cache_sentinel")?(j=O=>{O?.value&&F(O.value)},t[33]=j):j=t[33];let M;return t[34]!==D?(M=()=>_(!D),t[34]=D,t[35]=M):M=t[35],ug(dc.Fragment,{children:[yi(ve.Button,{id:`${dg}__button`,onClick:E,children:u("localization:copyToLocale")}),ug(St,{className:dg,gutter:!1,Header:yi(li,{onClose:B,title:u("localization:copyToLocale")}),slug:mg,children:[ug("div",{className:`${dg}__sub-header`,children:[yi("span",{children:S&&w?yi("div",{children:u("localization:copyFromTo",{from:v(S),to:v(w)})}):u("localization:selectLocaleToCopy")}),yi(oe,{buttonStyle:"primary",disabled:!S||!w,iconPosition:"left",onClick:k,size:"medium",children:x?u("general:copying")+"...":u("general:copy")})]}),ug("div",{className:`${dg}__content`,children:[yi(Zr,{label:u("localization:copyFrom"),name:"fromLocale",onChange:$,options:g,path:"fromLocale",readOnly:!0,value:S}),yi(Zr,{label:u("localization:copyTo"),name:"toLocale",onChange:j,options:C,path:"toLocale",value:w}),yi(Wr,{checked:D,field:{name:"overwriteExisting",label:u("general:overwriteExistingData")},onChange:M,path:"overwriteExisting"})]})]})]})};function TZ(t){return{label:t.label,value:t.code}}import{c as LZ}from"react/compiler-runtime";import{jsx as Un,jsxs as n6}from"react/jsx-runtime";import{getTranslation as s6}from"@payloadcms/translations";import{useRouter as kZ,useSearchParams as jZ}from"next/navigation.js";import{formatAdminURL as $Z,mergeListSearchAndWhere as BZ}from"payload/shared";import*as hC from"qs-esm";import lm from"react";import{jsx as FZ}from"react/jsx-runtime";import{useSearchParams as DZ}from"next/navigation.js";import*as t6 from"qs-esm";import{createContext as RZ,use as AZ,useCallback as fg,useEffect as dC,useMemo as PZ,useRef as EZ,useState as mC}from"react";var Jt=(function(t){return t.AllAvailable="allAvailable",t.AllInPage="allInPage",t.None="none",t.Some="some",t})({}),o6=RZ({count:void 0,getQueryParams:t=>"",getSelectedIds:()=>[],selectAll:void 0,selected:new Map,selectedIDs:[],setSelection:t=>{},toggleAll:t=>{},totalDocs:void 0}),e6=t=>{let e=[];for(let[o,n]of t)n&&e.push(o);return e},fC=({children:t,docs:e=[],totalDocs:o})=>{let n=EZ({}),{user:r}=Ie(),{code:s}=ye(),[i,a]=mC(()=>{let y=new Map;return e.forEach(({id:v})=>{y.set(v,!1)}),y}),[l,c]=mC("none"),[u,d]=mC(0),f=DZ(),{query:m}=mt(),p=fg((y=!1)=>{let v=new Map;if(y)c("allAvailable"),e.forEach(({id:x,_isLocked:I,_userEditing:w})=>{(!I||w?.id===r?.id)&&v.set(x,!0)});else if(l==="allAvailable"||l==="allInPage")c("none");else{let x=l!=="some";e.forEach(({id:I,_isLocked:w,_userEditing:F})=>{(!w||F?.id===r?.id)&&v.set(I,x)}),x&&v.size>0?v.size===e.length?c("allInPage"):c("some"):c("none")}a(v)},[e,l,r?.id]),h=fg(y=>{let v=e.find(F=>F.id===y);if(v?._isLocked&&r?.id!==v?._userEditing.id)return;let x=i.get(y),I=typeof x=="boolean"?!x:!0,w=new Map(i.set(y,I));l==="allAvailable"&&!I&&c("some"),a(w)},[i,e,l,r?.id]),g=fg(y=>{let v;if(l==="allAvailable")v=Yt(f)?.where||{id:{not_equals:""}};else{let x=[];for(let[I,w]of i)w&&x.push(I);v={id:{in:x}}}return y&&(v={and:[{...y},v]}),t6.stringify({locale:s,where:v},{addQueryPrefix:!0})},[l,i,s,f]),b=fg(()=>e6(i),[i]);dC(()=>{if(l==="allAvailable")return;let y=!1,v=!0;if(!i.size)v=!1,y=!1;else for(let[x,I]of i)v=v&&I,y=y||I;v&&i.size===e.length?c("allInPage"):c(y?"some":"none")},[l,i,o,e]),dC(()=>{let y=0;if(l==="allAvailable")y=o;else for(let[v,x]of i)x&&y++;d(y)},[l,i,o]),dC(()=>{c("none"),a(new Map)},[m]);let C=PZ(()=>e6(i),[i]);return n.current={count:u,getQueryParams:g,getSelectedIds:b,selectAll:l,selected:i,selectedIDs:C,setSelection:h,toggleAll:p,totalDocs:o},FZ(o6,{value:n.current,children:t})},xo=()=>AZ(o6);function pg({deletePermanently:t,hasDeletePermission:e,hasTrashPermission:o,isTrashView:n=!1}){return n||!o||e&&t}import{c as NZ}from"react/compiler-runtime";import{jsx as mc,jsxs as pC}from"react/jsx-runtime";import r6 from"react";var hg="list-selection";function gg(t){let e=NZ(5),{count:o,ListActions:n,SelectionActions:r}=t,{t:s}=N(),i;return e[0]!==n||e[1]!==r||e[2]!==o||e[3]!==s?(i=pC("div",{className:hg,children:[mc("span",{children:s("general:selectedCount",{count:o,label:""})}),n&&n.length>0&&pC(r6.Fragment,{children:[mc("span",{children:"\u2014"}),mc("div",{className:`${hg}__actions`,children:n})]}),r&&r.length>0&&pC(r6.Fragment,{children:[mc("span",{children:"\u2014"}),mc("div",{className:`${hg}__actions`,children:r})]})]}),e[0]=n,e[1]=r,e[2]=o,e[3]=s,e[4]=i):i=e[4],i}function ro({children:t,className:e,...o}){return mc(oe,{...o,buttonStyle:"none",className:[`${hg}__button`,e].filter(Boolean).join(" "),children:t})}var gC=t=>{let e=LZ(6),{viewType:o}=t,{collection:n,hasDeletePermission:r,hasTrashPermission:s,modalPrefix:i}=t,{slug:a,trash:l}=n===void 0?{}:n,{permissions:c}=Ie(),{count:u,selectAll:d,selectedIDs:f,toggleAll:m}=xo(),p=kZ(),h=jZ(),{clearRouteCache:g}=ht(),b=c?.collections?.[a],C=r!==void 0?r:!!b?.delete,y=s!==void 0?s:C,v=d===Jt.AllAvailable,x=v?[]:f,w=o==="trash"?C:C||y;if(d===Jt.None||!w)return null;let F=Yt(h)?.where,S=o==="trash"?{and:[...Array.isArray(F?.and)?F.and:F?[F]:[],{deletedAt:{exists:!0}}]}:F,R;return e[0]!==g||e[1]!==p||e[2]!==h||e[3]!==d||e[4]!==m?(R=()=>{m(),p.replace(hC.stringify({...Yt(h),page:d?"1":void 0},{addQueryPrefix:!0})),g()},e[0]=g,e[1]=p,e[2]=h,e[3]=d,e[4]=m,e[5]=R):R=e[5],Un(lm.Fragment,{children:Un(bC,{afterDelete:R,hasDeletePermission:C,hasTrashPermission:y,modalPrefix:i,search:Yt(h)?.search,selections:{[a]:{all:d===Jt.AllAvailable,ids:x,totalCount:v?u:x.length}},trash:l,viewType:o,where:S})})};function bC({afterDelete:t,hasDeletePermission:e=!1,hasTrashPermission:o=!1,modalPrefix:n,search:r,selections:s,trash:i,viewType:a,where:l}){let{t:c}=N(),{config:{collections:u,routes:{api:d}}}=H(),{code:f}=ye(),{i18n:m}=N(),{openModal:p}=ae(),[h,g]=lm.useState(!1),b=`${n?`${n}-`:""}confirm-delete-many-docs`,C=lm.useCallback(async()=>{let x=Object.keys(s).length===1,I={};for(let[w,{all:F,ids:S=[]}]of Object.entries(s)){let R=u.find(({slug:D})=>D===w);if(R){let D;F?x&&l?D=a==="trash"?{and:[...Array.isArray(l.and)?l.and:[l],{deletedAt:{exists:!0}}]}:l:D=a==="trash"?{and:[{id:{not_equals:""}},{deletedAt:{exists:!0}}]}:{id:{not_equals:""}}:D={and:[{id:{in:S}},...a==="trash"?[{deletedAt:{exists:!0}}]:[]]};let _=$Z({apiRoute:d,path:`/${w}${hC.stringify({limit:0,locale:f,select:{},where:BZ({collectionConfig:R,search:r,where:D}),...a==="trash"?{trash:!0}:{}},{addQueryPrefix:!0})}`}),T=pg({deletePermanently:h,hasDeletePermission:e,hasTrashPermission:!!R.trash&&o,isTrashView:a==="trash"}),A=T?await Ge.delete(_,{headers:{"Accept-Language":m.language,"Content-Type":"application/json"}}):await Ge.patch(_,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":m.language,"Content-Type":"application/json"}});try{let{plural:L,singular:P}=R.labels,E=await A.json(),B=E?.docs.length||0,k=B>1?L:P;if(A.status<400||B>0){let $;T?a==="trash"||e&&h?$="general:permanentlyDeletedCountSuccessfully":$="general:deletedCountSuccessfully":$="general:trashedCountSuccessfully",q.success(c($,{count:B,label:s6(k,m)}))}E?.errors.length>0&&q.error(E.message,{description:E.errors.map($=>$.message).join(`
55
55
  `)}),I[w]={deletedCount:B,errors:E?.errors||null,ids:E?.docs.map($=>$.id)||[],totalCount:E.totalDocs},A.status>400&&E?.errors.length===0&&(q.error(c("error:unknown")),I[w].errors=[c("error:unknown")]);continue}catch(L){q.error(c("error:unknown")),I[w]={deletedCount:0,errors:[L],ids:[],totalCount:0};continue}}}typeof t=="function"&&t(I)},[s,t,u,h,e,o,f,r,d,m,a,l,c]),{label:y,labelCount:v}=Object.entries(s).reduce((x,[I,w],F,S)=>{let R=u.find(({slug:D})=>D===I);if(R){let D=x.labelCount===void 0?w.totalCount:x.labelCount,_=`${x.labelCount!==void 0?`${w.totalCount} `:""}${s6(w.totalCount>1?R.labels.plural:R.labels.singular,m)}`,T;return F===S.length-1&&F!==0?T=`${x.label} and ${_}`:F>0?T=`${x.label}, ${_}`:T=_,{label:T,labelCount:D}}return x},{label:"",labelCount:void 0});return n6(lm.Fragment,{children:[Un(ro,{"aria-label":c("general:delete"),className:"delete-documents__toggle",onClick:()=>{p(b)},children:c("general:delete")}),Un(rt,{body:n6(lm.Fragment,{children:[Un("p",{children:i&&o?a==="trash"?Un(to,{elements:{0:({children:x})=>Un("strong",{children:x}),1:({children:x})=>Un("strong",{children:x})},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:c,variables:{count:v??0,label:y}}):c("general:aboutToTrashCount",{count:v,label:y}):c("general:aboutToDeleteCount",{count:v,label:y})}),i&&o&&e&&a!=="trash"&&Un("div",{className:"delete-documents__checkbox",children:Un(go,{checked:h,id:"delete-forever",label:c("general:deletePermanently"),name:"delete-forever",onToggle:x=>g(x.target.checked)})})]}),confirmingLabel:c("general:deleting"),heading:c("general:confirmDeletion"),modalSlug:b,onConfirm:C})]})}import{c as VJ}from"react/compiler-runtime";import{jsx as tt,jsxs as Do,Fragment as GJ}from"react/jsx-runtime";import{getTranslation as zJ}from"@payloadcms/translations";import{formatAdminURL as WJ,hasAutosaveEnabled as cP,hasDraftsEnabled as uP}from"payload/shared";import kC,{Fragment as pm,useEffect as HJ}from"react";import{createContext as MZ,use as i6}from"react";var bg=MZ({appIsReady:!1,breakpoint:void 0,breakpoints:void 0,iframeRef:void 0,isLivePreviewEnabled:void 0,isLivePreviewing:!1,isPopupOpen:!1,isPreviewEnabled:void 0,measuredDeviceSize:{height:0,width:0},openPopupWindow:()=>{},popupRef:void 0,previewURL:void 0,previewWindowType:"iframe",setAppIsReady:()=>{},setBreakpoint:()=>{},setHeight:()=>{},setIsLivePreviewing:()=>{},setLoadedURL:()=>{},setMeasuredDeviceSize:()=>{},setPreviewURL:()=>{},setPreviewWindowType:()=>{},setSize:()=>{},setToolbarPosition:()=>{},setURL:()=>{},setWidth:()=>{},setZoom:()=>{},size:{height:0,width:0},toolbarPosition:{x:0,y:0},typeofLivePreviewURL:void 0,url:void 0,zoom:1}),wo=()=>i6(bg),vg=()=>{let{isPreviewEnabled:t,previewURL:e,setPreviewURL:o}=i6(bg);return{isPreviewEnabled:t,previewURL:e,setPreviewURL:o}};import{jsx as l6,jsxs as VZ}from"react/jsx-runtime";import{dequal as GZ}from"dequal/lite";import{formatAdminURL as c6,getAutosaveInterval as zZ,hasDraftValidationEnabled as WZ,reduceFieldsToValues as u6}from"payload/shared";import*as f6 from"qs-esm";import HZ,{useDeferredValue as UZ,useEffect as d6,useRef as vC,useState as XZ}from"react";import{unflatten as OZ}from"payload/shared";var a6=(t,e,o)=>{let n={data:{},valid:!0};return t&&(Object.keys(t).forEach(r=>{(o===!0||!t[r]?.disableFormData)&&(n.data[r]=t[r]?.value,t[r].valid||(n.valid=!1))}),e&&(n.data=OZ(n.data))),n};var YZ="autosave",m6=1e3,p6=({id:t,collection:e,global:o})=>{let{config:{routes:{api:n}}}=H(),{docConfig:r,lastUpdateTime:s,mostRecentVersionIsAutosaved:i,setMostRecentVersionIsAutosaved:a,setUnpublishedVersionCount:l}=Se(),{isValid:c,setBackgroundProcessing:u,submit:d}=$e(),[f]=Ws(),m=po(),p=fo(),{code:h}=ye(),{i18n:g,t:b}=N(),C=zZ(r),y=WZ(r),[v,x]=XZ(!1),I=UZ(v),w=Cn(f,C),{queueTask:F}=ua(),S=vC(null),R=Qe(()=>{S.current=void 0;let A,L,P=()=>{L-A<m6?S.current=setTimeout(()=>{x(!1)},m6-(L-A)):T()};F(async()=>{if(m){A=new Date().getTime(),x(!0);let E,B,k,$=f6.stringify({autosave:!0,depth:0,draft:!0,"fallback-locale":"null",locale:h},{addQueryPrefix:!0});e&&t&&(k=e.slug,E=c6({apiRoute:n,path:`/${k}/${t}${$}`}),B="PATCH"),o&&(k=o.slug,E=c6({apiRoute:n,path:`/globals/${k}${$}`}),B="POST");let{valid:j}=a6(f,!0);if(!(p&&!j&&y)&&m&&E){let O=await d({acceptValues:{overrideLocalChanges:!1},action:E,context:{getDocPermissions:!1,incrementVersionCount:!i},disableFormWhileProcessing:!1,disableSuccessStatus:!0,method:B,overrides:{_status:"draft"},skipValidation:!y});O&&O?.res?.ok&&!i&&(a(!0),l(W=>W+1)),L=new Date().getTime(),P()}}},{afterProcess:()=>{u(!1)},beforeProcess:()=>{u(!0)}})}),D=vC(!1),_=vC(u6(w));d6(()=>{if(!D.current){D.current=!0;return}let{updatedAt:A,...L}=u6(w),{updatedAt:P,...E}=_.current;GZ(L,E)||(_.current=L,R())},[w]),d6(()=>()=>{T()},[]);let T=Qe(()=>{S.current&&clearTimeout(S.current),x(!1)});return VZ("div",{className:YZ,children:[y&&!c&&l6(Kd,{}),I&&b("general:saving"),!I&&!!s&&l6(HZ.Fragment,{children:b("version:lastSavedAgo",{distance:E1({date:s,i18n:g})})})]})};import{jsx as fc,jsxs as h6}from"react/jsx-runtime";import{getTranslation as g6}from"@payloadcms/translations";import{useRouter as ZZ}from"next/navigation.js";import{formatAdminURL as b6}from"payload/shared";import{Fragment as v6,useCallback as y6,useState as JZ}from"react";var C6="delete-document",x6=t=>{let{id:e,buttonId:o,collectionSlug:n,onDelete:r,redirectAfterDelete:s=!0,singularLabel:i,title:a}=t,{config:{routes:{admin:l,api:c}},getEntityConfig:u}=H(),d=u({collectionSlug:n}),{hasDeletePermission:f,hasTrashPermission:m}=Se(),{setModified:p}=$e(),h=ZZ(),{i18n:g,t:b}=N(),{title:C}=Po(),{startRouteTransition:y}=Ye(),{openModal:v}=ae(),x=`delete-${e}`,[I,w]=JZ(!1),F=y6(()=>{q.error(b("error:deletingTitle",{title:C}))},[b,C]),S=y6(async()=>{p(!1);let R=pg({deletePermanently:I,hasDeletePermission:f,hasTrashPermission:m});try{let D=b6({apiRoute:c,path:`/${n}/${e}`}),_=R?await Ge.delete(D,{headers:{"Accept-Language":g.language,"Content-Type":"application/json"}}):await Ge.patch(D,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":g.language,"Content-Type":"application/json"}}),T=await _.json();if(_.status<400){if(q.success(b(R?"general:titleDeleted":"general:titleTrashed",{label:g6(i,g),title:C})||T.message),s)return y(()=>h.push(b6({adminRoute:l,path:`/collections/${n}`})));typeof r=="function"&&await r({id:e,collectionConfig:d});return}T.errors?T.errors.forEach(A=>q.error(A.message)):F();return}catch{return F()}},[I,p,f,m,c,n,e,b,i,F,g,C,h,l,s,r,d,y]);return e?h6(v6,{children:[fc(ve.Button,{id:o,onClick:()=>{v(x)},children:b("general:delete")}),fc(rt,{body:h6(v6,{children:[fc(to,{elements:{1:({children:R})=>fc("strong",{children:R})},i18nKey:d.trash&&m?"general:aboutToTrash":"general:aboutToDelete",t:b,variables:{label:g6(i,g),title:a||C||e}}),d.trash&&m&&f&&fc("div",{className:`${C6}__checkbox`,children:fc(go,{checked:I,id:"delete-forever",label:b("general:deletePermanently"),name:"delete-forever",onToggle:R=>w(R.target.checked)})})]}),className:C6,confirmingLabel:b("general:deleting"),heading:b("general:confirmDeletion"),modalSlug:x,onConfirm:S})]}):null};import{jsx as wC,jsxs as tJ}from"react/jsx-runtime";import{getTranslation as SC}from"@payloadcms/translations";import{useRouter as oJ}from"next/navigation.js";import{formatAdminURL as S6,hasDraftsEnabled as rJ}from"payload/shared";import*as _6 from"qs-esm";import nJ,{useCallback as I6,useMemo as sJ}from"react";var Ns=t=>{for(let e of t){if("localized"in e&&e.localized)return!0;switch(e.type){case"array":case"collapsible":case"group":case"row":if(e.fields&&Ns(e.fields))return!0;break;case"blocks":if(e.blocks){for(let o of e.blocks)if(o.fields&&Ns(o.fields))return!0}break;case"tabs":if(e.tabs){for(let o of e.tabs)if("localized"in o&&o.localized||"fields"in o&&o.fields&&Ns(o.fields))return!0}break}}return!1};import{jsx as Ra,jsxs as yC}from"react/jsx-runtime";import{getTranslation as qZ}from"@payloadcms/translations";import{setsAreEqual as QZ}from"payload/shared";import{useCallback as CC,useMemo as xC,useState as KZ}from"react";var eJ=({i18n:t,localization:e})=>e.locales.map(o=>({label:qZ(o.label,t),value:o.code})),cm="select-locales-drawer",w6=({slug:t,localization:e,onConfirm:o})=>{let{i18n:n,t:r}=N(),{toggleModal:s}=ae(),[i,a]=KZ([]),l=xC(()=>eJ({i18n:n,localization:e}),[e,n]),c=xC(()=>l.map(p=>p.value),[l]),u=xC(()=>QZ(new Set(i),new Set(c)),[i,c]),d=CC(()=>{a(u?[]:[...c])},[u,c]),f=CC(p=>{a(h=>h.includes(p)?h.filter(g=>g!==p):[...h,p])},[]),m=CC(async()=>{await o({selectedLocales:i}),s(t)},[o,i,t,s]);return yC(St,{className:cm,gutter:!1,Header:Ra(li,{onClose:()=>{s(t)},title:`${r("general:duplicate")} ${r("localization:selectedLocales")}`}),slug:t,children:[yC("div",{className:`${cm}__sub-header`,children:[Ra("span",{children:r("localization:selectLocaleToDuplicate")}),Ra(oe,{buttonStyle:"primary",disabled:i.length===0,iconPosition:"left",id:"#action-duplicate-confirm",onClick:m,size:"medium",children:r("general:duplicate")})]}),yC("div",{className:`${cm}__content`,children:[Ra("div",{className:`${cm}__item`,children:Ra(go,{checked:u,id:"select-locale-all",label:r("general:selectAll",{count:c.length,label:r("general:locales")}),onToggle:d})}),l.map(p=>Ra("div",{className:`${cm}__item`,children:Ra(go,{checked:i.includes(p.value),id:`select-locale-${p.value}`,label:p.label,onToggle:()=>f(p.value)})},p.value))]})]})};var IC=({id:t,slug:e,onDuplicate:o,redirectAfterDuplicate:n=!0,selectLocales:r,singularLabel:s})=>{let i=oJ(),a=po(),{openModal:l}=ae(),{code:c}=ye(),{setModified:u}=$e(),{startRouteTransition:d}=Ye(),{config:{localization:f,routes:{admin:m,api:p}},getEntityConfig:h}=H(),g=h({collectionSlug:e}),{i18n:b,t:C}=N(),y=`duplicate-${t}`,v=`duplicate-locales-${t}`,x=sJ(()=>r&&g?Ns(g.fields):!1,[g,r]),I=I6(async S=>{let{selectedLocales:R}=S||{},D=R&&R.length>0,_={};c&&(_.locale=c),D&&(_.selectedLocales=R);let T={"Accept-Language":b.language,"Content-Type":"application/json",credentials:"include"};try{let A=await Ge.post(S6({apiRoute:p,path:`/${e}/${t}/duplicate${_6.stringify(_,{addQueryPrefix:!0})}`}),{body:JSON.stringify(rJ(g)?{_status:"draft"}:{}),headers:T}),{doc:L,errors:P,message:E}=await A.json();if(A.status<400){if(q.success(E||C("general:successfullyDuplicated",{label:SC(s,b)})),u(!1),n)return d(()=>i.push(S6({adminRoute:m,path:`/collections/${e}/${L.id}${c?`?locale=${c}`:""}`})));typeof o=="function"&&o({collectionConfig:g,doc:L})}else q.error(P?.[0].message||E||C("error:unspecific",{label:SC(s,b)}))}catch{q.error(C("error:unspecific",{label:SC(s,b)}))}},[m,p,g,b,t,c,o,n,i,u,s,e,d,C]),w=I6(async()=>{r?l(v):await I()},[I,v,r,l]),F=r?`${C("general:duplicate")} ${C("localization:selectedLocales")}`:C("general:duplicate");return!r||x?tJ(nJ.Fragment,{children:[wC(ve.Button,{id:`action-duplicate${x?"-locales":""}`,onClick:()=>{a?l(y):r?l(v):I()},children:F}),wC(rt,{body:C("general:unsavedChangesDuplicate"),confirmLabel:C("general:duplicateWithoutSaving"),heading:C("general:unsavedChanges"),modalSlug:y,onConfirm:w}),r&&f&&wC(w6,{localization:f,onConfirm:I,slug:v})]}):null};import{jsx as F6}from"react/jsx-runtime";import"react";import{jsx as um,jsxs as iJ}from"react/jsx-runtime";import{Fragment as T6}from"react";var yg=({active:t=!0,className:e})=>um("svg",{className:[e,"icon icon--eye"].filter(Boolean).join(" "),viewBox:"0 0 16 12",xmlns:"http://www.w3.org/2000/svg",children:t?um(T6,{children:um("path",{className:"stroke",d:"M2 11.5L4.35141 9.51035M15 0.5L12.6486 2.48965M10.915 6.64887C10.6493 7.64011 9.78959 8.38832 8.7408 8.48855M10.4085 4.38511C9.94992 3.84369 9.2651 3.5 8.5 3.5C7.11929 3.5 6 4.61929 6 6C6 6.61561 6.22251 7.17926 6.59149 7.61489M10.4085 4.38511L6.59149 7.61489M10.4085 4.38511L12.6486 2.48965M6.59149 7.61489L4.35141 9.51035M14.1292 3.92915C15.0431 5.02085 15.5 6 15.5 6C15.5 6 13.1667 11 8.5 11C7.67995 11 6.93195 10.8456 6.256 10.5911M4.35141 9.51035C2.45047 8.03672 1.5 6 1.5 6C1.5 6 3.83333 1 8.5 1C10.1882 1 11.5711 1.65437 12.6486 2.48965"})}):iJ(T6,{children:[um("circle",{className:"stroke",cx:"8.5",cy:"6",r:"2.5"}),um("path",{className:"stroke",d:"M8.5 1C3.83333 1 1.5 6 1.5 6C1.5 6 3.83333 11 8.5 11C13.1667 11 15.5 6 15.5 6C15.5 6 13.1667 1 8.5 1Z"})]})});var D6="live-preview-toggler",R6=()=>{let{isLivePreviewing:t,setIsLivePreviewing:e,url:o}=wo(),{t:n}=N();return o?F6("button",{"aria-label":n(t?"general:exitLivePreview":"general:livePreview"),className:[D6,t&&`${D6}--active`].filter(Boolean).join(" "),id:"live-preview-toggler",onClick:()=>{e(!t)},title:n(t?"general:exitLivePreview":"general:livePreview"),type:"button",children:F6(yg,{active:t})}):null};import{c as lJ}from"react/compiler-runtime";import{jsx as E6,jsxs as cJ}from"react/jsx-runtime";import{useState as uJ}from"react";import{jsx as A6,jsxs as aJ}from"react/jsx-runtime";import"react";var P6=({className:t})=>aJ("svg",{className:["icon icon--lock",t].filter(Boolean).join(" "),fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[A6("path",{className:"stroke",d:"M7.5 9.5V7.5C7.5 6.83696 7.76339 6.20107 8.23223 5.73223C8.70107 5.26339 9.33696 5 10 5C10.663 5 11.2989 5.26339 11.7678 5.73223C12.2366 6.20107 12.5 6.83696 12.5 7.5V9.5",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"1"}),A6("path",{className:"stroke",d:"M13.5 9.5H6.5C5.94772 9.5 5.5 9.94772 5.5 10.5V14C5.5 14.5523 5.94772 15 6.5 15H13.5C14.0523 15 14.5 14.5523 14.5 14V10.5C14.5 9.94772 14.0523 9.5 13.5 9.5Z",stopOpacity:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var N6="locked",dm=t=>{let e=lJ(8),{className:o,user:n}=t,[r,s]=uJ(!1),{t:i}=N(),a=rg(n)?n.email??n.id:i("general:anotherUser"),l;e[0]!==o?(l=[N6,o].filter(Boolean),e[0]=o,e[1]=l):l=e[1];let c=l.join(" "),u,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>s(!0),d=()=>s(!1),e[2]=u,e[3]=d):(u=e[2],d=e[3]);let f=`${a} ${i("general:isEditing")}`,m;return e[4]!==r||e[5]!==c||e[6]!==f?(m=cJ("div",{className:c,onMouseEnter:u,onMouseLeave:d,role:"button",tabIndex:0,children:[E6(Ao,{alignCaret:"left",className:`${N6}__tooltip`,position:"top",show:r,children:f}),E6(P6,{})]}),e[4]=r,e[5]=c,e[6]=f,e[7]=m):m=e[7],m};import{jsx as Cg,jsxs as dJ}from"react/jsx-runtime";import{getTranslation as L6}from"@payloadcms/translations";import{useRouter as mJ}from"next/navigation.js";import{formatAdminURL as k6}from"payload/shared";import*as $6 from"qs-esm";import{Fragment as fJ,useCallback as j6}from"react";var B6=t=>{let{id:e,buttonId:o,collectionSlug:n,onDelete:r,redirectAfterDelete:s=!0,singularLabel:i,title:a}=t,{config:{routes:{admin:l,api:c},serverURL:u},getEntityConfig:d}=H(),f=d({collectionSlug:n}),m=mJ(),{i18n:p,t:h}=N(),{title:g}=Po(),{startRouteTransition:b}=Ye(),{openModal:C}=ae(),y=`perma-delete-${e}`,v=j6(()=>{q.error(h("error:deletingTitle",{title:g}))},[h,g]),x=j6(async()=>{try{let I=k6({apiRoute:c,path:`/${n}${$6.stringify({trash:!0,where:{and:[{id:{equals:e}},{deletedAt:{exists:!0}}]}},{addQueryPrefix:!0})}`}),w=await Ge.delete(I,{headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}),F=await w.json();if(w.status<400){if(q.success(h("general:titleDeleted",{label:L6(i,p),title:g})||F.message),s)return b(()=>m.push(k6({adminRoute:l,path:`/collections/${n}/trash`,serverURL:u})));typeof r=="function"&&await r({id:e,collectionConfig:f});return}F.errors?F.errors.forEach(S=>q.error(S.message)):v()}catch{v()}},[u,c,n,e,h,i,v,p,g,m,l,s,r,f,b]);return e?dJ(fJ,{children:[Cg(oe,{buttonStyle:"secondary",id:o,onClick:()=>{C(y)},children:h("general:permanentlyDelete")}),Cg(rt,{body:Cg(to,{elements:{1:({children:I})=>Cg("strong",{children:I})},i18nKey:"general:aboutToPermanentlyDelete",t:h,variables:{label:L6(i,p),title:a||g||e}}),confirmingLabel:h("general:deleting"),heading:h("general:confirmDeletion"),modalSlug:y,onConfirm:x})]}):null};import{c as pJ}from"react/compiler-runtime";import{jsx as O6}from"react/jsx-runtime";import"react";import{jsx as M6}from"react/jsx-runtime";import"react";var mm=t=>{let{className:e}=t;return M6("svg",{className:[e,"icon icon--externalLink"].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:M6("path",{className:"stroke",d:"M16 10.6667V14.6667C16 15.0203 15.8595 15.3594 15.6095 15.6095C15.3594 15.8595 15.0203 16 14.6667 16H5.33333C4.97971 16 4.64057 15.8595 4.39052 15.6095C4.14048 15.3594 4 15.0203 4 14.6667V5.33333C4 4.97971 4.14048 4.64057 4.39052 4.39052C4.64057 4.14048 4.97971 4 5.33333 4H9.33333M16 4L10 10M16 4H12M16 4V8",strokeLinecap:"square"})})};var hJ="preview-btn";function _C(t){let e=pJ(3),{previewURL:o}=vg(),{t:n}=N();if(!o)return null;let r;return e[0]!==o||e[1]!==n?(r=O6("a",{"aria-label":n("version:preview"),className:hJ,href:o,id:"preview-button",target:"_blank",title:n("version:preview"),children:O6(mm,{})}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r}import{jsx as hc,jsxs as Y6}from"react/jsx-runtime";import{getTranslation as xJ}from"@payloadcms/translations";import{formatAdminURL as xg,hasAutosaveEnabled as wJ,hasLocalizeStatusEnabled as SJ,hasScheduledPublishEnabled as IJ}from"payload/shared";import*as wg from"qs-esm";import FC,{useCallback as DC,useEffect as _J,useState as TJ}from"react";import{jsx as lo,jsxs as Pa}from"react/jsx-runtime";import{getTranslation as vJ}from"@payloadcms/translations";import{formatAdminURL as yJ}from"payload/shared";import*as U6 from"qs-esm";import tr,{useCallback as CJ,useMemo as W6}from"react";import{jsx as Aa,jsxs as V6}from"react/jsx-runtime";import"react";var G6="table",TC=({appearance:t,BeforeTable:e,columns:o,data:n})=>{let r=o?.filter(s=>s?.active);return!r||r.length===0?Aa("div",{children:"No columns selected"}):V6("div",{className:[G6,t&&`${G6}--appearance-${t}`].filter(Boolean).join(" "),children:[e,V6("table",{cellPadding:"0",cellSpacing:"0",children:[Aa("thead",{children:Aa("tr",{children:r.map((s,i)=>Aa("th",{id:`heading-${s.accessor.replace(/\./g,"__")}`,children:s.Heading},i))})}),Aa("tbody",{children:n&&n?.map((s,i)=>Aa("tr",{className:`row-${i+1}`,"data-id":s.id,children:r.map((a,l)=>{let{accessor:c}=a;return Aa("td",{className:`cell-${c.replace(/\./g,"__")}`,children:a.renderedCells[i]},l)})},typeof s.id=="string"||typeof s.id=="number"?String(s.id):i))})]})]})};import{jsx as Xn,jsxs as gJ}from"react/jsx-runtime";import{getTranslation as bJ}from"@payloadcms/translations";import"react";var z6=({dateFormat:t,deleteHandler:e,docs:o,i18n:n,localization:r,supportedTimezones:s,t:i})=>{let a=[{accessor:"input.type",active:!0,field:{name:"",type:"text"},Heading:Xn("span",{children:i("version:type")}),renderedCells:o.map(l=>{let c=l.input?.type;return gJ(yt,{pillStyle:c==="publish"?"success":"warning",size:"small",children:[c==="publish"&&i("version:publish"),c==="unpublish"&&i("version:unpublish")]},l.id)})},{accessor:"waitUntil",active:!0,field:{name:"",type:"date"},Heading:Xn("span",{children:i("general:time")}),renderedCells:o.map(l=>Xn("span",{children:zr({date:l.waitUntil,i18n:n,pattern:t,timezone:l.input.timezone})},l.id))},{accessor:"input.timezone",active:!0,field:{name:"",type:"text"},Heading:Xn("span",{children:i("general:timezone")}),renderedCells:o.map(l=>{let u=s.find(d=>d.value===l.input.timezone)?.label||l.input.timezone;return Xn("span",{children:u||i("general:noValue")},l.id)})}];return r&&a.push({accessor:"input.locale",active:!0,field:{name:"",type:"text"},Heading:Xn("span",{children:i("general:locale")}),renderedCells:o.map(l=>{if(l.input.locale){let c=r.locales.find(u=>u.code===l.input.locale);if(c)return Xn("span",{children:bJ(c.label,n)},l.id)}return Xn("span",{children:i("general:all")},l.id)})}),a.push({accessor:"delete",active:!0,field:{name:"delete",type:"text"},Heading:Xn("span",{children:i("general:delete")}),renderedCells:o.map(l=>Xn(oe,{buttonStyle:"icon-label",className:"schedule-publish__delete",icon:"x",onClick:c=>{c.preventDefault(),e(l.id)},tooltip:i("general:delete")},l.id))}),a};var pc="schedule-publish",H6={label:"All",value:"all"},X6=({slug:t,defaultType:e,schedulePublishConfig:o})=>{let{toggleModal:n}=ae(),{config:{admin:{dateFormat:r,timezones:{defaultTimezone:s,supportedTimezones:i}},localization:a,routes:{api:l}}}=H(),{id:c,collectionSlug:u,globalSlug:d}=Se(),{title:f}=Po(),{i18n:m,t:p}=N(),{schedulePublish:h}=Lt(),[g,b]=tr.useState(e||"publish"),[C,y]=tr.useState(),[v,x]=tr.useState(s),[I,w]=tr.useState(H6),[F,S]=tr.useState(!1),R=p("general:schedulePublishFor",{title:f}),[D,_]=tr.useState(),[T,A]=tr.useState(),L=tr.useRef(()=>null),P=Intl.DateTimeFormat().resolvedOptions().timeZone,E=tr.useMemo(()=>{if(a){let V=a.locales.map(({code:W,label:Y})=>({label:vJ(Y,m),value:W}));return V.unshift(H6),V}return[]},[a,m]),B=tr.useCallback(async()=>{let V={sort:"waitUntil",where:{and:[{taskSlug:{equals:"schedulePublish"}},{waitUntil:{greater_than:new Date}}]}};u&&(V.where.and.push({"input.doc.value":{equals:String(c)}}),V.where.and.push({"input.doc.relationTo":{equals:u}})),d&&V.where.and.push({"input.global":{equals:d}});let{docs:W}=await Ge.post(yJ({apiRoute:l,path:"/payload-jobs"}),{body:U6.stringify(V),headers:{"Accept-Language":m.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"}}).then(Y=>Y.json());A(z6({dateFormat:r,deleteHandler:L.current,docs:W,i18n:m,localization:a,supportedTimezones:i,t:p})),_(W)},[u,d,l,m,r,a,i,p,c]),k=tr.useCallback(async V=>{try{await h({deleteID:V}),await B(),q.success(p("general:deletedSuccessfully"))}catch(W){console.error(W),q.error(W.message)}},[B,h,p]);tr.useEffect(()=>{L.current=k},[k]);let $=tr.useCallback(async()=>{if(!C)return q.error(p("general:noDateSelected"));S(!0);let V;typeof I=="object"&&I.value!=="all"&&g==="publish"&&(V=I.value);try{await h({type:g,date:C,doc:u?{relationTo:u,value:String(c)}:void 0,global:d||void 0,localeToPublish:V,timezone:v}),y(void 0),q.success(p("version:scheduledSuccessfully")),B()}catch(W){console.error(W),q.error(W.message)}S(!1)},[C,I,g,p,h,u,c,d,v,B]),j=W6(()=>{if(v&&P&&C){let V=no.tz(v),W=no.tz(P),Y=new no(C).withTimeZone(v),z=un(Y,V);return un(z,W).toISOString()}return C},[v,C,P]),M=CJ(V=>{if(v&&V){let W=no.tz(v),Y=new no(V),z=un(Y,W);y(z||null)}else y(V||null)},[y,v]);tr.useEffect(()=>{D||(async()=>await B())()},[D,B]);let O=W6(()=>C&&$3(C)?new Date:Ys(new Date),[C]);return Pa(St,{className:pc,gutter:!1,Header:Pa("div",{className:`${pc}__drawer-header`,children:[lo("h2",{title:R,children:R}),lo(dh,{onClick:()=>n(t)})]}),slug:t,children:[Pa(_o,{className:`${pc}__scheduler`,children:[lo(Ce,{label:p("version:type"),required:!0}),Pa("ul",{className:`${pc}__type`,children:[lo("li",{children:lo(Qu,{id:`${t}-type`,isSelected:g==="publish",onChange:()=>b("publish"),option:{label:p("version:publish"),value:"publish"},path:`${t}-type`,readOnly:F})}),lo("li",{children:lo(Qu,{id:`${t}-type`,isSelected:g==="unpublish",onChange:()=>b("unpublish"),option:{label:p("version:unpublish"),value:"unpublish"},path:`${t}-type`,readOnly:F})})]}),lo("br",{}),lo(Ce,{label:p("general:time"),path:"time",required:!0}),lo(Cl,{id:"time",maxTime:w3(),minDate:new Date,minTime:O,onChange:V=>M(V),pickerAppearance:"dayAndTime",readOnly:F,timeFormat:o?.timeFormat,timeIntervals:o?.timeIntervals??5,value:j}),i.length>0&&lo(Eu,{id:"timezone-picker",onChange:x,options:i,selectedTimezone:v}),lo("br",{}),E.length>0&&g==="publish"&&Pa(tr.Fragment,{children:[lo(Ce,{label:p("localization:localeToPublish")}),lo(pt,{onChange:V=>w(V),options:E,value:I}),lo("br",{})]}),Pa("div",{className:`${pc}__actions`,children:[lo(oe,{buttonStyle:"primary",disabled:F,id:"scheduled-publish-save",onClick:$,type:"button",children:p("general:save")}),F?lo("span",{children:p("general:saving")}):null]})]}),Pa(_o,{className:`${pc}__upcoming`,children:[lo("h4",{children:p("general:upcomingEvents")}),!D&&lo(Et,{}),D?.length===0&&lo(an,{type:"info",children:p("general:noUpcomingEventsScheduled")}),D?.length>0&&lo(TC,{appearance:"condensed",columns:T,data:D})]})]})};function RC({label:t}={}){let{id:e,collectionSlug:o,globalSlug:n,hasPublishedDoc:r,hasPublishPermission:s,setHasPublishedDoc:i,setMostRecentVersionIsAutosaved:a,setUnpublishedVersionCount:l,unpublishedVersionCount:c,uploadStatus:u}=Se(),{config:d,getEntityConfig:f}=H(),{submit:m}=$e(),p=po(),h=ut(),{code:g}=ye(),{isModalOpen:b,toggleModal:C}=ae(),y=`schedule-publish-${e}`,{localization:v,routes:{api:x}}=d,{i18n:I,t:w}=N(),F=t||w("version:publishChanges"),S=FC.useMemo(()=>{if(o)return f({collectionSlug:o});if(n)return f({globalSlug:n})},[o,n,f]),R=c>0,D=s&&(p||R||!r)&&u!=="uploading",_=IJ(S),T=wJ(S),A=!!(_&&s&&(n||o&&e)&&(T||!p)),[L,P]=TJ(!1);_J(()=>{let z=Ns(S?.fields);P(z)},[S?.fields]);let E=v&&L&&s,k=xr()==="update"&&!p,$=DC(async()=>{if(k)return;let z=wg.stringify({depth:0,draft:!0,"fallback-locale":"null",locale:g},{addQueryPrefix:!0}),K,U="POST";o&&(K=xg({apiRoute:x,path:`/${o}${e?`/${e}`:""}${z}`}),e&&(U="PATCH")),n&&(K=xg({apiRoute:x,path:`/globals/${n}${z}`})),await m({action:K,method:U,overrides:{_status:"draft"},skipValidation:!0})},[k,g,o,n,m,x,e]);_a({cmdCtrlKey:!0,editDepth:h,keyCodes:["s"]},z=>{z.preventDefault(),z.stopPropagation(),$&&T&&$()});let j=SJ(S),M=DC(async()=>{if(u==="uploading")return;let z=wg.stringify({depth:0,locale:g,...j&&{publishAllLocales:!0}},{addQueryPrefix:!0}),K=xg({apiRoute:x,path:`${n?`/globals/${n}`:`/${o}${e?`/${e}`:""}`}${z}`});await m({action:K,overrides:{_status:"published"}})&&(l(0),a(!1),i(!0))},[g,j,x,o,n,e,i,m,l,u,a]),O=DC(async z=>{if(u==="uploading")return;let K=wg.stringify({depth:0,locale:z,publishSpecificLocale:z},{addQueryPrefix:!0}),U=n?`/globals/${n}`:`/${o}${e?`/${e}`:""}`,X=xg({apiRoute:x,path:`${U}${K}`});await m({action:X,overrides:{_status:"published"}})&&i(!0)},[x,o,n,e,i,m,u]),V=!E||v&&v?.defaultLocalePublishOption!=="active",W=v&&v?.locales.find(z=>typeof z=="string"?z===g:z.code===g),Y=W&&xJ(W.label,I);return s?Y6(FC.Fragment,{children:[hc(Ar,{buttonId:"action-save",disabled:!D,enableSubMenu:A,onClick:V?M:()=>O(W.code),size:"medium",SubMenuPopupContent:E||A?({close:z})=>Y6(FC.Fragment,{children:[A&&hc(ve.ButtonGroup,{children:hc(ve.Button,{id:"schedule-publish",onClick:()=>[C(y),z()],children:w("version:schedulePublish")})},"schedule-publish"),E&&hc(ve.ButtonGroup,{children:hc(ve.Button,{id:"publish-locale",onClick:V?()=>O(W.code):M,children:V?w("version:publishIn",{locale:Y}):w("version:publishAllLocales")})})]}):void 0,type:"button",children:V?F:w("version:publishIn",{locale:Y})}),A&&b(y)&&hc(X6,{defaultType:R?"publish":"unpublish",schedulePublishConfig:_&&typeof S.versions.drafts.schedulePublish=="object"?S.versions.drafts.schedulePublish:void 0,slug:y})]}):null}import{jsx as gc,jsxs as Z6}from"react/jsx-runtime";import{getTranslation as J6}from"@payloadcms/translations";import{useRouter as FJ}from"next/navigation.js";import{formatAdminURL as q6}from"payload/shared";import*as tP from"qs-esm";import{Fragment as Q6,useCallback as K6,useState as DJ}from"react";var eP="restore-button",oP=t=>{let{id:e,buttonId:o,collectionSlug:n,onRestore:r,redirectAfterRestore:s=!0,singularLabel:i,title:a}=t,{config:{routes:{admin:l,api:c},serverURL:u},getEntityConfig:d}=H(),f=d({collectionSlug:n}),m=FJ(),{i18n:p,t:h}=N(),{title:g}=Po(),{startRouteTransition:b}=Ye(),{openModal:C}=ae(),y=`restore-${e}`,[v,x]=DJ(!1),I=K6(()=>{q.error(h("error:restoringTitle",{title:g}))},[h,g]),w=K6(async()=>{try{let F=q6({apiRoute:c,path:`/${n}${tP.stringify({trash:!0,where:{and:[{id:{equals:e}},{deletedAt:{exists:!0}}]}},{addQueryPrefix:!0})}`}),S={deletedAt:null};f?.versions?.drafts&&(S._status=v?"published":"draft");let R=await Ge.patch(F,{body:JSON.stringify(S),headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}),D=await R.json();if(R.status<400){if(q.success(h("general:titleRestored",{label:J6(i,p),title:g})||D.message),s)return b(()=>m.push(q6({adminRoute:l,path:`/collections/${n}/${e}`,serverURL:u})));typeof r=="function"&&await r({id:e,collectionConfig:f});return}D.errors?D.errors.forEach(_=>q.error(_.message)):I()}catch{I()}},[u,c,n,e,h,i,I,p,g,m,l,s,r,f,b,v]);return e?Z6(Q6,{children:[gc(oe,{buttonStyle:"primary",id:o,onClick:()=>{C(y)},children:h("general:restore")},o),gc(rt,{body:Z6(Q6,{children:[gc(to,{elements:{1:({children:F})=>gc("strong",{children:F})},i18nKey:f?.versions?.drafts?"general:aboutToRestoreAsDraft":"general:aboutToRestore",t:h,variables:{label:J6(i,p),title:a||g||e}}),f?.versions?.drafts&&gc("div",{className:`${eP}__checkbox`,children:gc(go,{checked:v,id:"restore-as-published",label:h("general:restoreAsPublished"),name:"restore-as-published",onToggle:F=>x(F.target.checked)})})]}),className:eP,confirmingLabel:h("general:restoring"),heading:h("general:confirmRestoration"),modalSlug:y,onConfirm:w})]}):null};import{jsx as RJ}from"react/jsx-runtime";import{useRef as AJ}from"react";function AC({label:t}){let{uploadStatus:e}=Se(),{t:o}=N(),{submit:n}=$e(),r=po(),s=t||o("general:save"),i=AJ(null),a=ut(),c=xr()==="update"&&!r||e==="uploading";return _a({cmdCtrlKey:!0,editDepth:a,keyCodes:["s"]},d=>{d.preventDefault(),d.stopPropagation(),i?.current&&i.current.click()}),RJ(Ar,{buttonId:"action-save",disabled:c,onClick:()=>{e!=="uploading"&&n()},ref:i,size:"medium",type:"button",children:s})}import{jsx as PJ}from"react/jsx-runtime";import{formatAdminURL as rP}from"payload/shared";import{useCallback as EJ,useRef as NJ}from"react";var LJ="save-draft";function PC(t){let{config:{routes:{api:e}}}=H(),{id:o,collectionSlug:n,globalSlug:r,setUnpublishedVersionCount:s,uploadStatus:i}=Se(),a=po(),{code:l}=ye(),c=NJ(null),u=ut(),{t:d}=N(),{submit:f}=$e(),p=xr()==="update"&&!a||i==="uploading",h=EJ(async()=>{if(p)return;let g=`?locale=${l}&depth=0&fallback-locale=null&draft=true`,b,C="POST";n&&(b=rP({apiRoute:e,path:`/${n}${o?`/${o}`:""}${g}`}),o&&(C="PATCH")),r&&(b=rP({apiRoute:e,path:`/globals/${r}${g}`})),await f({action:b,method:C,overrides:{_status:"draft"},skipValidation:!0}),s(y=>y+1)},[f,n,r,e,l,o,p,s]);return _a({cmdCtrlKey:!0,editDepth:u,keyCodes:["s"]},g=>{g.preventDefault(),g.stopPropagation(),c?.current&&c.current.click()}),PJ(Ar,{buttonId:"action-save-draft",buttonStyle:"secondary",className:LJ,disabled:p,onClick:()=>{h()},ref:c,size:"medium",type:"button",children:d("version:saveDraft")})}import{jsx as Sg,jsxs as EC}from"react/jsx-runtime";import{formatAdminURL as nP}from"payload/shared";import kJ,{useCallback as jJ}from"react";var fm="status",sP=()=>{let{id:t,collectionSlug:e,docPermissions:o,globalSlug:n,hasPublishedDoc:r,incrementVersionCount:s,isTrashed:i,setMostRecentVersionIsAutosaved:a,setUnpublishedVersionCount:l,unpublishedVersionCount:c}=Se(),{toggleModal:u}=ae(),{config:{routes:{api:d}}}=H(),{reset:f}=$e(),{code:m}=ye(),{i18n:p,t:h}=N(),g=`confirm-revert-${t}`,b;c>0&&r?b="changed":r?r&&c<=0&&(b="published"):b="draft";let C=i?r?"previouslyPublished":"previouslyDraft":b,y=jJ(async()=>{let x,I;e&&(x=nP({apiRoute:d,path:`/${e}/${t}?locale=${m}&fallback-locale=null&depth=0`}),I="patch"),n&&(x=nP({apiRoute:d,path:`/globals/${n}?locale=${m}&fallback-locale=null&depth=0`}),I="post");let F=await Ge.get(x,{headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}).then(R=>R.json()),S=await Ge[I](x,{body:JSON.stringify(F),headers:{"Accept-Language":p.language,"Content-Type":"application/json"}});if(S.status===200){let R,D=await S.json();n?R=D.result:e&&(R=D.doc),f(R),q.success(D.message),s(),a(!1),l(0)}else try{let R=await S.json();R.errors?.[0]?.message?q.error(R.errors[0].message):R.error?q.error(R.error):q.error(h("error:revertingDocument"))}catch{q.error(h("error:revertingDocument"))}},[d,e,n,t,p.language,s,m,f,l,a,h]),v=o?.update;return b?Sg("div",{className:fm,title:`${h("version:status")}: ${h(`version:${C}`)}`,children:EC("div",{className:`${fm}__value-wrap`,children:[EC("span",{className:`${fm}__label`,children:[h("version:status"),":\xA0"]}),Sg("span",{className:`${fm}__value`,children:h(`version:${C}`)}),!i&&v&&r&&b==="changed"&&EC(kJ.Fragment,{children:["\xA0\u2014\xA0",Sg(oe,{buttonStyle:"none",className:`${fm}__action`,id:"action-revert-to-published",onClick:()=>u(g),children:h("version:revertToPublished")}),Sg(rt,{body:h("version:aboutToRevertToPublished"),confirmingLabel:h("version:reverting"),heading:h("version:confirmRevertToSaved"),modalSlug:g,onConfirm:()=>y()})]})]})}):null};import{jsx as NC,jsxs as $J}from"react/jsx-runtime";import{getTranslation as BJ}from"@payloadcms/translations";import{formatAdminURL as iP}from"payload/shared";import*as lP from"qs-esm";import Ig,{useCallback as MJ,useEffect as OJ,useState as aP}from"react";function LC({label:t}={}){let{id:e,collectionSlug:o,data:n,globalSlug:r,hasPublishedDoc:s,hasPublishPermission:i,incrementVersionCount:a,isTrashed:l,setHasPublishedDoc:c,setMostRecentVersionIsAutosaved:u,setUnpublishedVersionCount:d}=Se(),{toggleModal:f}=ae(),{config:m,getEntityConfig:p}=H(),{reset:h}=$e(),{code:g,label:b}=ye(),[C,y]=aP(!1),[v,x]=aP(!1),I=`confirm-un-publish-${e}`,{routes:{api:w},serverURL:F}=m,{i18n:S,t:R}=N(),D=Ig.useMemo(()=>{if(o)return p({collectionSlug:o});if(r)return p({globalSlug:r})},[o,r,p]),_=MJ(B=>{(async()=>{let k,$,j=lP.stringify({depth:0,"fallback-locale":"null",locale:B?void 0:g,unpublishAllLocales:B},{addQueryPrefix:!0});o&&(k=iP({apiRoute:w,path:`/${o}/${e}${j}`,serverURL:F}),$="patch"),r&&(k=iP({apiRoute:w,path:`/globals/${r}${j}`,serverURL:F}),$="post");try{let M=await Ge[$](k,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":S.language,"Content-Type":"application/json"}});if(M.status===200)h({...n||{},_status:"draft"}),q.success(R("version:unpublishedSuccessfully")),a(),d(1),u(!1),c(!1);else try{let O=await M.json();O.errors?.[0]?.message?q.error(O.errors[0].message):O.error?q.error(O.error):q.error(R("error:unPublishingDocument"))}catch{q.error(R("error:unPublishingDocument"))}}catch{q.error(R("error:unPublishingDocument"))}})().catch(()=>{q.error(R("error:unPublishingDocument"))})},[n,h,o,r,F,w,g,e,S.language,a,c,u,d,R]);OJ(()=>{let B=Ns(D?.fields);x(B)},[D?.fields]);let T=D?.versions?.drafts,A=typeof T=="object"&&T!==null,L=Ig.useMemo(()=>A&&i&&s&&!l,[i,s,l,A]),P=Ig.useMemo(()=>{if(!L||!v)return!1;let B=T&&T.localizeStatus===!0,k=m.experimental?.localizeStatus===!0;return B&&k},[L,v,T,m.experimental?.localizeStatus]),E=BJ(b,S);return L?$J(Ig.Fragment,{children:[NC(ve.Button,{id:"action-unpublish",onClick:()=>{y(!0),f(I)},children:t||R("version:unpublish")}),P&&NC(ve.Button,{id:"action-unpublish-locale",onClick:()=>{y(!1),f(I)},children:t?`${t} [${E}]`:R("version:unpublishIn",{locale:E})}),NC(rt,{body:C?R("version:aboutToUnpublish"):R("version:aboutToUnpublishIn",{locale:E}),confirmingLabel:R("version:unpublishing"),heading:R("version:confirmUnpublish"),modalSlug:I,onConfirm:()=>_(C)})]}):null}var Ht="doc-controls",jC=t=>{let e=VJ(5),{id:o,slug:n,BeforeDocumentControls:r,customComponents:s,data:i,disableActions:a,disableCreate:l,EditMenuItems:c,hasSavePermission:u,isAccountView:d,isEditing:f,isInDrawer:m,isTrashed:p,onDelete:h,onDrawerCreateNew:g,onDuplicate:b,onRestore:C,onTakeOver:y,permissions:v,readOnlyForIncomingUser:x,redirectAfterDelete:I,redirectAfterDuplicate:w,redirectAfterRestore:F,user:S}=t,{PreviewButton:R,PublishButton:D,SaveButton:_,SaveDraftButton:T,Status:A,UnpublishButton:L}=s===void 0?{}:s,{i18n:P,t:E}=N(),B=ut(),{config:k,getEntityConfig:$}=H(),j=$({collectionSlug:n}),M=$({globalSlug:n}),{isLivePreviewEnabled:O}=wo(),{hasDeletePermission:V,hasTrashPermission:W}=Se(),{admin:Y,localization:z,routes:K}=k,{dateFormat:U}=Y,{admin:X}=K,[ne,Z]=kC.useState(""),[J,re]=kC.useState(""),me=Or(),xe=Ei(),_e,Be;e[0]!==i||e[1]!==U||e[2]!==P?(_e=()=>{i?.updatedAt&&Z(zr({date:i.updatedAt,i18n:P,pattern:U})),i?.createdAt&&re(zr({date:i.createdAt,i18n:P,pattern:U}))},Be=[i,P,U],e[0]=i,e[1]=U,e[2]=P,e[3]=_e,e[4]=Be):(_e=e[3],Be=e[4]),HJ(_e,Be);let Me=v&&"create"in v&&v.create,Ue=v&&"delete"in v&&v.delete,he=j?.trash?W||V:Ue,Oe=!!(j&&o&&!a&&(Me||he)),Ke=!o&&j?.versions?.drafts&&j.versions?.drafts.validate,le=uP(M),we=uP(j),G=cP(j),ie=cP(M),Q=G||ie,fe=G&&j.versions.drafts.autosave!==!1&&j.versions.drafts.autosave.showSaveDraftButton===!0||ie&&M.versions.drafts.autosave!==!1&&M.versions.drafts.autosave.showSaveDraftButton===!0,de=z&&!j?.admin?.disableCopyToLocale,se=j&&j.folders,ee=S&&x;return Do(_o,{className:Ht,children:[Do("div",{className:`${Ht}__wrapper`,children:[Do("div",{className:`${Ht}__content`,children:[ee||se?Do("div",{className:`${Ht}__meta-icons`,children:[ee&&tt(dm,{className:`${Ht}__locked-controls`,user:S}),se&&k.folders&&!p&&tt(Id,{folderCollectionSlug:k.folders.slug,folderFieldName:k.folders.fieldName})]}):null,Do("ul",{className:`${Ht}__meta`,children:[j&&!f&&!d&&tt("li",{className:`${Ht}__list-item`,children:tt("p",{className:`${Ht}__value`,children:P.t("general:creatingNewLabel",{label:zJ(j?.labels?.singular??P.t("general:document"),P)})})}),(we||le)&&Do(pm,{children:[(M||j&&f)&&tt("li",{className:[`${Ht}__status`,`${Ht}__list-item`].filter(Boolean).join(" "),children:tt(ue,{CustomComponent:A,Fallback:tt(sP,{})})}),u&&Q&&!Ke&&!p&&tt("li",{className:`${Ht}__list-item`,children:tt(p6,{collection:j,global:M,id:o,publishedDocUpdatedAt:i?.createdAt})})]}),j?.timestamps&&(f||d)&&Do(pm,{children:[Do("li",{className:[`${Ht}__list-item`,`${Ht}__value-wrap`].filter(Boolean).join(" "),title:i?.updatedAt?ne:"",children:[Do("p",{className:`${Ht}__label`,children:[P.t(p?"general:deleted":"general:lastModified"),":\xA0"]}),i?.updatedAt&&tt("p",{className:`${Ht}__value`,children:ne})]}),Do("li",{className:[`${Ht}__list-item`,`${Ht}__value-wrap`].filter(Boolean).join(" "),title:i?.createdAt?J:"",children:[Do("p",{className:`${Ht}__label`,children:[P.t("general:created"),":\xA0"]}),i?.createdAt&&tt("p",{className:`${Ht}__value`,children:J})]})]})]})]}),Do("div",{className:`${Ht}__controls-wrapper`,children:[Do("div",{className:`${Ht}__controls`,children:[r,O&&!m&&tt(R6,{}),(j?.admin.preview||M?.admin.preview)&&tt(ue,{CustomComponent:R,Fallback:tt(_C,{})}),u&&!p&&tt(pm,{children:we||le?Do(pm,{children:[(Ke||!Q||Q&&fe)&&tt(ue,{CustomComponent:T,Fallback:tt(PC,{})}),tt(ue,{CustomComponent:D,Fallback:tt(RC,{})})]}):tt(ue,{CustomComponent:_,Fallback:tt(AC,{})})}),V&&p&&tt(B6,{buttonId:"action-permanently-delete",collectionSlug:j?.slug,id:o.toString(),onDelete:h,redirectAfterDelete:I,singularLabel:j?.labels?.singular}),u&&p&&tt(oP,{buttonId:"action-restore",collectionSlug:j?.slug,id:o.toString(),onRestore:C,redirectAfterRestore:F,singularLabel:j?.labels?.singular}),S&&x&&tt(oe,{buttonStyle:"secondary",id:"take-over",onClick:y,size:"medium",type:"button",children:E("general:takeOver")})]}),Oe&&!x&&tt(it,{button:Do("div",{className:`${Ht}__dots`,children:[tt("div",{}),tt("div",{}),tt("div",{})]}),className:`${Ht}__popup`,disabled:xe||me,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:Do(ve.ButtonGroup,{children:[de&&tt(uC,{}),Me&&Do(kC.Fragment,{children:[!l&&tt(pm,{children:B>1?tt(ve.Button,{id:"action-create",onClick:g,children:P.t("general:createNew")}):tt(ve.Button,{href:WJ({adminRoute:X,path:`/collections/${j?.slug}/create`}),id:"action-create",children:P.t("general:createNew")})}),j.disableDuplicate!==!0&&f&&Do(GJ,{children:[tt(IC,{id:o,onDuplicate:b,redirectAfterDuplicate:w,singularLabel:j?.labels?.singular,slug:j?.slug}),z&&tt(IC,{id:o,onDuplicate:b,redirectAfterDuplicate:w,selectLocales:!0,singularLabel:j?.labels?.singular,slug:j?.slug})]})]}),he&&tt(x6,{buttonId:"action-delete",collectionSlug:j?.slug,id:o.toString(),onDelete:h,redirectAfterDelete:I,singularLabel:j?.labels?.singular,useAsTitle:j?.admin?.useAsTitle}),tt(ue,{CustomComponent:L,Fallback:tt(LC,{})}),c]})})]})]}),tt("div",{className:`${Ht}__divider`})]})};import{jsx as gP}from"react/jsx-runtime";import"react";var dP=/^<(?<name>[^\s/>]+)[^>]*>$/,mP=/^<(?<isEnd>\/)?(?<name>[^\s>]+)[^>]*>$/,$C=/^<[^>]+>/,UJ=/^<img[^>]*>$/,fP=/^<video[^>]*>.*?<\/video>$/ms,_g=class{config;leastCommonLength=1/0;matchedBlockList=[];newTokens=[];oldTokens=[];operationList=[];sideBySideContents;unifiedContent;constructor(e,o,{classNames:n={createBlock:"html-diff-create-block-wrapper",createInline:"html-diff-create-inline-wrapper",deleteBlock:"html-diff-delete-block-wrapper",deleteInline:"html-diff-delete-inline-wrapper"},greedyBoundary:r=1e3,greedyMatch:s=!0,minMatchedSize:i=2,tokenizeByCharacter:a=!1}={}){if(this.config={classNames:{createBlock:"html-diff-create-block-wrapper",createInline:"html-diff-create-inline-wrapper",deleteBlock:"html-diff-delete-block-wrapper",deleteInline:"html-diff-delete-inline-wrapper",...n},greedyBoundary:r,greedyMatch:s,minMatchedSize:i},e=e.trim(),o=o.trim(),e===o){this.unifiedContent=e;let c=0,u=e.replace(/<([^\s/>]+)[^>]*>/g,(d,f)=>{let m=f.length+1;return`${d.slice(0,m)} data-seq="${++c}"${d.slice(m)}`});this.sideBySideContents=[u,u];return}let l=a?this.tokenizeByCharacter:this.tokenizeByWord;this.oldTokens=l(e),this.newTokens=l(o),this.matchedBlockList=this.getMatchedBlockList(),this.operationList=this.getOperationList()}computeBestMatchedBlock(e,o,n,r){let s=null;for(let i=e;i<o;i++){let a=Math.min(o-i,r-n),l=this.slideBestMatchedBlock(i,n,a);if(l&&(!s||l.size>s.size)&&(s=l,l.size>this.leastCommonLength))return s}for(let i=n;i<r;i++){let a=Math.min(o-e,r-i),l=this.slideBestMatchedBlock(e,i,a);if(l&&(!s||l.size>s.size)&&(s=l,l.size>this.leastCommonLength))return s}return s}computeMatchedBlockList(e,o,n,r,s=[]){let i=this.computeBestMatchedBlock(e,o,n,r);return i?(e<i.oldStart&&n<i.newStart&&this.computeMatchedBlockList(e,i.oldStart,n,i.newStart,s),s.push(i),o>i.oldEnd&&r>i.newEnd&&this.computeMatchedBlockList(i.oldEnd,o,i.newEnd,r,s),s):[]}dressUpBlockTag(e,o){return e==="create"?`<div class="${this.config.classNames.createBlock}">${o}</div>`:e==="delete"?`<div class="${this.config.classNames.deleteBlock}">${o}</div>`:""}dressUpDiffContent(e,o){let n=o.length;if(!n)return"";let r="",s=0,i=-1;for(let a of o){i++;let l=a.includes('data-enable-match="true"'),c=a.includes('data-enable-match="false"'),u=!!a.match($C)?.length;if(c)s=i+1,r+=a;else if(!l&&u)i>s&&(r+=this.dressUpText(e,o.slice(s,i))),s=i+1,a.match(fP)?r+=this.dressUpBlockTag(e,a):r+=a;else if(l&&u){i>s&&(r+=this.dressUpText(e,o.slice(s,i))),s=i+1;let d=this.dressupMatchEnabledHtmlTag(e,a);r+=d}}return s<n&&(r+=this.dressUpText(e,o.slice(s))),r}dressUpInlineTag(e,o){return e==="create"?`<span class="${this.config.classNames.createInline}">${o}</span>`:e==="delete"?`<span class="${this.config.classNames.deleteInline}">${o}</span>`:""}dressupMatchEnabledHtmlTag(e,o){let n=o.match(dP)?.groups?.name;if(!n)return o;let r=n.length+1,s=e==="create"?"create":"delete";return`${o.slice(0,r)} data-match-type="${s}"${o.slice(r,o.length)}`}dressUpText(e,o){let n=o.join("");return n.trim()?e==="create"?`<span data-match-type="create">${n}</span>`:e==="delete"?`<span data-match-type="delete">${n}</span>`:"":""}getMatchedBlockList(){let e=this.oldTokens.length,o=this.newTokens.length,n=null,r=0;for(;r<e&&r<o&&this.oldTokens[r]===this.newTokens[r];)r++;r>=this.config.minMatchedSize&&(n={newEnd:r,newStart:0,oldEnd:r,oldStart:0,size:r});let s=null,i=e-1,a=o-1;for(;r<=i&&r<=a&&this.oldTokens[i]===this.newTokens[a];)i--,a--;let l=e-1-i;l>=this.config.minMatchedSize&&(s={newEnd:o,newStart:a+1,oldEnd:e,oldStart:i+1,size:l});let c=n?r:0,u=s?i+1:e,d=n?r:0,f=s?a+1:o;if(this.config.greedyMatch){let p=Math.min(u-c,f-d);p>this.config.greedyBoundary&&(this.leastCommonLength=Math.floor(p/3))}let m=this.computeMatchedBlockList(c,u,d,f);return n&&m.unshift(n),s&&m.push(s),m}getOperationList(){let e=[],o=0,n=0;for(let c of this.matchedBlockList){let u=o===c.oldStart,d=n===c.newStart,f={newEnd:c.newStart,newStart:n,oldEnd:c.oldStart,oldStart:o};!u&&!d?e.push(Object.assign(f,{type:"replace"})):u&&!d?e.push(Object.assign(f,{type:"create"})):!u&&d&&e.push(Object.assign(f,{type:"delete"})),e.push({type:"equal",newEnd:c.newEnd,newStart:c.newStart,oldEnd:c.oldEnd,oldStart:c.oldStart}),o=c.oldEnd,n=c.newEnd}let r=this.oldTokens.length,s=this.newTokens.length,i={newEnd:s,newStart:n,oldEnd:r,oldStart:o},a=o===r,l=n===s;return!a&&!l?e.push(Object.assign(i,{type:"replace"})):a&&!l?e.push(Object.assign(i,{type:"create"})):!a&&l&&e.push(Object.assign(i,{type:"delete"})),e}slideBestMatchedBlock(e,o,n){let r=0,s=null,i=0;for(let a=0;a<n;a++)this.oldTokens[e+a]===this.newTokens[o+a]?i++:i=0,i>r&&(r=i,s={newEnd:o+a+1,newStart:o+a-i+1,oldEnd:e+a+1,oldStart:e+a-i+1,size:i});return r>=this.config.minMatchedSize?s:null}tokenizeByCharacter(e){let o=[],n=0,r=/<picture[^>]*>.*?<\/picture>|<video[^>]*>.*?<\/video>|<[^>]+>/gs,s;for(;(s=r.exec(e))!==null;){let a=e.substring(n,s.index);if(a)for(let l of a)o.push(l);o.push(s[0]),n=s.index+s[0].length}let i=e.substring(n);for(let a of i)o.push(a);return o}tokenizeByWord(e){return e.match(/<picture[^>]*>.*?<\/picture>|<video[^>]*>.*?<\/video>|<[^>]+>|\w+\b|\s+|[^<>\w]/gs)||[]}getSideBySideContents(){if(this.sideBySideContents!==void 0)return this.sideBySideContents;let e="",o="",n=0;this.operationList.forEach(s=>{switch(s.type){case"create":{o+=this.dressUpDiffContent("create",this.newTokens.slice(s.newStart,s.newEnd));break}case"delete":{let i=this.oldTokens.slice(s.oldStart,s.oldEnd);e+=this.dressUpDiffContent("delete",i);break}case"equal":{let i=this.newTokens.slice(s.newStart,s.newEnd),a="";for(let l of i){let c=l.match(dP);if(c){n+=1;let u=(c?.groups?.name?.length??0)+1;a+=`${l.slice(0,u)} data-seq="${n}"${l.slice(u)}`}else a+=l}e+=a,o+=a;break}case"replace":{e+=this.dressUpDiffContent("delete",this.oldTokens.slice(s.oldStart,s.oldEnd)),o+=this.dressUpDiffContent("create",this.newTokens.slice(s.newStart,s.newEnd));break}default:console.error("Richtext diff error - invalid operation: "+String(s.type))}});let r=[e,o];return this.sideBySideContents=r,r}getUnifiedContent(){if(this.unifiedContent!==void 0)return this.unifiedContent;let e="";return this.operationList.forEach(o=>{switch(o.type){case"create":{e+=this.dressUpDiffContent("create",this.newTokens.slice(o.newStart,o.newEnd));break}case"delete":{e+=this.dressUpDiffContent("delete",this.oldTokens.slice(o.oldStart,o.oldEnd));break}case"equal":{for(let n of this.newTokens.slice(o.newStart,o.newEnd))e+=n;break}case"replace":{let n=this.oldTokens.slice(o.oldStart,o.oldEnd),r=this.newTokens.slice(o.newStart,o.newEnd);if(n.length===1&&r.length===1&&n[0]?.match($C)&&r[0]?.match($C)){e+=r[0];break}let s=[],i=[],a=o.newStart;for(let l=o.oldStart;l<o.oldEnd;l++){let c=this.oldTokens[l];if(!c)continue;let u=c?.match(mP);if(u){if([UJ,fP].some(f=>c?.match(f))){s.push(c);continue}e+=this.dressUpDiffContent("delete",s),s.splice(0);let d=!1;for(let f=a;f<o.newEnd;f++){let m=this.newTokens[f];if(!m)continue;let p=m?.match(mP);if(p&&p.groups?.name===u.groups?.name&&p.groups?.isEnd===u.groups?.isEnd){d=!0,e+=this.dressUpDiffContent("create",i),e+=m,i.splice(0),a=f+1;break}else i.push(m)}d||(e+=c,i.splice(0))}else s.push(c)}a<o.newEnd&&i.push(...this.newTokens.slice(a,o.newEnd)),e+=this.dressUpDiffContent("delete",s),e+=this.dressUpDiffContent("create",i);break}default:console.error("Richtext diff error - invalid operation: "+String(o.type))}}),this.unifiedContent=e,e}};var hm={'"':"\uE004","&":"\uE001","'":"\uE005","<":"\uE002",">":"\uE003"},gm={"\uE001":"&amp;","\uE002":"&lt;","\uE003":"&gt;","\uE004":"&quot;","\uE005":"&#39;"};function pP(t){return t==null?"":(typeof t=="string"?t:String(t)).replace(/&/g,hm["&"]).replace(/</g,hm["<"]).replace(/>/g,hm[">"]).replace(/"/g,hm['"']).replace(/'/g,hm["'"])}function hP(t){return t.replace(/\uE001/g,gm["\uE001"]).replace(/\uE002/g,gm["\uE002"]).replace(/\uE003/g,gm["\uE003"]).replace(/\uE004/g,gm["\uE004"]).replace(/\uE005/g,gm["\uE005"])}var bP="html-diff",XJ=({fromHTML:t,postProcess:e,toHTML:o,tokenizeByCharacter:n})=>{let r=new _g(t,o,{tokenizeByCharacter:n}),[s,i]=r.getSideBySideContents();e&&(s=e(s),i=e(i));let a=s?gP("div",{className:`${bP}__diff-old html-diff`,dangerouslySetInnerHTML:{__html:s}}):null,l=i?gP("div",{className:`${bP}__diff-new html-diff`,dangerouslySetInnerHTML:{__html:i}}):null;return{From:a,To:l}};import{useEffect as KJ}from"react";import{jsx as YJ}from"react/jsx-runtime";import{createContext as ZJ,use as JJ,useEffect as qJ,useRef as QJ}from"react";var vP=ZJ(null),yP=({children:t})=>{let e=QJ(new Set);return qJ(()=>{let r=s=>{e.current.forEach(({handler:i,ref:a})=>{a.current&&!a.current.contains(s.target)&&i()})};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]),YJ(vP,{value:{register:r=>e.current.add(r),unregister:r=>e.current.delete(r)},children:t})},BC=()=>{let t=JJ(vP);if(!t)throw new Error("useClickOutside must be used within a ClickOutsideProvider");return t};function eq(t,e,o=!0){let{register:n,unregister:r}=BC();KJ(()=>{if(!o||!t.current)return;let s={handler:e,ref:t};return n(s),()=>r(s)},[t,e,o,n,r])}import{c as _P}from"react/compiler-runtime";import{jsx as bm,jsxs as dq}from"react/jsx-runtime";import{useState as mq}from"react";import{c as VC}from"react/compiler-runtime";import{jsx as Ro,jsxs as Tg}from"react/jsx-runtime";import{getTranslation as tq}from"@payloadcms/translations";import{useRouter as oq,useSearchParams as rq}from"next/navigation.js";import{combineWhereConstraints as nq,formatAdminURL as MC,mergeListSearchAndWhere as sq,unflatten as CP}from"payload/shared";import*as OC from"qs-esm";import xP,{useCallback as wP,useEffect as iq,useMemo as SP,useState as aq}from"react";var lq=t=>{let e=VC(7),{action:o,disabled:n}=t,{submit:r}=$e(),{t:s}=N(),i;e[0]!==o||e[1]!==r?(i=()=>{r({action:o,method:"PATCH",skipValidation:!0})},e[0]=o,e[1]=r,e[2]=i):i=e[2];let a=i,l;return e[3]!==n||e[4]!==a||e[5]!==s?(l=Ro(Ar,{className:`${or}__save`,disabled:n,onClick:a,children:s("general:save")}),e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l},cq=t=>{let e=VC(7),{action:o,disabled:n}=t,{submit:r}=$e(),{t:s}=N(),i;e[0]!==o||e[1]!==r?(i=()=>{r({action:o,method:"PATCH",overrides:{_status:"published"},skipValidation:!0})},e[0]=o,e[1]=r,e[2]=i):i=e[2];let a=i,l;return e[3]!==n||e[4]!==a||e[5]!==s?(l=Ro(Ar,{className:`${or}__publish`,disabled:n,onClick:a,children:s("version:publishChanges")}),e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l},uq=t=>{let e=VC(7),{action:o,disabled:n}=t,{submit:r}=$e(),{t:s}=N(),i;e[0]!==o||e[1]!==r?(i=()=>{r({action:o,method:"PATCH",overrides:{_status:"draft"},skipValidation:!0})},e[0]=o,e[1]=r,e[2]=i):i=e[2];let a=i,l;return e[3]!==n||e[4]!==a||e[5]!==s?(l=Ro(Ar,{buttonStyle:"secondary",className:`${or}__draft`,disabled:n,onClick:a,children:s("version:saveDraft")}),e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l},IP=t=>{let{collection:e,collection:{fields:o,labels:{plural:n,singular:r}}={},count:s,drawerSlug:i,ids:a,onSuccess:l,selectAll:c,selectedFields:u,setSelectedFields:d,where:f}=t,{permissions:m,user:p}=Ie(),{code:h}=ye(),{closeModal:g}=ae(),{config:{routes:{api:b}}}=H(),{getFormState:C}=Lt(),{i18n:y,t:v}=N(),[x,I]=aq(!1),w=oq(),F=xP.useRef(null),S=m?.collections?.[e.slug],R=rq(),D=SP(()=>CP(u.reduce((P,E)=>(P[E.value.path]=!0,P),{})),[u]),_=wP(async({formState:P,submitted:E})=>{let B=Fr(F),{state:k}=await C({collectionSlug:e.slug,docPermissions:S,docPreferences:null,formState:P,operation:"update",schemaPath:e.slug,select:D,signal:B.signal,skipValidation:!E});return F.current=null,k},[C,e,S,D]);iq(()=>{let P=F.current;return()=>{Tr(P)}},[]);let T=SP(()=>{let P=[];f&&P.push(f);let E=sq({collectionConfig:e,search:R.get("search")});return E&&P.push(E),c?P.push(Yt(R)?.where||{id:{not_equals:""}}):P.push({id:{in:a||[]}}),OC.stringify({locale:h,select:{},where:nq(P)},{addQueryPrefix:!0})},[e,R,c,a,h,f]),A=()=>{w.replace(OC.stringify({...Yt(R),_r:Date.now(),page:c?"1":void 0},{addQueryPrefix:!0})),g(i),typeof l=="function"&&l()},L=wP(async({dispatchFields:P,formState:E,selected:B})=>{I(!0),d(B||[]);let{state:k}=await C({collectionSlug:e.slug,docPermissions:S,docPreferences:null,formState:E,operation:"update",schemaPath:e.slug,select:CP(B.reduce(($,j)=>($[j.value.path]=!0,$),{})),skipValidation:!0});P({type:"UPDATE_MANY",formState:k}),I(!1)},[C,e.slug,S,d]);return Ro(ru,{collectionSlug:e.slug,currentEditor:p,hasPublishedDoc:!1,id:null,initialData:{},isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,versionCount:0,children:Ro(zf,{value:"update",children:Tg("div",{className:`${or}__main`,children:[Tg("div",{className:`${or}__header`,children:[Ro("h2",{className:`${or}__header__title`,children:v("general:editingLabel",{count:s,label:tq(s>1?n:r,y)})}),Ro("button",{"aria-label":v("general:close"),className:`${or}__header__close`,id:`close-drawer__${i}`,onClick:()=>g(i),type:"button",children:Ro(vt,{})})]}),Tg(ws,{className:`${or}__form`,isInitializing:x,onChange:[_],onSuccess:A,children:[Ro(vh,{fields:o,onChange:L,permissions:S.fields}),u.length===0?null:Ro("div",{className:"render-fields",children:u.map((P,E)=>{let{value:{field:B,fieldPermissions:k,path:$}}=P;return Ro(ql,{clientFieldConfig:B,indexPath:"",parentPath:"",parentSchemaPath:"",path:$,permissions:k},`${$}-${E}`)})}),Ro("div",{className:`${or}__sidebar-wrap`,children:Ro("div",{className:`${or}__sidebar`,children:Ro("div",{className:`${or}__sidebar-sticky-wrap`,children:Ro("div",{className:`${or}__document-actions`,children:e?.versions?.drafts?Tg(xP.Fragment,{children:[Ro(uq,{action:MC({apiRoute:b,path:`/${e.slug}${T}&draft=true`}),disabled:u.length===0}),Ro(cq,{action:MC({apiRoute:b,path:`/${e.slug}${T}&draft=true`}),disabled:u.length===0})]}):Ro(lq,{action:MC({apiRoute:b,path:`/${e.slug}${T}`}),disabled:u.length===0})})})})})]})]})})})};var or="edit-many",fq=t=>{let e=_P(8),{count:o,selectAll:n,selectedIDs:r,toggleAll:s}=xo(),i;e[0]!==s?(i=()=>s(),e[0]=s,e[1]=i):i=e[1];let a=n===Jt.AllAvailable,l;return e[2]!==o||e[3]!==t||e[4]!==r||e[5]!==i||e[6]!==a?(l=bm(vm,{...t,count:o,ids:r,onSuccess:i,selectAll:a}),e[2]=o,e[3]=t,e[4]=r,e[5]=i,e[6]=a,e[7]=l):l=e[7],l},vm=t=>{let e=_P(16),{collection:o,count:n,ids:r,modalPrefix:s,onSuccess:i,selectAll:a,where:l}=t,{permissions:c}=Ie(),{openModal:u}=ae(),{t:d}=N(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];let[m,p]=mq(f),h=c?.collections?.[o.slug],g=`${s?`${s}-`:""}edit-${o.slug}`;if(n===0||!h?.update)return null;let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=[or,`${or}__toggle`].filter(Boolean),e[1]=b):b=e[1];let C;if(e[2]!==o||e[3]!==n||e[4]!==g||e[5]!==r||e[6]!==i||e[7]!==u||e[8]!==a||e[9]!==m||e[10]!==d||e[11]!==l){let y;e[13]!==g||e[14]!==u?(y=()=>{u(g),p([])},e[13]=g,e[14]=u,e[15]=y):y=e[15],C=dq("div",{className:b.join(" "),children:[bm(ro,{"aria-label":d("general:edit"),onClick:y,children:d("general:edit")}),bm(ns,{children:bm(St,{Header:null,slug:g,children:bm(IP,{collection:o,count:n,drawerSlug:g,ids:r,onSuccess:i,selectAll:a,selectedFields:m,setSelectedFields:p,where:l})})})]}),e[2]=o,e[3]=n,e[4]=g,e[5]=r,e[6]=i,e[7]=u,e[8]=a,e[9]=m,e[10]=d,e[11]=l,e[12]=C}else C=e[12];return C};import{c as pq}from"react/compiler-runtime";import{jsx as hq}from"react/jsx-runtime";import"react";function gq(t){let e=pq(3),o=ut(),n;return e[0]!==o||e[1]!==t?(n=hq(Zo,{closeOnBlur:!1,...t,style:{...t.style||{},zIndex:`calc(100 + ${o||0} + 1)`}}),e[0]=o,e[1]=t,e[2]=n):n=e[2],n}import{c as bq}from"react/compiler-runtime";import{jsx as Fg,jsxs as vq}from"react/jsx-runtime";import yq from"react";function GC(t){let e=bq(12),{highlightField:o,setKey:n}=t,{id:r}=Se(),{toggleModal:s}=ae(),{t:i}=N(),a=`generate-confirmation-${r}`,l;e[0]!==o||e[1]!==n||e[2]!==i?(l=()=>{n(),q.success(i("authentication:newAPIKeyGenerated")),o(!0)},e[0]=o,e[1]=n,e[2]=i,e[3]=l):l=e[3];let c=l,u;e[4]!==a||e[5]!==s?(u=()=>{s(a)},e[4]=a,e[5]=s,e[6]=u):u=e[6];let d;return e[7]!==c||e[8]!==a||e[9]!==i||e[10]!==u?(d=vq(yq.Fragment,{children:[Fg(oe,{buttonStyle:"secondary",onClick:u,size:"small",children:i("authentication:generateNewAPIKey")}),Fg(rt,{body:Fg(to,{elements:{1:Cq},i18nKey:"authentication:generatingNewAPIKeyWillInvalidate",t:i}),confirmLabel:i("authentication:generate"),heading:i("authentication:confirmGeneration"),modalSlug:a,onConfirm:c})]}),e[7]=c,e[8]=a,e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function Cq(t){let{children:e}=t;return Fg("strong",{children:e})}import{c as xq}from"react/compiler-runtime";import{useEffect as wq}from"react";function Sq(t){let e=xq(4),{permissions:o}=t,{setPermissions:n}=Ie(),r,s;return e[0]!==o||e[1]!==n?(r=()=>{n(o)},s=[o,n],e[0]=o,e[1]=n,e[2]=r,e[3]=s):(r=e[2],s=e[3]),wq(r,s),null}import{jsx as co,jsxs as Nq}from"react/jsx-runtime";import{getTranslation as yc}from"@payloadcms/translations";import{validateWhereQuery as Lq}from"payload/shared";import kq,{Fragment as jq,useEffect as GP,useRef as zP,useState as $q}from"react";import{jsx as zC,jsxs as Iq}from"react/jsx-runtime";import"react";var WC="dots",Dg=({ariaLabel:t,className:e,noBackground:o,orientation:n="vertical"})=>Iq("div",{"aria-label":t,className:[e,WC,o&&`${WC}--no-background`,n&&`${WC}--${n}`].filter(Boolean).join(" "),children:[zC("div",{}),zC("div",{}),zC("div",{})]});import{jsx as Lr,jsxs as ym}from"react/jsx-runtime";import{getTranslation as RP}from"@payloadcms/translations";import{formatAdminURL as AP,transformColumnsToPreferences as PP,transformColumnsToSearchParams as EP}from"payload/shared";import{Fragment as NP,useCallback as Rg,useMemo as Dq}from"react";import{c as _q}from"react/compiler-runtime";import{jsx as bc,jsxs as Tq}from"react/jsx-runtime";import{getTranslation as Fq}from"@payloadcms/translations";import{jsx as TP}from"react/jsx-runtime";import"react";var FP=({className:t})=>TP("svg",{className:["icon","icon--people",t].filter(Boolean).join(" "),fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:TP("path",{className:"stroke",d:"M14 16C14 14.5855 13.4381 13.229 12.4379 12.2288C11.4377 11.2286 10.0812 10.6667 8.66668 10.6667M8.66668 10.6667C7.25219 10.6667 5.89563 11.2286 4.89544 12.2288C3.89525 13.229 3.33334 14.5855 3.33334 16M8.66668 10.6667C10.5076 10.6667 12 9.17428 12 7.33333C12 5.49238 10.5076 4 8.66668 4C6.82573 4 5.33334 5.49238 5.33334 7.33333C5.33334 9.17428 6.82573 10.6667 8.66668 10.6667ZM16.6667 15.3333C16.6667 13.0867 15.3333 11 14 10C14.4383 9.67118 14.7888 9.23939 15.0204 8.74285C15.252 8.2463 15.3577 7.70031 15.328 7.1532C15.2984 6.60609 15.1343 6.07472 14.8503 5.60613C14.5664 5.13754 14.1713 4.74617 13.7 4.46667",strokeLinecap:"round",strokeLinejoin:"round"})});var Ea="active-query-preset";function DP(t){let e=_q(11),{activePreset:o,openPresetListDrawer:n,resetPreset:r}=t,{i18n:s,t:i}=N(),{getEntityConfig:a}=H(),l;if(e[0]!==o||e[1]!==a||e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==i){let c=a({collectionSlug:"payload-query-presets"}),u=o&&`${Ea}--active`,d;e[7]!==u?(d=[Ea,u].filter(Boolean),e[7]=u,e[8]=d):d=e[8];let f;e[9]!==n?(f=()=>{n()},e[9]=n,e[10]=f):f=e[10],l=bc(yt,{className:d.join(" "),id:"select-preset",onClick:f,pillStyle:"light",size:"small",children:Tq("div",{className:`${Ea}__label`,children:[o?.isShared&&bc(FP,{className:`${Ea}__shared`}),bc("div",{className:`${Ea}__label-text-max-width`,children:bc("div",{className:`${Ea}__label-text`,children:o?.title||i("general:selectLabel",{label:Fq(c.labels.singular,s)})})}),o?bc("div",{className:`${Ea}__clear`,id:"clear-preset",onClick:async m=>{m.stopPropagation(),await r()},onKeyDown:async m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),await r())},role:"button",tabIndex:0,children:bc(vt,{})}):null]})}),e[0]=o,e[1]=a,e[2]=s,e[3]=n,e[4]=r,e[5]=i,e[6]=l}else l=e[6];return l}var LP="confirm-delete-preset",Na="payload-query-presets",Ag="query-preset-bar",kP=({activePreset:t,collectionSlug:e,queryPresetPermissions:o})=>{let{modified:n,query:r,refineListData:s,setModified:i}=mt(),{i18n:a,t:l}=N(),{openModal:c}=ae(),{config:{routes:{api:u}},getEntityConfig:d}=H(),f=d({collectionSlug:Na}),[m,,{openDrawer:p}]=jt({id:t?.id,collectionSlug:Na}),[h,,{closeDrawer:g,openDrawer:b}]=jt({collectionSlug:Na}),C=Dq(()=>({"payload-query-presets":{isTemp:{not_equals:!0},relatedCollection:{equals:e}}}),[e]),[y,,{closeDrawer:v,openDrawer:x}]=ca({collectionSlugs:[Na],filterOptions:C,selectedCollection:Na}),I=Rg(async D=>{await s({columns:D.columns?EP(D.columns):void 0,groupBy:D.groupBy||"",preset:D.id,where:D.where},!1)},[s]),w=Rg(async()=>{await s({columns:[],groupBy:"",preset:"",where:{}},!1)},[s]),F=Rg(async()=>{try{await fetch(AP({apiRoute:u,path:`/${Na}/${t.id}`}),{method:"DELETE"}).then(async D=>{try{let _=await D.json();D.status<400?(q.success(l("general:titleDeleted",{label:RP(f?.labels?.singular,a),title:t.title})),await w()):_.errors?_.errors.forEach(T=>q.error(T.message)):q.error(l("error:deletingTitle",{title:t.title}))}catch{q.error(l("error:deletingTitle",{title:t.title}))}})}catch{q.error(l("error:deletingTitle",{title:t.title}))}},[u,t?.id,t?.title,l,f,a,w]),S=Rg(async()=>{try{await fetch(AP({apiRoute:u,path:`/${Na}/${t.id}`}),{body:JSON.stringify({columns:PP(r.columns),groupBy:r.groupBy,where:r.where}),credentials:"include",headers:{"Content-Type":"application/json"},method:"PATCH"}).then(async D=>{try{let _=await D.json();D.status<400?(q.success(l("general:updatedLabelSuccessfully",{label:RP(f?.labels?.singular,a)})),i(!1)):_.errors?_.errors.forEach(T=>q.error(T.message)):q.error(l("error:unknown"))}catch{q.error(l("error:unknown"))}})}catch{q.error(l("error:unknown"))}},[u,t?.id,r.columns,r.groupBy,r.where,l,f?.labels?.singular,a,i]),R=t&&n;return ym(NP,{children:[ym("div",{className:Ag,children:[ym("div",{className:`${Ag}__menu`,children:[Lr(DP,{activePreset:t,openPresetListDrawer:x,resetPreset:w}),Lr(yt,{"aria-label":l("general:newLabel",{label:f?.labels?.singular}),className:`${Ag}__create-new-preset`,icon:Lr(ar,{}),id:"create-new-preset",onClick:()=>{b()},size:"small"})]}),ym("div",{className:`${Ag}__menu-items`,children:[R&&Lr(ro,{id:"reset-preset",onClick:async()=>{await s({columns:EP(t.columns),groupBy:t.groupBy||"",where:t.where},!1)},type:"button",children:l("general:reset")},"reset"),R&&o.update&&Lr(ro,{id:"save-preset",onClick:async()=>{await S()},type:"button",children:t?.isShared?l("general:updateForEveryone"):l("fields:saveChanges")},"save"),t&&o?.delete&&ym(NP,{children:[Lr(ro,{id:"delete-preset",onClick:()=>c(LP),type:"button",children:l("general:deleteLabel",{label:f?.labels?.singular})}),Lr(ro,{id:"edit-preset",onClick:()=>{p()},type:"button",children:l("general:editLabel",{label:f?.labels?.singular})})]})]})]}),Lr(h,{initialData:{columns:PP(r.columns),groupBy:r.groupBy,relatedCollection:e,where:r.where},onSave:async({doc:D})=>{g(),await I(D)},redirectAfterCreate:!1}),Lr(rt,{body:Lr(to,{elements:{1:({children:D})=>Lr("strong",{children:D})},i18nKey:"general:aboutToDelete",t:l,variables:{label:f?.labels?.singular,title:t?.title}}),confirmingLabel:l("general:deleting"),heading:l("general:confirmDeletion"),modalSlug:LP,onConfirm:F}),Lr(m,{onDelete:()=>{},onDuplicate:async({doc:D})=>{await I(D)},onSave:async({doc:D})=>{await I(D)}}),Lr(y,{allowCreate:!1,disableQueryPresets:!0,onSelect:async({doc:D})=>{v(),await I(D)}})]})};import{jsx as UC,jsxs as Aq}from"react/jsx-runtime";import{jsx as jP}from"react/jsx-runtime";import{useEffect as $P,useRef as BP,useState as Rq}from"react";var MP="search-filter";function HC(t){let{handleChange:e,initialParams:o,label:n,searchQueryParam:r}=t,s=o?.search||r,[i,a]=Rq(typeof s=="string"?s:void 0),l=BP(!0),c=BP(typeof s=="string"?s:void 0),u=Cn(i,300);return $P(()=>(s!==c.current&&(l.current=!1,a(s),c.current=s),()=>{l.current=!0,c.current=void 0}),[s]),$P(()=>{u!==c.current&&l.current&&(e&&e(u),c.current=u)},[u,e]),jP("div",{className:MP,children:jP("input",{"aria-label":n,className:`${MP}__input`,id:"search-filter-input",onChange:d=>{l.current=!0,a(d.target.value)},placeholder:n,type:"text",value:i||""})})}var OP="search-bar";function vc({Actions:t,className:e,label:o="Search...",onSearchChange:n,searchQueryParam:r}){return Aq("div",{className:[OP,e].filter(Boolean).join(" "),children:[UC(Zi,{}),UC(HC,{handleChange:n,label:o,searchQueryParam:r}),t&&t.length>0?UC("div",{className:`${OP}__actions`,children:t}):null]})}import{fieldAffectsData as Pq,flattenTopLevelFields as Eq}from"payload/shared";var VP=(t,e,o)=>{if(t){let n=Eq(e,{i18n:o,moveSubFieldsToTop:!0}),r=new Set(t),s=[];for(let i of n)Pq(i)&&r.has(i.name)&&(s.push(i),r.delete(i.name));return s}return null};var Xo="list-controls",XC=t=>{let{beforeActions:e,collectionConfig:o,collectionSlug:n,disableQueryPresets:r,enableColumns:s=!0,enableFilters:i=!0,enableSort:a=!1,listMenuItems:l,queryPreset:c,queryPresetPermissions:u,renderedFilters:d,resolvedFilterOptions:f}=t,{handleSearchChange:m,query:p}=mt(),h=Iy(o),{i18n:g,t:b}=N(),{breakpoints:{s:C}}=mr(),y=(h&&yc("label"in h&&(typeof h.label=="string"||typeof h.label=="object")?h.label:"name"in h?h.name:null,g))??"ID",v=VP(o.admin.listSearchableFields,o.fields,g),x=zP(b("general:searchBy",{label:yc(y,g)})),I=zP(!!p?.where),w=Lq(p?.where),[F,S]=$q(w?"where":void 0);return GP(()=>{I.current&&!p?.where?I.current=!1:p?.where&&(I.current=!0)},[S,p?.where]),GP(()=>{v?.length>0?x.current=v.reduce((R,D,_)=>{let T="label"in D&&D.label?D.label:"name"in D?D.name:null;return _===0?`${b("general:searchBy",{label:yc(T,g)})}`:_===v.length-1?`${R} ${b("general:or")} ${yc(T,g)}`:`${R}, ${yc(T,g)}`},""):x.current=b("general:searchBy",{label:yc(y,g)})},[b,v,g,y]),Nq("div",{className:Xo,children:[o?.enableQueryPresets&&!r&&co(kP,{activePreset:c,collectionSlug:n,queryPresetPermissions:u}),co(vc,{Actions:[!C&&co(kq.Fragment,{children:e&&e},"before-actions"),s&&co(yt,{"aria-controls":`${Xo}-columns`,"aria-expanded":F==="columns",className:`${Xo}__toggle-columns`,icon:co(He,{direction:F==="columns"?"up":"down"}),id:"toggle-list-columns",onClick:()=>S(F!=="columns"?"columns":void 0),pillStyle:"light",size:"small",children:b("general:columns")},"toggle-list-columns"),i&&co(yt,{"aria-controls":`${Xo}-where`,"aria-expanded":F==="where",className:`${Xo}__toggle-where`,icon:co(He,{direction:F==="where"?"up":"down"}),id:"toggle-list-filters",onClick:()=>S(F!=="where"?"where":void 0),pillStyle:"light",size:"small",children:b("general:filters")},"toggle-list-filters"),a&&co(yt,{"aria-controls":`${Xo}-sort`,"aria-expanded":F==="sort",className:`${Xo}__toggle-sort`,icon:co(He,{}),id:"toggle-list-sort",onClick:()=>S(F!=="sort"?"sort":void 0),pillStyle:"light",size:"small",children:b("general:sort")},"toggle-list-sort"),o.admin.groupBy&&co(yt,{"aria-controls":`${Xo}-group-by`,"aria-expanded":F==="group-by",className:`${Xo}__toggle-group-by`,icon:co(He,{direction:F==="group-by"?"up":"down"}),id:"toggle-group-by",onClick:()=>S(F!=="group-by"?"group-by":void 0),pillStyle:"light",size:"small",children:b("general:groupByLabel",{label:""})},"toggle-group-by"),l&&Array.isArray(l)&&l.length>0&&co(it,{button:co(Dg,{ariaLabel:b("general:moreOptions")}),className:`${Xo}__popup`,horizontalAlign:"right",id:"list-menu",size:"small",verticalAlign:"bottom",children:co(ve.ButtonGroup,{children:l.map((R,D)=>co(jq,{children:R},`list-menu-item-${D}`))})},"list-menu")].filter(Boolean),label:x.current,onSearchChange:m,searchQueryParam:p?.search},n),s&&co(Sr,{className:`${Xo}__columns`,height:F==="columns"?"auto":0,id:`${Xo}-columns`,children:co(kp,{collectionSlug:o.slug})}),co(Sr,{className:`${Xo}__where`,height:F==="where"?"auto":0,id:`${Xo}-where`,children:co(Zh,{collectionPluralLabel:o?.labels?.plural,collectionSlug:o.slug,fields:o?.fields,renderedFilters:d,resolvedFilterOptions:f})}),o.admin.groupBy&&co(Sr,{className:`${Xo}__group-by`,height:F==="group-by"?"auto":0,id:`${Xo}-group-by`,children:co(eg,{collectionSlug:o.slug,fields:o.fields})})]})};import{c as lQ}from"react/compiler-runtime";import{jsx as La,jsxs as cQ}from"react/jsx-runtime";import{Fragment as uQ}from"react";import{c as XP}from"react/compiler-runtime";import{jsx as ZC,jsxs as Hq}from"react/jsx-runtime";import Uq from"react";import{jsx as Bq}from"react/jsx-runtime";import{getTranslation as WP}from"@payloadcms/translations";import{useRouter as Mq,useSearchParams as Oq}from"next/navigation.js";import{combineWhereConstraints as Vq,formatAdminURL as Gq,mergeListSearchAndWhere as zq}from"payload/shared";import*as YC from"qs-esm";import Wq,{useCallback as HP}from"react";function UP(t){let{collection:e,collection:{slug:o,labels:{plural:n,singular:r}}={},drawerSlug:s,ids:i,onSuccess:a,selectAll:l,where:c}=t,{clearRouteCache:u}=ht(),{config:{routes:{api:d}}}=H(),{code:f}=ye(),m=Mq(),p=Oq(),{i18n:h,t:g}=N(),b=HP(()=>{q.error(g("error:unknown"))},[g]),C=Wq.useMemo(()=>{let v=[{_status:{not_equals:"published"}}];c&&v.push(c);let x=zq({collectionConfig:e,search:p.get("search")});return x&&v.push(x),l?v.push(Yt(p)?.where||{id:{not_equals:""}}):v.push({id:{in:i||[]}}),YC.stringify({locale:f,select:{},where:Vq(v)},{addQueryPrefix:!0})},[e,p,l,i,f,c]),y=HP(async()=>{let v=Gq({apiRoute:d,path:`/${o}${C}&draft=true`});await Ge.patch(v,{body:JSON.stringify({_status:"published"}),headers:{"Accept-Language":h.language,"Content-Type":"application/json"}}).then(async x=>{try{let I=await x.json(),w=I?.docs.length||0,F=w>1?n:r;return x.status<400||w>0?(q.success(g("general:updatedCountSuccessfully",{count:w,label:WP(F,h)})),I?.errors.length>0&&q.error(I.message,{description:I.errors.map(S=>S.message).join(`
56
56
  `)}),m.replace(YC.stringify({...Yt(p),page:l?"1":void 0},{addQueryPrefix:!0})),u(),typeof a=="function"&&a(),null):(I.errors?I.errors.forEach(S=>q.error(S.message)):b(),!1)}catch{return b()}})},[d,o,C,h,n,r,g,m,p,l,u,b,a]);return Bq(rt,{body:g("version:aboutToPublishSelection",{label:WP(n,h)}),cancelLabel:g("general:cancel"),confirmingLabel:g("version:publishing"),confirmLabel:g("general:confirm"),heading:g("version:confirmPublish"),modalSlug:s,onConfirm:y})}var Xq=t=>{let e=XP(8),{count:o,selectAll:n,selectedIDs:r,toggleAll:s}=xo(),i;e[0]!==s?(i=()=>s(),e[0]=s,e[1]=i):i=e[1];let a=n===Jt.AllAvailable,l;return e[2]!==o||e[3]!==t||e[4]!==r||e[5]!==i||e[6]!==a?(l=ZC(Cm,{...t,count:o,ids:r,onSuccess:i,selectAll:a}),e[2]=o,e[3]=t,e[4]=r,e[5]=i,e[6]=a,e[7]=l):l=e[7],l},Cm=t=>{let e=XP(12),{collection:o,collection:n,count:r,ids:s,modalPrefix:i,onSuccess:a,selectAll:l,where:c}=t,{slug:u,versions:d}=n===void 0?{}:n,{permissions:f}=Ie(),{t:m}=N(),{openModal:p}=ae(),g=f?.collections?.[u]?.update,b=`${i?`${i}-`:""}publish-${u}`;if(!d?.drafts||r===0||!g)return null;let C;if(e[0]!==o||e[1]!==b||e[2]!==s||e[3]!==a||e[4]!==p||e[5]!==l||e[6]!==m||e[7]!==c){let y;e[9]!==b||e[10]!==p?(y=()=>{p(b)},e[9]=b,e[10]=p,e[11]=y):y=e[11],C=Hq(Uq.Fragment,{children:[ZC(ro,{"aria-label":m("version:publish"),onClick:y,children:m("version:publish")}),ZC(UP,{collection:o,drawerSlug:b,ids:s,onSuccess:a,selectAll:l,where:c})]}),e[0]=o,e[1]=b,e[2]=s,e[3]=a,e[4]=p,e[5]=l,e[6]=m,e[7]=c,e[8]=C}else C=e[8];return C};import{jsx as Pg,jsxs as YP}from"react/jsx-runtime";import{getTranslation as ZP}from"@payloadcms/translations";import{useRouter as Yq,useSearchParams as Zq}from"next/navigation.js";import{formatAdminURL as Jq,mergeListSearchAndWhere as qq}from"payload/shared";import*as qC from"qs-esm";import JC from"react";var JP="confirm-restore-many-docs",qP="restore-many",QP=t=>{let{collection:{slug:e}={},viewType:o}=t,{permissions:n}=Ie(),{config:{collections:r,routes:s,serverURL:i}}=H(),{code:a}=ye(),l=Yq(),{clearRouteCache:c}=ht(),u=Zq(),{count:d,getSelectedIds:f,selectAll:m,toggleAll:p}=xo(),{openModal:h}=ae(),{i18n:g,t:b}=N(),[C,y]=JC.useState(!1),x=n?.collections?.[e]?.update;if(m===Jt.None||!x||o!=="trash")return null;let I=m===Jt.AllAvailable,w=I?[]:f(),F=Yt(u)?.where,S={and:[...Array.isArray(F?.and)?F.and:F?[F]:[],{deletedAt:{exists:!0}}]},R=async()=>{let T=r.find(B=>B.slug===e);if(!T)return;let A;I?A=S:A={and:[{id:{in:w}},{deletedAt:{exists:!0}}]};let L=Jq({apiRoute:s.api,path:`/${e}${qC.stringify({limit:0,locale:a,select:{},trash:!0,where:qq({collectionConfig:T,search:Yt(u)?.search,where:A})},{addQueryPrefix:!0})}`}),P={deletedAt:null};T?.versions?.drafts&&(P._status=C?"published":"draft");let E=await Ge.patch(L,{body:JSON.stringify(P),headers:{"Accept-Language":g.language,"Content-Type":"application/json"}});try{let{plural:B,singular:k}=T.labels,$=await E.json(),j=$?.docs?.length||0,M=j>1?B:k;(E.status<400||j>0)&&q.success(b("general:restoredCountSuccessfully",{count:j,label:ZP(M,g)})),$?.errors?.length>0&&q.error($.message,{description:$.errors.map(O=>O.message).join(`