1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6618],{41850:(e,t,n)=>{let l,a;n.r(t),n.d(t,{Account:()=>fF,ActionsProvider:()=>fB,AnimateHeight:()=>a2,AppHeader:()=>f9,ArrayField:()=>hI,AuthProvider:()=>lx,Banner:()=>tl,BlockSelector:()=>ob,BlocksDrawer:()=>oy,BlocksField:()=>o_,BrowseByFolderButton:()=>vb,BulkUploadDrawer:()=>hp,BulkUploadProvider:()=>hb,Button:()=>tD,CalendarIcon:()=>s.m,Card:()=>me,CheckIcon:()=>aK,CheckboxField:()=>a$,CheckboxInput:()=>aQ,ChevronIcon:()=>ta,ClientFunctionProvider:()=>be,CloseMenuIcon:()=>fU,CodeBlockIcon:()=>v$,CodeEdiftor:()=>i.l,CodeEditorLazy:()=>oE,CodeField:()=>oD,Collapsible:()=>a9,CollapsibleField:()=>oL,Combobox:()=>vv,ConfigProvider:()=>i.b,ConfirmPasswordField:()=>hB,ConfirmationModal:()=>lf,CopyIcon:()=>tF,CopyLocaleData:()=>ml,CopyToClipboard:()=>pK,DateCell:()=>cY,DateCondition:()=>gC,DatePicker:()=>s.n,DateTimeField:()=>sQ,DefaultBlockImage:()=>oh,DefaultBrowseByFolderView:()=>b5,DefaultCell:()=>c6,DefaultCollectionFolderView:()=>bZ,DefaultEditView:()=>yC,DefaultListView:()=>bL,DeleteMany:()=>mh,DocumentControls:()=>mY,DocumentEventsProvider:()=>uD,DocumentFields:()=>d3,DocumentIcon:()=>vx,DocumentInfoProvider:()=>aR,DocumentLocked:()=>fD,DocumentTakeOver:()=>fN,DragHandleIcon:()=>a3,Drawer:()=>lc,DrawerContentContainer:()=>pl,DrawerToggler:()=>ls,Dropzone:()=>dE,EditDepthProvider:()=>ni,EditIcon:()=>to,EditMany:()=>gt,EditUpload:()=>pV,EmailAndUsernameFields:()=>bN,EmailField:()=>sX,EntityVisibilityProvider:()=>bu,ErrorIcon:()=>v6,ErrorPill:()=>nn,ExternalLinkIcon:()=>mR,FieldContext:()=>aI,FieldDescription:()=>na,FieldDiffContainer:()=>y_,FieldDiffLabel:()=>yS,FieldError:()=>no,FieldLabel:()=>lD,FieldPathContext:()=>aF,File:()=>cG,FileDetails:()=>p$,FolderFileTable:()=>vL,FolderIcon:()=>d2,FolderProvider:()=>d5,FolderTypeField:()=>vy,Form:()=>di,FormLoadingOverlayToggle:()=>ck,FormSubmit:()=>pe,FullscreenModal:()=>gl,GearIcon:()=>v0,GenerateConfirmation:()=>ga,GridViewIcon:()=>v3,GroupByHeader:()=>vl,GroupByPageControls:()=>vd,GroupField:()=>s6,Gutter:()=>la,Hamburger:()=>fH,HiddenField:()=>s5,HydrateAuthProvider:()=>gr,InfoIcon:()=>v5,ItemCardGrid:()=>vV,JSONField:()=>ud,JoinField:()=>uu,LeaveWithoutSaving:()=>fC,LineIcon:()=>aY,Link:()=>tt,LinkIcon:()=>tr,ListControls:()=>gV,ListDrawerContextProvider:()=>s9,ListHeader:()=>vt,ListQueryProvider:()=>co,ListSelection:()=>gZ,ListViewIcon:()=>v2,LivePreviewProvider:()=>br,LivePreviewWindow:()=>yp,LoadingOverlay:()=>cC,LoadingOverlayToggle:()=>cS,LocaleProvider:()=>lk,Locked:()=>mD,LogOutIcon:()=>vp,Logout:()=>vh,MenuIcon:()=>fz,MinimizeMaximizeIcon:()=>vJ,Modal:()=>nq,MoreIcon:()=>tO,MoveDocToFolder:()=>pN,MoveDocToFolderButton:()=>pP,MoveFolderIcon:()=>v1,NavContext:()=>fG,NavGroup:()=>vm,NavProvider:()=>f$,NavToggler:()=>fJ,NullifyLocaleField:()=>aZ,NumberCondition:()=>gS,NumberField:()=>up,OperationProvider:()=>aL,OrderableTable:()=>fe,PageConfigProvider:()=>i.d,PageControls:()=>vc,PageControlsComponent:()=>vs,Pagination:()=>
1ua,ParamsProvider:()=>bh,PasswordField:()=>hV,PayloadIcon:()=>f0,PerPage:()=>vr,Pill:()=>ol,PillSelector:()=>ch,PlusIcon:()=>ti,PointField:()=>uf,Popup:()=>t_,PopupList:()=>tc,PreferencesProvider:()=>aC,PreviewButton:()=>mA,PreviewSizes:()=>p1,ProgressBar:()=>bs,PublishButton:()=>mB,PublishMany:()=>gq,QueryPresetsAccessCell:()=>fl,QueryPresetsColumnField:()=>fb,QueryPresetsColumnsCell:()=>ft,QueryPresetsGroupByCell:()=>fv,QueryPresetsGroupByField:()=>fw,QueryPresetsWhereCell:()=>fn,QueryPresetsWhereField:()=>fx,RadioGroupField:()=>ub,ReactSelect:()=>sW,RelationshipCondition:()=>gD,RelationshipField:()=>uQ,RelationshipInput:()=>uG,RelationshipProvider:()=>cB,RelationshipTable:()=>ui,RenderCustomComponent:()=>ep,RenderDefaultCell:()=>c9,RenderFields:()=>hL,RenderTitle:()=>vK,RichTextField:()=>uX,RootProvider:()=>b_,RouteCacheProvider:()=>d9,RouteTransitionProvider:()=>e5,RowField:()=>u$,RowLabel:()=>eV,RowLabelProvider:()=>eU,SaveButton:()=>mV,SaveDraftButton:()=>mH,ScrollInfoProvider:()=>bb,SearchFilter:()=>gx,SearchIcon:()=>of,SearchParamsProvider:()=>bC,SectionTitle:()=>oj,Select:()=>sW,SelectAll:()=>bP,SelectCondition:()=>gT,SelectField:()=>u0,SelectInput:()=>uZ,SelectMany:()=>bR,SelectRow:()=>bT,SelectionProvider:()=>ms,ServerFunctionsContext:()=>cr,ServerFunctionsProvider:()=>cs,SetDocumentStepNav:()=>yx,SetDocumentTitle:()=>yw,SetStepNav:()=>f6,ShimmerEffect:()=>i.f,SlugField:()=>vQ,SortColumn:()=>vG,SortHeader:()=>h6,SortRow:()=>h4,StaggeredShimmers:()=>i.g,StickyToolbar:()=>vu,SuccessIcon:()=>v4,SwapIcon:()=>ts,TabComponent:()=>dc,Table:()=>mO,TableColumnsProvider:()=>cd,TabsField:()=>
1dp,TabsProvider:()=>s0,TextCondition:()=>gA,TextField:()=>dx,TextInput:()=>dv,TextareaField:()=>dj,TextareaInput:()=>dw,ThemeProvider:()=>i.i,Thumbnail:()=>cX,TimezonePicker:()=>sY,Tooltip:()=>tN,Translation:()=>pc,TranslationProvider:()=>s.c,UIField:()=>dC,UnpublishMany:()=>gX,Upload:()=>p8,UploadEditsProvider:()=>a_,UploadField:()=>hT,UploadHandlersProvider:()=>u4,UploadInput:()=>hD,ViewDescription:()=>fT,WarningIcon:()=>v8,WatchChildErrors:()=>oR,WatchCondition:()=>az,WindowInfoProvider:()=>bx,XIcon:()=>s.a,allFieldComponents:()=>hq,defaultTheme:()=>i.h,documentDrawerBaseClass:()=>cR,fieldBaseClass:()=>aq,fieldComponents:()=>hH,fieldReducer:()=>da,formatDrawerSlug:()=>li,formatTimeToNow:()=>af,getHTMLDiffComponents:()=>m1,parseSearchParams:()=>ce,toast:()=>eJ,useActions:()=>fI,useAddClientFunction:()=>bt,useAllFormFields:()=>eI,useAuth:()=>lw,useBulkUpload:()=>hy,useBulkUploadDrawerSlug:()=>hx,useCellProps:()=>c8,useClickOutside:()=>m5,useClickOutsideContext:()=>m6,useClientFunctions:()=>bn,useCollapsible:()=>a4,useConfig:()=>i.c,useControllableState:()=>i.a,useDebounce:()=>cF,useDebouncedCallback:()=>uN,useDebouncedEffect:()=>u6,useDelay:()=>i.e,useDelayedRender:()=>cg,useDocumentDrawer:()=>cO,useDocumentDrawerContext:()=>cD,useDocumentEvents:()=>uT,useDocumentForm:()=>eD,useDocumentInfo:()=>aD,useDocumentTitle:()=>ay,useDrawerSlug:()=>lo,useEditDepth:()=>ns,useEffectEvent:()=>lv,useEntityVisibility:()=>bd,useField:()=>aB,useFieldPath:()=>aM,useFolder:()=>d4,useForm:()=>
1eP,useFormBackgroundProcessing:()=>eL,useFormFields:()=>eM,useFormInitializing:()=>eF,useFormModified:()=>eO,useFormProcessing:()=>eA,useFormSubmitted:()=>eR,useHotkey:()=>hG,useIntersect:()=>tj,useListDrawer:()=>uk,useListDrawerContext:()=>s7,useListQuery:()=>cn,useListRelationships:()=>cU,useLivePreviewContext:()=>mg,useLocale:()=>lN,useModal:()=>nE,useNav:()=>fQ,useOperation:()=>aO,useParams:()=>bf,usePayloadAPI:()=>hZ,usePreferences:()=>aS,useQueue:()=>uE,useResize:()=>hJ,useRouteCache:()=>d7,useRouteTransition:()=>e8,useRowLabel:()=>ez,useScrollInfo:()=>bg,useSearchParams:()=>bS,useSelection:()=>mc,useServerFunctions:()=>ci,useStepNav:()=>f1,useTableColumns:()=>cu,useTheme:()=>i.j,useThrottledEffect:()=>lA,useTranslation:()=>s.d,useUploadControls:()=>d_,useUploadEdits:()=>aN,useUploadHandlers:()=>u8,useUseTitleField:()=>h0,useWatchForm:()=>eT,useWindowInfo:()=>bw,withCondition:()=>aV});var o=n(976),r=n(929),i=n(39813),s=n(19270),c=n(21066),u=n(15772),d=n(54959),p=n(37529),h=n(63114),f=n(5100),m=n(87438),g=n(47397),v=n(62882),b=n(51735),y=n(9978),x=n(11735),w=n(86683),j=n(45659),C=n(93082),S=n(28815),k=n(3939),_=n(3001),N=n(36172),E=n(35817),P=n(229),D=n(56192),T=n(49758),R=n(33960),A=n(89622),L=n(84354),O=n(14761),F=n(31428),M=n(37337),I=n(5273),B=n(37235),U=n(96649),z=n(15047),V=n(76172),H=n(39879),q=n(15860);n(29498);var W=n(88755),K=n(96434),Y=n(49870),G=n(51577),Q=n(54975),X=n(63873),$=n(71578),Z=n(49313),J=n(55036),ee=n(75831).hp,et=(0,c.c)(e=>{function t(e,t){var n=e.length;for(e.push(t);0<n;){var l=n-1>>>1,o=e[l];if(0<a(o,t))e[l]=t,e[n]=o,n=l;else break}}function n(e){return 0===e.length?null:e[0]}function l(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var l=0,o=e.length,r=o>>>1;l<r;){var i=2*(l+1)-1,s=e[i],c=i+1,u=e[c];if(0>a(s,n))c<o&&0>a(u,s)?(e[l]=u,e[c]=n,l=c):(e[l]=s,e[i]=n,l=i);else if(c<o&&0>a(u,n))e[l]=u,e[c]=n,l=c;else break}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now?(s=performance,e.unstable_now=function(){return s.now()}):(u=(c=Date).now(),e.unstable_now=function(){return c.now()-u});var o,r,i,s,c,u,d=[],p=[],h=1,f=null,m=3,g=!1,v=!1,b=!1,y="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,w="u">typeof setImmediate?setImmediate:null;function j(e){for(var a=n(p);null!==a;){if(null===a.callback)l(p);else if(a.startTime<=e)l(p),a.sortIndex=a.expirationTime,t(d,a);else break;a=n(p)}}function C(e){if(b=!1,j(e),!v)if(null!==n(d))v=!0,D();else{var t=n(p);null!==t&&T(C,t.startTime-e)}}var S=!1,k=-1,_=5,N=-1;function E(){return!(e.unstable_now()-N<_)}function P(){if(S){var t=e.unstable_now();N=t;var a=!0;try{e:{v=!1,b&&(b=!1,x(k),k=-1),g=!0;var r=m;try{t:{for(j(t),f=n(d);null!==f&&!(f.expirationTime>t&&E());){var i=f.callback;if("function"==typeof i){f.callback=null,m=f.priorityLevel;var s=i(f.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof s){f.callback=s,j(t),a=!0;break t}f===n(d)&&l(d),j(t)}else l(d);f=n(d)}if(null!==f)a=!0;else{var c=n(p);null!==c&&T(C,c.startTime-t),a=!1}}break e}finally{f=null,m=r,g=!1}}}finally{a?o():S=!1}}}
1function D(){S||(S=!0,o())}function T(t,n){k=y(function(){t(e.unstable_now())},n)}"function"==typeof w?o=function(){w(P)}:"u">typeof MessageChannel?(i=(r=new MessageChannel).port2,r.port1.onmessage=P,o=function(){i.postMessage(null)}):o=function(){y(P,0)},e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){v||g||(v=!0,D())},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},e.unstable_scheduleCallback=function(l,a,o){var r=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?r+o:r,l){case 1:var i=-1;break;case 2:i=250;break;case 5:i=0x3fffffff;break;case 4:i=1e4;break;default:i=5e3}return i=o+i,l={id:h++,callback:a,priorityLevel:l,startTime:o,expirationTime:i,sortIndex:-1},o>r?(l.sortIndex=o,t(p,l),null===n(d)&&l===n(p)&&(b?(x(k),k=-1):b=!0,T(C,o-r))):(l.sortIndex=i,t(d,l),v||g||(v=!0,D())),l},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}}),en=(0,c.c)((e,t)=>{t.exports=et()}),el=(0,c.c)(e=>{var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,l=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,r=t?Symbol.for("react.profiler"):60114,i=t?Symbol.for("react.provider"):60109,s=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,p=t?Symbol.for("react.suspense"):60113,h=t?Symbol.for("react.suspense_list"):60120,f=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,b=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case c:case u:case a:case r:case o:case p:return e;default:switch(e=e&&e.$$typeof){case s:case d:case m:case f:case i:return e;default:return t}}case l:return t}}}function w(e){return x(e)===u}e.AsyncMode=c,e.ConcurrentMode=u,e.ContextConsumer=s,e.ContextProvider=i,e.Element=n,e.ForwardRef=d,e.Fragment=a,e.Lazy=m,e.Memo=f,e.Portal=l,e.Profiler=r,e.StrictMode=o,e.Suspense=p,e.isAsyncMode=function(e){return w(e)||x(e)===c},e.isConcurrentMode=w,e.isContextConsumer=function(e){return x(e)===s},e.isContextProvider=function(e){return x(e)===i},e.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},e.isForwardRef=function(e){return x(e)===d},e.isFragment=function(e){return x(e)===a},e.isLazy=function(e){return x(e)===m},e.isMemo=function(e){return x(e)===f},e.isPortal=function(e){return x(e)===l},e.isProfiler=function(e){return x(e)===r},e.isStrictMode=function(e){return x(e)===o},e.isSuspense=function(e){return x(e)===p},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===u||e===r||e===o||e===p||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===i||e.$$typeof===s||e.$$typeof===d||e.$$typeof===v||e.$$typeof===b||e.$$typeof===y||e.$$typeof===g)},e.typeOf=x}),ea=(0,c.c)((e,t)=>{t.exports=el()}),eo=(0,c.c)((e,t)=>{var n=ea(),l={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},r={};function i(e){return n.isMemo(e)?o:r[e.$$typeof]||l}r[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},r[n.Memo]=o;var s=Object.defineProperty,c=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;
1t.exports=function e(t,n,l){if("string"!=typeof n){if(h){var o=p(n);o&&o!==h&&e(t,o,l)}var r=c(n);u&&(r=r.concat(u(n)));for(var f=i(t),m=i(n),g=0;g<r.length;++g){var v=r[g];if(!a[v]&&!(l&&l[v])&&!(m&&m[v])&&!(f&&f[v])){var b=d(n,v);try{s(t,v,b)}catch(e){}}}}return t}}),er=(0,c.c)((e,t)=>{var n=Math.floor(0xffffff*Math.random()),l=d.index=parseInt(0xffffff*Math.random(),10),a=(typeof J>"u"||"number"!=typeof J.pid?Math.floor(1e5*Math.random()):J.pid)%65535,o=(()=>{try{return _Buffer}catch(e){try{return ee}catch(e){return null}}})(),r=function(e){return!!(null!=e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))},i=[];for(s=0;s<256;s++)i[s]=(s<=15?"0":"")+s.toString(16);var s,c=RegExp("^[0-9a-fA-F]{24}$"),u=[];for(s=0;s<10;)u[48+s]=s++;for(;s<16;)u[55+s]=u[87+s]=s++;function d(e){if(!(this instanceof d))return new d(e);if(e&&(e instanceof d||"ObjectID"===e._bsontype))return e;if(this._bsontype="ObjectID",null==e||"number"==typeof e){this.id=this.generate(e);return}var t=d.isValid(e);if(!t&&null!=e)throw Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(t&&"string"==typeof e&&24===e.length)return d.createFromHexString(e);if(null!=e&&12===e.length)this.id=e;else{if(null!=e&&"function"==typeof e.toHexString)return e;throw Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}}t.exports=d,d.default=d,d.createFromTime=function(e){var t,n;return new d((t=8,(8===(n=(n=e=parseInt(e,10)%0xffffffff).toString(16)).length?n:"00000000".substring(n.length,t)+n)+"0000000000000000"))},d.createFromHexString=function(e){if(typeof e>"u"||null!=e&&24!==e.length)throw Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");for(var t="",n=0;n<24;)t+=String.fromCharCode(u[e.charCodeAt(n++)]<<4|u[e.charCodeAt(n++)]);return new d(t)},d.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&c.test(e):e instanceof d||(r(e)?d.isValid(e.toString("hex")):"function"==typeof e.toHexString&&!!o&&(e.id instanceof o||"string"==typeof e.id)&&(12===e.id.length||24===e.id.length&&c.test(e.id)))))},d.prototype={constructor:d,toHexString:function(){if(!this.id||!this.id.length)throw Error("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(24===this.id.length)return this.id;if(r(this.id))return this.id.toString("hex");for(var e="",t=0;t<this.id.length;t++)e+=i[this.id.charCodeAt(t)];return e},equals:function(e){return e instanceof d?this.toString()===e.toString():"string"==typeof e&&d.isValid(e)&&12===e.length&&r(this.id)?e===this.id.toString("binary"):"string"==typeof e&&d.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&d.isValid(e)&&12===e.length?e===this.id:null!=e&&(e instanceof d||!!e.toHexString)&&e.toHexString()===this.toHexString()},getTimestamp:function(){var e,t=new Date;return e=r(this.id)?this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24:this.id.charCodeAt(3)|this.id.charCodeAt(2)<<8|this.id.charCodeAt(1)<<16|this.id.charCodeAt(0)<<24,t.setTime(1e3*Math.floor(e)),t},generate:function(e){"number"!=typeof e&&(e=~~(Date.now()/1e3)),e=parseInt(e,10)%0xffffffff;var t=l=(l+1)%0xffffff;return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e,n>>16&255,n>>8&255,255&n,a>>8&255,255&a,t>>16&255,t>>8&255,255&t)}};var p=Symbol&&Symbol.for&&Symbol.for("nodejs.util.inspect.custom")||"inspect";d.prototype[p]=function(){return"ObjectID("+this+")"},d.prototype.toJSON=d.prototype.toHexString,d.prototype.toString=d.prototype.toHexString}),ei=(0,c.c)((e,t)=>{function n(e){return void 0===e}function l(e){return e===Object(e)}function a(e){return Array.isArray(e)}function o(e,t){return t?l(e)&&!n(e.uri):l(e)&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.slice}function r(e){return!n(e)&&e}t.exports={serialize:function e(t,i,s,c){i=i||{},s=s||new FormData,i.indices=r(i.indices),i.nullsAsUndefineds=r(i.nullsAsUndefineds),i.booleansAsIntegers=r(i.booleansAsIntegers),i.allowEmptyArrays=r(i.allowEmptyArrays),i.noAttributesWithArrayNotation=r(i.noAttributesWithArrayNotation),i.noFilesWithArrayNotation=r(i.noFilesWithArrayNotation),i.dotsForObjectNotation=r(i.dotsForObjectNotation);let u="function"==typeof s.getParts;return n(t)||(null===t?i.nullsAsUndefineds||s.append(c,""):"boolean"==typeof t?i.booleansAsIntegers?s.append(c,+!!t):s.append(c,t):a(t)?t.length?t.forEach((t,n)=>{var a;let r=c+"["+(i.indices?n:"")+"]";(i.noAttributesWithArrayNotation||i.noFilesWithArrayNotation&&o(a=t,u)&&"string"==typeof a.name&&(l(a.lastModifiedDate)||"number"==typeof a.lastModified))&&(r=c),e(t,i,s,r)}):i.allowEmptyArrays&&s.append(i.noAttributesWithArrayNotation?c:c+"[]",""):t instanceof Date?s.append(c,t.toISOString()):l(t)&&!o(t,u)?Object.keys(t).forEach(n=>{let l=t[n];if(a(l))for(;n.length>2&&n.lastIndexOf("[]")===n.length-2;)n=n.substring(0,n.length-2);let o=c?i.dotsForObjectNotation?c+"."+n:c+"["+n+"]":n;e(l,i,s,o)}):s.append(c,t)),s}}}),es=(0,c.c)((e,t)=>{!function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 0xff00ff&n.rotl(e,8)|0xff00ff00&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,l=0;n<e.length;n++,l+=8)t[l>>>5]|=e[n]<<24-l%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(t){for(var n=[],l=0;l<t.length;l+=3)for(var a=t[l]<<16|t[l+1]<<8|t[l+2],o=0;o<4;o++)8*l+6*o<=8*t.length?n.push(e.charAt(a>>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],l=0,a=0;l<t.length;a=++l%4)0!=a&&n.push((e.indexOf(t.charAt(l-1))&Math.pow(2,-2*a+8)-1)<<2*a|e.indexOf(t.charAt(l))>>>6-2*a);return n}};t.exports=n}()}),ec=(0,c.c)((e,t)=>{var n={utf8:{stringToBytes:function(e){return n.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(n.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};t.exports=n}),eu=(0,c.c)((e,t)=>{function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}t.exports=function(e){var t;return null!=e&&(n(e)||"function"==typeof(t=e).readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))||!!e._isBuffer)}}),ed=(0,c.c)((e,t)=>{!function(){var e=es(),n=ec().utf8,l=eu(),a=ec().bin,o=function(t,r){t.constructor==String?t=r&&"binary"===r.encoding?a.stringToBytes(t):n.stringToBytes(t):l(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var i=e.bytesToWords(t),s=8*t.length,c=0x67452301,u=-0x10325477,d=-0x67452302,p=0x10325476,h=0;h<i.length;h++)i[h]=(i[h]<<8|i[h]>>>24)&0xff00ff|(i[h]<<24|i[h]>>>8)&0xff00ff00;i[s>>>5]|=128<<s%32,i[(s+64>>>9<<4)+14]=s;for(var f=o._ff,m=o._gg,g=o._hh,v=o._ii,h=0;h<i.length;h+=16){var b=c,y=u,x=d,w=p;c=f(c,u,d,p,i[h+0],7,-0x28955b88),p=f(p,c,u,d,i[h+1],12,-0x173848aa),d=f(d,p,c,u,i[h+2],17,0x242070db),u=f(u,d,p,c,i[h+3],22,-0x3e423112),c=f(c,u,d,p,i[h+4],7,-0xa83f051),p=f(p,c,u,d,i[h+5],12,0x4787c62a),d=f(d,p,c,u,i[h+6],17,-0x57cfb9ed),u=f(u,d,p,c,i[h+7],22,-0x2b96aff),c=f(c,u,d,p,i[h+8],7,0x698098d8),p=f(p,c,u,d,i[h+9],12,-0x74bb0851),d=f(d,p,c,u,i[h+10],17,-42063),u=f(u,d,p,c,i[h+11],22,-0x76a32842),c=f(c,u,d,p,i[h+12],7,0x6b901122),p=f(p,c,u,d,i[h+13],12,-0x2678e6d),d=f(d,p,c,u,i[h+14],17,-0x5986bc72),u=f(u,d,p,c,i[h+15],22,0x49b40821),c=m(c,u,d,p,i[h+1],5,-0x9e1da9e),p=m(p,c,u,d,i[h+6],9,-0x3fbf4cc0),d=m(d,p,c,u,i[h+11],14,0x265e5a51),u=m(u,d,p,c,i[h+0],20,-0x16493856),c=m(c,u,d,p,i[h+5],5,-0x29d0efa3),p=m(p,c,u,d,i[h+10],9,0x2441453),d=m(d,p,c,u,i[h+15],14,-0x275e197f),u=m(u,d,p,c,i[h+4],20,-0x182c0438),c=m(c,u,d,p,i[h+9],5,0x21e1cde6),p=m(p,c,u,d,i[h+14],9,-0x3cc8f82a),d=m(d,p,c,u,i[h+3],14,-0xb2af279),u=m(u,d,p,c,i[h+8],20,0x455a14ed),c=m(c,u,d,p,i[h+13],5,-0x561c16fb),p=m(p,c,u,d,i[h+2],9,-0x3105c08),d=m(d,p,c,u,i[h+7],14,0x676f02d9),u=m(u,d,p,c,i[h+12],20,-0x72d5b376),c=g(c,u,d,p,i[h+5],4,-378558),p=g(p,c,u,d,i[h+8],11,-0x788e097f),d=g(d,p,c,u,i[h+11],16,0x6d9d6122),u=g(u,d,p,c,i[h+14],23,-0x21ac7f4),c=g(c,u,d,p,i[h+1],4,-0x5b4115bc),p=g(p,c,u,d,i[h+4],11,0x4bdecfa9),d=g(d,p,c,u,i[h+7],16,-0x944b4a0),u=g(u,d,p,c,i[h+10],23,-0x41404390),c=g(c,u,d,p,i[h+13],4,0x289b7ec6),p=g(p,c,u,d,i[h+0],11,-0x155ed806),d=g(d,p,c,u,i[h+3],16,-0x2b10cf7b),u=g(u,d,p,c,i[h+6],23,0x4881d05),c=g(c,u,d,p,i[h+9],4,-0x262b2fc7),p=g(p,c,u,d,i[h+12],11,-0x1924661b),d=g(d,p,c,u,i[h+15],16,0x1fa27cf8),u=g(u,d,p,c,i[h+2],23,-0x3b53a99b),c=v(c,u,d,p,i[h+0],6,-0xbd6ddbc),p=v(p,c,u,d,i[h+7],10,0x432aff97),d=v(d,p,c,u,i[h+14],15,-0x546bdc59),u=v(u,d,p,c,i[h+5],21,-0x36c5fc7),c=v(c,u,d,p,i[h+12],6,0x655b59c3),p=v(p,c,u,d,i[h+3],10,-0x70f3336e),d=v(d,p,c,u,i[h+10],15,-1051523),u=v(u,d,p,c,i[h+1],21,-0x7a7ba22f),c=v(c,u,d,p,i[h+8],6,0x6fa87e4f),p=v(p,c,u,d,i[h+15],10,-0x1d31920),d=v(d,p,c,u,i[h+6],15,-0x5cfebcec),u=v(u,d,p,c,i[h+13],21,0x4e0811a1),c=v(c,u,d,p,i[h+4],6,-0x8ac817e),p=v(p,c,u,d,i[h+11],10,-0x42c50dcb),d=v(d,p,c,u,i[h+2],15,0x2ad7d2bb),u=v(u,d,p,c,i[h+9],21,-0x14792c6f),c=c+b>>>0,u=u+y>>>0,d=d+x>>>0,p=p+w>>>0}return e.endian([c,u,d,p])};o._ff=function(e,t,n,l,a,o,r){var i=e+(t&n|~t&l)+(a>>>0)+r;return(i<<o|i>>>32-o)+t},o._gg=function(e,t,n,l,a,o,r){var i=e+(t&l|n&~l)+(a>>>0)+r;return(i<<o|i>>>32-o)+t},o._hh=function(e,t,n,l,a,o,r){var i=e+(t^n^l)+(a>>>0)+r;return(i<<o|i>>>32-o)+t},o._ii=function(e,t,n,l,a,o,r){var i=e+(n^(t|~l))+(a>>>0)+r;return(i<<o|i>>>32-o)+t}
1,o._blocksize=16,o._digestsize=16,t.exports=function(t,n){if(null==t)throw Error("Illegal argument "+t);var l=e.wordsToBytes(o(t,n));return n&&n.asBytes?l:n&&n.asString?a.bytesToString(l):e.bytesToHex(l)}}()});function ep(e){let{CustomComponent:t,Fallback:n}=e;return void 0!==t?t:n}var eh=(0,c.e)(en(),1),ef=Symbol(),em=Symbol(),eg=typeof window>"u"||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?o.useEffect:o.useLayoutEffect,ev=eh.unstable_runWithPriority?e=>{try{(0,eh.unstable_runWithPriority)(eh.unstable_NormalPriority,e)}catch(t){if("Not implemented."===t.message)e();else throw t}}:e=>e(),eb=e=>e;function ey(e,t){let{v:{current:n},n:{current:l},l:a}=(0,o.useContext)(e)[ef],r=t(n),[i,s]=(0,o.useReducer)((e,a)=>{if(!a)return[n,r];if("p"in a)throw a.p;if(a.n===l)return Object.is(e[1],r)?e:[n,r];try{if("v"in a){if(Object.is(e[0],a.v))return e;let n=t(a.v);return Object.is(e[1],n)?e:[a.v,n]}}catch(e){}return[...e]},[n,r]);return Object.is(i[1],r)||s(),eg(()=>(a.add(s),()=>{a.delete(s)}),[a]),i[1]}var ex=(0,o.createContext)({}),ew=(0,o.createContext)({}),ej=(0,o.createContext)({}),eC=(0,o.createContext)(!1),eS=(0,o.createContext)(!1),ek=(0,o.createContext)(!1),e_=(0,o.createContext)(!1),eN=(0,o.createContext)(!1),eE=function(e){let t,n=(0,o.createContext)({[ef]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});return n[em]=n.Provider,t=n.Provider,n.Provider=e=>{let{value:n,children:l}=e,a=(0,o.useRef)(n),r=(0,o.useRef)(0),[i,s]=(0,o.useState)(null);i&&(i(n),s(null));let c=(0,o.useRef)();if(!c.current){let e=new Set;c.current={[ef]:{v:a,n:r,l:e,u:(t,n)=>{r.current+=1;let l={n:r.current};(null==n?void 0:n.suspense)&&(l.n*=-1,l.p=new Promise(e=>{s(()=>t=>{l.v=t,delete l.p,e(t)})})),e.forEach(e=>e(l)),t()}}}}return eg(()=>{a.current=n,r.current+=1,ev(()=>{c.current[ef].l.forEach(e=>{e({n:r.current,v:n})})})},[n]),(0,o.createElement)(t,{value:c.current},l)},delete n.Consumer,n}([{},()=>null]),eP=()=>(0,o.use)(ex),eD=()=>(0,o.use)(ew),eT=()=>(0,o.use)(ej),eR=()=>(0,o.use)(eC),eA=()=>(0,o.use)(eS),eL=()=>(0,o.use)(ek),eO=()=>(0,o.use)(e_),eF=()=>(0,o.use)(eN),eM=e=>ey(eE,e),eI=()=>ey(eE,eb),eB=o.createContext({data:{},path:"",rowNumber:void 0}),eU=e=>{let{children:t,path:n,rowNumber:l}=e,{getDataByPath:a,getSiblingData:r}=eT(),i=r(n),s=a(n)||i,c=o.useMemo(()=>({data:s,path:n,rowNumber:l}),[s,n,l]);return(0,u.jsx)(eB,{value:c,children:t})},ez=()=>o.use(eB),eV=e=>{let{className:t,CustomComponent:n,label:l,path:a,rowNumber:o}=e;return(0,u.jsx)(eU,{path:a,rowNumber:o,children:(0,u.jsx)(ep,{CustomComponent:n,Fallback:"string"==typeof l?(0,u.jsx)("span",{className:["row-label",t].filter(Boolean).join(" "),style:{pointerEvents:"none"},children:l}):l})})},eH=Array(12).fill(0),eq=e=>{let{visible:t,className:n}=e;return o.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":t},o.createElement("div",{className:"sonner-spinner"},eH.map((e,t)=>o.createElement("div",{className:"sonner-loading-bar",key:"spinner-bar-".concat(t)}))))},eW=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eK=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),eY=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),eG=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),eQ=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),eX=1,e$=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
1{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...l}=e,a="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:eX++,o=this.toasts.find(e=>e.id===a),r=void 0===e.dismissible||e.dismissible;return o?this.toasts=this.toasts.map(t=>t.id===a?(this.publish({...t,...e,id:a,title:n}),{...t,...e,id:a,dismissible:r,title:n}):t):this.addToast({title:n,...l,dismissible:r,id:a}),a},this.dismiss=e=>(e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{let n;if(!t)return;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let l=e instanceof Promise?e:e(),a=void 0!==n,r,i=l.then(async e=>{if(r=["resolve",e],o.isValidElement(e))a=!1,this.create({id:n,type:"default",message:e});else if(eZ(e)&&!e.ok){a=!1;let l="function"==typeof t.error?await t.error("HTTP error! status: ".concat(e.status)):t.error,o="function"==typeof t.description?await t.description("HTTP error! status: ".concat(e.status)):t.description;this.create({id:n,type:"error",message:l,description:o})}else if(void 0!==t.success){a=!1;let l="function"==typeof t.success?await t.success(e):t.success,o="function"==typeof t.description?await t.description(e):t.description;this.create({id:n,type:"success",message:l,description:o})}}).catch(async e=>{if(r=["reject",e],void 0!==t.error){a=!1;let l="function"==typeof t.error?await t.error(e):t.error,o="function"==typeof t.description?await t.description(e):t.description;this.create({id:n,type:"error",message:l,description:o})}}).finally(()=>{var e;a&&(this.dismiss(n),n=void 0),null==(e=t.finally)||e.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===r[0]?t(r[1]):e(r[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||eX++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},eZ=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,eJ=Object.assign((e,t)=>{let n=(null==t?void 0:t.id)||eX++;return e$.addToast({title:e,...t,id:n}),n},{success:e$.success,info:e$.info,warning:e$.warning,error:e$.error,custom:e$.custom,message:e$.message,promise:e$.promise,dismiss:e$.dismiss,loading:e$.loading},{getHistory:()=>e$.toasts});function e0(e){return void 0!==e.label}function e1(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}!function(e){let{insertAt:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===t&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}(':where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
1left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
1:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
1--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}\n');var e3=e=>{var t,n,l,a,r,i,s,c,u,d,p;let{invert:h,toast:f,unstyled:m,interacting:g,setHeights:v,visibleToasts:b,heights:y,index:x,toasts:w,expanded:j,removeToast:C,defaultRichColors:S,closeButton:k,style:_,cancelButtonStyle:N,actionButtonStyle:E,className:P="",descriptionClassName:D="",duration:T,position:R,gap:A,loadingIcon:L,expandByDefault:O,classNames:F,icons:M,closeButtonAriaLabel:I="Close toast",pauseWhenPageIsHidden:B}=e,[U,z]=o.useState(null),[V,H]=o.useState(null),[q,W]=o.useState(!1),[K,Y]=o.useState(!1),[G,Q]=o.useState(!1),[X,$]=o.useState(!1),[Z,J]=o.useState(!1),[ee,et]=o.useState(0),[en,el]=o.useState(0),ea=o.useRef(f.duration||T||4e3),eo=o.useRef(null),er=o.useRef(null),ei=0===x,es=x+1<=b,ec=f.type,eu=!1!==f.dismissible,ed=f.className||"",ep=f.descriptionClassName||"",eh=o.useMemo(()=>y.findIndex(e=>e.toastId===f.id)||0,[y,f.id]),ef=o.useMemo(()=>{var e;return null!=(e=f.closeButton)?e:k},[f.closeButton,k]),em=o.useMemo(()=>f.duration||T||4e3,[f.duration,T]),eg=o.useRef(0),ev=o.useRef(0),eb=o.useRef(0),ey=o.useRef(null),[ex,ew]=R.split("-"),ej=o.useMemo(()=>
1y.reduce((e,t,n)=>n>=eh?e:e+t.height,0),[y,eh]),eC=(()=>{let[e,t]=o.useState(document.hidden);return o.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),eS=f.invert||h,ek="loading"===ec;ev.current=o.useMemo(()=>eh*A+ej,[eh,ej]),o.useEffect(()=>{ea.current=em},[em]),o.useEffect(()=>{W(!0)},[]),o.useEffect(()=>{let e=er.current;if(e){let t=e.getBoundingClientRect().height;return el(t),v(e=>[{toastId:f.id,height:t,position:f.position},...e]),()=>v(e=>e.filter(e=>e.toastId!==f.id))}},[v,f.id]),o.useLayoutEffect(()=>{if(!q)return;let e=er.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,el(n),v(e=>e.find(e=>e.toastId===f.id)?e.map(e=>e.toastId===f.id?{...e,height:n}:e):[{toastId:f.id,height:n,position:f.position},...e])},[q,f.title,f.description,v,f.id]);let e_=o.useCallback(()=>{Y(!0),et(ev.current),v(e=>e.filter(e=>e.toastId!==f.id)),setTimeout(()=>{C(f)},200)},[f,C,v,ev]);return o.useEffect(()=>{let e;if((!f.promise||"loading"!==ec)&&f.duration!==1/0&&"loading"!==f.type)return j||g||B&&eC?(()=>{if(eb.current<eg.current){let e=new Date().getTime()-eg.current;ea.current=ea.current-e}eb.current=new Date().getTime()})():ea.current!==1/0&&(eg.current=new Date().getTime(),e=setTimeout(()=>{var e;null==(e=f.onAutoClose)||e.call(f,f),e_()},ea.current)),()=>clearTimeout(e)},[j,g,f,ec,B,eC,e_]),o.useEffect(()=>{f.delete&&e_()},[e_,f.delete]),o.createElement("li",{tabIndex:0,ref:er,className:e1(P,ed,null==F?void 0:F.toast,null==(t=null==f?void 0:f.classNames)?void 0:t.toast,null==F?void 0:F.default,null==F?void 0:F[ec],null==(n=null==f?void 0:f.classNames)?void 0:n[ec]),"data-sonner-toast":"","data-rich-colors":null!=(l=f.richColors)?l:S,"data-styled":!(f.jsx||f.unstyled||m),"data-mounted":q,"data-promise":!!f.promise,"data-swiped":Z,"data-removed":K,"data-visible":es,"data-y-position":ex,"data-x-position":ew,"data-index":x,"data-front":ei,"data-swiping":G,"data-dismissible":eu,"data-type":ec,"data-invert":eS,"data-swipe-out":X,"data-swipe-direction":V,"data-expanded":!!(j||O&&q),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":"".concat(K?ee:ev.current,"px"),"--initial-height":O?"auto":"".concat(en,"px"),..._,...f.style},onPointerDown:e=>{ek||!eu||(eo.current=new Date,et(ev.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(Q(!0),ey.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,l;if(X||!eu)return;ey.current=null;let a=Number((null==(e=er.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=er.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),r=new Date().getTime()-(null==(n=eo.current)?void 0:n.getTime()),i="x"===U?a:o,s=Math.abs(i)/r;if(Math.abs(i)>=20||s>.11){et(ev.current),null==(l=f.onDismiss)||l.call(f,f),H("x"===U?a>0?"right":"left":o>0?"down":"up"),e_(),$(!0),J(!1);return}Q(!1),z(null)},onPointerMove:t=>{var n,l,a,o;if(!ey.current||!eu||(null==(n=window.getSelection())?void 0:n.toString().length)>0)return;let r=t.clientY-ey.current.y,i=t.clientX-ey.current.x,s=null!=(l=e.swipeDirections)?l:function(e){let[t,n]=e.split("-"),l=[];return t&&l.push(t),n&&l.push(n),l}(R);!U&&(Math.abs(i)>1||Math.abs(r)>1)&&z(Math.abs(i)>Math.abs(r)?"x":"y");let c={x:0,y:0};"y"===U?(s.includes("top")||s.includes("bottom"))&&(s.includes("top")&&r<0||s.includes("bottom")&&r>0)&&(c.y=r):"x"===U&&(s.includes("left")||s.includes("right"))&&(s.includes("left")&&i<0||s.includes("right")&&i>0)&&(c.x=i),(Math.abs(c.x)>0||Math.abs(c.y)>0)&&J(!0),null==(a=er.current)||a.style.setProperty("--swipe-amount-x","".concat(c.x,"px")),null==(o=er.current)||o.style.setProperty("--swipe-amount-y","".concat(c.y,"px"))}},ef&&!f.jsx?o.createElement("button",{"aria-label":I,"data-disabled":ek,"data-close-button":!0,onClick:ek||!eu?()=>{}:()=>{var e;e_(),null==(e=f.onDismiss)||e.call(f,f)},className:e1(null==F?void 0:F.closeButton,null==(a=null==f?void 0:f.classNames)?void 0:a.closeButton)},null!=(r=null==M?void 0:M.close)?r:eQ):null,f.jsx||(0,o.isValidElement)(f.title)?f.jsx?f.jsx:"function"==typeof f.title?f.title():f.title:o.createElement(o.Fragment,null,ec||f.icon||f.promise?o.createElement("div",{"data-icon":"",className:e1(null==F?void 0:F.icon,null==(i=null==f?void 0:f.classNames)?void 0:i.icon)},f.promise||"loading"===f.type&&!f.icon?f.icon||function(){var e,t,n;return null!=M&&M.loading?o.createElement("div",{className:e1(null==F?void 0:F.loader,null==(e=null==f?void 0:f.classNames)?void 0:e.loader,"sonner-loader"),"data-visible":"loading"===ec},M.loading):L?o.createElement("div",{className:e1(null==F?void 0:F.loader,null==(t=null==f?void 0:f.classNames)?void 0:t.loader,"sonner-loader"),"data-visible":"loading"===ec},L):o.createElement(eq,{className:e1(null==F?void 0:F.loader,null==(n=null==f?void 0:f.classNames)?void 0:n.loader),visible:"loading"===ec})}():null,"loading"!==f.type?f.icon||(null==M?void 0:M[ec])||(e=>{switch(e){case"success":return eW;case"info":return eY;case"warning":return eK;case"error":return eG;default:return null}})(ec):null):null,o.createElement("div",{"data-content":"",className:e1(null==F?void 0:F.content,null==(s=null==f?void 0:f.classNames)?void 0:s.content)},o.createElement("div",{"data-title":"",className:e1(null==F?void 0:F.title,null==(c=null==f?void 0:f.classNames)?void 0:c.title)},"function"==typeof f.title?f.title():f.title),f.description?o.createElement("div",{"data-description":"",className:e1(D,ep,null==F?void 0:F.description,null==(u=null==f?void 0:f.classNames)?void 0:u.description)},"function"==typeof f.description?f.description():f.description):null),(0,o.isValidElement)(f.cancel)?f.cancel:f.cancel&&e0(f.cancel)?o.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||N,onClick:e=>{var t,n;e0(f.cancel)&&eu&&(null==(n=(t=f.cancel).onClick)||n.call(t,e),e_())},className:e1(null==F?void 0:F.cancelButton,null==(d=null==f?void 0:f.classNames)?void 0:d.cancelButton)},f.cancel.label):null,(0,o.isValidElement)(f.action)?f.action:f.action&&e0(f.action)?o.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||E,onClick:e=>{var t,n;e0(f.action)&&(null==(n=(t=f.action).onClick)||n.call(t,e),e.defaultPrevented||e_())},className:e1(null==F?void 0:F.actionButton,null==(p=null==f?void 0:f.classNames)?void 0:p.actionButton)},f.action.label):null))};
1function e2(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}var e6=(0,o.forwardRef)(function(e,t){let{invert:n,position:l="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:s,className:c,offset:u,mobileOffset:d,theme:p="light",richColors:h,duration:f,style:m,visibleToasts:g=3,toastOptions:v,dir:b=e2(),gap:y=14,loadingIcon:x,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:C}=e,[S,k]=o.useState([]),_=o.useMemo(()=>Array.from(new Set([l].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,l]),[N,E]=o.useState([]),[P,D]=o.useState(!1),[T,R]=o.useState(!1),[A,L]=o.useState("system"!==p?p:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),O=o.useRef(null),F=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=o.useRef(null),I=o.useRef(!1),B=o.useCallback(e=>{k(t=>{var n;return null!=(n=t.find(t=>t.id===e.id))&&n.delete||e$.dismiss(e.id),t.filter(t=>{let{id:n}=t;return n!==e.id})})},[]);return o.useEffect(()=>e$.subscribe(e=>{if(e.dismiss)return void k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t));setTimeout(()=>{r.flushSync(()=>{k(t=>{let n=t.findIndex(t=>t.id===e.id);return -1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[]),o.useEffect(()=>{if("system"!==p)return void L(p);if("system"===p&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?L("dark"):L("light")),typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",e=>{let{matches:t}=e;L(t?"dark":"light")})}catch(t){e.addListener(e=>{let{matches:t}=e;try{L(t?"dark":"light")}catch(e){console.error(e)}})}},[p]),o.useEffect(()=>{S.length<=1&&D(!1)},[S]),o.useEffect(()=>{let e=e=>{var t,n;a.every(t=>e[t]||e.code===t)&&(D(!0),null==(t=O.current)||t.focus()),"Escape"===e.code&&(document.activeElement===O.current||null!=(n=O.current)&&n.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),o.useEffect(()=>{if(O.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,I.current=!1)}},[O.current]),o.createElement("section",{ref:t,"aria-label":"".concat(j," ").concat(F),tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((t,l)=>{var a;let r,[p,j]=t.split("-");return S.length?o.createElement("ol",{key:t,dir:"auto"===b?e2():b,tabIndex:-1,ref:O,className:c,"data-sonner-toaster":!0,"data-theme":A,"data-y-position":p,"data-lifted":P&&S.length>1&&!i,"data-x-position":j,style:{"--front-toast-height":"".concat((null==(a=N[0])?void 0:a.height)||0,"px"),"--width":"".concat(356,"px"),"--gap":"".concat(y,"px"),...m,...(r={},[u,d].forEach((e,t)=>{let n=1===t,l=n?"--mobile-offset":"--offset",a=n?"16px":"32px";function o(e){["top","right","bottom","left"].forEach(t=>{r["".concat(l,"-").concat(t)]="number"==typeof e?"".concat(e,"px"):e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?r["".concat(l,"-").concat(t)]=a:r["".concat(l,"-").concat(t)]="number"==typeof e[t]?"".concat(e[t],"px"):e[t]}):o(a)}),r)},onBlur:e=>{I.current&&!e.currentTarget.contains(e.relatedTarget)&&(I.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||I.current||(I.current=!0,M.current=e.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{T||D(!1)},onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||R(!0)},onPointerUp:()=>R(!1)},S.filter(e=>!e.position&&0===l||e.position===t).map((l,a)=>{var r,c;return o.createElement(e3,{key:l.id,icons:w,index:a,toast:l,defaultRichColors:h,duration:null!=(r=null==v?void 0:v.duration)?r:f,className:null==v?void 0:v.className,descriptionClassName:null==v?void 0:v.descriptionClassName,invert:n,visibleToasts:g,closeButton:null!=(c=null==v?void 0:v.closeButton)?c:s,interacting:T,position:t,style:null==v?void 0:v.style,unstyled:null==v?void 0:v.unstyled,classNames:null==v?void 0:v.classNames,cancelButtonStyle:null==v?void 0:v.cancelButtonStyle,actionButtonStyle:null==v?void 0:v.actionButtonStyle,removeToast:B,toasts:S.filter(e=>e.position==l.position),heights:N.filter(e=>e.position==l.position),setHeights:E,expandByDefault:i,gap:y,loadingIcon:x,expanded:P,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))}),e5=e=>{let t,n=(0,f.c)(11),{children:l}=e,[a,r]=(0,o.useOptimistic)(!1),[i,s]=o.useState(0),c=(0,o.useRef)(i),d=(0,o.useRef)(null),p;n[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{d.current=setInterval(()=>
1{let e=c.current+(.93-c.current)*Math.random()*.2*Math.pow(Math.log(1+(1-c.current)*.75),.75);s(e),c.current=e},250)},n[0]=p):p=n[0];let h=p,m,g;n[1]!==a?(m=()=>{s(0),c.current=0,a?h():d.current&&clearInterval(d.current)},g=[a,h],n[1]=a,n[2]=m,n[3]=g):(m=n[2],g=n[3]),(0,o.useEffect)(m,g),n[4]!==r?(t=e=>{(0,o.startTransition)(()=>{r(!0),"function"==typeof e&&e()})},n[4]=r,n[5]=t):t=n[5];let v=t,b;return n[6]!==l||n[7]!==a||n[8]!==v||n[9]!==i?(b=(0,u.jsx)(e4,{value:{isTransitioning:a,startRouteTransition:v,transitionProgress:i},children:l}),n[6]=l,n[7]=a,n[8]=v,n[9]=i,n[10]=b):b=n[10],b},e4=o.createContext({isTransitioning:!1,startRouteTransition:()=>{},transitionProgress:0}),e8=()=>o.use(e4),e9=/https?|ftp|gopher|file/;function e7(e){return"string"!=typeof e&&("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}var te="default"in p?p.default:p,tt=e=>{let{children:t,href:n,onClick:l,preventDefault:a=!0,ref:o,replace:r,scroll:i,...s}=e,c=(0,h.useRouter)(),{startRouteTransition:d}=e8();return(0,u.jsx)(te,{href:n,onClick:e=>{(function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which})(e)||(l&&l(e),a&&e.preventDefault(),d(()=>{let e="string"==typeof n?n:function(e){var t;let n,{auth:l}=e,{hostname:a}=e,o=e.protocol||"",r=e.pathname||"",i=e.hash||"",s=e.query||"",c=!1;l=l?encodeURIComponent(l).replace(/%3A/i,":")+"@":"",e.host?c=l+e.host:a&&(c=l+(~a.indexOf(":")?"[".concat(a,"]"):a),e.port&&(c+=":"+e.port)),s&&"object"==typeof s&&(s=String((t=s,n=new URLSearchParams,Object.entries(t).forEach(e=>{let[t,l]=e;Array.isArray(l)?l.forEach(e=>n.append(t,e7(e))):n.set(t,e7(l))}),n)));let u=e.search||s&&"?".concat(s)||"";return o&&!o.endsWith(":")&&(o+=":"),e.slashes||(!o||e9.test(o))&&!1!==c?(c="//"+(c||""),r&&"/"!==r[0]&&(r="/"+r)):c||(c=""),i&&"#"!==i[0]&&(i="#"+i),u&&"?"!==u[0]&&(u="?"+u),r=r.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),"".concat(o).concat(c).concat(r).concat(u).concat(i)}(n);r?c.replace(e,{scroll:i}):c.push(e,{scroll:i})}))},ref:o,...s,children:t})},tn="banner",tl=e=>{let{type:t="default",alignIcon:n="right",children:l,className:a,icon:r,onClick:i,to:s}=e,c=[tn,"".concat(tn,"--type-").concat(t),a&&a,s&&"".concat(tn,"--has-link"),(s||i)&&"".concat(tn,"--has-action"),r&&"".concat(tn,"--has-icon"),r&&"".concat(tn,"--align-icon-").concat(n)].filter(Boolean).join(" "),d="div";return i&&!s&&(d="button"),s&&(d=tt),(0,u.jsxs)(d,{className:c,href:s||null,onClick:i,children:[r&&"left"===n&&(0,u.jsx)(o.Fragment,{children:r}),(0,u.jsx)("span",{className:"".concat(tn,"__content"),children:l}),r&&"right"===n&&(0,u.jsx)(o.Fragment,{children:r})]})},ta=e=>{let{ariaLabel:t,className:n,direction:l,size:a}=e;return(0,u.jsx)("svg",{"aria-label":t,className:["icon icon--chevron",n,a&&"icon--size-".concat(a)].filter(Boolean).join(" "),height:"100%",style:{transform:"left"===l?"rotate(90deg)":"right"===l?"rotate(-90deg)":"up"===l?"rotate(180deg)":void 0},viewBox:"0 0 20 20",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M14 8L10 12L6 8",strokeLinecap:"square"})})},to=e=>{let{className:t}=e;return(0,u.jsx)("svg",{className:[t,"icon icon--edit"].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M9.68531 4.62938H5.2634C4.92833 4.62938 4.60698 4.76248 4.37004 4.99942C4.13311 5.23635 4 5.5577 4 5.89278V14.7366C4 15.0717 4.13311 15.393 4.37004 15.63C4.60698 15.8669 4.92833 16 5.2634 16H14.1072C14.4423 16 14.7636 15.8669 15.0006 15.63C15.2375 15.393 15.3706 15.0717 15.3706 14.7366V10.3147M13.7124 4.39249C13.9637 4.14118 14.3046 4 14.66 4C15.0154 4 15.3562 4.14118 15.6075 4.39249C15.8588 4.6438 16 4.98464 16 5.34004C16 5.69544 15.8588 6.03629 15.6075 6.28759L9.91399 11.9817C9.76399 12.1316 9.57868 12.2413 9.37515 12.3008L7.56027 12.8314C7.50591 12.8472 7.44829 12.8482 7.39344 12.8341C7.33859 12.8201 7.28853 12.7915 7.24849 12.7515C7.20845 12.7115 7.17991 12.6614 7.16586 12.6066C7.15181 12.5517 7.15276 12.4941 7.16861 12.4397L7.69924 10.6249C7.75896 10.4215 7.86888 10.2364 8.01888 10.
10866L13.7124 4.39249Z",strokeLinecap:"square"})})},tr=()=>(0,u.jsx)("svg",{"aria-hidden":"true",className:"graphic link icon icon--link",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M7.99999 13.3333H6.66666C5.78261 13.3333 4.93476 12.9821 4.30964 12.357C3.68452 11.7319 3.33333 10.884 3.33333 9.99999C3.33333 9.11593 3.68452 8.26809 4.30964 7.64297C4.93476 7.01785 5.78261 6.66666 6.66666 6.66666H7.99999M12 6.66666H13.3333C14.2174 6.66666 15.0652 7.01785 15.6904 7.64297C16.3155 8.26809 16.6667 9.11593 16.6667 9.99999C16.6667 10.884 16.3155 11.7319 15.6904 12.357C15.0652 12.9821 14.2174 13.3333 13.3333 13.3333H12M7.33333 9.99999H12.6667",strokeLinecap:"square"})}),ti=()=>(0,u.jsx)("svg",{className:"icon icon--plus",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M5.33333 9.99998H14.6667M9.99999 5.33331V14.6666",strokeLinecap:"square"})}),ts=()=>(0,u.jsx)("svg",{className:"icon icon--swap",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M7.33334 4L4.66667 6.66667M4.66667 6.66667L7.33334 9.33333M4.66667 6.66667H15.3333M12.6667 16L15.3333 13.3333M15.3333 13.3333L12.6667 10.6667M15.3333 13.3333H4.66667",strokeLinecap:"square"})}),tc={};(0,c.d)(tc,{Button:()=>tf,ButtonGroup:()=>th,Divider:()=>tu,GroupLabel:()=>td});var tu=()=>(0,u.jsx)("hr",{className:"popup-divider"}),td=e=>{let{label:t}=e;return(0,u.jsx)("p",{className:"popup-list-group-label",children:t})},tp="popup-button-list",th=e=>{let{buttonSize:t="default",children:n,className:l,textAlign:a="left"}=e,o=[tp,l,"".concat(tp,"__text-align--").concat(a),"".concat(tp,"__button-size--").concat(t)].filter(Boolean).join(" ");return(0,u.jsx)("div",{className:o,children:n})},tf=e=>{let{id:t,active:n,children:l,className:a,disabled:o,href:r,onClick:i}=e,s=["".concat(tp,"__button"),o&&"".concat(tp,"__disabled"),n&&"".concat(tp,"__button--selected"),a].filter(Boolean).join(" ");if(!o){if(r)return(0,u.jsx)(tt,{className:s,href:r,id:t,onClick:e=>{i&&i(e)},prefetch:!1,children:l});if(i)return(0,u.jsx)("button",{className:s,id:t,onClick:e=>{i&&i(e)},type:"button",children:l})}return(0,u.jsx)("div",{className:s,id:t,children:l})},tm={};(0,c.d)(tm,{WindowInfo:()=>tb,WindowInfoContext:()=>tg,WindowInfoProvider:()=>tx,useWindowInfo:()=>tv,withWindowInfo:()=>tw});var tg=(0,o.createContext)({}),tv=()=>(0,o.useContext)(tg),tb=e=>{let{children:t}=e,n=tv();return t?"function"==typeof t?o.createElement(o.Fragment,null,t(n)):o.createElement(o.Fragment,null,t):null},ty=(e,t)=>{let{payload:{breakpoints:n,animationRef:l}}=t;l.current=null;let{eventsFired:a}=e,{documentElement:{style:o,clientWidth:r,clientHeight:i}}=document,{innerWidth:s,innerHeight:c}=window,u="".concat(r/100,"px"),d="".concat(i/100,"px"),p=n?Object.keys(n).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:window.matchMedia(n[t]).matches}),{}):{};return o.setProperty("--vw",u),o.setProperty("--vh",d),{width:s,height:c,"--vw":u,"--vh":d,breakpoints:p,eventsFired:a+1}},tx=e=>{let{breakpoints:t,children:n}=e,l=(0,o.useRef)(null),[a,r]=(0,o.useReducer)(ty,{width:void 0,height:void 0,"--vw":"","--vh":"",breakpoints:{},eventsFired:0}),i=(0,o.useCallback)(()=>{l.current&&cancelAnimationFrame(l.current),l.current=requestAnimationFrame(()=>r({type:"UPDATE",payload:{breakpoints:t,animationRef:l}}))},[t]),s=(0,o.useCallback)(()=>{setTimeout(()=>{i()},500)},[i]);return(0,o.useEffect)(()=>(window.addEventListener("resize",i),window.addEventListener("orientationchange",s),()=>{window.removeEventListener("resize",i),window.removeEventListener("orientationchange",s)}),[i,s]),(0,o.useEffect)(()=>{0===a.eventsFired&&r({type:"UPDATE",payload:{breakpoints:t,animationRef:l}})},[t,a]),o.createElement(tg.Provider,{value:Object.assign({},a)},n&&n)},tw=e=>t=>{let n=tv();return o.createElement(e,Object.assign({},t,{windowInfo:n}))},tj=(e,t)=>{let n,l=(0,f.c)(8),{root:a,rootMargin:r,threshold:i}=void 0===e?{}:e,[s,c]=(0,o.useState)(),[u,d]=(0,o.useState)(null),p=(0,o.useRef)("u">typeof window&&"IntersectionObserver"in window&&!t?new window.IntersectionObserver(e=>{let[t]=e;return c(t)},{root:void 0===a?null:a,rootMargin:void 0===r?"0px":r,threshold:void 0===i?0:i}):null),h,m;return l[0]!==t||l[1]!==u?(h=()=>
1{if(t)return;let{current:e}=p;return e.disconnect(),u&&e.observe(u),()=>e.disconnect()},m=[u,t],l[0]=t,l[1]=u,l[2]=h,l[3]=m):(h=l[2],m=l[3]),(0,o.useEffect)(h,m),l[4]!==s||l[5]!==u||l[6]!==d?(n=[d,s,u],l[4]=s,l[5]=u,l[6]=d,l[7]=n):n=l[7],n},tC="popup-button",tS=e=>{let t,n,l=(0,f.c)(24),{active:a,button:o,buttonType:r,className:i,disabled:s,noBackground:c,setActive:d,size:p}=e,h="".concat(tC,"--").concat(r),m=!c&&"".concat(tC,"--background"),g=p&&"".concat(tC,"--size-").concat(p),v=s&&"".concat(tC,"--disabled"),b;l[0]!==i||l[1]!==h||l[2]!==m||l[3]!==g||l[4]!==v?(b=[tC,i,h,m,g,v].filter(Boolean),l[0]=i,l[1]=h,l[2]=m,l[3]=g,l[4]=v,l[5]=b):b=l[5];let y=b.join(" "),x;l[6]!==a||l[7]!==d?(x=()=>{d(!a)},l[6]=a,l[7]=d,l[8]=x):x=l[8];let w=x;if("none"===r)return null;if("custom"===r){let e,t;return l[9]!==w?(e=e=>{"Enter"===e.key&&w()},l[9]=w,l[10]=e):e=l[10],l[11]!==o||l[12]!==y||l[13]!==w||l[14]!==e?(t=(0,u.jsx)("div",{className:y,onClick:w,onKeyDown:e,role:"button",tabIndex:0,children:o}),l[11]=o,l[12]=y,l[13]=w,l[14]=e,l[15]=t):t=l[15],t}return l[16]!==w?(t=e=>{"Enter"===e.key&&w()},l[16]=w,l[17]=t):t=l[17],l[18]!==o||l[19]!==y||l[20]!==s||l[21]!==w||l[22]!==t?(n=(0,u.jsx)("button",{className:y,disabled:s,onClick:w,onKeyDown:t,tabIndex:0,type:"button",children:o}),l[18]=o,l[19]=y,l[20]=s,l[21]=w,l[22]=t,l[23]=n):n=l[23],n},tk="popup",t_=e=>{let{id:t,boundingRef:n,button:l,buttonClassName:a,buttonSize:r,buttonType:i="default",caret:s=!0,children:c,className:d,disabled:p,forceOpen:h,horizontalAlign:f="left",initActive:m=!1,noBackground:g,onToggleClose:v,onToggleOpen:b,render:y,showOnHover:x=!1,showScrollbar:w=!1,size:j="medium",verticalAlign:C="top"}=e,{height:S,width:k}=tv(),[_,N]=tj({root:(null==n?void 0:n.current)||null,rootMargin:"-100px 0px 0px 0px",threshold:1}),E=(0,o.useRef)(null),P=(0,o.useRef)(null),[D,T]=(0,o.useState)(m),[R,A]=(0,o.useState)(C),[L,O]=(0,o.useState)(f),F=o.useCallback(e=>{e&&"function"==typeof b&&b(!0),e||"function"!=typeof v||v(),T(e)},[v,b]),M=(0,o.useCallback)(e=>{let{horizontal:t=!1,vertical:l=!1}=e;if(E.current){let{bottom:e,left:a,right:o,top:r}=E.current.getBoundingClientRect(),i=100,s=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=0;(null==n?void 0:n.current)&&({bottom:c,left:u,right:s,top:i}=n.current.getBoundingClientRect()),t&&(o>s&&a>u?O("right"):a<u&&o<s&&O("left")),l&&(r<i&&e<c?A("bottom"):e>c&&r>i&&A("top"))}},[n]),I=(0,o.useCallback)(e=>{E.current.contains(e.target)||P.current.contains(e.target)||F(!1)},[E,F]);(0,o.useEffect)(()=>{M({horizontal:!0})},[N,M,k]),(0,o.useEffect)(()=>{M({vertical:!0})},[N,M,S]),(0,o.useEffect)(()=>(D?document.addEventListener("mousedown",I):document.removeEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}),[D,I,b]),(0,o.useEffect)(()=>{F(h)},[h,F]);let B=[tk,d,"".concat(tk,"--size-").concat(j),r&&"".concat(tk,"--button-size-").concat(r),"".concat(tk,"--v-align-").concat(R),"".concat(tk,"--h-align-").concat(L),D&&"".concat(tk,"--active"),w&&"".concat(tk,"--show-scrollbar")].filter(Boolean).join(" ");return(0,u.jsxs)("div",{className:B,id:t,children:[(0,u.jsx)("div",{className:"".concat(tk,"__trigger-wrap"),ref:P,children:x?(0,u.jsx)("div",{className:"".concat(tk,"__on-hover-watch"),onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),role:"button",tabIndex:0,children:(0,u.jsx)(tS,{active:D,button:l,buttonType:i,className:a,disabled:p,noBackground:g,setActive:F,size:r})}):(0,u.jsx)(tS,{active:D,button:l,buttonType:i,className:a,disabled:p,noBackground:g,setActive:F,size:r})}),(0,u.jsxs)("div",{className:"".concat(tk,"__content"),ref:E,children:[(0,u.jsx)("div",{className:"".concat(tk,"__hide-scrollbar"),ref:_,children:(0,u.jsx)("div",{className:"".concat(tk,"__scroll-container"),children:(0,u.jsxs)("div",{className:"".concat(tk,"__scroll-content"),children:[y&&y({close:()=>F(!1)}),c]})})}),s&&(0,u.jsx)("div",{className:"".concat(tk,"__caret")})]})]})},tN=e=>{let{alignCaret:t="center",boundingRef:n,children:l,className:a,delay:r=350,position:i,show:s=!0,staticPositioning:c=!1}=e,[d,p]=o.useState(s),[h,f]=o.useState("top"),[m,g]=tj({root:(null==n?void 0:n.current)||null,rootMargin:"-145
1px 0px 0px 100px",threshold:0},c);return(0,o.useEffect)(()=>{let e;return r&&s?e=setTimeout(()=>{p(s)},r):p(s),()=>{e&&clearTimeout(e)}},[s,r]),(0,o.useEffect)(()=>{c||f((null==g?void 0:g.isIntersecting)?"top":"bottom")},[g,c]),(0,u.jsxs)(o.Fragment,{children:[!c&&(0,u.jsx)("aside",{"aria-hidden":"true",className:["tooltip",a,"tooltip--caret-".concat(t),"tooltip--position-top"].filter(Boolean).join(" "),ref:m,style:{opacity:"0"},children:(0,u.jsx)("div",{className:"tooltip-content",children:l})}),(0,u.jsx)("aside",{className:["tooltip",a,d&&"tooltip--show","tooltip--caret-".concat(t),"tooltip--position-".concat(i||h)].filter(Boolean).join(" "),title:(e=>"string"==typeof e?e:"")(l),children:(0,u.jsx)("div",{className:"tooltip-content",children:l})})]})},tE={chevron:ta,edit:to,link:tr,plus:ti,swap:ts,x:s.a},tP=e=>{let{children:t,icon:n,showTooltip:l,tooltip:a}=e,r=tE[n];return(0,u.jsxs)(o.Fragment,{children:[a&&(0,u.jsx)(tN,{className:"".concat("btn","__tooltip"),show:l,children:a}),(0,u.jsxs)("span",{className:"".concat("btn","__content"),children:[t&&(0,u.jsx)("span",{className:"".concat("btn","__label"),children:t}),n&&(0,u.jsxs)("span",{className:"".concat("btn","__icon"),children:[(0,o.isValidElement)(n)&&n,r&&(0,u.jsx)(r,{})]})]})]})},tD=e=>{let{id:t,type:n="button","aria-label":l,buttonStyle:a="primary",children:r,className:i,disabled:s,el:c="button",enableSubMenu:d,extraButtonProps:p={},icon:h,iconPosition:f="right",iconStyle:m="without-border",margin:g=!0,newTab:v,onClick:b,onMouseDown:y,ref:x,round:w,size:j="medium",SubMenuPopupContent:C,to:S,tooltip:k,url:_}=e,[N,E]=o.useState(!1),P=["btn",i&&i,h&&"".concat("btn","--icon"),m&&"".concat("btn","--icon-style-").concat(m),h&&!r&&"".concat("btn","--icon-only"),j&&"".concat("btn","--size-").concat(j),h&&f&&"".concat("btn","--icon-position-").concat(f),k&&"".concat("btn","--has-tooltip"),!C&&"".concat("btn","--withoutPopup"),!g&&"".concat("btn","--no-margin")].filter(Boolean).join(" "),D=[a&&"".concat("btn","--style-").concat(a),s&&"".concat("btn","--disabled"),w&&"".concat("btn","--round"),C?"".concat("btn","--withPopup"):"".concat("btn","--withoutPopup")].filter(Boolean).join(" "),T={id:t,type:n,"aria-disabled":s,"aria-label":l,className:C?P:[P,D].join(" "),disabled:s,onClick:s?void 0:function(e){E(!1),"submit"!==n&&b&&e.preventDefault(),b&&b(e)},onMouseDown:s?void 0:y,onPointerEnter:k?()=>E(!0):void 0,onPointerLeave:k?()=>E(!1):void 0,rel:v?"noopener noreferrer":void 0,target:v?"_blank":void 0,title:l,...p},R;switch(c){case"anchor":R=(0,u.jsx)("a",{...T,href:s?void 0:_,ref:x,children:(0,u.jsx)(tP,{icon:h,showTooltip:N,tooltip:k,children:r})});break;case"link":s&&(R=(0,u.jsx)("div",{...T,children:(0,u.jsx)(tP,{icon:h,showTooltip:N,tooltip:k,children:r})})),R=(0,u.jsx)(tt,{...T,href:S||_,prefetch:!1,children:(0,u.jsx)(tP,{icon:h,showTooltip:N,tooltip:k,children:r})});break;default:R=(0,u.jsx)(c,{ref:x,...T,children:(0,u.jsx)(tP,{icon:h,showTooltip:N,tooltip:k,children:r})})}return C?(0,u.jsxs)("div",{className:D,children:[R,(0,u.jsx)(t_,{button:(0,u.jsx)(ta,{}),buttonSize:j,className:s&&!d?"".concat("btn","--popup-disabled"):"",disabled:s&&!d,horizontalAlign:"right",id:"".concat(t,"-popup"),noBackground:!0,render:e=>{let{close:t}=e;return C({close:()=>t()})},size:"large",verticalAlign:"bottom"})]}):R};function tT(e){let{fieldsFromClipboard:t,fieldsFromConfig:n}=e;return!!n&&t.length===(null==n?void 0:n.length)&&t.every((e,t)=>{let l=n[t];if(e.type!==l.type||(0,m.Z7)(e)&&(0,m.Z7)(l)&&e.name!==l.name)return!1;let a=(0,m.sd)(l),o=(0,m.sd)(e);return o===a&&(!o||!a||tT({fieldsFromClipboard:e.fields,fieldsFromConfig:l.fields}))})}var tR="_payloadClipboard";function tA(e){let{getDataToCopy:t,t:n,...l}=e,a={data:t(),...l};try{return localStorage.setItem(tR,JSON.stringify(a)),!0}catch(e){return n("error:unableToCopy")}}function tL(e){let t,{onPaste:n,path:l,t:a,...o}=e;try{let e=localStorage.getItem(tR);if(!e)return a("error:invalidClipboardData");t=JSON.parse(e)}catch(e){return a("error:invalidClipboardData")}return!function(e){let{data:t,path:n,...l}=e;return!(typeof t>"u")&&!!n&&!!l.type&&("blocks"===l.type?function(e){let{blocksFromClipboard:t,blocksFromConfig:n}=e,l=new Map(null==n?void 0:n.map(e=>[e.slug,e]));if(!l.size)return!1;let a=new Set;for(let e of t){let t=e.slug;if(!a.has(t)){let n=l.get(t);if(!n||!tT({fieldsFromClipboard:e.fields,fieldsFromConfig:n.fields}))return!1;a.add(t)}}return!0}({blocksFromClipboard:l.blocks,blocksFromConfig:l.schemaBlocks}):tT({fieldsFromClipboard:l.fields,fieldsFromConfig:l.schemaFields}))}({...t,...o,fieldPath:l})?a("error:invalidClipboardData"):(n(t),!0)}var tO=e=>{let{className:t}=e;
1return(0,u.jsxs)("svg",{className:["icon icon--more",t].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{className:"fill",d:"M10 10.6666C10.3682 10.6666 10.6667 10.3682 10.6667 9.99998C10.6667 9.63179 10.3682 9.33331 10 9.33331C9.63182 9.33331 9.33334 9.63179 9.33334 9.99998C9.33334 10.3682 9.63182 10.6666 10 10.6666Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M14.6667 10.6666C15.0349 10.6666 15.3333 10.3682 15.3333 9.99998C15.3333 9.63179 15.0349 9.33331 14.6667 9.33331C14.2985 9.33331 14 9.63179 14 9.99998C14 10.3682 14.2985 10.6666 14.6667 10.6666Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M5.33334 10.6666C5.70153 10.6666 6.00001 10.3682 6.00001 9.99998C6.00001 9.63179 5.70153 9.33331 5.33334 9.33331C4.96515 9.33331 4.66667 9.63179 4.66667 9.99998C4.66667 10.3682 4.96515 10.6666 5.33334 10.6666Z",strokeLinecap:"square"})]})},tF=()=>(0,u.jsx)("svg",{className:"icon icon--copy",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M4.66666 12.6667C3.93333 12.6667 3.33333 12.0667 3.33333 11.3333V4.66668C3.33333 3.93334 3.93333 3.33334 4.66666 3.33334H11.3333C12.0667 3.33334 12.6667 3.93334 12.6667 4.66668M8.66666 7.33334H15.3333C16.0697 7.33334 16.6667 7.9303 16.6667 8.66668V15.3333C16.6667 16.0697 16.0697 16.6667 15.3333 16.6667H8.66666C7.93028 16.6667 7.33333 16.0697 7.33333 15.3333V8.66668C7.33333 7.9303 7.93028 7.33334 8.66666 7.33334Z",strokeLinecap:"square"})}),tM=e=>{let t=(0,f.c)(4),{isPaste:n,isRow:l}=e,{t:a}=(0,s.d)(),r;if(t[0]!==n||t[1]!==l||t[2]!==a){let e=a("general:copyField");!l&&n?e=a("general:pasteField"):l&&!n?e=a("general:copyRow"):l&&n&&(e=a("general:pasteRow")),r=(0,u.jsxs)(o.Fragment,{children:[n?(0,u.jsx)(to,{}):(0,u.jsx)(tF,{})," ",e]}),t[0]=n,t[1]=l,t[2]=a,t[3]=r}else r=t[3];return r},tI=e=>{let{allowCopy:t,allowPaste:n,className:l,copyClassName:a,disabled:r,isRow:i,onPaste:c,pasteClassName:d,path:p,...h}=e,{t:f}=(0,s.d)(),m=["".concat("clipboard-action","__popup"),l].filter(Boolean).join(" "),g=(0,o.useCallback)(()=>{let e=tA({path:p,t:f,...h});"string"==typeof e?eJ.error(e):eJ.success(f("general:copied"))},[f,h,p]),v=(0,o.useCallback)(()=>{let e=tL("array"===h.type?{onPaste:c,path:p,schemaFields:h.fields,t:f}:{onPaste:c,path:p,schemaBlocks:h.blocks,t:f});"string"==typeof e&&eJ.error(e)},[c,h,p,f]);return n||t?(0,u.jsx)(t_,{button:(0,u.jsx)(tO,{}),className:m,disabled:r,horizontalAlign:"center",render:e=>{let{close:l}=e;return(0,u.jsxs)(tc.ButtonGroup,{children:[(0,u.jsx)(tc.Button,{className:a,disabled:!t,onClick:()=>{g(),l()},children:(0,u.jsx)(tM,{isRow:i})}),(0,u.jsx)(tc.Button,{className:d,disabled:!n,onClick:()=>{v(),l()},children:(0,u.jsx)(tM,{isPaste:!0,isRow:i})})]})},size:"large",verticalAlign:"bottom"}):null};function tB(e){let{formState:t,path:n,rowIndex:l}=e,a={},o="number"!=typeof l?n:"".concat(n,".").concat(l);for(let e in t){if(!e.startsWith(o))continue;let{customComponents:n,validate:l,...r}=t[e];Array.isArray(r.rows)&&(r.rows=r.rows.map(e=>{if(!e||"object"!=typeof e)return e;let{customComponents:t,...n}=e;return n})),a[e]=r}return a}function tU(e){var t,n,l;let a,{dataFromClipboard:o,formState:r,path:i,rowIndex:s}=e,{type:c,data:u,path:d,rowIndex:p}=o,h="number"!=typeof p,f="number"!=typeof s,m=!h&&f,g="array"===c,v;if(v=h&&f?d:h?"".concat(d,".").concat(s):"".concat(d,".").concat(p),a=f?m?"".concat(i,".0"):i:"".concat(i,".").concat(s),m){let e="".concat(i,".0"),n=u["".concat(v,".id")].value,l=null==(t=r[i].rows)?void 0:t.length;for(let t in r[i].rows=[{...l&&g?r[i].rows[0]:{},id:n,isLoading:!1,lastRenderedPath:e}],r[i].value=1,r[i].initialValue=1,r[i].disableFormData=!0,r)t!==i&&!t.startsWith(e)&&t.startsWith(i)&&delete r[t]}for(let e in u){if(!f&&e.endsWith(".id")||!e.startsWith(v))continue;let t=e.replace(v,a),o=g?null==(n=r[t])?void 0:n.customComponents:void 0,i=g?null==(l=r[t])?void 0:l.validate:void 0;r[t]={customComponents:o,validate:i,...u[e]}}return r}function tz(e){var t,n;let l;return e?"[object Window]"===(l=Object.prototype.toString.call(e))||"[object global]"===l?e:"nodeType"in e&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}var tV="u">typeof window&&"u">typeof window.document&&"u">typeof window.document.createElement?o.useLayoutEffect:o.useEffect,tH={},tq=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return n.reduce((e,t)=>
1{for(let[n,l]of Object.entries(t)){let t=e[n];null!=t&&(e[n]=t+-1*l)}return e},{...e})},tW=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[tW.Translate.toString(e),tW.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:l}=e;return t+" "+n+"ms "+l}}});function tK(e,t,n){let l=e.slice();return l.splice(n<0?l.length+n:n,0,l.splice(t,1)[0]),l}function tY(e){return null!==e&&e>=0}var tG=e=>{let{rects:t,activeIndex:n,overIndex:l,index:a}=e,o=tK(t,l,n),r=t[a],i=o[a];return i&&r?{x:i.left-r.left,y:i.top-r.top,scaleX:i.width/r.width,scaleY:i.height/r.height}:null},tQ="Sortable",tX=o.createContext({activeIndex:-1,containerId:tQ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tG,disabled:{draggable:!1,droppable:!1}});function t$(e){let{children:t,id:n,items:l,strategy:a=tG,disabled:r=!1}=e,{active:i,dragOverlay:s,droppableRects:c,over:u,measureDroppableContainers:d}=(0,g.fF)(),p=(0,o.useMemo)(()=>{if(n)return n;let e=null==tH[tQ]?0:tH[tQ]+1;return tH[tQ]=e,tQ+"-"+e},[tQ,n]),h=null!==s.rect,f=(0,o.useMemo)(()=>l.map(e=>"object"==typeof e&&"id"in e?e.id:e),[l]),m=null!=i,v=i?f.indexOf(i.id):-1,b=u?f.indexOf(u.id):-1,y=(0,o.useRef)(f),x=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(f,y.current),w=-1!==b&&-1===v||x,j="boolean"==typeof r?{draggable:r,droppable:r}:r;tV(()=>{x&&m&&d(f)},[x,f,m,d]),(0,o.useEffect)(()=>{y.current=f},[f]);let C=(0,o.useMemo)(()=>({activeIndex:v,containerId:p,disabled:j,disableTransforms:w,items:f,overIndex:b,useDragOverlay:h,sortedRects:f.reduce((e,t,n)=>{let l=c.get(t);return l&&(e[n]=l),e},Array(f.length)),strategy:a}),[v,p,j.draggable,j.droppable,w,f,b,c,h,a]);return o.createElement(tX.Provider,{value:C},t)}var tZ=e=>{let{id:t,items:n,activeIndex:l,overIndex:a}=e;return tK(n,l,a).indexOf(t)},tJ=e=>{let{containerId:t,isSorting:n,wasDragging:l,index:a,items:o,newIndex:r,previousItems:i,previousContainerId:s,transition:c}=e;return!!c&&!!l&&(i===o||a!==r)&&(!!n||r!==a&&t===s)},t0={duration:200,easing:"ease"},t1="transform",t3=tW.Transition.toString({property:t1,duration:0,easing:"linear"}),t2={roleDescription:"sortable"};function t6(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var t5=[g.vL.Down,g.vL.Right,g.vL.Up,g.vL.Left],t4=(e,t)=>{let{context:{active:n,collisionRect:l,droppableRects:a,droppableContainers:o,over:r,scrollableAncestors:i}}=t;if(t5.includes(e.code)){if(e.preventDefault(),!n||!l)return;let t=[];o.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;let o=a.get(n.id);
1if(o)switch(e.code){case g.vL.Down:l.top<o.top&&t.push(n);break;case g.vL.Up:l.top>o.top&&t.push(n);break;case g.vL.Left:l.left>o.left&&t.push(n);break;case g.vL.Right:l.left<o.left&&t.push(n)}});let s=(0,g.y$)({active:n,collisionRect:l,droppableRects:a,droppableContainers:t,pointerCoordinates:null}),c=(0,g.Vy)(s,"id");if(c===(null==r?void 0:r.id)&&s.length>1&&(c=s[1].id),null!=c){let e=o.get(n.id),t=o.get(c),r=t?a.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&r&&e&&t){let n=(0,g.sl)(s).some((e,t)=>i[t]!==e),a=t8(e,t),o=function(e,t){return!!t6(e)&&!!t6(t)&&!!t8(e,t)&&e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!a?{x:0,y:0}:{x:o?l.width-r.width:0,y:o?l.height-r.height:0},u={x:r.left,y:r.top};return c.x&&c.y?u:tq(u,c)}}}};function t8(e,t){return!!t6(e)&&!!t6(t)&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var t9=e=>{let t,n,l=(0,f.c)(17),{id:a,disabled:r}=e,i;l[0]===Symbol.for("react.memo_cache_sentinel")?(i={duration:250,easing:"cubic-bezier(0, 0.2, 0.2, 1)"},l[0]=i):i=l[0],l[1]!==r||l[2]!==a?(t={id:a,disabled:r,transition:i},l[1]=r,l[2]=a,l[3]=t):t=l[3];let{attributes:s,isDragging:c,listeners:u,setNodeRef:d,transform:p,transition:h}=function(e){var t,n,l,a;let{animateLayoutChanges:r=tJ,attributes:i,disabled:s,data:c,getNewIndex:u=tZ,id:d,strategy:p,resizeObserverConfig:h,transition:f=t0}=e,{items:m,containerId:v,activeIndex:b,disabled:y,disableTransforms:x,sortedRects:w,overIndex:j,useDragOverlay:C,strategy:S}=(0,o.useContext)(tX),k=(t=s,n=y,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(l=null==t?void 0:t.draggable)?l:n.draggable,droppable:null!=(a=null==t?void 0:t.droppable)?a:n.droppable}),_=m.indexOf(d),N=(0,o.useMemo)(()=>({sortable:{containerId:v,index:_,items:m},...c}),[v,c,_,m]),E=(0,o.useMemo)(()=>m.slice(m.indexOf(d)),[m,d]),{rect:P,node:D,isOver:T,setNodeRef:R}=(0,g.zM)({id:d,data:N,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...h}}),{active:A,activatorEvent:L,activeNodeRect:O,attributes:F,setNodeRef:M,listeners:I,isDragging:B,over:U,setActivatorNodeRef:z,transform:V}=(0,g.PM)({id:d,data:N,attributes:{...t2,...i},disabled:k.draggable}),H=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.useMemo)(()=>e=>{t.forEach(t=>t(e))},t)}(R,M),q=!!A,W=q&&!x&&tY(b)&&tY(j),K=!C&&B,Y=K&&W?V:null,G=W?null!=Y?Y:(null!=p?p:S)({rects:w,activeNodeRect:O,activeIndex:b,overIndex:j,index:_}):null,Q=tY(b)&&tY(j)?u({id:d,items:m,activeIndex:b,overIndex:j}):_,X=null==A?void 0:A.id,$=(0,o.useRef)({activeId:X,items:m,newIndex:Q,containerId:v}),Z=m!==$.current.items,J=r({active:A,containerId:v,isDragging:B,isSorting:q,id:d,index:_,items:m,newIndex:$.current.newIndex,previousItems:$.current.items,previousContainerId:$.current.containerId,transition:f,wasDragging:null!=$.current.activeId}),ee=function(e){let{disabled:t,index:n,node:l,rect:a}=e,[r,i]=(0,o.useState)(null),s=(0,o.useRef)(n);return tV(()=>{if(!t&&n!==s.current&&l.current){let e=a.current;if(e){let t=(0,g.Sj)(l.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&i(n)}}n!==s.current&&(s.current=n)},[t,n,l,a]),(0,o.useEffect)(()=>{r&&i(null)},[r]),r}({disabled:!J,index:_,node:D,rect:P});return(0,o.useEffect)(()=>{q&&$.current.newIndex!==Q&&($.current.newIndex=Q),v!==$.current.containerId&&($.current.containerId=v),m!==$.current.items&&($.current.items=m)},[q,Q,v,m]),(0,o.useEffect)(()=>{if(X===$.current.activeId)return;if(X&&!$.current.activeId){$.current.activeId=X;return}let e=setTimeout(()=>{$.current.activeId=X},50);return()=>clearTimeout(e)},[X]),{active:A,activeIndex:b,attributes:F,data:N,rect:P,index:_,newIndex:Q,items:m,isOver:T,isSorting:q,isDragging:B,listeners:I,node:D,overIndex:j,over:U,setNodeRef:H,setActivatorNodeRef:z,setDroppableNodeRef:R,setDraggableNodeRef:M,transform:null!=ee?ee:G,transition:ee||Z&&$.current.newIndex===_?t3:!(K&&!function(e){if(!e)return!1;let{KeyboardEvent:t}=tz(e.target);return t&&e instanceof t}(L)||!f)&&(q||J)?tW.Transition.toString({...f,property:t1}):void 0}}(t),m=c?"grabbing":"grab",v;l[4]!==m||l[5]!==h?(v={cursor:m,transition:h},l[4]=m,l[5]=h,l[6]=v):v=l[6],l[7]!==s||l[8]!==v?(n={...s,style:v},l[7]=s,l[8]=v,l[9]=n):n=l[9];let b=p&&"translate3d(".concat(p.x,"px, ").concat(p.y,"px, 0)"),y;return l[10]!==c||l[11]!==u||l[12]!==d||l[13]!==n||l[14]!==b||l[15]!==h?(y={attributes:n,isDragging:c,listeners:u,setN
1odeRef:d,transform:b,transition:h},l[10]=c,l[11]=u,l[12]=d,l[13]=n,l[14]=b,l[15]=h,l[16]=y):y=l[16],y},t7=e=>{let t=(0,f.c)(12),{id:n,children:l,disabled:a}=e,r;t[0]!==a||t[1]!==n?(r={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=r):r=t[2];let{attributes:i,isDragging:s,listeners:c,setNodeRef:d,transform:p,transition:h}=t9(r),m=s?"grabbing":"grab",g;return t[3]!==i||t[4]!==l||t[5]!==s||t[6]!==c||t[7]!==d||t[8]!==m||t[9]!==p||t[10]!==h?(g=(0,u.jsx)(o.Fragment,{children:l({attributes:{...i,style:{cursor:m}},isDragging:s,listeners:c,setNodeRef:d,transform:p,transition:h})}),t[3]=i,t[4]=l,t[5]=s,t[6]=c,t[7]=d,t[8]=m,t[9]=p,t[10]=h,t[11]=g):g=t[11],g},ne=e=>{let t,n=(0,f.c)(18),{children:l,className:a,ids:r,onDragEnd:i,onDragStart:s}=e,c=(0,o.useId)(),d;n[0]!==c?(d={id:c},n[0]=c,n[1]=d):d=n[1];let{setNodeRef:p}=(0,g.zM)(d),h;n[2]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:5}},n[2]=h):h=n[2],n[3]===Symbol.for("react.memo_cache_sentinel")?(t={coordinateGetter:t4},n[3]=t):t=n[3];let m=(0,g.FR)((0,g.MS)(g.AN,h),(0,g.MS)(g.uN,t)),v;n[4]!==r||n[5]!==i?(v=e=>{let{active:t,over:n}=e;e.activatorEvent.stopPropagation(),t&&n&&"function"==typeof i&&i({event:e,moveFromIndex:r.findIndex(e=>e===t.id),moveToIndex:r.findIndex(e=>e===n.id)})},n[4]=r,n[5]=i,n[6]=v):v=n[6];let b=v,y;n[7]!==s?(y=e=>{let{active:t}=e;t&&"function"==typeof s&&s({id:t.id,event:e})},n[7]=s,n[8]=y):y=n[8];let x=y,w;return n[9]!==l||n[10]!==a||n[11]!==b||n[12]!==x||n[13]!==c||n[14]!==r||n[15]!==m||n[16]!==p?(w=(0,u.jsx)(g.Mp,{collisionDetection:g.fp,id:c,onDragEnd:b,onDragStart:x,sensors:m,children:(0,u.jsx)(t$,{items:r,children:(0,u.jsx)("div",{className:a,ref:p,children:l})})}),n[9]=l,n[10]=a,n[11]=b,n[12]=x,n[13]=c,n[14]=r,n[15]=m,n[16]=p,n[17]=w):w=n[17],w},nt="error-pill",nn=e=>{let{className:t,count:n,i18n:l,withMessage:a}=e,o=[nt,!a&&n<99&&"".concat(nt,"--fixed-width"),t&&t].filter(Boolean).join(" ");return 0===n?null:(0,u.jsx)("div",{className:o,children:(0,u.jsxs)("div",{className:"".concat(nt,"__content"),children:[(0,u.jsx)("span",{className:"".concat(nt,"__count"),children:n}),a&&" ".concat(n>1?l.t("general:errors"):l.t("general:error"))]})})},nl="field-description",na=e=>{let t=(0,f.c)(8),{className:n,description:l,marginPlacement:a,path:o}=e,{i18n:r}=(0,s.d)();if(l){let e="field-description-".concat(null==o?void 0:o.replace(/\./g,"__")),i=a&&"".concat(nl,"--margin-").concat(a),s;t[0]!==n||t[1]!==e||t[2]!==i?(s=[nl,n,e,i].filter(Boolean),t[0]=n,t[1]=e,t[2]=i,t[3]=s):s=t[3];let c=s.join(" "),p;return t[4]!==l||t[5]!==r||t[6]!==c?(p=(0,u.jsx)("div",{className:c,children:(0,d.s)(l,r)}),t[4]=l,t[5]=r,t[6]=c,t[7]=p):p=t[7],p}return null},no=e=>{let t=(0,f.c)(8),{alignCaret:n,message:l,path:a,showError:o}=e,r=void 0===n?"right":n,i=eR(),s;t[0]!==a?(s=e=>{let[t]=e;return t&&(null==t?void 0:t[a])||null},t[0]=a,t[1]=s):s=t[1];let c=eM(s),d;if(t[2]!==r||t[3]!==c||t[4]!==i||t[5]!==l||t[6]!==o){d=Symbol.for("react.early_return_sentinel");e:{let{errorMessage:e,valid:t}=c||{},n=l||e;if((o||i&&!1===t)&&(null==n?void 0:n.length)){d=(0,u.jsx)(tN,{alignCaret:r,className:"field-error",delay:0,staticPositioning:!0,children:n});break e}}t[2]=r,t[3]=c,t[4]=i,t[5]=l,t[6]=o,t[7]=d}else d=t[7];return d!==Symbol.for("react.early_return_sentinel")?d:null},nr=(0,o.createContext)(0),ni=e=>{let t=(0,f.c)(3),{children:n}=e,l=ns()+1,a;return t[0]!==n||t[1]!==l?(a=(0,u.jsx)(nr,{value:l,children:n}),t[0]=n,t[1]=l,t[2]=a):a=t[2],a},ns=()=>(0,o.use)(nr),nc=(e,t)=>(null==e?void 0:e.locales)&&0!==e.locales.length?e.locales.find(e=>(null==e?void 0:e.code)===t):null;function nu(){return(nu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function nd(e,t){if(null==e)return{};var n={};for(var l in e)if(({}).hasOwnProperty.call(e,l)){if(t.includes(l))continue;n[l]=e[l]}return n}function np(e,t){return(np=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function nh(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,np(e,t)}
1function nf(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var nm={disabled:!1},ng=o.createContext(null),nv=function(e){return e.scrollTop},nb="unmounted",ny="exited",nx="entering",nw="entered",nj="exiting",nC=function(e){function t(t,n){var l,a=e.call(this,t,n)||this,o=n&&!n.isMounting?t.enter:t.appear;return a.appearStatus=null,t.in?o?(l=ny,a.appearStatus=nx):l=nw:l=t.unmountOnExit||t.mountOnEnter?nb:ny,a.state={status:l},a.nextCallback=null,a}nh(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===nb?{status:ny}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==nx&&n!==nw&&(t=nx):(n===nx||n===nw)&&(t=nj)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,l=this.props.timeout;return e=t=n=l,null!=l&&"number"!=typeof l&&(e=l.exit,t=l.enter,n=void 0!==l.appear?l.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===nx){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:r.findDOMNode(this);n&&nv(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===ny&&this.setState({status:nb})},n.performEnter=function(e){var t=this,n=this.props.enter,l=this.context?this.context.isMounting:e,a=this.props.nodeRef?[l]:[r.findDOMNode(this),l],o=a[0],i=a[1],s=this.getTimeouts(),c=l?s.appear:s.enter;if(!e&&!n||nm.disabled)return void this.safeSetState({status:nw},function(){t.props.onEntered(o)});this.props.onEnter(o,i),this.safeSetState({status:nx},function(){t.props.onEntering(o,i),t.onTransitionEnd(c,function(){t.safeSetState({status:nw},function(){t.props.onEntered(o,i)})})})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),l=this.props.nodeRef?void 0:r.findDOMNode(this);if(!t||nm.disabled)return void this.safeSetState({status:ny},function(){e.props.onExited(l)});this.props.onExit(l),this.safeSetState({status:nj},function(){e.props.onExiting(l),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:ny},function(){e.props.onExited(l)})})})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(l){n&&(n=!1,t.nextCallback=null,e(l))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:r.findDOMNode(this),l=null==e&&!this.props.addEndListener;if(!n||l)return void setTimeout(this.nextCallback,0);if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],o=a[0],i=a[1];this.props.addEndListener(o,i)}null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===nb)return null;var t=this.props,n=t.children,l=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,nd(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.createElement(ng.Provider,{value:null},"function"==typeof n?n(e,l):o.cloneElement(o.Children.only(n),l))},t}(o.Component);function nS(){}nC.contextType=ng,nC.propTypes={},nC.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:nS,onEntering:nS,onEntered:nS,onExit:nS,onExiting:nS,onExited:nS},nC.UNMOUNTED=nb,nC.EXITED=ny,nC.ENTERING=nx,nC.ENTERED=nw,nC.EXITING=nj;var nk=function(e,t){return e&&t&&t.split(" ").forEach(function(t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=nf(e.className,t):e.setAttribute("class",nf(e.className&&e.className.baseVal||"",t))})},n_=function(e){function t(){for(var t,n=arguments.length,l=Array(n),a=0;a<n;a++)l[a]=arguments[a];
1return(t=e.call.apply(e,[this].concat(l))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var l=t.resolveArguments(e,n),a=l[0],o=l[1];t.removeClasses(a,"exit"),t.addClass(a,o?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var l=t.resolveArguments(e,n),a=l[0],o=l[1];t.addClass(a,o?"appear":"enter","active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var l=t.resolveArguments(e,n),a=l[0],o=l[1]?"appear":"enter";t.removeClasses(a,o),t.addClass(a,o,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,l="string"==typeof n,a=l&&n?n+"-":"",o=l?""+a+e:n[e],r=l?o+"-active":n[e+"Active"],i=l?o+"-done":n[e+"Done"];return{baseClassName:o,activeClassName:r,doneClassName:i}},t}nh(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var l,a=this.getClassNames(t)[n+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&o&&(a+=" "+o),"active"===n&&e&&nv(e),a&&(this.appliedClasses[t][n]=a,l=a,e&&l&&l.split(" ").forEach(function(t){e.classList?e.classList.add(t):(e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" "))||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],l=n.base,a=n.active,o=n.done;this.appliedClasses[t]={},l&&nk(e,l),a&&nk(e,a),o&&nk(e,o)},n.render=function(){var e=this.props,t=(e.classNames,nd(e,["classNames"]));return o.createElement(nC,nu({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(o.Component);n_.defaultProps={classNames:""},n_.propTypes={};var nN=(0,o.createContext)({}),nE=()=>(0,o.useContext)(nN),nP=e=>e?{appear:"".concat(e,"--appear"),appearActive:"".concat(e,"--appearActive"),appearDone:"".concat(e,"--appearDone"),enter:"".concat(e,"--enter"),enterActive:"".concat(e,"--enterActive"),enterDone:"".concat(e,"--enterDone"),exit:"".concat(e,"--exit"),exitActive:"".concat(e,"--exitActive"),exitDone:"".concat(e,"--exitDone")}:{};function nD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,l)}return n}function nT(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nD(Object(n),!0).forEach(function(t){var l,a,o;l=e,a=t,o=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var l=n.call(e,t||"default");if("object"!=typeof l)return l;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(a))in l?Object.defineProperty(l,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):l[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}(0,s.j)();var nR={activateTrap:function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var l=e.indexOf(t);-1===l||e.splice(l,1),e.push(t)},deactivateTrap:function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},nA=function(e){return(null==e?void 0:e.key)==="Tab"||(null==e?void 0:e.keyCode)===9},nL=function(e){return nA(e)&&!e.shiftKey},nO=function(e){return nA(e)&&e.shiftKey},nF=function(e){return setTimeout(e,0)},nM=function(e,t){var n=-1;return e.every(function(e,l){return!t(e)||(n=l,!1)}),n},nI=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return"function"==typeof e?e.apply(void 0,n):e},nB=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},nU=[],nz=function(e,t){var n,l=(null==t?void 0:t.document)||document,a=(null==t?void 0:t.trapStack)||nU,o=nT({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:nL,isKeyBackward:nO},t),r={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},i=function(e,t,n){return e&&void 0!==e[t]?e[t]:o[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return r.containerGroups.findIndex(function(t){var l=t.container,a=t.tabbableNodes;return l.contains(e)||(null==n?void 0:n.includes(l))||a.find(function(t){return t===e})})},u=function(e){var t=o[e];if("function"==typeof t){for(var n=arguments.length,a=Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];t=t.apply(void 0,a)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var i=t;if("string"==typeof t&&!(i=l.querySelector(t)))throw Error("`".concat(e,"` as selector refers to no known node"));return i},d=function(){var e=u("initialFocus");if(!1===e)return!1;if(void 0===e||!(0,s.i)(e,o.tabbableOptions))if(c(l.activeElement)>=0)e=l.activeElement;else{var t=r.tabbableGroups[0];e=t&&t.firstTabbableNode||u("fallbackFocus")}if(!e)throw Error("Your focus-trap needs to have at least one focusable element");return e},p=function(){if(r.containerGroups=r.containers.map(function(e){var t=(0,s.f)(e,o.tabbableOptions),n=(0,s.g)(e,o.tabbableOptions),l=t.length>0?t[0]:void 0,a=t.length>0?t[t.length-1]:void 0,r=n.find(function(e){return(0,s.h)(e)}),i=n.slice().reverse().find(function(e){return(0,s.h)(e)}),c=!!t.find(function(e){return(0,s.e)(e)>0});return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:l,lastTabbableNode:a,firstDomTabbableNode:r,lastDomTabbableNode:i,nextTabbableNode:function(e){var l=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=t.indexOf(e);return a<0?l?n.slice(n.indexOf(e)+1).find(function(e){return(0,s.h)(e)}):n.slice(0,n.indexOf(e)).reverse().find(function(e){return(0,s.h)(e)}):t[a+(l?1:-1)]}}}),r.tabbableGroups=r.containerGroups.filter(function(e){return e.tabbableNodes.length>0}),r.tabbableGroups.length<=0&&!u("fallbackFocus"))throw Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(r.containerGroups.find(function(e){return e.posTabIndexesFound})&&r.containerGroups.length>1)throw Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},f=function e(t){if(!1!==t&&t!==h(document)){if(!t||!t.focus)return void e(d());t.focus({preventScroll:!!o.preventScroll}),r.mostRecentlyFocusedNode=t,t.tagName&&"input"===t.tagName.toLowerCase()&&"function"==typeof t.select&&t.select()}},m=function(e){var t=u("setReturnFocus",e);return t||!1!==t&&e},g=function(e){var t=e.target,n=e.event,l=e.isBackward,a=void 0!==l&&l;t=t||nB(n),p();var i=null;if(r.tabbableGroups.length>0){var d=c(t,n),h=d>=0?r.containerGroups[d]:void 0;if(d<0)i=a?r.tabbableGroups[r.tabbableGroups.length-1].lastTabbableNode:r.tabbableGroups[0].firstTabbableNode;else if(a){var f=nM(r.tabbableGroups,function(e){var n=e.firstTabbableNode;return t===n});if(f<0&&(h.container===t||(0,s.i)(t,o.tabbableOptions)&&!(0,s.h)(t,o.tabbableOptions)&&!h.nextTabbableNode(t,!1))&&(f=d
1),f>=0){var m=0===f?r.tabbableGroups.length-1:f-1,g=r.tabbableGroups[m];i=(0,s.e)(t)>=0?g.lastTabbableNode:g.lastDomTabbableNode}else nA(n)||(i=h.nextTabbableNode(t,!1))}else{var v=nM(r.tabbableGroups,function(e){var n=e.lastTabbableNode;return t===n});if(v<0&&(h.container===t||(0,s.i)(t,o.tabbableOptions)&&!(0,s.h)(t,o.tabbableOptions)&&!h.nextTabbableNode(t))&&(v=d),v>=0){var b=v===r.tabbableGroups.length-1?0:v+1,y=r.tabbableGroups[b];i=(0,s.e)(t)>=0?y.firstTabbableNode:y.firstDomTabbableNode}else nA(n)||(i=h.nextTabbableNode(t))}}else i=u("fallbackFocus");return i},v=function(e){if(!(c(nB(e),e)>=0)){if(nI(o.clickOutsideDeactivates,e))return void n.deactivate({returnFocus:o.returnFocusOnDeactivate});nI(o.allowOutsideClick,e)||e.preventDefault()}},b=function(e){var t=nB(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(r.mostRecentlyFocusedNode=t);else{e.stopImmediatePropagation();var l,a=!0;if(r.mostRecentlyFocusedNode)if((0,s.e)(r.mostRecentlyFocusedNode)>0){var i=c(r.mostRecentlyFocusedNode),u=r.containerGroups[i].tabbableNodes;if(u.length>0){var p=u.findIndex(function(e){return e===r.mostRecentlyFocusedNode});p>=0&&(o.isKeyForward(r.recentNavEvent)?p+1<u.length&&(l=u[p+1],a=!1):p-1>=0&&(l=u[p-1],a=!1))}}else r.containerGroups.some(function(e){return e.tabbableNodes.some(function(e){return(0,s.e)(e)>0})})||(a=!1);else a=!1;a&&(l=g({target:r.mostRecentlyFocusedNode,isBackward:o.isKeyBackward(r.recentNavEvent)})),f(l||r.mostRecentlyFocusedNode||d())}r.recentNavEvent=void 0},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r.recentNavEvent=e;var n=g({event:e,isBackward:t});n&&(nA(e)&&e.preventDefault(),f(n))},x=function(e){if(((null==e?void 0:e.key)==="Escape"||(null==e?void 0:e.key)==="Esc"||(null==e?void 0:e.keyCode)===27)&&!1!==nI(o.escapeDeactivates,e)){e.preventDefault(),n.deactivate();return}(o.isKeyForward(e)||o.isKeyBackward(e))&&y(e,o.isKeyBackward(e))},w=function(e){c(nB(e),e)>=0||nI(o.clickOutsideDeactivates,e)||nI(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},j=function(){if(r.active)return nR.activateTrap(a,n),r.delayInitialFocusTimer=o.delayInitialFocus?nF(function(){f(d())}):f(d()),l.addEventListener("focusin",b,!0),l.addEventListener("mousedown",v,{capture:!0,passive:!1}),l.addEventListener("touchstart",v,{capture:!0,passive:!1}),l.addEventListener("click",w,{capture:!0,passive:!1}),l.addEventListener("keydown",x,{capture:!0,passive:!1}),n},C=function(){if(r.active)return l.removeEventListener("focusin",b,!0),l.removeEventListener("mousedown",v,!0),l.removeEventListener("touchstart",v,!0),l.removeEventListener("click",w,!0),l.removeEventListener("keydown",x,!0),n},S="u">typeof window&&"MutationObserver"in window?new MutationObserver(function(e){e.some(function(e){return Array.from(e.removedNodes).some(function(e){return e===r.mostRecentlyFocusedNode})})&&f(d())}):void 0,k=function(){S&&(S.disconnect(),r.active&&!r.paused&&r.containers.map(function(e){S.observe(e,{subtree:!0,childList:!0})}))};return(n={get active(){return r.active},get paused(){return r.paused},activate:function(e){if(r.active)return this;var t=i(e,"onActivate"),n=i(e,"onPostActivate"),a=i(e,"checkCanFocusTrap");a||p(),r.active=!0,r.paused=!1,r.nodeFocusedBeforeActivation=l.activeElement,null==t||t();var o=function(){a&&p(),j(),k(),null==n||n()};return a?a(r.containers.concat()).then(o,o):o(),this},deactivate:function(e){if(!r.active)return this;var t=nT({onDeactivate:o.onDeactivate,onPostDeactivate:o.onPostDeactivate,checkCanReturnFocus:o.checkCanReturnFocus},e);clearTimeout(r.delayInitialFocusTimer),r.delayInitialFocusTimer=void 0,C(),r.active=!1,r.paused=!1,k(),nR.deactivateTrap(a,n);var l=i(t,"onDeactivate"),s=i(t,"onPostDeactivate"),c=i(t,"checkCanReturnFocus"),u=i(t,"returnFocus","returnFocusOnDeactivate");null==l||l();var d=function(){nF(function(){u&&f(m(r.nodeFocusedBeforeActivation)),null==s||s()})};return u&&c?c(m(r.nodeFocusedBeforeActivation)).then(d,d):d(),this},pause:function(e){if(r.paused||!r.active)return this;var t=i(e,"onPause"),n=i(e,"onPostPause");
1return r.paused=!0,null==t||t(),C(),k(),null==n||n(),this},unpause:function(e){if(!r.paused||!r.active)return this;var t=i(e,"onUnpause"),n=i(e,"onPostUnpause");return r.paused=!1,null==t||t(),p(),j(),k(),null==n||n(),this},updateContainerElements:function(e){return r.containers=[].concat(e).filter(Boolean).map(function(e){return"string"==typeof e?l.querySelector(e):e}),r.active&&p(),k(),this}}).updateContainerElements(e),n},nV=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,l=Object.getOwnPropertySymbols(e);a<l.length;a++)0>t.indexOf(l[a])&&Object.prototype.propertyIsEnumerable.call(e,l[a])&&(n[l[a]]=e[l[a]]);return n},nH="modal-item",nq=(l=e=>{let{children:t}=e;return t?"function"==typeof t?(0,u.jsx)(o.Fragment,{children:t(e)}):(0,u.jsx)(o.Fragment,{children:t}):null},e=>{let t=nE(),n=(0,o.useRef)(null),[i,s]=(0,o.useState)(!1),c=(0,o.useRef)(!1),[d,p]=(0,o.useState)(null),{modalState:h,classPrefix:f,containerRef:m,transTime:g,setCloseOnBlur:v,setBodyScrollLock:b,openModal:y}=t,{className:x,htmlElement:w="dialog",slug:j="",closeOnBlur:C=!0,lockBodyScroll:S=!0,classPrefix:k,onEnter:_,onEntering:N,onEntered:E,onExit:P,onExiting:D,onExited:T,openOnInit:R,trapFocus:A=!0,focusTrapOptions:L={}}=e,O=nV(e,["className","htmlElement","slug","closeOnBlur","lockBodyScroll","classPrefix","onEnter","onEntering","onEntered","onExit","onExiting","onExited","openOnInit","trapFocus","focusTrapOptions"]),F=k||f,M=a||j,I=h[M]&&h[M].isOpen;(0,o.useEffect)(()=>{if(A){let e=n.current;!1===c.current&&e&&(p(nz(e,Object.assign(Object.assign({},L),{fallbackFocus:(null==L?void 0:L.fallbackFocus)||e,allowOutsideClick:!("u">typeof L.allowOutsideClick)||L.allowOutsideClick}))),c.current=!0)}},[A,i,L]),(0,o.useEffect)(()=>{s(!0)},[]),(0,o.useEffect)(()=>(d&&(I?d.activate():d.deactivate()),()=>{d&&d.deactivate()}),[I,d]),(0,o.useEffect)(()=>{I&&v(C)},[I,C,v]),(0,o.useEffect)(()=>{let e=n.current;return e&&b(!!(I&&S),e),()=>{e&&b(!1,e)}},[I,S,b]);let[B,U]=(0,o.useState)(I);if((0,o.useEffect)(()=>{I?U(I):setTimeout(()=>U(!1),g)},[I,g]),(0,o.useEffect)(()=>{R&&y(M)},[M,R,y]),m.current){let a=F?"".concat(F,"__").concat(nH):nH,o=[a,"".concat(a,"--slug-").concat(M),x].filter(Boolean).join(" "),i=Object.assign({role:"dialog"!==w?"dialog":void 0,open:"dialog"===w?B||I:void 0,"aria-modal":!0,"aria-label":O["aria-labelledby"]?void 0:M},O);return r.createPortal((0,u.jsx)(n_,{nodeRef:n,timeout:g,in:I,classNames:nP(a),appear:!0,onEnter:_,onEntering:N,onEntered:E,onExit:P,onExiting:D,onExited:T,children:(0,u.jsx)(w,Object.assign({ref:n,id:(null==O?void 0:O.id)||M,className:o},i,{children:(0,u.jsx)(l,Object.assign({},e,{isOpen:I,modal:t}))}))}),m.current)}return null}),nW=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,l=Object.getOwnPropertySymbols(e);a<l.length;a++)0>t.indexOf(l[a])&&Object.prototype.propertyIsEnumerable.call(e,l[a])&&(n[l[a]]=e[l[a]]);return n},nK="modal-container",nY=e=>{let{oneModalIsOpen:t,classPrefix:n,transTime:l,setContainerRef:a,containerRef:o,closeAllModals:r,closeOnBlur:i}=nE(),{className:s,htmlElement:c="div",children:d,onClick:p}=e,h=nW(e,["className","htmlElement","children","onClick"]),f=n?"".concat(n,"__").concat(nK):nK,m=[f,s].filter(Boolean).join(" "),g=Object.assign(Object.assign({},h),{onClick:e=>{i&&r(),"function"==typeof p&&p(e)}});return(0,u.jsx)(n_,{nodeRef:o,in:t,timeout:l,classNames:nP(f),appear:!0,children:(0,u.jsx)(c,Object.assign({className:m,ref:a},g,{children:d&&d}))})},nG=!1;"u">typeof window&&(nQ={get passive(){nG=!0}},window.addEventListener("testPassive",null,nQ),window.removeEventListener("testPassive",null,nQ));var nQ,nX="u">typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),n$=[],nZ=!1,nJ=-1,n0=void 0,n1=void 0,n3=void 0,n2=function(e){return n$.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))})},n6=function(e){var t=e||window.event;return!!n2(t.target)||t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1)},n5=function(e){if(void 0===n3){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var l=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);n3=document.body.style.paddingRight,document.body.style.paddingRight=l+n+"px"}}void 0===n0&&(n0=document.body.style.overflow,document.body.style.overflow="hidden")},n4=function(){void 0!==n3&&(document.body.style.paddingRight=n3,n3=void 0),void 0!==n0&&(
1document.body.style.overflow=n0,n0=void 0)},n8=function(){if(void 0!==n1){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=n1.position,document.body.style.top=n1.top,document.body.style.left=n1.left,window.scrollTo(t,e),n1=void 0}},n9=function(e,t){var n=e.targetTouches[0].clientY-nJ;return!n2(e.target)&&(t&&0===t.scrollTop&&n>0||t&&t.scrollHeight-t.scrollTop<=t.clientHeight&&n<0?n6(e):(e.stopPropagation(),!0))},n7=function(e,t){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");!n$.some(function(t){return t.targetElement===e})&&(n$=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}(n$),[{targetElement:e,options:t||{}}]),nX?window.requestAnimationFrame(function(){if(void 0===n1){n1={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,l=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout(function(){return window.requestAnimationFrame(function(){var e=l-window.innerHeight;e&&t>=l&&(document.body.style.top=-(t+e))})},300)}}):n5(t),nX&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(nJ=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&n9(t,e)},nZ||(document.addEventListener("touchmove",n6,nG?{passive:!1}:void 0),nZ=!0)))},le=function(e){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");n$=n$.filter(function(t){return t.targetElement!==e}),nX&&(e.ontouchstart=null,e.ontouchmove=null,nZ&&0===n$.length&&(document.removeEventListener("touchmove",n6,nG?{passive:!1}:void 0),nZ=!1)),nX?n8():n4()},lt=(e,t)=>{let n=Object.assign({},e),{type:l,payload:a}=t;switch(l){case"UPDATE_MODAL":{let{slug:e}=a;e&&(n[e]=Object.assign(Object.assign({},n[e]),a));break}case"OPEN_MODAL":{let{slug:e}=a;e&&(e in n&&n[e].isOpen||(n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:Date.now(),isOpen:!0})));break}case"TOGGLE_MODAL":{let{slug:e}=a;if(e){let t=e in n&&n[e].isOpen;n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:t?void 0:Date.now(),isOpen:!t})}break}case"CLOSE_MODAL":{let{slug:e}=a;e&&(n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:void 0,isOpen:!1}));break}case"REMOVE_MODAL":{let{slug:e}=a;e&&e in n&&delete n[e];break}case"CLOSE_LATEST_MODAL":{let e=Object.keys(n).reduce((e,t)=>{let l=n[t];return l.isOpen&&"number"==typeof l.openedOn&&(!e||"number"==typeof e.openedOn&&l.openedOn>e.openedOn)?l:e},void 0);e&&(n[e.slug]=Object.assign(Object.assign({},n[e.slug]),{isOpen:!1,openedOn:void 0}));break}case"CLOSE_ALL_MODALS":n=Object.entries(n).reduce((e,t)=>{let[n,l]=t;return e[n]=Object.assign(Object.assign({},l),{isOpen:!1,openedOn:void 0}),e},{})}return n},ln=e=>{let{classPrefix:t,minifyCSS:n=!0,generateCSS:l=!0,zIndex:a=9999,handleParamChange:r,children:i,transTime:s=250}=e,c=(0,o.useRef)(null),[d,p]=(0,o.useReducer)(lt,{},()=>(()=>{let e=(()=>{if("u">typeof window)return new URLSearchParams(window.location.search)})(),t=[];if(e){let n=e.get("modal");n&&(t=n.includes(",")?n.split(","):[n])}return t})().reduce((e,t)=>(e[t]={slug:t,isOpen:!0,openedOn:Date.now()},e),{})),[h,f]=(0,o.useState)(!1),[m,g]=(0,o.useState)(!1),[v,b]=(0,o.useState)(!1),[y,x]=(0,o.useState)(""),w=(0,o.useRef)(!1),j=(0,o.useCallback)(e=>{27===e.keyCode&&p({type:"CLOSE_LATEST_MODAL"})},[]);(0,o.useEffect)(()=>(w.current||(document.addEventListener("keydown",e=>j(e),!1),w.current=!0),()=>{w.current&&document.removeEventListener("keydown",e=>j(e),!1)}),[j]),(0,o.useEffect)(()=>{if(l){let e="";e=(e=>{let{classPrefix:t,zIndex:n}=e,l=t?"".concat(t,"__"):"";return"\n .".concat(l).concat(nK," {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n position: fixed;\n pointer-events: none;\n visibility: hidden;\n z-index: -1;\n }\n\n .").concat(l).concat(nK,"--appear,\n .").concat(l).concat(nK,"--appearDone,\n .").concat(l).concat(nK,"--enter,\n .").concat(l).concat(nK,"--enterDone,\n .").concat(l).concat(nK,"--exit {\n pointer-events: all;\n visibility: visible;\n z-index: ").concat(n,";\n }\n\n .").concat(l).concat(nH," {\n position: absolute;\n visibility: hidden;\n }\n\n .").concat(l).concat(nH,"--appear,\n .").concat(l).concat(nH,"--appearDone,\n .").concat(l).concat(nH,"--enter,\n .").concat(l).concat(nH,"--enterDone,\n .").concat(l).concat(nH,"--exit {\n visibility: visible;\n }\n ")})({classPrefix:t,zIndex:a}),n&&(e=e.replace(/\n/g,"").replace(/\s\s+/g," ")),x(e)}},[l,n,a,t]),(0,o.useEffect)(()=>
1{if("function"==typeof r&&r(d),"boolean"==typeof r&&r){let e=Object.keys(d).filter(e=>d[e].isOpen),t=new URLSearchParams;for(let n of e)t.append("modal",n);let n=t.toString()?"?".concat(t):"",l="".concat(window.location.pathname).concat(n);window.history.pushState({},"",l)}},[d,r]),(0,o.useEffect)(()=>{f(Object.keys(d).some(e=>d[e].isOpen))},[d]);let C=(0,o.useCallback)((e,t)=>{t&&(e?(n7(t),b(!0)):(le(t),b(!1)))},[]),S=(0,o.useCallback)(e=>{c.current=e},[]),k=(0,o.useCallback)(e=>{p({type:"OPEN_MODAL",payload:{slug:e}})},[]),_=(0,o.useCallback)(e=>{p({type:"CLOSE_MODAL",payload:{slug:e}})},[]),N=(0,o.useCallback)(()=>{p({type:"CLOSE_ALL_MODALS"})},[]),E=(0,o.useCallback)(e=>{p({type:"TOGGLE_MODAL",payload:{slug:e}})},[]),P=(0,o.useCallback)(e=>d[e]&&d[e].isOpen,[d]),D=Object.assign({},e);return delete D.children,(0,u.jsxs)(o.Fragment,{children:[l&&(0,u.jsx)("style",{dangerouslySetInnerHTML:{__html:y}}),(0,u.jsx)(nN.Provider,{value:Object.assign(Object.assign({},D),{transTime:s,containerRef:c,modalState:d,oneModalIsOpen:h,isModalOpen:P,closeOnBlur:m,bodyScrollIsLocked:v,classPrefix:t,closeAllModals:N,setCloseOnBlur:g,openModal:k,closeModal:_,toggleModal:E,setBodyScrollLock:C,setContainerRef:S}),children:i})]})},ll="gutter",la=e=>{let{children:t,className:n,left:l=!0,negativeLeft:a=!1,negativeRight:o=!1,ref:r,right:i=!0}=e,s=l&&!a,c=i&&!o;return(0,u.jsx)("div",{className:[ll,s&&"".concat(ll,"--left"),c&&"".concat(ll,"--right"),a&&"".concat(ll,"--negative-left"),o&&"".concat(ll,"--negative-right"),n].filter(Boolean).join(" "),ref:r,children:t})},lo=e=>{let t=(0,f.c)(3),n=(0,o.useId)(),l=ns(),a="".concat(e,"-").concat(n),r;return t[0]!==l||t[1]!==a?(r=li({slug:a,depth:l}),t[0]=l,t[1]=a,t[2]=r):r=t[2],r},lr="drawer",li=e=>{let{slug:t,depth:n}=e;return"drawer_".concat(n,"_").concat(t)},ls=e=>{let t=(0,f.c)(4),{slug:n,children:l,className:a,disabled:o,onClick:r,...i}=e,{openModal:s}=nE(),c;return t[0]!==r||t[1]!==s||t[2]!==n?(c=e=>{s(n),"function"==typeof r&&r(e)},t[0]=r,t[1]=s,t[2]=n,t[3]=c):c=t[3],(0,u.jsx)("button",{className:a,disabled:o,onClick:c,type:"button",...i,children:l})},lc=e=>{var t;let n=(0,f.c)(22),{slug:l,children:a,className:r,gutter:i,Header:c,hoverTitle:d,title:p}=e,h=void 0===i||i,{t:m}=(0,s.d)(),{closeModal:g,modalState:v}=nE(),b=lp(),y=!!(null==(t=v[l])?void 0:t.isOpen),[x,w]=(0,o.useState)(y),j,C;if(n[0]!==y?(j=()=>{w(y)},C=[y],n[0]=y,n[1]=j,n[2]=C):(j=n[1],C=n[2]),(0,o.useLayoutEffect)(j,C),y){let e=x&&"".concat(lr,"--is-open"),t=b>1&&"".concat(lr,"--nested"),o;n[3]!==r||n[4]!==e||n[5]!==t?(o=[r,lr,e,t].filter(Boolean),n[3]=r,n[4]=e,n[5]=t,n[6]=o):o=n[6];let i=o.join(" "),f=100+b,v;if(n[7]!==c||n[8]!==a||n[9]!==g||n[10]!==b||n[11]!==h||n[12]!==d||n[13]!==l||n[14]!==m||n[15]!==i||n[16]!==f||n[17]!==p){let e;n[19]!==g||n[20]!==l?(e=()=>g(l),n[19]=g,n[20]=l,n[21]=e):e=n[21],v=(0,u.jsx)(ld,{children:(0,u.jsxs)(nq,{className:i,closeOnBlur:!1,slug:l,style:{zIndex:f},children:[(!b||1===b)&&(0,u.jsx)("div",{className:"".concat(lr,"__blur-bg")}),(0,u.jsx)("button",{"aria-label":m("general:close"),className:"".concat(lr,"__close"),id:"close-drawer__".concat(l),onClick:e,type:"button"}),(0,u.jsxs)("div",{className:"".concat(lr,"__content"),style:{width:"calc(100% - (".concat(b," * var(--gutter-h)))")},children:[(0,u.jsx)("div",{className:"".concat(lr,"__blur-bg-content")}),(0,u.jsxs)(la,{className:"".concat(lr,"__content-children"),left:h,right:h,children:[c,void 0===c&&(0,u.jsxs)("div",{className:"".concat(lr,"__header"),children:[(0,u.jsx)("h2",{className:"".concat(lr,"__header__title"),title:d?p:null,children:p}),(0,u.jsx)("button",{"aria-label":m("general:close"),className:"".concat(lr,"__header__close"),id:"close-drawer__".concat(l),onClick:()=>g(l),type:"button",children:(0,u.jsx)(s.a,{})})]}),a]})]})]})}),n[7]=c,n[8]=a,n[9]=g,n[10]=b,n[11]=h,n[12]=d,n[13]=l,n[14]=m,n[15]=i,n[16]=f,n[17]=p,n[18]=v}else v=n[18];return v}return null},lu=(0,o.createContext)(1),ld=e=>{let t=(0,f.c)(3),{children:n}=e,l=lp()+1,a;return t[0]!==n||t[1]!==l?(a=(0,u.jsx)(lu,{value:l,children:n}),t[0]=n,t[1]=l,t[2]=a):a=t[2],a},lp=()=>(0,o.use)(lu),lh="confirmation-modal";function lf(e){let t,n=(0,f.c)(25),{body:l,cancelLabel:a,className:r,confirmingLabel:i,confirmLabel:c,heading:d,modalSlug:p,onCancel:h,onConfirm:m}=e,g=lp(),[v,b]=o.useState(!1),{closeModal:y,isModalOpen:x}=nE(),{t:w}=(0,s.d)(),j;n[0]!==y||n[1]!==v||n[2]!==p||n[3]!==m?(j=async()=>{v||(b(!0),"function"==typeof m&&await m(),b(!1),y(p))},n[0]=y,n[1]=v,n[2]=p,n[3]=m,n[4]=j):j=n[4];let C=j,S;n[5]!==y||n[6]!==v||n[7]!==p||n[8]!==h?(S=()=>
1{v||(y(p),"function"==typeof h&&h())},n[5]=y,n[6]=v,n[7]=p,n[8]=h,n[9]=S):S=n[9];let k=S;if(!x(p))return null;n[10]!==r?(t=[lh,r].filter(Boolean),n[10]=r,n[11]=t):t=n[11];let _=t.join(" "),N=100+g,E;return n[12]!==l||n[13]!==a||n[14]!==c||n[15]!==v||n[16]!==i||n[17]!==d||n[18]!==p||n[19]!==k||n[20]!==C||n[21]!==w||n[22]!==_||n[23]!==N?(E=(0,u.jsx)(nq,{className:_,closeOnBlur:!1,slug:p,style:{zIndex:N},children:(0,u.jsxs)("div",{className:"".concat(lh,"__wrapper"),children:[(0,u.jsxs)("div",{className:"".concat(lh,"__content"),children:["string"==typeof d?(0,u.jsx)("h1",{children:d}):d,"string"==typeof l?(0,u.jsx)("p",{children:l}):l]}),(0,u.jsxs)("div",{className:"".concat(lh,"__controls"),children:[(0,u.jsx)(tD,{buttonStyle:"secondary",disabled:v,id:"confirm-cancel",onClick:k,size:"large",type:"button",children:a||w("general:cancel")}),(0,u.jsx)(tD,{id:"confirm-action",onClick:C,size:"large",children:v?i||"".concat(w("general:loading"),"..."):c||w("general:confirm")})]})]})}),n[12]=l,n[13]=a,n[14]=c,n[15]=v,n[16]=i,n[17]=d,n[18]=p,n[19]=k,n[20]=C,n[21]=w,n[22]=_,n[23]=N,n[24]=E):E=n[24],E}var lm="stay-logged-in",lg=()=>{let e=(0,f.c)(12),{refreshCookie:t}=lw(),n=(0,h.useRouter)(),{config:l}=(0,i.c)(),{admin:a,routes:o,serverURL:r}=l,{routes:c}=a,{logout:d}=c,{admin:p}=o,{t:m}=(0,s.d)(),{startRouteTransition:g}=e8(),b;e[0]!==p||e[1]!==d||e[2]!==n||e[3]!==r||e[4]!==g?(b=()=>g(()=>n.push((0,v.Q)({adminRoute:p,path:d,serverURL:r}))),e[0]=p,e[1]=d,e[2]=n,e[3]=r,e[4]=g,e[5]=b):b=e[5];let y=b,x;e[6]!==t?(x=()=>{t()},e[6]=t,e[7]=x):x=e[7];let w=x,j;return e[8]!==w||e[9]!==y||e[10]!==m?(j=(0,u.jsx)(lf,{body:m("authentication:youAreInactive"),cancelLabel:m("authentication:stayLoggedIn"),confirmLabel:m("authentication:logOut"),heading:m("authentication:stayLoggedIn"),modalSlug:lm,onCancel:w,onConfirm:y}),e[8]=w,e[9]=y,e[10]=m,e[11]=j):j=e[11],j};function lv(e){let t,n=(0,f.c)(4),l=(0,o.useRef)(e),a,r;return n[0]!==e?(a=()=>{l.current=e},r=[e],n[0]=e,n[1]=a,n[2]=r):(a=n[1],r=n[2]),(0,o.useInsertionEffect)(a,r),n[3]===Symbol.for("react.memo_cache_sentinel")?(t=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,l.current)(...t)},n[3]=t):t=n[3],t}var lb={delete:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{headers:{}},n=t&&t.headers?{...t.headers}:{};return fetch(e,{...t,credentials:"include",headers:{...n},method:"delete"})},get:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{headers:{}},n="";return t.params&&(n=y.A(t.params,{addQueryPrefix:!0})),fetch("".concat(e).concat(n),{credentials:"include",...t})},patch:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{headers:{}},n=t&&t.headers?{...t.headers}:{};return fetch(e,{...t,credentials:"include",headers:{...n},method:"PATCH"})},post:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{headers:{}},n=t&&t.headers?{...t.headers}:{},l={...t,credentials:"include",headers:{...n},method:"post"};return fetch("".concat(e),l)},put:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{headers:{}},n=t&&t.headers?{...t.headers}:{};return fetch(e,{...t,credentials:"include",headers:{...n},method:"put"})}},ly=(0,o.createContext)({});function lx(e){let{children:t,permissions:n,user:l}=e,a=(0,h.usePathname)(),r=(0,h.useRouter)(),{config:c}=(0,i.c)(),{admin:{autoLogin:d,autoRefresh:p,routes:{inactivity:f},user:m},routes:{admin:g,api:x},serverURL:w}=c,{i18n:j}=(0,s.d)(),{closeAllModals:C,openModal:S}=nE(),{startRouteTransition:k}=e8(),[_,N]=(0,o.useState)(l),[E,P]=(0,o.useState)(),[D,T]=(0,o.useState)(),[R,A]=(0,o.useState)(n),[L,O]=(0,o.useState)(12e4),[F,M]=(0,o.useState)(!1),I=o.useRef(null),B=o.useRef(null),U=o.useRef(null),z=null==_?void 0:_.id,V=(0,o.useCallback)(()=>{k(()=>r.replace((0,v.Q)({adminRoute:g,path:"".concat(f).concat(window.location.pathname.startsWith(g)?"?redirect=".concat(encodeURIComponent(window.location.pathname)):""),serverURL:w}))),C()},[r,g,f,C,k,w]),H=(0,o.useCallback)(()=>{N(null),P(void 0),T(void 0),clearTimeout(I.current)},[]),q=lv(()=>{p?$():S(lm)}),W=(0,o.useCallback)(e=>{if(clearTimeout(B.current),clearTimeout(U.current),null==e?void 0:e.user){var t;N(e.user),P(e.token),T(1e3*e.exp);let n=Math.max(0,Math.min((null!=(t=e.exp)?t:0)*1e3-Date.now(),0x7fffffff));if(n){let e=Math.min(6e4,n/2);O(e),B.current=setTimeout(q,Math.max(n-e,0)),U.current=setTimeout(()=>{H(),V()},n)}}else H()},[V,H]),K=(0,o.useCallback)(e=>{if(!z)return;let t=Math.max(0,(null!=D?D:0)-Date.now());(e||D&&t<2*L)&&(clearTimeout(I.current),I.current=setTimeout(async()=>{try{let e=await lb.post((0,b.n)({apiRoute:x,path:"/".concat(m,"/refresh-token?refresh"),serverURL:w}),{headers:{"Accept-Language":j.language}}
1);if(200===e.status){let t=await e.json();W(t)}else W(null),V()}catch(e){eJ.error(e.message)}},1e3))},[x,j.language,V,w,W,D,m,L,z]),Y=(0,o.useCallback)(async e=>{try{let t=await lb.post((0,b.n)({apiRoute:x,path:"/".concat(m,"/refresh-token"),serverURL:w}),{headers:{"Accept-Language":j.language}});if(200===t.status){let n=await t.json();return e||W(n),n.user}_&&(W(null),V())}catch(e){eJ.error("Refreshing token failed: ".concat(e.message))}return null},[x,j.language,V,w,W,m,_]),G=(0,o.useCallback)(async()=>{try{_&&_.collection&&(W(null),await lb.post((0,b.n)({apiRoute:x,path:"/".concat(_.collection,"/logout"),serverURL:w})))}catch(e){}return!0},[x,w,W,_]),Q=(0,o.useCallback)(async function(){let{locale:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=y.A({locale:e},{addQueryPrefix:!0});try{let e=await lb.get((0,b.n)({apiRoute:x,path:"/access".concat(t),serverURL:w}),{headers:{"Accept-Language":j.language}});if(200===e.status){let t=await e.json();A(t)}else throw Error("Fetching permissions failed with status code ".concat(e.status))}catch(e){eJ.error("Refreshing permissions failed: ".concat(e.message))}},[w,x,j]),X=o.useCallback(async()=>{try{let e=await lb.get((0,b.n)({apiRoute:x,path:"/".concat(m,"/me"),serverURL:w}),{credentials:"include",headers:{"Accept-Language":j.language}});if(200===e.status){let t=await e.json();return W(t),(null==t?void 0:t.user)||null}}catch(e){eJ.error("Fetching user failed: ".concat(e.message))}return null},[w,x,m,j.language,W]),$=lv(K);(0,o.useEffect)(()=>{$()},[a]);let Z=lv(X);return(0,o.useEffect)(()=>{!async function(){await Z(),M(!0)}()},[]),(0,o.useEffect)(()=>{_||!d||d.prefillOnly||Z()},[_,d]),(0,o.useEffect)(()=>()=>{clearTimeout(I.current),clearTimeout(B.current),clearTimeout(U.current)},[]),_||F?(0,u.jsx)(ly,{value:{fetchFullUser:X,logOut:G,permissions:R,refreshCookie:K,refreshCookieAsync:Y,refreshPermissions:Q,setPermissions:A,setUser:W,token:E,tokenExpirationMs:D,user:_},children:t}):null}var lw=()=>(0,o.use)(ly),lj=(0,o.createContext)({}),lC=(0,o.createContext)({localeIsLoading:!1,setLocaleIsLoading:e=>{}}),lS=async(e,t)=>{var n;return await (null==(n=fetch("".concat(t,"/payload-preferences/").concat(e),{credentials:"include",headers:{"Content-Type":"application/json"},method:"GET"}))?void 0:n.then(e=>e.json()))},lk=e=>{let t,n=(0,f.c)(26),{children:l,locale:a}=e,{config:r}=(0,i.c)(),{localization:s,routes:c,serverURL:d}=r,p=void 0!==s&&s,{api:m}=c,{user:g}=lw(),v=p?p.defaultLocale:"en",b=(0,h.useSearchParams)(),y;n[0]!==b?(y=b.get("locale"),n[0]=b,n[1]=y):y=n[1];let x=y,w;n[2]!==v||n[3]!==a||n[4]!==x||n[5]!==p?(w=()=>p&&(!p||p.locales.length)?nc(p,x)||nc(p,a)||nc(p,v)||nc(p,p.locales[0].code):{},n[2]=v,n[3]=a,n[4]=x,n[5]=p,n[6]=w):w=n[6];let[j,C]=o.useState(w),[S,k]=(0,o.useState)(!1),_=(0,o.useRef)(j),N,E;n[7]!==j?(N=()=>{j.code!==_.current.code&&k(!1),_.current=j},E=[j],n[7]=j,n[8]=N,n[9]=E):(N=n[8],E=n[9]),(0,o.useEffect)(N,E);let P="".concat(d).concat(m),D;n[10]!==v||n[11]!==P||n[12]!==x||n[13]!==p||n[14]!==(null==g?void 0:g.id)?(D=()=>{!async function(){if(p&&(null==g?void 0:g.id)){var e,t,n;let l=nc(p,x||await (null==(e=lS("locale",P))?void 0:e.then(lE)))||nc(p,v)||nc(p,null==p||null==(n=p.locales)||null==(t=n[0])?void 0:t.code);l&&C(l)}}()},n[10]=v,n[11]=P,n[12]=x,n[13]=p,n[14]=null==g?void 0:g.id,n[15]=D):D=n[15];let T=null==g?void 0:g.id,R;return n[16]!==v||n[17]!==P||n[18]!==x||n[19]!==p||n[20]!==T?(R=[v,p,P,x,T],n[16]=v,n[17]=P,n[18]=x,n[19]=p,n[20]=T,n[21]=R):R=n[21],(0,o.useEffect)(D,R),n[22]!==l||n[23]!==S||n[24]!==j?(t=(0,u.jsx)(lj,{value:j,children:(0,u.jsx)(lC,{value:{localeIsLoading:S,setLocaleIsLoading:k},children:l})}),n[22]=l,n[23]=S,n[24]=j,n[25]=t):t=n[25],t},l_=()=>(0,o.use)(lC),lN=()=>(0,o.use)(lj);function lE(e){return e.value}var lP=(e,t,n)=>{if(e)return"field-".concat(e.replace(/\./g,"__")).concat(t>1?"-".concat(t):"").concat(n?"-".concat(n):"")},lD=e=>{let{as:t,hideLocale:n,htmlFor:l,label:a,localized:o,path:r,required:i,unstyled:c}=e,p=void 0===t?"label":t,h=void 0!==c&&c,{uuid:f}=eP(),m=ns(),g=l||lP(r,m,f),{i18n:v}=(0,s.d)(),{code:b,label:y}=lN();return a?(0,u.jsxs)("label"===p?g?"label":"span":p||"span",{className:"field-label".concat(h?" unstyled":""),htmlFor:g,children:[(0,d.s)(a,v),void 0!==i&&i&&!h&&(0,u.jsx)("span",{className:"required",children:"*"}),void 0!==o&&o&&!(void 0!==n&&n)&&(0,u.jsxs)("span",{className:"localized",children:["â ","string"==typeof y?y:b]})]}):null},lT=e=>{let{collapsed:t,rowID:n,rows:l}=e;return l.reduce((e,l)=>(n===l.id&&(l.collapsed=t),l.collapsed&&e.collapsedIDs.push(l.id),e.updatedRows.push(l),e),{collapsedIDs:[],updatedRows:[]})},lR=e=>{let{collapsed:t,rows:n}=e;return n.reduce((e,n)=>(n.collapsed=t,t&&e.collapsedIDs.push(n.id),e.updatedRows.push(n),e),{collapsedIDs:[],updatedRows:[]})}
1,lA=(e,t,n)=>{let l,a=(0,f.c)(9),r;a[0]!==n?(r=void 0===n?[]:n,a[0]=n,a[1]=r):r=a[1];let i=r,s;a[2]===Symbol.for("react.memo_cache_sentinel")?(s=Date.now(),a[2]=s):s=a[2];let c=(0,o.useRef)(s),u;a[3]!==e||a[4]!==t?(u=()=>{let n=setTimeout(()=>{Date.now()-c.current>=t&&(e(),c.current=Date.now())},t-(Date.now()-c.current));return()=>{clearTimeout(n)}},a[3]=e,a[4]=t,a[5]=u):u=a[5],a[6]!==t||a[7]!==i?(l=[t,...i],a[6]=t,a[7]=i,a[8]=l):l=a[8],(0,o.useEffect)(u,l)},lL={},lO={};function lF(e,t){try{let n=(lL[e]||(lL[e]=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return n in lO?lO[n]:lI(n,n.split(":"))}catch(n){if(e in lO)return lO[e];let t=null==e?void 0:e.match(lM);return t?lI(e,t.slice(1)):NaN}}var lM=/([+-]\d\d):?(\d\d)?/;function lI(e,t){let n=+t[0],l=+(t[1]||0);return lO[e]=n>0?60*n+l:60*n-l}var lB=class e extends Date{static tz(t){for(var n=arguments.length,l=Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];return l.length?new e(...l,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){return-lF(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),lz(this),+this}[Symbol.for("constructDateFrom")](t){return new e(+new Date(t),this.timeZone)}constructor(...e){super(),e.length>1&&"string"==typeof e[e.length-1]&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(lF(this.timeZone,this))?this.setTime(NaN):e.length?"number"==typeof e[0]&&(1===e.length||2===e.length&&"number"!=typeof e[1])?this.setTime(e[0]):"string"==typeof e[0]?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),lV(this,NaN),lz(this)):this.setTime(Date.now())}},lU=/^(get|set)(?!UTC)/;function lz(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function lV(e){let t=lF(e.timeZone,e),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);let l=-new Date(+e).getTimezoneOffset(),a=l- -new Date(+n).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let r=l-t;r&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+r);let i=lF(e.timeZone,e),s=-new Date(+e).getTimezoneOffset()-i-r;if(i!==t&&s){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let t=i-lF(e.timeZone,e);t&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+t),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+t))}}Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!lU.test(e))return;let t=e.replace(lU,"$1UTC");lB.prototype[t]&&(e.startsWith("get")?lB.prototype[e]=function(){return this.internal[t]()}:(lB.prototype[e]=function(){var e;return Date.prototype[t].apply(this.internal,arguments),e=this,Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),lV(e),+this},lB.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),lz(this),+this}))});var lH=Symbol.for("constructDateFrom");function lq(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&lH in e?e[lH](t):e instanceof Date?new e.constructor(t):new Date(t)}function lW(e,t){return lq(t||e,e)}var lK={};function lY(e,t){var n,l,a,o,r,i,s,c;let u=null!=(c=null!=(s=null!=(i=null!=(r=null==t?void 0:t.weekStartsOn)?r:null==t||null==(l=t.locale)||null==(n=l.options)?void 0:n.weekStartsOn)?i:lK.weekStartsOn)?s:null==(o=lK.locale)||null==(a=o.options)?void 0:a.weekStartsOn)?c:0,d=lW(e,null==t?void 0:t.in),p=d.getDay();return d.setDate(d.getDate()-(7*(p<u)+p-u)),d.setHours(0,0,0,0),d}function lG(e,t){return lY(e,{...t,weekStartsOn:1})}function lQ(e,t){let n=lW(e,null==t?void 0:t.in),l=n.getFullYear(),a=lq(n,0);a.setFullYear(l+1,0,4),a.setHours(0,0,0,0);let o=lG(a),r=lq(n,0);r.setFullYear(l,0,4),r.setHours(0,0,0,0);let i=lG(r);return n.getTime()>=o.getTime()?l+1:n.getTime()>=i.getTime()?l:l-1}function lX(e){let t=lW(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-n}function l$(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];let a=lq.bind(null,e||n.find(e=>"object"==typeof e));return n.map(a)}function lZ(e,t){let n=lW(e,null==t?void 0:t.in);return n.setHours(0,0,0,0),n}function lJ(e,t){let n=lW(e)-lW(t);return n<0?-1:n>0?1:n}function l0(e){return lq(e,Date.now())}function l1(e,t){let n=lW(e,null==t?void 0:t.in);return n.setHours(23,59,59,999),n}function l3(e,t){var n,l,a,o,r,i,s,c;let u=lW(e,null==t?void 0:t.in),d=u.getFullYear(),p=null!=(c=null!=(s=null!=(i=null!=(r=null==t?void 0:t.firstWeekContainsDate)?r:null==t||null==(l=t.locale)||null==(n=l.options)?void 0:n.firstWeekContainsDate)?i:lK.firstWeekContainsDate)?s:null==(o=lK.locale)||null==(a=o.options)?void 0:a.firstWeekContainsDate)?c:1,h=lq((null==t?void 0:t.in)||e,0);h.setFullYear(d+1,0,p),h.setHours(0,0,0,0);let f=lY(h,t),m=lq((null==t?void 0:t.in)||e,0);m.setFullYear(d,0,p),m.setHours(0,0,0,0);let g=lY(m,t);return+u>=+f?d+1:+u>=+g?d:d-1}function l2(e,t){let n=Math.abs(e).toString().padStart(t,"0");return(e<0?"-":"")+n}var l6={y(e,t){let n=e.getFullYear(),l=n>0?n:1-n;return l2("yy"===t?l%100:l,t.length)},M(e,t){let n=e.getMonth();return"M"===t?String(n+1):l2(n+1,2)},d:(e,t)=>l2(e.getDate(),t.length),a(e,t){let n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];
1default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>l2(e.getHours()%12||12,t.length),H:(e,t)=>l2(e.getHours(),t.length),m:(e,t)=>l2(e.getMinutes(),t.length),s:(e,t)=>l2(e.getSeconds(),t.length),S(e,t){let n=t.length;return l2(Math.trunc(e.getMilliseconds()*Math.pow(10,n-3)),t.length)}},l5={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},l4={G:function(e,t,n){let l=+(e.getFullYear()>0);switch(t){case"G":case"GG":case"GGG":return n.era(l,{width:"abbreviated"});case"GGGGG":return n.era(l,{width:"narrow"});default:return n.era(l,{width:"wide"})}},y:function(e,t,n){if("yo"===t){let t=e.getFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return l6.y(e,t)},Y:function(e,t,n,l){let a=l3(e,l),o=a>0?a:1-a;return"YY"===t?l2(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):l2(o,t.length)},R:function(e,t){return l2(lQ(e),t.length)},u:function(e,t){return l2(e.getFullYear(),t.length)},Q:function(e,t,n){let l=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(l);case"QQ":return l2(l,2);case"Qo":return n.ordinalNumber(l,{unit:"quarter"});case"QQQ":return n.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(l,{width:"narrow",context:"formatting"});default:return n.quarter(l,{width:"wide",context:"formatting"})}},q:function(e,t,n){let l=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(l);case"qq":return l2(l,2);case"qo":return n.ordinalNumber(l,{unit:"quarter"});case"qqq":return n.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(l,{width:"narrow",context:"standalone"});default:return n.quarter(l,{width:"wide",context:"standalone"})}},M:function(e,t,n){let l=e.getMonth();switch(t){case"M":case"MM":return l6.M(e,t);case"Mo":return n.ordinalNumber(l+1,{unit:"month"});case"MMM":return n.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(l,{width:"narrow",context:"formatting"});default:return n.month(l,{width:"wide",context:"formatting"})}},L:function(e,t,n){let l=e.getMonth();switch(t){case"L":return String(l+1);case"LL":return l2(l+1,2);case"Lo":return n.ordinalNumber(l+1,{unit:"month"});case"LLL":return n.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(l,{width:"narrow",context:"standalone"});default:return n.month(l,{width:"wide",context:"standalone"})}},w:function(e,t,n,l){var a,o,r,i,s,c,u,d;let p,h,f,m,g=Math.round((lY(m=lW(e,null==l?void 0:l.in),l)-(p=null!=(d=null!=(u=null!=(c=null!=(s=null==l?void 0:l.firstWeekContainsDate)?s:null==l||null==(o=l.locale)||null==(a=o.options)?void 0:a.firstWeekContainsDate)?c:lK.firstWeekContainsDate)?u:null==(i=lK.locale)||null==(r=i.options)?void 0:r.firstWeekContainsDate)?d:1,h=l3(m,l),(f=lq((null==l?void 0:l.in)||m,0)).setFullYear(h,0,p),f.setHours(0,0,0,0),lY(f,l)))/6048e5)+1;return"wo"===t?n.ordinalNumber(g,{unit:"week"}):l2(g,t.length)},I:function(e,t,n){var l;let a,o,r,i=Math.round((lG(r=lW(e,void 0))-(a=lQ(r,void 0),(o=lq((null==l?void 0:l.in)||r,0)).setFullYear(a,0,4),o.setHours(0,0,0,0),lG(o)))/6048e5)+1;return"Io"===t?n.ordinalNumber(i,{unit:"week"}):l2(i,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):l6.d(e,t)},D:function(e,t,n){let l,a,o=function(e,t,n){let[l,a]=l$(void 0,e,t),o=lZ(l),r=lZ(a);return Math.round((o-lX(o)-(r-lX(r)))/864e5)}(l=lW(e,void 0),((a=lW(l,void 0)).setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a))+1;return"Do"===t?n.ordinalNumber(o,{unit:"dayOfYear"}):l2(o,t.length)},E:function(e,t,n){let l=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){let a=e.getDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return l2(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){let a=e.getDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return l2(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){let l=e.getDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return l2(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(l,{width:"short",context:"formatting"});default:return n.day(l,{width:"wide",context:"formatting"})}},a:function(e,t,n){let l=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){let l=e.getHours(),a;
1switch(a=12===l?l5.noon:0===l?l5.midnight:l/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){let l=e.getHours(),a;switch(a=l>=17?l5.evening:l>=12?l5.afternoon:l>=4?l5.morning:l5.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return l6.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):l6.H(e,t)},K:function(e,t,n){let l=e.getHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):l2(l,t.length)},k:function(e,t,n){let l=e.getHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):l2(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):l6.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):l6.s(e,t)},S:function(e,t){return l6.S(e,t)},X:function(e,t,n){let l=e.getTimezoneOffset();if(0===l)return"Z";switch(t){case"X":return l9(l);case"XXXX":case"XX":return l7(l);default:return l7(l,":")}},x:function(e,t,n){let l=e.getTimezoneOffset();switch(t){case"x":return l9(l);case"xxxx":case"xx":return l7(l);default:return l7(l,":")}},O:function(e,t,n){let l=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+l8(l,":");default:return"GMT"+l7(l,":")}},z:function(e,t,n){let l=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+l8(l,":");default:return"GMT"+l7(l,":")}},t:function(e,t,n){return l2(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return l2(+e,t.length)}};function l8(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e>0?"-":"+",l=Math.abs(e),a=Math.trunc(l/60),o=l%60;return 0===o?n+String(a):n+String(a)+t+l2(o,2)}function l9(e,t){return e%60==0?(e>0?"-":"+")+l2(Math.abs(e)/60,2):l7(e,t)}function l7(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Math.abs(e);return(e>0?"-":"+")+l2(Math.trunc(n/60),2)+t+l2(n%60,2)}var ae=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},at=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},an={p:at,P:(e,t)=>{let n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return ae(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",ae(a,t)).replace("{{time}}",at(o,t))}},al=/^D+$/,aa=/^Y+$/,ao=["D","DD","YY","YYYY"],ar=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ai=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,as=/^'([^]*?)'?$/,ac=/''/g,au=/[a-zA-Z]/;function ad(e,t,n){var l,a,o,r,i,c,u,d,p,h,f,m,g,v,b,y,x,w;let j=null!=(h=null!=(p=null==n?void 0:n.locale)?p:lK.locale)?h:s.b,C=null!=(v=null!=(g=null!=(m=null!=(f=null==n?void 0:n.firstWeekContainsDate)?f:null==n||null==(a=n.locale)||null==(l=a.options)?void 0:l.firstWeekContainsDate)?m:lK.firstWeekContainsDate)?g:null==(r=lK.locale)||null==(o=r.options)?void 0:o.firstWeekContainsDate)?v:1,S=null!=(w=null!=(x=null!=(y=null!=(b=null==n?void 0:n.weekStartsOn)?b:null==n||null==(c=n.locale)||null==(i=c.options)?void 0:i.weekStartsOn)?y:lK.weekStartsOn)?x:null==(d=lK.locale)||null==(u=d.options)?void 0:u.weekStartsOn)?w:0,k=lW(e,null==n?void 0:n.in);if(!(k instanceof Date||"object"==typeof k&&"[object Date]"===Object.prototype.toString.call(k))&&"number"!=typeof k||isNaN(+lW(k)))throw RangeError("Invalid time value");let _=t.match(ai).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,an[t])(e,j.formatLong):e}).join("").match(ar).map(e=>{if("''"===e)return{isToken:!1,value:"'"};let t=e[0];if("'"===t){var n;let t;return{isToken:!1,value:(t=(n=e).match(as))?t[1].replace(ac,"'"):n}}if(l4[t])return{isToken:!0,value:e};
1if(t.match(au))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});j.localize.preprocessor&&(_=j.localize.preprocessor(k,_));let N={firstWeekContainsDate:C,weekStartsOn:S,locale:j};return _.map(l=>{if(!l.isToken)return l.value;let a=l.value;return(!(null==n?void 0:n.useAdditionalWeekYearTokens)&&aa.test(a)||!(null==n?void 0:n.useAdditionalDayOfYearTokens)&&al.test(a))&&function(e,t,n){var l,a,o;let r,i=(l=e,a=t,o=n,r="Y"===l[0]?"years":"days of the month","Use `".concat(l.toLowerCase(),"` instead of `").concat(l,"` (in `").concat(a,"`) for formatting ").concat(r," to the input `").concat(o,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(console.warn(i),ao.includes(e))throw RangeError(i)}(a,t,String(e)),(0,l4[a[0]])(k,a,j.localize,N)}).join("")}function ap(e,t){var n,l;let a="function"==typeof(n=t)&&(null==(l=n.prototype)?void 0:l.constructor)===n?new t(0):lq(t,0);return a.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),a.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),a}var ah=e=>{let{date:t,i18n:n,pattern:l,timezone:a}=e,o=new lB(new Date(t));if(a){let e=lB.tz(a),t=ap(o.withTimeZone(a),e);return n.dateFNS?ad(t,l,{locale:n.dateFNS}):"".concat(n.t("general:loading"),"...")}return n.dateFNS?ad(o,l,{locale:n.dateFNS}):"".concat(n.t("general:loading"),"...")},af=e=>{let{date:t,i18n:n}=e,l="string"==typeof t?new Date(t):t;return(null==n?void 0:n.dateFNS)?function(e,t){return function(e,t,n){var l,a,o;let r=null!=(a=null!=(l=null==n?void 0:n.locale)?l:lK.locale)?a:s.b,i=lJ(e,t);if(isNaN(i))throw RangeError("Invalid time value");let c=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:i}),[u,d]=l$(null==n?void 0:n.in,...i>0?[t,e]:[e,t]),p=(o=void 0,e=>{let t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})((lW(d)-lW(u))/1e3),h=Math.round((p-(lX(d)-lX(u))/1e3)/60),f;if(h<2)return(null==n?void 0:n.includeSeconds)?p<5?r.formatDistance("lessThanXSeconds",5,c):p<10?r.formatDistance("lessThanXSeconds",10,c):p<20?r.formatDistance("lessThanXSeconds",20,c):p<40?r.formatDistance("halfAMinute",0,c):p<60?r.formatDistance("lessThanXMinutes",1,c):r.formatDistance("xMinutes",1,c):0===h?r.formatDistance("lessThanXMinutes",1,c):r.formatDistance("xMinutes",h,c);if(h<45)return r.formatDistance("xMinutes",h,c);if(h<90)return r.formatDistance("aboutXHours",1,c);if(h<1440){let e=Math.round(h/60);return r.formatDistance("aboutXHours",e,c)}if(h<2520)return r.formatDistance("xDays",1,c);if(h<43200){let e=Math.round(h/1440);return r.formatDistance("xDays",e,c)}if(h<86400)return f=Math.round(h/43200),r.formatDistance("aboutXMonths",f,c);if((f=function(e,t,n){var l;let a,o,r,[i,s,c]=l$(void 0,e,e,t),u=lJ(s,c),d=Math.abs(function(e,t,n){let[l,a]=l$(void 0,e,t);return 12*(l.getFullYear()-a.getFullYear())+(l.getMonth()-a.getMonth())}(s,c));if(d<1)return 0;1===s.getMonth()&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-u*d);let p=lJ(s,c)===-u;+l1(a=lW(i,void 0),l)==+(r=(o=lW(a,null==l?void 0:l.in)).getMonth(),o.setFullYear(o.getFullYear(),r+1,0),o.setHours(23,59,59,999),o)&&1===d&&1===lJ(i,c)&&(p=!1);let h=u*(d-p);return 0===h?0:h}(d,u))<12){let e=Math.round(h/43200);return r.formatDistance("xMonths",e,c)}{let e=f%12,t=Math.trunc(f/12);return e<3?r.formatDistance("aboutXYears",t,c):e<9?r.formatDistance("overXYears",t,c):r.formatDistance("almostXYears",t+1,c)}}(e,l0(e),t)}(l,{locale:n.dateFNS}):"".concat(n.t("general:loading"),"...")};function am(e){return"object"==typeof e&&"root"in e}function ag(e,t){for(let n of e)"text"in n&&n.text?t+=n.text:"children"in n||(t+="[".concat(n.type,"]")),"children"in n&&n.children&&(t+=ag(n.children,t));return t}var av=e=>{var t,n,l,a,o,r,i;let s,{collectionConfig:c,data:u,dateFormat:p,fallback:h,globalConfig:f,i18n:m}=e;if(c){let e=null==c||null==(o=c.admin)?void 0:o.useAsTitle;if(e&&(s=null==u?void 0:u[e])){let t=c.fields.find(t=>"name"in t&&t.name===e),n=(null==t?void 0:t.type)==="date",l=(null==t?void 0:t.type)==="relationship";n&&(s=ah({date:s,i18n:m,pattern:"date"in t.admin&&(null==t||null==(i=t.admin)||null==(r=i.date)?void 0:r.displayFormat)||p}
1)||s),l&&(s=(e=>Array.isArray(e)?e.map(e=>"object"==typeof e&&null!==e?e.id:String(e)).filter(Boolean).join(", "):"object"==typeof e&&null!==e?e.id||"":String(e))(u[e]))}}return f&&(s=(0,d.s)(null==f?void 0:f.label,m)||(null==f?void 0:f.slug)),s&&am(s)&&(s=ag((null==(n=s.root.children)||null==(t=n[0])?void 0:t.children)||[],"")),!s&&am(h)&&(s=ag((null==(a=h.root.children)||null==(l=a[0])?void 0:l.children)||[],"")),s||(s="string"==typeof h?h:"[".concat(m.t("general:untitled"),"]")),s},ab=(0,o.createContext)({}),ay=()=>(0,o.use)(ab),ax=e=>{let{children:t}=e,{id:n,collectionSlug:l,data:a,docConfig:r,globalSlug:c,initialData:d}=aD(),{config:{admin:{dateFormat:p}}}=(0,i.c)(),{i18n:h}=(0,s.d)(),[f,m]=(0,o.useState)(()=>av({collectionConfig:l?r:void 0,data:{...d||{},id:n},dateFormat:p,fallback:null==n?void 0:n.toString(),globalConfig:c?r:void 0,i18n:h}));return(0,o.useEffect)(()=>{m(av({collectionConfig:l?r:void 0,data:{...a,id:n},dateFormat:p,fallback:null==n?void 0:n.toString(),globalConfig:c?r:void 0,i18n:h}))},[a,p,h,n,l,r,c]),(0,u.jsx)(ab,{value:{setDocumentTitle:m,title:f},children:t})},aw=(0,o.createContext)({}),aj=(e,t)=>({body:JSON.stringify({value:e}),headers:{"Accept-Language":t,"Content-Type":"application/json"}}),aC=e=>{let{children:t}=e,n=(0,o.useRef)({}),l=(0,o.useRef)({}),a=(0,o.useRef)({}),{config:r}=(0,i.c)(),{user:c}=lw(),{i18n:d}=(0,s.d)(),{routes:{api:p},serverURL:h}=r;(0,o.useEffect)(()=>{c||(l.current={})},[c]);let f=(0,o.useCallback)(async e=>{let t=l.current;if("u">typeof t[e])return t[e];let n=new Promise(t=>{(async()=>{let n=await lb.get("".concat(h).concat(p,"/payload-preferences/").concat(e),{credentials:"include",headers:{"Accept-Language":d.language}}
1),a=null;200===n.status&&(a=(await n.json()).value),l.current[e]=a,t(a)})()});return t[e]=n,n},[d.language,p,l,h]),m=(0,o.useCallback)(async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!1===n){l.current[e]=t,await lb.post("".concat(h).concat(p,"/payload-preferences/").concat(e),aj(t,d.language));return}let o=t,r=await f(e);if("object"==typeof t&&"object"==typeof r&&"object"==typeof o){if(r&&(o=function e(t,n){let l={...t};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&("object"==typeof n[a]&&!Array.isArray(n[a])&&t[a]?l[a]=e(t[a],n[a]):l[a]=n[a]);return l}(r,o)),(0,w.j)(o,r))return;a.current[e]={...a.current[e],...o}}else{if(o===r)return;a.current[e]=o}let i=async()=>{(0,w.j)(a.current[e],l.current[e])||(l.current[e]=a.current[e],await lb.post("".concat(h).concat(p,"/payload-preferences/").concat(e),aj(l.current[e],d.language)),delete a.current[e])};setTimeout(()=>{i()})},[p,f,d.language,a,h]);return n.current.getPreference=f,n.current.setPreference=m,(0,u.jsx)(aw,{value:n.current,children:t})},aS=()=>(0,o.use)(aw),ak=o.createContext({getUploadEdits:()=>{},resetUploadEdits:void 0,updateUploadEdits:void 0,uploadEdits:void 0}),a_=e=>{let t=(0,f.c)(10),{children:n,initialUploadEdits:l}=e,a;t[0]!==l?(a=l||{},t[0]=l,t[1]=a):a=t[1];let[r,i]=o.useState(a),s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i({})},t[2]=s):s=t[2];let c=s,d;t[3]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{i(t=>({...t||{},...e||{}}))},t[3]=d):d=t[3];let p=d,h;t[4]!==r?(h=()=>r,t[4]=r,t[5]=h):h=t[5];let m=h,g;return t[6]!==n||t[7]!==m||t[8]!==r?(g=(0,u.jsx)(ak,{value:{getUploadEdits:m,resetUploadEdits:c,updateUploadEdits:p,uploadEdits:r},children:n}),t[6]=n,t[7]=m,t[8]=r,t[9]=g):g=t[9],g},aN=()=>o.use(ak),aE=e=>{let{collectionSlug:t,docPermissions:n,globalSlug:l,isEditing:a}=e;return t?!!(a&&(null==n?void 0:n.update)||!a&&(null==n?void 0:n.create)):!!l&&!!(null==n?void 0:n.update)},aP=(0,o.createContext)({}),aD=()=>(0,o.use)(aP),aT=e=>{let{children:t,...n}=e,{id:l,collectionSlug:a,currentEditor:r,docPermissions:c,globalSlug:d,hasPublishedDoc:p,hasPublishPermission:h,hasSavePermission:f,initialData:m,initialState:g,isLocked:v,lastUpdateTime:b,mostRecentVersionIsAutosaved:x,unpublishedVersionCount:w,versionCount:j}=n,[C,S]=(0,i.a)(c),[k,_]=(0,i.a)(f),[N,E]=(0,i.a)(h),{permissions:P}=lw(),{config:{admin:{dateFormat:D},routes:{api:T},serverURL:R},getEntityConfig:A}=(0,i.c)(),L=A({collectionSlug:a}),O=A({globalSlug:d}),F=(0,o.useRef)(new AbortController),M=L||O,{i18n:I}=(0,s.d)(),{uploadEdits:B}=aN(),[U,z]=(0,o.useState)(()=>av({collectionConfig:L,data:{...m||{},id:l},dateFormat:D,fallback:null==l?void 0:l.toString(),globalConfig:O,i18n:I})),[V,H]=(0,o.useState)(x),[q,W]=(0,o.useState)(j),[K,Y]=(0,o.useState)(p),[G,Q]=(0,o.useState)(w),[X,$]=(0,i.a)(v),[Z,J]=(0,i.a)(r),[ee,et]=(0,i.a)(b),[en,el]=(0,i.a)(m),[ea,eo]=(0,i.a)("idle"),er=(0,o.useRef)({hasShownLockedModal:!1,isLocked:!1,user:null}),ei=(0,o.useCallback)(e=>{eo(e)},[eo]),{getPreference:es,setPreference:ec}=aS(),{code:eu}=lN(),{localeIsLoading:ed}=l_(),ep=(0,o.useMemo)(()=>void 0===g||void 0===m||ed,[m,g,ed]),eh="".concat(R).concat(T),ef,em,eg;d&&(ef=d,em="globals",eg="global-".concat(ef)),a&&(ef=a,em="collections",l&&(eg="collection-".concat(ef,"-").concat(l)));let ev=(0,o.useCallback)(async(e,t)=>{try{let n=t===d,l=await lb.get("".concat(R).concat(T,"/payload-locked-documents"),{credentials:"include",params:n?{"where[globalSlug][equals]":t}:{"where[document.relationTo][equals]":t,"where[document.value][equals]":e}}),{docs:a}=await l.json();if((null==a?void 0:a.length)>0){let e=a[0].id;await lb.delete("".concat(R).concat(T,"/payload-locked-documents/").concat(e),{credentials:"include",headers:{"Content-Type":"application/json"}}),$(!1)}}catch(e){console.error("Failed to unlock the document",e)}},[R,T,d,$]),eb=(0,o.useCallback)(async(e,t,n)=>{try{let l=t===d,a=await lb.get("".concat(R).concat(T,"/payload-locked-documents"),{credentials:"include",params:l?{"where[globalSlug][equals]":t}:{"where[document.relationTo][equals]":t,"where[document.value][equals]":e}}),{docs:o}=await a.json();if((null==o?void 0:o.length)>0){let e=o[0].id,t="object"==typeof n?{relationTo:n.collection,value:n.id}:{relationTo:"users",value:n};await lb.patch("".concat(R).concat(T,"/payload-locked-documents/").concat(e),{body:JSON.stringify({user:t}),credentials:"include",headers:{"Content-Type":"application/json"}})}}catch(e){console.error("Failed to update the document editor",e)}
1},[R,T,d]),ey=(e=>{let{id:t,api:n,collectionSlug:l,globalSlug:a,i18n:r,locale:i,permissions:s,serverURL:c,setDocPermissions:u,setHasPublishPermission:d,setHasSavePermission:p}=e;return o.useCallback(async e=>{let o={locale:i||void 0},h=(null==e?void 0:e.id)||t,f=(e=>{let{id:t,collectionSlug:n,globalSlug:l}=e;return!!(l||n&&t)})({id:h,collectionSlug:l,globalSlug:a});if(f){let t=l?"/".concat(l,"/access/").concat(h):a?"/globals/".concat(a,"/access"):null;if(t){let i=await (await fetch("".concat(c).concat(n).concat(t,"?").concat(y.A(o)),{body:JSON.stringify({...e||{},_status:"draft"}),credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"post"})).json(),s=await fetch("".concat(c).concat(n).concat(t,"?").concat(y.A(o)),{body:JSON.stringify({...e||{},_status:"published"}),credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"POST"}).then(e=>e.json());u(i),p(aE({collectionSlug:l,docPermissions:i,globalSlug:a,isEditing:f})),d(null==s?void 0:s.update)}}else{var m,g;let e=l?null==s||null==(m=s.collections)?void 0:m[l]:null==s||null==(g=s.globals)?void 0:g[a];u(e),p(aE({collectionSlug:l,docPermissions:e,globalSlug:a,isEditing:f}))}},[i,t,l,a,c,n,r.language,u,p,d,null==s?void 0:s.collections,null==s?void 0:s.globals])})({id:l,api:T,collectionSlug:a,globalSlug:d,i18n:I,locale:eu,permissions:P,serverURL:R,setDocPermissions:S,setHasPublishPermission:E,setHasSavePermission:_}),ex=(0,o.useCallback)(()=>es(eg),[es,eg]),ew=(0,o.useCallback)(async(e,t)=>{let n=await ex();if(eg)try{var l;await ec(eg,{...n,fields:{...(null==n?void 0:n.fields)||{},[e]:{...null==n||null==(l=n.fields)?void 0:l[e],...t}}})}catch(e){console.error(e)}},[ec,eg,ex]),ej=(0,o.useCallback)(()=>{let e=q+1;L&&L.versions?L.versions.maxPerDoc>0?W(Math.min(e,L.versions.maxPerDoc)):W(e):O&&O.versions&&(O.versions.max>0?W(Math.min(e,O.versions.max)):W(e))},[L,O,q]);(0,o.useEffect)(()=>{z(av({collectionConfig:L,data:{...en,id:l},dateFormat:D,fallback:null==l?void 0:l.toString(),globalConfig:O,i18n:I}))},[L,O,en,D,I,l]),(0,o.useEffect)(()=>{let e=F.current;return()=>{if(e)try{e.abort()}catch(e){}}},[]);let eC=o.useMemo(()=>"".concat("".concat(eh).concat("globals"===em?"/globals":"","/").concat(ef).concat(l?"/".concat(l):"")).concat(y.A({depth:0,"fallback-locale":"null",locale:eu,uploadEdits:B||void 0},{addQueryPrefix:!0})),[eh,eu,em,l,ef,B]),eS={...n,action:eC,currentEditor:Z,data:en,docConfig:M,docPermissions:C,documentIsLocked:X,documentLockState:er,getDocPermissions:ey,getDocPreferences:ex,hasPublishedDoc:K,hasPublishPermission:N,hasSavePermission:k,incrementVersionCount:ej,initialData:m,initialState:g,isInitializing:ep,lastUpdateTime:ee,mostRecentVersionIsAutosaved:V,preferencesKey:eg,savedDocumentData:en,setCurrentEditor:J,setData:el,setDocFieldPreferences:ew,setDocumentIsLocked:$,setDocumentTitle:z,setHasPublishedDoc:Y,setLastUpdateTime:et,setMostRecentVersionIsAutosaved:H,setUnpublishedVersionCount:Q,setUploadStatus:ei,title:U,unlockDocument:ev,unpublishedVersionCount:G,updateDocumentEditor:eb,updateSavedDocumentData:el,uploadStatus:ea,versionCount:q};return(0,u.jsx)(aP,{value:eS,children:(0,u.jsx)(ax,{children:t})})},aR=e=>(0,u.jsx)(a_,{children:(0,u.jsx)(aT,{...e})}),aA=(0,o.createContext)(""),aL=e=>{let{children:t,operation:n}=e;return(0,u.jsx)(aA,{value:n,children:t})},aO=()=>(0,o.use)(aA),aF=o.createContext(void 0),aM=()=>{let e=o.useContext(aF);if(e)return e},aI=o.createContext(void 0),aB=e=>{let t=aM(),n=o.use(aI),l=o.useRef(null);if(null===l.current){let a=(null==e?void 0:e.path)||t||e.potentiallyStalePath;l.current=!!(n&&a&&n.path===a)}if(!0===l.current){if(!n)throw Error("FieldContext was removed after mount. This breaks hook ordering.");return n}return(e=>{let t=(0,f.c)(65),n;t[0]!==e?(n=e||{},t[0]=e,t[1]=n):n=t[1];let{disableFormData:l,hasRows:a,path:r,potentiallyStalePath:c,validate:u}=n,d=void 0!==l&&l,p=aM(),h=r||p||c,m=eR(),g=eA(),v=eF(),{user:b}=lw(),{id:y,collectionSlug:x}=aD(),w=aO(),j=eM(aU),C;t[2]!==h?(C=e=>{let[t]=e;return t&&(null==t?void 0:t[h])||null},t[2]=h,t[3]=C):C=t[3];let S=eM(C),{t:k}=(0,s.d)(),{config:_}=(0,i.c)(),{getData:N,getDataByPath:E,getSiblingData:P,setModified:D}=eP(),T=eD(),R=null==S?void 0:S.filterOptions,A=null==S?void 0:S.value,L=null==S?void 0:S.initialValue,O="boolean"!=typeof(null==S?void 0:S.valid)||S.val
1id,F=!1===O&&m,M=(0,o.useRef)(O),I=(0,o.useRef)(null==S?void 0:S.errorMessage),B;t[4]!==h?(B=h?h.split("."):[],t[4]=h,t[5]=B):B=t[5];let U=B,z;t[6]!==d||t[7]!==j||t[8]!==a||t[9]!==h||t[10]!==D?(z=(e,t)=>{let n=e&&"object"==typeof e&&"function"==typeof e.preventDefault&&"function"==typeof e.stopPropagation?e.target.value:e;j({type:"UPDATE",disableFormData:d||a&&n>0,path:h,value:n}),void 0!==t&&t||D(!0)},t[6]=d,t[7]=j,t[8]=a,t[9]=h,t[10]=D,t[11]=z):z=t[11];let V=z,H=null==S?void 0:S.blocksFilterOptions,q=null==S?void 0:S.customComponents,W=g||v,K=null==S?void 0:S.errorMessage,Y;t[12]!==(null==S?void 0:S.errorPaths)?(Y=(null==S?void 0:S.errorPaths)||[],t[12]=null==S?void 0:S.errorPaths,t[13]=Y):Y=t[13];let G=null==S?void 0:S.rows,Q=null==S?void 0:S.selectFilterOptions,X=null==S?void 0:S.valid,$;t[14]!==R||t[15]!==L||t[16]!==v||t[17]!==h||t[18]!==g||t[19]!==V||t[20]!==F||t[21]!==m||t[22]!==G||t[23]!==Q||t[24]!==X||t[25]!==H||t[26]!==q||t[27]!==W||t[28]!==K||t[29]!==Y||t[30]!==A?($={blocksFilterOptions:H,customComponents:q,disabled:W,errorMessage:K,errorPaths:Y,filterOptions:R,formInitializing:v,formProcessing:g,formSubmitted:m,initialValue:L,path:h,rows:G,selectFilterOptions:Q,setValue:V,showError:F,valid:X,value:A},t[14]=R,t[15]=L,t[16]=v,t[17]=h,t[18]=g,t[19]=V,t[20]=F,t[21]=m,t[22]=G,t[23]=Q,t[24]=X,t[25]=H,t[26]=q,t[27]=W,t[28]=K,t[29]=Y,t[30]=A,t[31]=$):$=t[31];let Z=$,J;t[32]!==x||t[33]!==_||t[34]!==d||t[35]!==j||t[36]!==T||t[37]!==S||t[38]!==N||t[39]!==E||t[40]!==P||t[41]!==a||t[42]!==y||t[43]!==w||t[44]!==h||t[45]!==U||t[46]!==k||t[47]!==b||t[48]!==u||t[49]!==A?(J=()=>{(async()=>{let e=A;(null==S?void 0:S.rows)&&Array.isArray(S.rows)&&(e=E(h));let t=I.current,n=M.current,l=N(),o="function"==typeof u?await u(e,{id:y,blockData:void 0,collectionSlug:x,data:(null==T?void 0:T.getData)?T.getData():l,event:"onChange",operation:w,path:U,preferences:{},req:{payload:{config:_},t:k,user:b},siblingData:P(h)}):"string"==typeof I.current?I.current:M.current;if("string"==typeof o?(n=!1,t=o):"boolean"==typeof o&&(n=o,t=void 0),n!==M.current||t!==I.current){M.current=n,I.current=t;let e={type:"UPDATE",errorMessage:t,path:h,rows:null==S?void 0:S.rows,valid:n,validate:u,value:A};(d||a&&"number"==typeof A&&A>0)&&(e.disableFormData=!0),"function"==typeof j&&j(e)}})()},t[32]=x,t[33]=_,t[34]=d,t[35]=j,t[36]=T,t[37]=S,t[38]=N,t[39]=E,t[40]=P,t[41]=a,t[42]=y,t[43]=w,t[44]=h,t[45]=U,t[46]=k,t[47]=b,t[48]=u,t[49]=A,t[50]=J):J=t[50];let ee=null==S?void 0:S.rows,et;return t[51]!==x||t[52]!==d||t[53]!==j||t[54]!==N||t[55]!==E||t[56]!==P||t[57]!==y||t[58]!==w||t[59]!==h||t[60]!==ee||t[61]!==b||t[62]!==u||t[63]!==A?(et=[A,d,j,N,P,E,y,w,h,b,u,ee,x],t[51]=x,t[52]=d,t[53]=j,t[54]=N,t[55]=E,t[56]=P,t[57]=y,t[58]=w,t[59]=h,t[60]=ee,t[61]=b,t[62]=u,t[63]=A,t[64]=et):et=t[64],lA(J,150,et),Z})(e)};function aU(e){let[,t]=e;return t}var az=e=>{let t=(0,f.c)(2),{children:n,path:l}=e,a;t[0]!==l?(a=e=>{let[t]=e;return t&&(null==t?void 0:t[l])||null},t[0]=l,t[1]=a):a=t[1];let{passesCondition:o}=eM(a)||{};return!1===o?null:n},aV=e=>t=>{let{path:n}=t;return(0,u.jsx)(az,{path:n,children:(0,u.jsx)(e,{...t})})},aH=e=>{var t,n,l,a;return{...(null==e||null==(t=e.admin)?void 0:t.style)||{},...(null==e||null==(n=e.admin)?void 0:n.width)?{"--field-width":e.admin.width}:{flex:"1 1 auto"},...(null==e||null==(a=e.admin)||null==(l=a.style)?void 0:l.flex)?{flex:e.admin.style.flex}:{}}},aq="field-type";function aW(e){let{fieldLocalized:t,fieldRTL:n,locale:l,localizationConfig:a}=e,o=l&&a&&a.locales&&a.locales.length>1,r=(null==l?void 0:l.code)===(null==a?void 0:a.defaultLocale);return!1!==n&&(null==l?void 0:l.rtl)===!0&&(t||!t&&!o||!t&&r)||!0===n}var aK=()=>(0,u.jsx)("svg",{className:"icon icon--check",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M15.3333 6.00001L8.00001 13.3333L4.66667 10",strokeLinecap:"square"})}),aY=()=>(0,u.jsx)("svg",{className:"icon icon--line",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M5.33333 10H14.6667",strokeLinecap:"square"})}),aG="checkbox-input",aQ=e=>{let t=(0,f.c)(22),{id:n,name:l,AfterInput:a,BeforeInput:r,checked:i,className:s,inputRef:c,Label:d,label:p,localized:h,onToggle:m,partialChecked:g,readOnly:v,required:b}=e,y=(0,o.useId)(),x=n||y,w=i&&"".concat(aG,"--checked"),j=v&&"".concat(aG,"--read-only"),C;
1t[0]!==s||t[1]!==w||t[2]!==j?(C=[s,aG,w,j].filter(Boolean),t[0]=s,t[1]=w,t[2]=j,t[3]=C):C=t[3];let S=C.join(" "),k=!!i,_;if(t[4]!==a||t[5]!==r||t[6]!==d||t[7]!==i||t[8]!==x||t[9]!==c||t[10]!==p||t[11]!==h||t[12]!==l||t[13]!==m||t[14]!==g||t[15]!==v||t[16]!==b||t[17]!==S||t[18]!==k){let e=(0,u.jsx)("input",{"aria-label":"","aria-labelledby":l,defaultChecked:k,disabled:v,id:x,name:l,onInput:m,ref:c,required:b,title:l,type:"checkbox"}),n=!i&&g?"partial":"check",o;t[20]!==n?(o=["".concat(aG,"__icon"),n].filter(Boolean),t[20]=n,t[21]=o):o=t[21],_=(0,u.jsxs)("div",{className:S,children:[(0,u.jsxs)("div",{className:"".concat(aG,"__input"),children:[r,e,(0,u.jsxs)("span",{className:o.join(" "),children:[i&&(0,u.jsx)(aK,{}),!i&&g&&(0,u.jsx)(aY,{})]}),a]}),(0,u.jsx)(ep,{CustomComponent:d,Fallback:(0,u.jsx)(lD,{htmlFor:x,label:p,localized:h,required:b})})]}),t[4]=a,t[5]=r,t[6]=d,t[7]=i,t[8]=x,t[9]=c,t[10]=p,t[11]=h,t[12]=l,t[13]=m,t[14]=g,t[15]=v,t[16]=b,t[17]=S,t[18]=k,t[19]=_}else _=t[19];return _},aX="checkbox",a$=aV(e=>{let{id:t,checked:n,disableFormData:l,field:a,field:{admin:{className:r,description:i}={},label:c,required:d}={},onChange:p,partialChecked:h,path:f,readOnly:m,validate:g}=e,{uuid:v}=eP(),b=ns(),{i18n:{language:y}}=(0,s.d)(),w=x.aG.includes(y),{customComponents:{AfterInput:j,BeforeInput:C,Description:S,Error:k,Label:_}={},disabled:N,path:E,setValue:P,showError:D,value:T}=aB({disableFormData:l,potentiallyStalePath:f,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof g)return g(e,{...t,required:d})},[g,d])}),R=(0,o.useCallback)(()=>{m||(P(!T),"function"==typeof p&&p(!T))},[p,m,P,T]),A=n||!!T,L=t||lP(E,b,v),O=(0,o.useMemo)(()=>aH(a),[a]);return(0,u.jsxs)("div",{className:[aq,aX,D&&"error",r,T&&"".concat(aX,"--checked"),(m||N)&&"".concat(aX,"--read-only")].filter(Boolean).join(" "),style:O,children:[(0,u.jsx)(ep,{CustomComponent:k,Fallback:(0,u.jsx)(no,{alignCaret:w?"right":"left",path:E,showError:D})}),(0,u.jsx)(aQ,{AfterInput:j,BeforeInput:C,checked:A,id:L,inputRef:null,Label:_,label:c,name:E,onToggle:R,partialChecked:h,readOnly:m||N,required:d}),(0,u.jsx)(ep,{CustomComponent:S,Fallback:(0,u.jsx)(na,{description:i,path:E})})]})}),aZ=e=>{let t,n,l=(0,f.c)(13),{fieldValue:a,localized:r,path:c,readOnly:d}=e,p=void 0!==d&&d,{code:h}=lN(),{config:m}=(0,i.c)(),{localization:g}=m,[v,b]=o.useState("number"!=typeof a),{t:y}=(0,s.d)(),{dispatchFields:x,setModified:w}=eP();if(!r||!g||g.defaultLocale===h||!g.fallback)return null;l[0]!==v||l[1]!==x||l[2]!==a||l[3]!==c||l[4]!==w?(t=()=>{let e=!v;x({type:"UPDATE",path:c,value:e?null:a||0}),w(!0),b(e)},l[0]=v,l[1]=x,l[2]=a,l[3]=c,l[4]=w,l[5]=t):t=l[5];let j=t;if(a){let e=!1;if("number"==typeof a&&a>0&&(e=!0),Array.isArray(a)&&a.length>0&&(e=!0),e)return v&&b(!1),null}return l[6]!==v||l[7]!==a||l[8]!==j||l[9]!==c||l[10]!==p||l[11]!==y?(n=(0,u.jsx)(tl,{className:"nullify-locale-field",children:!a&&p?y("general:fallbackToDefaultLocale"):(0,u.jsx)(a$,{checked:v,field:{name:"",label:y("general:fallbackToDefaultLocale")},id:"field-".concat(c.replace(/\./g,"__")),onChange:j,path:c,schemaPath:""})}),l[6]=v,l[7]=a,l[8]=j,l[9]=c,l[10]=p,l[11]=y,l[12]=n):n=l[12],n},aJ=e=>{let t=document.getElementById(e);if(t){let e=t.getBoundingClientRect();window.scrollBy({behavior:"smooth",top:e.top-100})}},a0="array-actions",a1=e=>{let t=(0,f.c)(12),{addRow:n,copyRow:l,duplicateRow:a,hasMaxRows:r,index:i,isSortable:c,moveRow:d,pasteRow:p,removeRow:h,rowCount:m}=e,{t:g}=(0,s.d)(),v;return t[0]!==n||t[1]!==l||t[2]!==a||t[3]!==r||t[4]!==i||t[5]!==c||t[6]!==d||t[7]!==p||t[8]!==h||t[9]!==m||t[10]!==g?(v=(0,u.jsx)(t_,{button:(0,u.jsx)(tO,{}),buttonClassName:"".concat(a0,"__button"),className:a0,horizontalAlign:"center",render:e=>{let{close:t}=e;return(0,u.jsxs)(tc.ButtonGroup,{buttonSize:"small",children:[c&&0!==i&&(0,u.jsxs)(tc.Button,{className:"".concat(a0,"__action ").concat(a0,"__move-up"),onClick:()=>{d(i,i-1),t()},children:[(0,u.jsx)("div",{className:"".concat(a0,"__action-chevron"),children:(0,u.jsx)(ta,{direction:"up"})}),g("general:moveUp")]}),c&&i<m-1&&(0,u.jsxs)(tc.Button,{className:"".concat(a0,"__action"),onClick:()=>{d(i,i+1),t()},children:[(0,u.jsx)("div",{className:"".concat(a0,"__action-chevron"),children:(0,u.jsx)(ta,{})}),g("general:moveDown")]}),!r&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)(tc.Button,{className:"".concat(a0,"__action ").concat(a0,"__add"),onClick:()=>{n(i+1),t()},children:[(0,u.jsx)(ti,{}),g("general:addBelow")]}),(0,u.jsxs)(tc.Button,{className:"".concat(a0,"__action ").concat(a0,"__duplicate"),onClick:()=>{a(i),t()},children:[(0,u.jsx)(tF,{}),g("general:duplicate")]})]}),(0,u.jsx)(tc.Button,{className:"".concat(a0,"__action ").concat(a0,"__copy"),onClick:()=>{l(i),t()},children:(0,u.jsx)(tM,{isRow:!0})}),(0,u.jsx)(tc.Button,{className:"".concat(a0,"__action ").concat(a0,"__paste"),onClick:()=>{p(i),t()},children:(0,u.jsx)(tM,{isPaste:!0,isRow:!0})}),(0,u.jsxs)(tc.Button,{className:"".concat(a0,"__action ").concat(a0,"__remove"),onClick:()=>{h(i),t()},children:[(0,u.jsx)(s.a,{}),g("general:remove")]})]})},size:"medium"}),t[0]=n,t[1]=l,t[2]=a,t[3]=r,t[4]=i,t[5]=c,t[6]=d,t[7]=p,t[8]=h,t[9]=m,t[10]=g,t[11]=v):v=t[11],v},a3=e=>{let{className:t}=e;return(0,u.jsxs)("svg",{className:["icon icon--drag-handle",t].filter(
1Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{className:"fill",d:"M7.99999 10.6667C8.36818 10.6667 8.66666 10.3682 8.66666 9.99999C8.66666 9.6318 8.36818 9.33332 7.99999 9.33332C7.63181 9.33332 7.33333 9.6318 7.33333 9.99999C7.33333 10.3682 7.63181 10.6667 7.99999 10.6667Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M7.99999 5.99999C8.36818 5.99999 8.66666 5.70151 8.66666 5.33332C8.66666 4.96513 8.36818 4.66666 7.99999 4.66666C7.63181 4.66666 7.33333 4.96513 7.33333 5.33332C7.33333 5.70151 7.63181 5.99999 7.99999 5.99999Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M7.99999 15.3333C8.36818 15.3333 8.66666 15.0348 8.66666 14.6667C8.66666 14.2985 8.36818 14 7.99999 14C7.63181 14 7.33333 14.2985 7.33333 14.6667C7.33333 15.0348 7.63181 15.3333 7.99999 15.3333Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M12 10.6667C12.3682 10.6667 12.6667 10.3682 12.6667 9.99999C12.6667 9.6318 12.3682 9.33332 12 9.33332C11.6318 9.33332 11.3333 9.6318 11.3333 9.99999C11.3333 10.3682 11.6318 10.6667 12 10.6667Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M12 5.99999C12.3682 5.99999 12.6667 5.70151 12.6667 5.33332C12.6667 4.96513 12.3682 4.66666 12 4.66666C11.6318 4.66666 11.3333 4.96513 11.3333 5.33332C11.3333 5.70151 11.6318 5.99999 12 5.99999Z",strokeLinecap:"square"}),(0,u.jsx)("path",{className:"fill",d:"M12 15.3333C12.3682 15.3333 12.6667 15.0348 12.6667 14.6667C12.6667 14.2985 12.3682 14 12 14C11.6318 14 11.3333 14.2985 11.3333 14.6667C11.3333 15.0348 11.6318 15.3333 12 15.3333Z",strokeLinecap:"square"})]})},a2=e=>{let{id:t,children:n,className:l,duration:a=300,height:r}=e,[i,s]=o.useState(()=>!!r),c=(0,o.useRef)(i),[d,p]=o.useState(()=>i?"":"none"),[h,f]=o.useState(()=>i?"":"hidden"),[m,g]=o.useState(!1),v=(0,o.useRef)(null),b=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let e,t,n=!!r,l=c.current!==n;return c.current=n,l&&(g(!0),f("hidden"),n?p(""):e=window.setTimeout(()=>{p("none")},a),s(n),t=window.setTimeout(()=>{f(""),g(!1)},a)),()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[r,a]),(e=>{let{containerRef:t,contentRef:n,duration:l,open:a}=e,r=(0,o.useMemo)(()=>!!("u">typeof CSS&&CSS)&&!!CSS.supports&&CSS.supports("interpolate-size","allow-keywords"),[]),i=(0,o.useRef)(!1),s=(0,o.useRef)(a),[c,u]=(0,o.useState)(!1),d=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let e=t.current,o=n.current;if(!e||!o||r)return;let p=t=>{e.style.height=t};return(()=>{if(!i.current&&a){p("auto"),u(!1);return}i.current=!0,s.current!==a&&p(a?"0px":"".concat(o.scrollHeight,"px")),e.offsetHeight,u(!0),e.style.transition="height ".concat(l,"ms ease"),p(a?"".concat(o.scrollHeight,"px"):"0px");let t=()=>{e&&(e.style.transition="",e.style.height=a?"auto":"0px",u(!1)),e.removeEventListener("transitionend",t)};e.addEventListener("transitionend",t)})(),s.current=a,d.current=new ResizeObserver(()=>{c&&(e.style.height=a?"".concat(o.scrollHeight,"px"):"0px")}),d.current.observe(o),()=>{var t;e&&(e.style.transition="",e.style.height=""),null==(t=d.current)||t.disconnect()}},[a,l,t,n,r])})({containerRef:v,contentRef:b,duration:a,open:i}),(0,u.jsx)("div",{"aria-hidden":!i,className:[l,"rah-static",i&&"auto"===r&&"rah-static--height-auto",m&&"rah-animating--".concat(i?"down":"up"),m&&"auto"===r&&"rah-animating--to-height-auto"].filter(Boolean).join(" "),id:t,ref:v,style:{overflow:h,transition:"height ".concat(a,"ms ease")},children:(0,u.jsx)("div",{ref:b,...d?{style:{display:d}}:{},children:n})})},a6=(0,o.createContext)({isCollapsed:void 0,isVisible:void 0,isWithinCollapsible:void 0,toggle:()=>{}}),a5=e=>{let{children:t,isCollapsed:n,isWithinCollapsible:l=!0,toggle:a}=e,{isCollapsed:r,isVisible:i}=a4(),s=o.useMemo(()=>({isCollapsed:n,isVisible:i&&!r,isWithinCollapsible:l,toggle:a}),[n,l,a,r,i]);return(0,u.jsx)(a6,{value:s,children:t})},a4=()=>(0,o.use)(a6),a8="collapsible",a9=e=>{let t,n=(0,f.c)(25),{actions:l,AfterCollapsible:a,children:r,className:i,collapsibleStyle:c,disableHeaderToggle:d,disableToggleIndicator:p,dragHandleProps:h,header:m,initCollapsed:g,isCollapsed:v,onToggle:b}=e,y=void 0!==d&&d,x=void 0!==p&&p,[w,j]=(0,o.useState)(!!g),[C,S]=(0,o.useState)(!1),{isWithinCollapsible:k}=a4(),{t:_}=(0,s.d)(),N="boolean"==typeof v?v:w,E;n[0]!==N||n[1]!==b?(E=()=>{"function"==typeof b&&b(!N),j(!N)},n[0]=N,n[1]=b,n[2]=E):E=n[2];let P=E,D=h&&"".concat(a8,"--has-drag-handle"),T=N&&"".concat(a8,"--collapsed"),R=k&&"".concat(a8,"--nested"),A=C&&!y&&"".concat(a8,"--hovered"),L="".concat(a8,"--style-").concat(void 0===c?"default":c),O;n[3]!==i||n[4]!==D||n[5]!==T||n[6]!==R||n[7]!==A||n[8]!==L?(O=[a8,i,D,T,R,A,L].filter(
1Boolean),n[3]=i,n[4]=D,n[5]=T,n[6]=R,n[7]=A,n[8]=L,n[9]=O):O=n[9];let F=O.join(" "),M="".concat(a8,"__toggle-wrap").concat(y?" toggle-disabled":""),I,B;return n[10]===Symbol.for("react.memo_cache_sentinel")?(I=()=>S(!0),B=()=>S(!1),n[10]=I,n[11]=B):(I=n[10],B=n[11]),n[12]!==a||n[13]!==l||n[14]!==r||n[15]!==y||n[16]!==x||n[17]!==h||n[18]!==m||n[19]!==N||n[20]!==_||n[21]!==F||n[22]!==M||n[23]!==P?(t=(0,u.jsx)("div",{className:F,children:(0,u.jsxs)(a5,{isCollapsed:N,toggle:P,children:[(0,u.jsxs)("div",{className:M,onMouseEnter:I,onMouseLeave:B,children:[!y&&(0,u.jsx)("button",{className:["".concat(a8,"__toggle"),"".concat(a8,"__toggle--").concat(N?"collapsed":"open")].filter(Boolean).join(" "),onClick:P,type:"button",children:(0,u.jsx)("span",{children:_("fields:toggleBlock")})}),h&&(0,u.jsx)("div",{className:"".concat(a8,"__drag"),...h.attributes,...h.listeners,children:(0,u.jsx)(a3,{})}),m?(0,u.jsx)("div",{className:["".concat(a8,"__header-wrap"),h&&"".concat(a8,"__header-wrap--has-drag-handle")].filter(Boolean).join(" "),children:m}):null,(0,u.jsxs)("div",{className:"".concat(a8,"__actions-wrap"),children:[l?(0,u.jsx)("div",{className:"".concat(a8,"__actions"),children:l}):null,!x&&(0,u.jsx)("div",{className:"".concat(a8,"__indicator"),children:(0,u.jsx)(ta,{direction:N?void 0:"up"})})]})]}),(0,u.jsx)(a2,{height:N?0:"auto",children:(0,u.jsx)("div",{className:"".concat(a8,"__content"),children:r})}),a]})}),n[12]=a,n[13]=l,n[14]=r,n[15]=y,n[16]=x,n[17]=h,n[18]=m,n[19]=N,n[20]=_,n[21]=F,n[22]=M,n[23]=P,n[24]=t):t=n[24],t},a7=e=>{var t;let n=(0,f.c)(9),{children:l,className:a,forceRender:r}=e,[i,s]=o.useState(!!r),c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c={rootMargin:"1000px"},n[0]=c):c=n[0];let[d,p]=tj(c,!!r),h=!!(null==p?void 0:p.isIntersecting),m=(null==p||null==(t=p.boundingClientRect)?void 0:t.top)<0,g=r||h||m,v,b;n[1]!==i||n[2]!==g?(v=()=>{g&&!i&&s(!0)},b=[g,i],n[1]=i,n[2]=g,n[3]=v,n[4]=b):(v=n[3],b=n[4]),o.useEffect(v,b);let y=i?l:null,x;return n[5]!==a||n[6]!==d||n[7]!==y?(x=(0,u.jsx)("div",{className:a,ref:d,children:y}),n[5]=a,n[6]=d,n[7]=y,n[8]=x):x=n[8],x},oe="pill",ot=e=>{let t=(0,f.c)(12),{id:n,className:l}=e,a;t[0]!==n?(a={id:n},t[0]=n,t[1]=a):a=t[1];let{attributes:o,isDragging:r,listeners:i,setNodeRef:s,transform:c}=t9(a),d=r&&"".concat(oe,"--is-dragging"),p;t[2]!==l||t[3]!==d?(p=[d,l].filter(Boolean),t[2]=l,t[3]=d,t[4]=p):p=t[4];let h=p.join(" "),m;return t[5]!==o||t[6]!==i||t[7]!==e||t[8]!==s||t[9]!==h||t[10]!==c?(m=(0,u.jsx)(on,{...e,className:h,elementProps:{...i,...o,ref:s,style:{transform:c}}}),t[5]=o,t[6]=i,t[7]=e,t[8]=s,t[9]=h,t[10]=c,t[11]=m):m=t[11],m},on=e=>{let{id:t,alignIcon:n="right","aria-checked":l,"aria-controls":a,"aria-expanded":o,"aria-label":r,children:i,className:s,draggable:c,elementProps:d,icon:p,onClick:h,pillStyle:f="light",rounded:m,size:g="medium",to:v}=e,b=[oe,"".concat(oe,"--style-").concat(f),"".concat(oe,"--size-").concat(g),s&&s,v&&"".concat(oe,"--has-link"),(v||h)&&"".concat(oe,"--has-action"),p&&"".concat(oe,"--has-icon"),p&&"".concat(oe,"--align-icon-").concat(n),c&&"".concat(oe,"--draggable"),m&&"".concat(oe,"--rounded")].filter(Boolean).join(" "),y="div";return h&&!v&&(y="button"),v&&(y=tt),(0,u.jsxs)(y,{...d,"aria-checked":l,"aria-controls":a,"aria-expanded":o,"aria-label":r,className:b,href:v||null,id:t,onClick:h,type:"button"===y?"button":void 0,children:[(0,u.jsx)("span",{className:"".concat(oe,"__label"),children:i}),!!p&&(0,u.jsx)("span",{className:"".concat(oe,"__icon"),children:p})]})},ol=e=>{let{draggable:t}=e;return t?(0,u.jsx)(ot,{...e}):(0,u.jsx)(on,{...e})};function oa(e,t){let[n,l]=(0,o.useState)(e);return(0,o.useEffect)(()=>{let n=setTimeout(()=>{l(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var oo="thumbnail-card",or=e=>{let t=(0,f.c)(13),{alignLabel:n,className:l,collection:a,doc:o,label:r,onClick:c,thumbnail:d}=e,{config:p}=(0,i.c)(),{i18n:h}=(0,s.d)(),m="function"==typeof c&&"".concat(oo,"--has-on-click"),g=n&&"".concat(oo,"--align-label-").concat(n),v;t[0]!==l||t[1]!==m||t[2]!==g?(v=[oo,l,m,g].filter(Boolean),t[0]=l,t[1]=m,t[2]=g,t[3]=v):v=t[3];let b=v.join(" "),y;if(t[4]!==b||t[5]!==a||t[6]!==p||t[7]!==o||t[8]!==h||t[9]!==r||t[10]!==c||t[11]!==d){let e=r;e||(e=av({collectionConfig:a,data:o,dateFormat:p.admin.dateFormat,fallback:null==o?void 0:o.filename,i18n:h})),y=(0,u.jsxs)("button",{className:b,onClick:c,title:e,type:"button",children:[(0,u.jsx)("div",{className:"".concat(oo,"__thumbnail"),children:d}),(0,u.jsx)("div",{className:"".concat(oo,"__label"),children:e})]}),t[4]=b,t[5]=a,t[6]=p,t[7]=o,t[8]=h,t[9]=r,t[10]=c,t[11]=d,t[12]=y}else y=t[12];return y},oi=[];for(os=0;os<256;++os)oi.push((os+256).toString(16).slice(1));
1var os,oc,ou=new Uint8Array(16),od={randomUUID:"u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},op=function(e,t,n){if(od.randomUUID&&!t&&!e)return od.randomUUID();var l=(e=e||{}).random||(e.rng||function(){if(!oc&&!(oc="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oc(ou)})();if(l[6]=15&l[6]|64,l[8]=63&l[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=l[a];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(oi[e[t+0]]+oi[e[t+1]]+oi[e[t+2]]+oi[e[t+3]]+"-"+oi[e[t+4]]+oi[e[t+5]]+"-"+oi[e[t+6]]+oi[e[t+7]]+"-"+oi[e[t+8]]+oi[e[t+9]]+"-"+oi[e[t+10]]+oi[e[t+11]]+oi[e[t+12]]+oi[e[t+13]]+oi[e[t+14]]+oi[e[t+15]]).toLowerCase()}(l)},oh=()=>{let[e]=(0,o.useState)(()=>"pattern".concat(op()));return(0,u.jsxs)("svg",{fill:"none",height:"151",preserveAspectRatio:"xMidYMid slice",viewBox:"0 0 231 151",width:"231",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsxs)("g",{clipPath:"url(#".concat(e,")"),children:[(0,u.jsx)("rect",{fill:"#D9D9D9",height:"100%",rx:"2",width:"100%"}),(0,u.jsx)("rect",{fill:"#BCBCBC",height:"116.063",transform:"rotate(52.0687 33.7051 79.3051)",width:"85.8593",x:"33.7051",y:"79.3051"}),(0,u.jsx)("rect",{fill:"#BCBCBC",height:"116.063",transform:"rotate(52.0687 86.1219 92.6272)",width:"85.8593",x:"86.1219",y:"92.6272"}),(0,u.jsx)("circle",{cx:"189",cy:"45",fill:"#BCBCBC",r:"19"}),(0,u.jsx)("rect",{fill:"#B8B8B8",height:"5",rx:"2.5",width:"98",x:"66",y:"70"}),(0,u.jsx)("rect",{fill:"#B8B8B8",height:"5",rx:"2.5",width:"76",x:"77",y:"82"})]}),(0,u.jsx)("defs",{children:(0,u.jsx)("clipPath",{id:"".concat(e),children:(0,u.jsx)("rect",{fill:"white",height:"151",width:"231"})})})]})},of=()=>(0,u.jsx)("svg",{className:"icon icon--search",fill:"none",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M16 16L13.1333 13.1333M14.6667 9.33333C14.6667 12.2789 12.2789 14.6667 9.33333 14.6667C6.38781 14.6667 4 12.2789 4 9.33333C4 6.38781 6.38781 4 9.33333 4C12.2789 4 14.6667 6.38781 14.6667 9.33333Z",strokeLinecap:"square"})}),om="block-search",og=e=>{let t=(0,f.c)(5),{setSearchTerm:n}=e,{t:l}=(0,s.d)(),a;t[0]!==n?(a=e=>{n(e.target.value)},t[0]=n,t[1]=a):a=t[1];let o=a,r;return t[2]!==o||t[3]!==l?(r=(0,u.jsxs)("div",{className:om,children:[(0,u.jsx)("input",{className:"".concat(om,"__input"),onChange:o,placeholder:l("fields:searchForBlock")}),(0,u.jsx)(of,{})]}),t[2]=o,t[3]=l,t[4]=r):r=t[4],r},ov="blocks-drawer",ob=e=>{let{blocks:t,onSelect:n,searchTerm:l}=e,[a,r]=(0,i.a)(null!=l?l:""),[c,p]=(0,o.useState)(t),{i18n:h}=(0,s.d)(),{config:f}=(0,i.c)(),m=(0,o.useMemo)(()=>{let e={_none:[]};return c.forEach(t=>{var n;if("object"==typeof t&&(null==(n=t.admin)?void 0:n.group)){let n=t.admin.group,l="string"==typeof n?n:(0,d.s)(n,h);Object.hasOwn(e,l)?e[l].push(t):e[l]=[t]}else e._none.push(t)}),e},[c,h]);return(0,o.useEffect)(()=>{let e=a.toLowerCase();p(null==t?void 0:t.reduce((t,n)=>{let l="string"==typeof n?f.blocksMap[n]:n;return((e,t)=>"string"==typeof e.labels.singular?e.labels.singular.toLowerCase():"object"==typeof e.labels.singular?(0,d.s)(e.labels.singular,t).toLowerCase():"")(l,h).includes(e)&&t.push(l),t},[]))},[a,t,h,f.blocksMap]),(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(og,{setSearchTerm:r}),(0,u.jsx)("div",{className:"".concat(ov,"__blocks-wrapper"),children:(0,u.jsx)("ul",{className:"".concat(ov,"__block-groups"),children:Object.entries(m).map(e=>{let[t,l]=e;return l.length?(0,u.jsxs)("li",{className:["".concat(ov,"__block-group"),"_none"===t&&"".concat(ov,"__block-group-none")].filter(Boolean).join(" "),children:["_none"!==t&&(0,u.jsx)("h3",{className:"".concat(ov,"__block-group-label"),children:t}),(0,u.jsx)("ul",{className:"".concat(ov,"__blocks"),children:l.map((e,t)=>{let{slug:l,imageAltText:a,imageURL:o,labels:r}="string"==typeof e?f.blocksMap[e]:e;return(0,u.jsx)("li",{className:"".concat(ov,"__block"),children:(0,u.jsx)(or,{alignLabel:"center",label:(0,d.s)(null==r?void 0:r.singular,h),onClick:()=>{"function"==typeof n&&n(l)},thumbnail:(0,u.jsx)("div",{className:"".concat(ov,"__default-image"),children:o?(0,u.jsx)("img",{alt:a,src:o}):(0,u.jsx)(oh,{})})})},t)})})]},t):null})})})]})},oy=e=>{let t,n=(0,f.c)(19),{addRow:l,addRowIndex:a,blocks:r,drawerSlug:i,labels:c}=e,{closeModal:p,isModalOpen:h}=nE(),{i18n:m,t:g}=(0,s.d)(),[v,b]=o.useState(""),y,x;if(n[0]!==i||n[1]!==h?(y=()=>{h(i)||b("")},x=[h,i],n[0]=i,n[1]=h,n[2]=y,n[3]=x):(y=n[2],x=n[3]),(0,o.useEffect)(y,x),n[4]!==l||n[5]!==a||n[6]!==r||n[7]!==p||n[8]!==i||n[9]!==m||n[10]!==c.singular||n[11]!==v||n[12]!==g){let e;n[14]!==l||n[15]!==a||n[16]!==p||n[17]!==i?(e=e=>{l(a,e),p(i)},n[14]=l,n[15]=a,n[16]=p,n[17]=i,n[18]=e):e=n[18],t=(0,u.jsx)(lc,{slug:i,title:g("fields:addLabel",{label:(0,d.s)(c.singular,m)}),children:(0,u.jsx)(ob,{blocks:r,onSelect:e,searchTerm:v})}),n[4]=l,n[5]=a,n[6]=r,n[7]=p,n[8]=i,n[9]=m,n[10]=c.singular,n[11]=v,n[12]=g,n[13]=t}else t=n[13];return t},ox=e=>{let t,n=(0,f.c)(28),{addRow:l,blocks:a,blockType:r,copyRow:i,duplicateRow:s,hasMaxRows:c,isSortable:d,labels:p,moveRow:h,pasteRow:m,removeRow:g,rowCount:v,rowIndex:b}=e,{closeModal:y,openModal:x}=nE(),w=lo("blocks-drawer"),[j,C]=o.useState(null),S;if(n[0]!==l||n[1]!==y||n[2]!==w||n[3]!==j?(S=(e,t)=>{"function"==typeof l&&l(j,t),y(w)}
1,n[0]=l,n[1]=y,n[2]=w,n[3]=j,n[4]=S):S=n[4],n[5]!==r||n[6]!==a||n[7]!==i||n[8]!==w||n[9]!==s||n[10]!==c||n[11]!==d||n[12]!==p||n[13]!==h||n[14]!==x||n[15]!==m||n[16]!==g||n[17]!==v||n[18]!==b||n[19]!==S){let e,l;n[21]!==w||n[22]!==x?(e=e=>{C(e),x(w)},n[21]=w,n[22]=x,n[23]=e):e=n[23],n[24]!==r||n[25]!==s||n[26]!==b?(l=()=>s(b,r),n[24]=r,n[25]=s,n[26]=b,n[27]=l):l=n[27],t=(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(oy,{addRow:S,addRowIndex:b,blocks:a,drawerSlug:w,labels:p}),(0,u.jsx)(a1,{addRow:e,copyRow:i,duplicateRow:l,hasMaxRows:c,index:b,isSortable:d,moveRow:h,pasteRow:m,removeRow:g,rowCount:v})]}),n[5]=r,n[6]=a,n[7]=i,n[8]=w,n[9]=s,n[10]=c,n[11]=d,n[12]=p,n[13]=h,n[14]=x,n[15]=m,n[16]=g,n[17]=v,n[18]=b,n[19]=S,n[20]=t}else t=n[20];return t},ow="section-title",oj=e=>{let t=(0,f.c)(14),{customOnChange:n,customValue:l,path:a,readOnly:o}=e,r;t[0]!==a?(r={path:a},t[0]=a,t[1]=r):r=t[1];let{setValue:i,value:c}=aB(r),{t:d}=(0,s.d)(),p;t[2]===Symbol.for("react.memo_cache_sentinel")?(p=[ow].filter(Boolean),t[2]=p):p=t[2];let h=p.join(" "),m;t[3]!==n||t[4]!==i?(m=n||(e=>{e.stopPropagation(),e.preventDefault(),i(e.target.value)}),t[3]=n,t[4]=i,t[5]=m):m=t[5];let g=m,v=l||c,b;return t[6]!==l||t[7]!==g||t[8]!==a||t[9]!==o||t[10]!==d||t[11]!==v||t[12]!==c?(b=(0,u.jsx)("div",{className:h,"data-value":v,children:(0,u.jsx)("input",{className:"".concat(ow,"__input"),id:a,name:a,onChange:g,placeholder:d("general:untitled"),readOnly:o,type:"text",value:l||c||""})}),t[6]=l,t[7]=g,t[8]=a,t[9]=o,t[10]=d,t[11]=v,t[12]=c,t[13]=b):b=t[13],b},oC="blocks-field",oS=e=>{var t,n;let l=(0,f.c)(42),{addRow:a,attributes:o,block:r,blocks:c,copyRow:p,duplicateRow:h,errorCount:m,fields:g,hasMaxRows:v,isLoading:b,isSortable:y,Label:x,labels:w,listeners:j,moveRow:C,parentPath:S,pasteRow:k,path:_,permissions:N,readOnly:E,removeRow:P,row:D,rowCount:T,rowIndex:R,schemaPath:A,setCollapse:L,setNodeRef:O,transform:F}=e,M=oa(b,500),{i18n:I}=(0,s.d)(),B=eR()&&m>0,U=!(null==(t=r.admin)?void 0:t.disableBlockName),z=B?"".concat(oC,"__row--has-errors"):"".concat(oC,"__row--no-errors"),V;l[0]!==z?(V=["".concat(oC,"__row"),z].filter(Boolean),l[0]=z,l[1]=V):V=l[1];let H=V.join(" "),q;if(l[2]!==x||l[3]!==a||l[4]!==o||l[5]!==r.fields||l[6]!==r.labels||l[7]!==r.slug||l[8]!==c||l[9]!==H||l[10]!==p||l[11]!==h||l[12]!==m||l[13]!==B||l[14]!==g||l[15]!==v||l[16]!==I||l[17]!==M||l[18]!==y||l[19]!==w||l[20]!==j||l[21]!==C||l[22]!==S||l[23]!==k||l[24]!==_||l[25]!==N||l[26]!==E||l[27]!==P||l[28]!==D.blockType||l[29]!==D.collapsed||l[30]!==D.id||l[31]!==T||l[32]!==R||l[33]!==A||l[34]!==L||l[35]!==O||l[36]!==U||l[37]!==F){let e,t;if(!0===N)e=!0;else{let t=(null==N||null==(n=N.blocks)?void 0:n[r.slug])||(null==N?void 0:N.blocks);if(!0===t)e=!0;else if(null==t?void 0:t.fields)e=t.fields;else if("object"==typeof N&&N&&!t){let n=!0===N.read,l=!N.create||!N.update;e=n&&(l||"object"==typeof N&&1===Object.keys(N).length&&N.read)?{read:!0}:null==t?void 0:t.fields}else e=null==t?void 0:t.fields}l[39]!==D.id||l[40]!==L?(t=e=>L(D.id,e),l[39]=D.id,l[40]=L,l[41]=t):t=l[41],q=(0,u.jsx)("div",{id:"".concat(null==S?void 0:S.split(".").join("-"),"-row-").concat(R),ref:O,style:{transform:F},children:(0,u.jsx)(a9,{actions:E?void 0:(0,u.jsx)(ox,{addRow:a,blocks:c,blockType:D.blockType,copyRow:p,duplicateRow:h,fields:r.fields,hasMaxRows:v,isSortable:y,labels:w,moveRow:C,pasteRow:k,removeRow:P,rowCount:T,rowIndex:R}),className:H,collapsibleStyle:B?"error":"default",dragHandleProps:y?{id:D.id,attributes:o,listeners:j}:void 0,header:M?(0,u.jsx)(i.f,{height:"1rem",width:"8rem"}):(0,u.jsxs)("div",{className:"".concat(oC,"__block-header"),children:[(0,u.jsx)(eV,{CustomComponent:x,label:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"".concat(oC,"__block-number"),children:String(R+1).padStart(2,"0")}),(0,u.jsx)(ol,{className:"".concat(oC,"__block-pill ").concat(oC,"__block-pill-").concat(D.blockType),pillStyle:"white",size:"small",children:(0,d.s)(r.labels.singular,I)}),U&&(0,u.jsx)(oj,{path:"".concat(_,".blockName"),readOnly:E})]}),path:_,rowNumber:R}),B&&(0,u.jsx)(nn,{count:m,i18n:I,withMessage:!0})]}),isCollapsed:D.collapsed,onToggle:t,children:M?(0,u.jsx)(i.f,{}):(0,u.jsx)(hL,{className:"".concat(oC,"__fields"),fields:g,margins:"small",parentIndexPath:"",parentPath:_,parentSchemaPath:A,permissions:e,readOnly:E})},D.id)},"".concat(S,"-row-").concat(R)),l[2]=x,l[3]=a,l[4]=o,l[5]=r.fields,l[6]=r.labels,l[7]=r.slug,l[8]=c,l[9]=H,l[10]=p,l[11]=h,l[12]=m,l[13]=B,l[14]=g,l[15]=v,l[16]=I,l[17]=M,l[18]=y,l[19]=w,l[20]=j,l[21]=C,l[22]=S,l[23]=k,l[24]=_,l[25]=N,l[26]=E,l[27]=P,l[28]=D.blockType,l[29]=D.c
1ollapsed,l[30]=D.id,l[31]=T,l[32]=R,l[33]=A,l[34]=L,l[35]=O,l[36]=U,l[37]=F,l[38]=q}else q=l[38];return q},ok="blocks-field",o_=aV(e=>{let{i18n:t,t:n}=(0,s.d)(),{field:l,field:{name:a,type:r,admin:{className:c,description:p,isSortable:h=!0}={},blockReferences:f,blocks:m,label:g,labels:v,localized:b,maxRows:y,minRows:x,required:w},path:j,permissions:C,readOnly:S,schemaPath:k,validate:_}=e,N=null!=k?k:a,E=+(null!=x?!!x:!!w),{setDocFieldPreferences:P}=aD(),{addFieldRow:D,dispatchFields:T,getFields:R,moveFieldRow:A,removeFieldRow:L,replaceState:O,setModified:F}=eP(),{code:M}=lN(),{config:{localization:I},config:B}=(0,i.c)(),U=lo("blocks-drawer"),z=eR(),V={plural:n("fields:blocks"),singular:n("fields:block"),...v},H=!I||!I.fallback||M===I.defaultLocale,{blocksFilterOptions:q,customComponents:{AfterInput:W,BeforeInput:K,Description:Y,Error:G,Label:Q}={},disabled:X,errorPaths:$,path:Z,rows:J=[],showError:ee,valid:et,value:en}=aB({hasRows:!0,potentiallyStalePath:j,validate:(0,o.useCallback)((e,t)=>!H&&null===e||("function"==typeof _?_(e,{...t,maxRows:y,minRows:E,required:w}):void 0),[y,E,w,_,H])}),{clientBlocks:el,clientBlocksAfterFilter:ea}=(0,o.useMemo)(()=>{let e=[];
1if(f)for(let t of f){let n="string"==typeof t?B.blocksMap[t]:t;n&&e.push(n)}else e=m;if(Array.isArray(q)){let t=e.filter(e=>{let t="string"==typeof e?e:e.slug;return q.includes(t)});return{clientBlocks:e,clientBlocksAfterFilter:t}}return{clientBlocks:e,clientBlocksAfterFilter:e}},[f,m,q,B.blocksMap]),eo=(0,o.useCallback)((e,t)=>{D({blockType:t,path:Z,rowIndex:e,schemaPath:N}),setTimeout(()=>{aJ("".concat(Z,"-row-").concat(e+1))},0)},[D,Z,N]),er=(0,o.useCallback)(e=>{T({type:"DUPLICATE_ROW",path:Z,rowIndex:e}),F(!0),setTimeout(()=>{aJ("".concat(Z,"-row-").concat(e+1))},0)},[T,Z,F]),ei=(0,o.useCallback)(e=>{L({path:Z,rowIndex:e})},[Z,L]),es=(0,o.useCallback)((e,t)=>{A({moveFromIndex:e,moveToIndex:t,path:Z})},[A,Z]),ec=(0,o.useCallback)(e=>{let{collapsedIDs:t,updatedRows:n}=lR({collapsed:e,rows:J});T({type:"SET_ALL_ROWS_COLLAPSED",path:Z,updatedRows:n}),P(Z,{collapsed:t})},[T,Z,J,P]),eu=(0,o.useCallback)((e,t)=>{let{collapsedIDs:n,updatedRows:l}=lT({collapsed:t,rowID:e,rows:J});T({type:"SET_ROW_COLLAPSED",path:Z,updatedRows:l}),P(Z,{collapsed:n})},[T,Z,J,P]),ed=(0,o.useCallback)(e=>{let t=tA({type:r,blocks:el,getDataToCopy:()=>tB({formState:{...R()},path:Z,rowIndex:e}),path:Z,rowIndex:e,t:n});"string"==typeof t?eJ.error(t):eJ.success(n("general:copied"))},[el,Z,n,r,R]),eh=(0,o.useCallback)(e=>{let t=tL({onPaste:t=>{O(tU({dataFromClipboard:t,formState:{...R()},path:Z,rowIndex:e})),F(!0)},path:Z,schemaBlocks:el,t:n});"string"==typeof t&&eJ.error(t)},[el,R,Z,O,F,n]),ef=(0,o.useCallback)(e=>{O(tU({dataFromClipboard:e,formState:{...R()},path:Z})),F(!0)},[R,Z,O,F]),em=y&&J.length>=y,eg=$.length,ev=z&&eg+ +!et>0,eb=J.length<E||w&&0===J.length,ey=S&&0===J.length,ex=(0,o.useMemo)(()=>aH(l),[l]);return(0,u.jsxs)("div",{className:[aq,ok,c,ev?"".concat(ok,"--has-error"):"".concat(ok,"--has-no-error")].filter(Boolean).join(" "),id:"field-".concat(null==Z?void 0:Z.replace(/\./g,"__")),style:ex,children:[ee&&(0,u.jsx)(ep,{CustomComponent:G,Fallback:(0,u.jsx)(no,{path:Z,showError:ee})}),(0,u.jsxs)("header",{className:"".concat(ok,"__header"),children:[(0,u.jsxs)("div",{className:"".concat(ok,"__header-wrap"),children:[(0,u.jsxs)("div",{className:"".concat(ok,"__heading-with-error"),children:[(0,u.jsx)("h3",{children:(0,u.jsx)(ep,{CustomComponent:Q,Fallback:(0,u.jsx)(lD,{as:"span",label:g,localized:b,path:Z,required:w})})}),ev&&eg>0&&(0,u.jsx)(nn,{count:eg,i18n:t,withMessage:!0})]}),(0,u.jsxs)("ul",{className:"".concat(ok,"__header-actions"),children:[J.length>0&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("li",{children:(0,u.jsx)("button",{className:"".concat(ok,"__header-action"),onClick:()=>ec(!0),type:"button",children:n("fields:collapseAll")})}),(0,u.jsx)("li",{children:(0,u.jsx)("button",{className:"".concat(ok,"__header-action"),onClick:()=>ec(!1),type:"button",children:n("fields:showAll")})})]}),(0,u.jsx)("li",{children:(0,u.jsx)(tI,{allowCopy:(null==J?void 0:J.length)>0,allowPaste:!S,blocks:el,className:"".concat(ok,"__header-action"),disabled:X,getDataToCopy:()=>tB({formState:{...R()},path:Z}),onPaste:ef,path:Z,type:r})})]})]}),(0,u.jsx)(ep,{CustomComponent:Y,Fallback:(0,u.jsx)(na,{description:p,path:Z})})]}),K,(0,u.jsx)(aZ,{fieldValue:en,localized:b,path:Z,readOnly:S}),(J.length>0||!et&&(ey||eb))&&(0,u.jsxs)(ne,{className:"".concat(ok,"__rows"),ids:J.map(e=>e.id),onDragEnd:e=>{let{moveFromIndex:t,moveToIndex:n}=e;return es(t,n)},children:[J.map((e,t)=>{var n;let{blockType:l,isLoading:a}=e,o=null!=(n=B.blocksMap[l])?n:el.find(e=>e.slug===l);if(o){let n="".concat(Z,".").concat(t),l=$.filter(e=>e.startsWith(n+".")).length;return(0,u.jsx)(t7,{disabled:S||X||!h,id:e.id,children:r=>{var i,s;return(0,u.jsx)(oS,{...r,addRow:eo,block:o,blocks:el,copyRow:ed,duplicateRow:er,errorCount:l,fields:o.fields,hasMaxRows:em,isLoading:a,isSortable:h,Label:null==J||null==(s=J[t])||null==(i=s.customComponents)?void 0:i.RowLabel,labels:V,moveRow:es,parentPath:Z,pasteRow:eh,path:n,permissions:C,readOnly:S||X,removeRow:ei,row:e,rowCount:J.length,rowIndex:t,schemaPath:N+o.slug,setCollapse:eu})}},e.id)}return null}),!H&&(0,u.jsxs)(o.Fragment,{children:[eb&&(0,u.jsx)(tl,{type:"error",children:n("validation:requiresAtLeast",{count:E,label:(0,d.s)(E>1?V.plural:V.singular,t)||n(E>1?"general:row":"general:rows")})}),ey&&(0,u.jsx)(tl,{children:n("validation:fieldHasNo",{label:(0,d.s)(V.plural,t)})})]})]}),!em&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(ls,{className:"".concat(ok,"__drawer
1-toggler"),disabled:S||X,slug:U,children:(0,u.jsx)(tD,{buttonStyle:"icon-label",disabled:S||X,el:"span",icon:"plus",iconPosition:"left",iconStyle:"with-border",children:n("fields:addLabel",{label:(0,d.s)(V.singular,t)})})}),(0,u.jsx)(oy,{addRow:eo,addRowIndex:(null==J?void 0:J.length)||0,blocks:ea,drawerSlug:U,labels:V})]}),W]})}),oN=(0,o.lazy)(()=>n.e(2153).then(n.bind(n,52153))),oE=e=>(0,u.jsx)(o.Suspense,{fallback:(0,u.jsx)(i.f,{}),children:(0,u.jsx)(oN,{...e})}),oP={js:"javascript",ts:"typescript",tsx:"typescript"},oD=aV(e=>{let{field:t,field:{admin:{className:n,description:l,editorOptions:a,editorProps:r,language:i="javascript"}={},label:s,localized:c,required:d},onMount:p,path:h,readOnly:f,validate:m}=e,g=o.useRef("formState"),[v,b]=(0,o.useState)(Date.now()),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:j,Label:C}={},disabled:S,initialValue:k,path:_,setValue:N,showError:E,value:P}=aB({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,required:d})},[m,d])}),D=o.useRef((P||k)!==void 0?null!=P?P:k:void 0),T=(0,o.useCallback)(e=>{if(!(f||S)){g.current="internalEditor";try{N(e||null),D.current=e}catch(t){N(e||null),D.current=e}}},[f,S,N]);(0,o.useEffect)(()=>{"formState"===g.current&&(D.current=(P||k)!==void 0?null!=P?P:k:void 0,b(Date.now())),g.current="formState"},[k,_,P]);let R=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsxs)("div",{className:[aq,"code-field",n,E&&"error",(f||S)&&"read-only"].filter(
1Boolean).join(" "),style:R,children:[(0,u.jsx)(ep,{CustomComponent:C,Fallback:(0,u.jsx)(lD,{label:s,localized:c,path:_,required:d})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:j,Fallback:(0,u.jsx)(no,{path:_,showError:E})}),x,(0,u.jsx)(oE,{defaultLanguage:oP[i]||i,onChange:T,onMount:p,options:a,readOnly:f||S,recalculatedHeightAt:v,value:D.current,wrapperProps:{id:"field-".concat(null==_?void 0:_.replace(/\./g,"__"))},...r||{}}),y]}),(0,u.jsx)(ep,{CustomComponent:w,Fallback:(0,u.jsx)(na,{description:l,path:_})})]})}),oT=e=>e.reduce((e,t)=>{var n;let l="fields"in t?t.fields:void 0;return l?(0,m.Z7)(t)?e.push("".concat(t.name,".")):e.push(...oT(l)):"tabs"===t.type?"tabs"in t&&(null==(n=t.tabs)||n.forEach(t=>{"name"in t?e.push("".concat(t.name,".")):e.push(...oT(t.fields))})):(0,m.Z7)(t)&&e.push(t.name),e},[]),oR=e=>{let t,n=(0,f.c)(12),{fields:l,path:a,setErrorCount:o}=e,[r]=eI(),i=eR(),s;n[0]!==l?(s=oT(l),n[0]=l,n[1]=s):s=n[1];let c=s,u;return n[2]!==r||n[3]!==i||n[4]!==a||n[5]!==c||n[6]!==o?(u=()=>{if(i){let e=0;Object.entries(r).forEach(t=>{let[n]=t;if(null==c?void 0:c.some(e=>{let t=[...a,e].join(".");return t.endsWith(".")?n.startsWith(t):n===t})){let t=r[n];"valid"in t&&!t.valid&&(e+=1)}}),o(e)}},n[2]=r,n[3]=i,n[4]=a,n[5]=c,n[6]=o,n[7]=u):u=n[7],n[8]!==l||n[9]!==r||n[10]!==i?(t=[r,i,l],n[8]=l,n[9]=r,n[10]=i,n[11]=t):t=n[11],lA(u,250,t),null},oA="collapsible-field",oL=aV(e=>{let{field:t,field:{admin:{className:n,description:l,initCollapsed:a=!1}={},fields:r,label:i}={},indexPath:c,parentPath:p,parentSchemaPath:h,path:f,permissions:m,readOnly:g}=e,{i18n:v}=(0,s.d)(),{getPreference:b,setPreference:y}=aS(),{preferencesKey:x}=aD(),[w,j]=(0,o.useState)(),C="collapsible-".concat(null==f?void 0:f.replace(/\./g,"__")),[S,k]=(0,o.useState)(0),_=S>0,{customComponents:{AfterInput:N,BeforeInput:E,Description:P,Label:D}={},disabled:T}=aB({path:f}),R=(0,o.useCallback)(async e=>{var t,n;let l=await b(x);x&&y(x,{...l,...f?{fields:{...(null==l?void 0:l.fields)||{},[f]:{...null==l||null==(t=l.fields)?void 0:t[f],collapsed:e}}}:{fields:{...(null==l?void 0:l.fields)||{},[C]:{...null==l||null==(n=l.fields)?void 0:n[C],collapsed:e}}}})},[x,C,b,y,f]);(0,o.useEffect)(()=>{(async()=>{if(x){var e,t,n,l;let o=await b(x),r=f?null==o||null==(t=o.fields)||null==(e=t[f])?void 0:e.collapsed:null==o||null==(l=o.fields)||null==(n=l[C])?void 0:n.collapsed;j(void 0!==r?!!r:"boolean"==typeof a&&a)}else j("boolean"==typeof a&&a)})()},[b,x,C,a,f]);let A=(0,o.useMemo)(()=>aH(t),[t]);return"boolean"!=typeof w?null:(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(oR,{fields:r,path:f.split(".").slice(0,-1),setErrorCount:k}),(0,u.jsxs)("div",{className:[aq,oA,n,_?"".concat(oA,"--has-error"):"".concat(oA,"--has-no-error")].filter(Boolean).join(" "),id:"field-".concat(C),style:A,children:[E,(0,u.jsx)(a9,{className:"".concat(oA,"__collapsible"),collapsibleStyle:_?"error":"default",header:(0,u.jsxs)("div",{className:"".concat(oA,"__row-label-wrap"),children:[(0,u.jsx)(eV,{CustomComponent:D,label:(0,d.s)(i,v),path:f}),_&&(0,u.jsx)(nn,{count:S,i18n:v,withMessage:!0})]}),initCollapsed:w,onToggle:R,children:(0,u.jsx)(hL,{fields:r,margins:"small",parentIndexPath:c,parentPath:p,parentSchemaPath:h,permissions:m,readOnly:g||T})}),N,(0,u.jsx)(ep,{CustomComponent:P,Fallback:(0,u.jsx)(na,{description:l,path:f})})]})]})}),oO=(0,o.lazy)(()=>n.e(8806).then(n.bind(n,98806))),oF=e=>(0,u.jsx)(o.Suspense,{fallback:(0,u.jsx)(i.f,{height:50}),children:(0,u.jsx)(oO,{...e})});function oM(e){return(oM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oI(e){var t=function(e,t){if("object"!=oM(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var l=n.call(e,t||"default");if("object"!=oM(l))return l;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==oM(t)?t:t+""}function oB(e,t,n){return(t=oI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,l)}return n}function oz(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?oU(Object(n),!0).forEach(function(t){oB(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oV(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=Array(t);n<t;n++)l[n]=e[n];return l}function oH(e,t){if(e){if("string"==typeof e)return oV(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oV(e,t):void 0}}function oq(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var l,a,o,r,i=[],s=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(l=o.call(n)).done)&&(i.push(l.value),i.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw a}}return i}}(e,t)||oH(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oW(e,t){if(null==e)return{};var n,l,a=nd(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(l=0;l<o.length;l++)n=o[l],t.includes(n)||({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var oK=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function oY(e){var t=e.defaultInputValue,n=e.defaultMenuIsOpen,l=e.defaultValue,a=e.inputValue,r=e.menuIsOpen,i=e.onChange,s=e.onInputChange,c=e.onMenuClose,u=e.onMenuOpen,d=e.value,p=oW(e,oK),h=oq((0,o.useState)(void 0!==a?a:void 0===t?"":t),2),f=h[0],m=h[1],g=oq((0,o.useState)(void 0!==r?r:void 0!==n&&n),2),v=g[0],b=g[1],y=oq((0,o.useState)(void 0!==d?d:void 0===l?null:l),2),x=y[0],w=y[1],j=(0,o.useCallback)(function(e,t){"function"==typeof i&&i(e,t),w(e)},[i]),C=(0,o.useCallback)(function(e,t){var n;"function"==typeof s&&(n=s(e,t)),m(void 0!==n?n:e)},[s]),S=(0,o.useCallback)(function(){"function"==typeof u&&u(),b(!0)},[u]),k=(0,o.useCallback)(function(){"function"==typeof c&&c(),b(!1)},[c]),_=void 0!==a?a:f,N=void 0!==r?r:v,E=void 0!==d?d:x;return oz(oz({},p),{},{inputValue:_,menuIsOpen:N,onChange:j,onInputChange:C,onMenuClose:k,onMenuOpen:S,value:E})}function oG(e,t){for(var n=0;n<t.length;n++){var l=t[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,oI(l.key),l)}}function oQ(e){return(oQ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(oX=function(){return!!e})()}function o$(e){return function(e){if(Array.isArray(e))return oV(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||oH(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var oZ=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(((t=document.createElement("style")).setAttribute("data-emotion",this.key),void 0!==this.nonce&&t.setAttribute("nonce",this.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t));var t,n=this.tags[this.tags.length-1];if(this.isSpeedy){var l=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(n);try{l.insertRule(e,l.cssRules.length)}catch(e){}}else n.appendChild(document.createTextNode(e));this.ctr++}
vendor: 4,171 bytes, line 1
1,t.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},e}(),oJ="-ms-",o0="-moz-",o1="-webkit-",o3="comm",o2="rule",o6="decl",o5="@keyframes",o4=Math.abs,o8=String.fromCharCode,o9=Object.assign;function o7(e,t,n){return e.replace(t,n)}function re(e,t){return e.indexOf(t)}function rt(e,t){return 0|e.charCodeAt(t)}function rn(e,t,n){return e.slice(t,n)}function rl(e){return e.length}function ra(e,t){return t.push(e),e}var ro=1,rr=1,ri=0,rs=0,rc=0,ru="";function rd(e,t,n,l,a,o,r){return{value:e,root:t,parent:n,type:l,props:a,children:o,line:ro,column:rr,length:r,return:""}}function rp(e,t){return o9(rd("",null,null,"",null,null,0),e,{length:-e.length},t)}function rh(){return rc=rs<ri?rt(ru,rs++):0,rr++,10===rc&&(rr=1,ro++),rc}function rf(){return rt(ru,rs)}function rm(e){switch(e){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 rg(e){return ro=rr=1,ri=rl(ru=e),rs=0,[]}function rv(e){var t,n;return(t=rs-1,n=function e(t){for(;rh();)switch(rc){case t:return rs;case 34:case 39:34!==t&&39!==t&&e(rc);break;case 40:41===t&&e(t);break;case 92:rh()}return rs}(91===e?e+2:40===e?e+1:e),rn(ru,t,n)).trim()}function rb(e,t,n,l,a,o,r,i,s,c,u){for(var d=a-1,p=0===a?o:[""],h=p.length,f=0,m=0,g=0;f<l;++f)for(var v=0,b=rn(e,d+1,d=o4(m=r[f])),y=e;v<h;++v)(y=(m>0?p[v]+" "+b:o7(b,/&\f/g,p[v])).trim())&&(s[g++]=y);return rd(e,t,n,0===a?o2:i,s,c,u)}function ry(e,t,n,l){return rd(e,t,n,o6,rn(e,0,l),rn(e,l+1,-1),l)}function rx(e,t){for(var n="",l=e.length,a=0;a<l;a++)n+=t(e[a],a,e,t)||"";return n}function rw(e,t,n,l){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case o6:return e.return=e.return||e.value;case o3:return"";case o5:return e.return=e.value+"{"+rx(e.children,l)+"}";case o2:e.value=e.props.join(",")}return rl(n=rx(e.children,l))?e.return=e.value+"{"+n+"}":""}var rj=function(e,t,n){for(var l=0,a=0;l=a,a=rf(),38===l&&12===a&&(t[n]=1),!rm(a);)rh();return rn(ru,e,rs)},rC=function(e,t){var n=-1,l=44;do switch(rm(l)){case 0:38===l&&12===rf()&&(t[n]=1),e[n]+=rj(rs-1,t,n);break;case 2:e[n]+=rv(l);break;case 4:if(44===l){e[++n]=58===rf()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=o8(l)}while(l=rh());return e},rS=function(e,t){var n;return n=rC(rg(e),t),ru="",n},rk=new WeakMap,r_=function(e){if(!("rule"!==e.type||!e.parent||e.length<1)){for(var t=e.value,n=e.parent,l=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if(!(1===e.props.length&&58!==t.charCodeAt(0)&&!rk.get(n))&&!l){rk.set(e,!0);for(var a=[],o=rS(t,a),r=n.props,i=0,s=0;i<o.length;i++)for(var c=0;c<r.length;c++,s++)e.props[s]=a[i]?o[i].replace(/&\f/g,r[c]):r[c]+" "+o[i]}}},rN=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}},rE=[function(e,t,n,l){if(e.length>-1&&!e.return)switch(e.type){case o6:e.return=function e(t,n){switch(45^rt(t,0)?(((n<<2^rt(t,0))<<2^rt(t,1))<<2^rt(t,2))<<2^rt(t,3):0){case 5103:return o1+"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 o1+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return o1+t+o0+t+oJ+t+t;case 6828:case 4268:return o1+t+oJ+t+t;case 6165:return o1+t+oJ+"flex-"+t+t;case 5187:return o1+t+o7(t,/(\w+).+(:[^]+)/,o1+"box-$1$2"+oJ+"flex-$1$2")+t;case 5443:return o1+t+oJ+"flex-item-"+o7(t,/flex-|-self/,"")+t;case 4675:return o1+t+oJ+"flex-line-pack"+o7(t,/align-content|flex-|-self/,"")+t;case 5548:return o1+t+oJ+o7(t,"shrink","negative")+t;case 5292:return o1+t+oJ+o7(t,"basis","preferred-size")+t;case 6060:return o1+"box-"+o7(t,"-grow","")+o1+t+oJ+o7(t,"grow","positive")+t;case 4554:return o1+o7(t,/([^-])(transform)/g,"$1"+o1+"$2")+t;case 6187:return o7(o7(o7(t,/(zoom-|grab)/,o1+"$1"),/(image-set)/,o1+"$1"),t,"")+t;
vendor: 5,635 bytes, line 1
1case 5495:case 3959:return o7(t,/(image-set\([^]*)/,o1+"$1$`$1");case 4968:return o7(o7(t,/(.+:)(flex-)?(.*)/,o1+"box-pack:$3"+oJ+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+o1+t+t;case 4095:case 3583:case 4068:case 2532:return o7(t,/(.+)-inline(.+)/,o1+"$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(rl(t)-1-n>6)switch(rt(t,n+1)){case 109:if(45!==rt(t,n+4))break;case 102:return o7(t,/(.+:)(.+)-([^]+)/,"$1"+o1+"$2-$3$1"+o0+(108==rt(t,n+3)?"$3":"$2-$3"))+t;case 115:return~re(t,"stretch")?e(o7(t,"stretch","fill-available"),n)+t:t}break;case 4949:if(115!==rt(t,n+1))break;case 6444:switch(rt(t,rl(t)-3-(~re(t,"!important")&&10))){case 107:return o7(t,":",":"+o1)+t;case 101:return o7(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+o1+(45===rt(t,14)?"inline-":"")+"box$3$1"+o1+"$2$3$1"+oJ+"$2box$3")+t}break;case 5936:switch(rt(t,n+11)){case 114:return o1+t+oJ+o7(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return o1+t+oJ+o7(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return o1+t+oJ+o7(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return o1+t+oJ+t+t}return t}(e.value,e.length);break;case o5:return rx([rp(e,{value:o7(e.value,"@","@"+o1)})],l);case o2:if(e.length){var a,o;return a=e.props,o=function(t){var n;switch(n=t,(n=/(::plac\w+|:read-\w+)/.exec(n))?n[0]:n){case":read-only":case":read-write":return rx([rp(e,{props:[o7(t,/:(read-\w+)/,":"+o0+"$1")]})],l);case"::placeholder":return rx([rp(e,{props:[o7(t,/:(plac\w+)/,":"+o1+"input-$1")]}),rp(e,{props:[o7(t,/:(plac\w+)/,":"+o0+"$1")]}),rp(e,{props:[o7(t,/:(plac\w+)/,oJ+"input-$1")]})],l)}return""},a.map(o).join("")}}}],rP=function(e,t,n){var l=e.key+"-"+t.name;!1===n&&void 0===e.registered[l]&&(e.registered[l]=t.styles)},rD=function(e,t,n){rP(e,t,n);var l=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do e.insert(t===a?"."+l:"",a,e.sheet,!0),a=a.next;while(void 0!==a)}},rT={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},rR=/[A-Z]|^ms/g,rA=/_EMO_([^_]+?)_([^]*?)_EMO_/g,rL=function(e){return 45===e.charCodeAt(1)},rO=function(e){return null!=e&&"boolean"!=typeof e},rF=function(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}(function(e){return rL(e)?e:e.replace(rR,"-$&").toLowerCase()}),rM=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(rA,function(e,t,n){return rB={name:t,styles:n,next:rB},t})}return 1===rT[e]||rL(e)||"number"!=typeof t||0===t?t:t+"px"};function rI(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return rB={name:n.name,styles:n.styles,next:rB},n.name;if(void 0!==n.styles){var l=n.next;if(void 0!==l)for(;void 0!==l;)rB={name:l.name,styles:l.styles,next:rB},l=l.next;return n.styles+";"}return function(e,t,n){var l="";if(Array.isArray(n))for(var a=0;a<n.length;a++)l+=rI(e,t,n[a])+";";else for(var o in n){var r=n[o];if("object"!=typeof r)null!=t&&void 0!==t[r]?l+=o+"{"+t[r]+"}":rO(r)&&(l+=rF(o)+":"+rM(o,r)+";");else if(Array.isArray(r)&&"string"==typeof r[0]&&(null==t||void 0===t[r[0]]))for(var i=0;i<r.length;i++)rO(r[i])&&(l+=rF(o)+":"+rM(o,r[i])+";");else{var s=rI(e,t,r);switch(o){case"animation":case"animationName":l+=rF(o)+":"+s+";";break;default:l+=o+"{"+s+"}"}}}return l}(e,t,n);case"function":if(void 0!==e){var a=rB,o=n(e);return rB=a,rI(e,t,o)}}if(null==t)return n;var r=t[n];return void 0!==r?r:n}var rB,rU=/label:\s*([^\s;{]+)\s*(;|$)/g;function rz(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var l=!0,a="";rB=void 0;var o=e[0];null==o||void 0===o.raw?(l=!1,a+=rI(n,t,o)):a+=o[0];for(var r=1;r<e.length;r++)a+=rI(n,t,e[r]),l&&(a+=o[r]);rU.lastIndex=0;for(var i,s="";null!==(i=rU.exec(a));)s+="-"+i[1];return{name:function(e){for(var t,n=0,l=0,a=e.length;a>=4;++l,a-=4)t=(65535&(t=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24))*0x5bd1e995+((t>>>16)*59797<<16),t^=t>>>24,n=(65535&t)*0x5bd1e995+((t>>>16)*59797<<16)^(65535&n)*0x5bd1e995+((n>>>16)*59797<<16);switch(a){case 3:n^=(255&e.charCodeAt(l+2))<<16;case 2:n^=(255&e.charCodeAt(l+1))<<8;case 1:n^=255&e.charCodeAt(l),n=(65535&n)*0x5bd1e995+((n>>>16)*59797<<16)}return n^=n>>>13,(((n=(65535&n)*0x5bd1e995+((n>>>16)*59797<<16))^n>>>15)>>>0).toString(36)}(a)+s,styles:a,next:rB}}var rV=!!o.useInsertionEffect&&o.useInsertionEffect||function(e){return e()},rH=o.createContext("u">typeof HTMLElement?function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var l,a=e.stylisPlugins||rE,o={},r=[];l=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)o[t[n]]=!0;r.push(e)});
1var i,s,c,u,d=(s=(i=[r_,rN].concat(a,[rw,(c=function(e){u.insert(e)},function(e){e.root||(e=e.return)&&c(e)})])).length,function(e,t,n,l){for(var a="",o=0;o<s;o++)a+=i[o](e,t,n,l)||"";return a}),p=function(e){var t,n;return rx((n=function e(t,n,l,a,o,r,i,s,c){for(var u,d=0,p=0,h=i,f=0,m=0,g=0,v=1,b=1,y=1,x=0,w="",j=o,C=r,S=a,k=w;b;)switch(g=x,x=rh()){case 40:if(108!=g&&58==rt(k,h-1)){-1!=re(k+=o7(rv(x),"&","&\f"),"&\f")&&(y=-1);break}case 34:case 39:case 91:k+=rv(x);break;case 9:case 10:case 13:case 32:k+=function(e){for(;(rc=rf())&&rc<33;)rh();return rm(e)>2||rm(rc)>3?"":" "}(g);break;case 92:k+=function(e,t){for(var n;--t&&rh()&&!(rc<48||rc>102||rc>57&&rc<65||rc>70&&rc<97););return n=rs+(t<6&&32==rf()&&32==rh()),rn(ru,e,n)}(rs-1,7);continue;case 47:switch(rf()){case 42:case 47:ra((u=function(e,t){for(;rh()&&e+rc!==57&&(e+rc!==84||47!==rf()););return"/*"+rn(ru,t,rs-1)+"*"+o8(47===e?e:rh())}(rh(),rs),rd(u,n,l,o3,o8(rc),rn(u,2,-2),0)),c);break;default:k+="/"}break;case 123*v:s[d++]=rl(k)*y;case 125*v:case 59:case 0:switch(x){case 0:case 125:b=0;case 59+p:-1==y&&(k=o7(k,/\f/g,"")),m>0&&rl(k)-h&&ra(m>32?ry(k+";",a,l,h-1):ry(o7(k," ","")+";",a,l,h-2),c);break;case 59:k+=";";default:if(ra(S=rb(k,n,l,d,p,o,s,w,j=[],C=[],h),r),123===x)if(0===p)e(k,n,S,S,j,r,h,s,C);else switch(99===f&&110===rt(k,3)?100:f){case 100:case 108:case 109:case 115:e(t,S,S,a&&ra(rb(t,S,S,0,0,o,s,w,o,j=[],h),C),o,C,h,s,a?j:C);break;default:e(k,S,S,S,[""],C,0,s,C)}}d=p=m=0,v=y=1,w=k="",h=i;break;case 58:h=1+rl(k),m=g;default:if(v<1){if(123==x)--v;else if(125==x&&0==v++&&125==(rc=rs>0?rt(ru,--rs):0,rr--,10===rc&&(rr=1,ro--),rc))continue}switch(k+=o8(x),x*v){case 38:y=p>0?1:(k+="\f",-1);break;case 44:s[d++]=(rl(k)-1)*y,y=1;break;case 64:45===rf()&&(k+=rv(rh())),f=rf(),p=h=rl(w=k+=function(e){for(;!rm(rf());)rh();return rn(ru,e,rs)}(rs)),x++;break;case 45:45===g&&2==rl(k)&&(v=0)}}return r}("",null,null,null,[""],t=rg(t=e),0,[0],t),ru="",n),d)},h={key:t,sheet:new oZ({key:t,container:l,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:o,registered:{},insert:function(e,t,n,l){u=n,p(e?e+"{"+t.styles+"}":t.styles),l&&(h.inserted[t.name]=!0)}};return h.sheet.hydrate(r),h}({key:"css"}):null);rH.Provider;var rq=o.createContext({}),rW={}.hasOwnProperty,rK="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",rY=function(e,t){var n={};for(var l in t)rW.call(t,l)&&(n[l]=t[l]);return n[rK]=e,n},rG=function(e){var t=e.cache,n=e.serialized,l=e.isStringTag;return rP(t,n,l),rV(function(){return rD(t,n,l)}),null},rQ=(ir=function(e,t,n){var l,a,r,i=e.css;"string"==typeof i&&void 0!==t.registered[i]&&(i=t.registered[i]);var s=e[rK],c=[i],u="";"string"==typeof e.className?(l=t.registered,a=e.className,r="",a.split(" ").forEach(function(e){void 0!==l[e]?c.push(l[e]+";"):e&&(r+=e+" ")}),u=r):null!=e.className&&(u=e.className+" ");var d=rz(c,void 0,o.useContext(rq));u+=t.key+"-"+d.name;var p={};for(var h in e)rW.call(e,h)&&"css"!==h&&h!==rK&&(p[h]=e[h]);return p.className=u,n&&(p.ref=n),o.createElement(o.Fragment,null,o.createElement(rG,{cache:t,serialized:d,isStringTag:"string"==typeof s}),o.createElement(s,p))},(0,o.forwardRef)(function(e,t){return ir(e,(0,o.useContext)(rH),t)}));(0,c.e)(eo());var rX=function(e,t){var n=arguments;if(null==t||!rW.call(t,"css"))return o.createElement.apply(void 0,n);var l=n.length,a=Array(l);a[0]=rQ,a[1]=rY(e,t);for(var r=2;r<l;r++)a[r]=n[r];return o.createElement.apply(null,a)};function r$(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return rz(t)}!function(e){var t;t||(t=e.JSX||(e.JSX={}))}(rX||(rX={})),(0,s.l)();var rZ=o.useLayoutEffect,rJ=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],r0=function(){};function r1(e,t){for(var n=arguments.length,l=Array(n>2?n-2:0),a=2;a<n;a++)l[a-2]=arguments[a];var o=[].concat(l);if(t&&e)for(var r in t)t.hasOwnProperty(r)&&t[r]&&o.push("".concat(r?"-"===r[0]?e+r:e+"__"+r:e));return o.filter(function(e){return e}).map(function(e){return String(e).trim()}).join(" ")}var r3=function(e){return Array.isArray(e)?e.filter(Boolean):"object"===oM(e)&&null!==e?[e]:[]},r2=function(e){return 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,oz({},oW(e,rJ))},r6=function(e,t,n){var l=e.cx,a=e.getStyles,o=e.getClassNames,r=e.className;return{css:a(t,e),className:l(null!=n?n:{},o(t,e),r)}};function r5(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function r4(e){return r5(e)?window.pageYOffset:e.scrollTop}function r8(e,t){if(r5(e))return void window.scrollTo(0,t);e.scrollTop=t}function r9(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r0,a=r4(e),o=t-a,r=0;!function t(){var i;r+=10,r8(e,o*((i=(i=r)/n-1)*i*i+1)+a),r<n?window.requestAnimationFrame(t):l(e)}()}function r7(e,t){var n=e.getBoundingClientRect(),l=t.getBoundingClientRect(),a=t.offsetHeight/3;l.bottom+a>n.bottom?r8(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+a,e.scrollHeight)):l.top-a<n.top&&r8(e,Math.max(t.offsetTop-a,0))}function ie(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}var it=!1,il="u">typeof window?window:{};il.addEventListener&&il.removeEventListener&&(il.addEventListener("p",r0,{get passive
1(){return it=!0}}),il.removeEventListener("p",r0,!1));var ia=it;function io(e){return null!=e}var ir,ii,is=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return Object.entries(e).filter(function(e){var t=oq(e,1)[0];return!n.includes(t)}).reduce(function(e,t){var n=oq(t,2),l=n[0],a=n[1];return e[l]=a,e},{})},ic=["children","innerProps"],iu=["children","innerProps"],id=function(e){return"auto"===e?"bottom":e},ip=(0,o.createContext)(null),ih=function(e){var t=e.children,n=e.minMenuHeight,l=e.maxMenuHeight,a=e.menuPlacement,r=e.menuPosition,i=e.menuShouldScrollIntoView,s=e.theme,c=((0,o.useContext)(ip)||{}).setPortalPlacement,u=(0,o.useRef)(null),d=oq((0,o.useState)(l),2),p=d[0],h=d[1],f=oq((0,o.useState)(null),2),m=f[0],g=f[1],v=s.spacing.controlHeight;return rZ(function(){var e=u.current;if(e){var t="fixed"===r,o=function(e){var t,n=e.maxHeight,l=e.menuEl,a=e.minHeight,o=e.placement,r=e.shouldScroll,i=e.isFixedPosition,s=e.controlHeight,c=function(e){var t=getComputedStyle(e),n="absolute"===t.position,l=/(auto|scroll)/;if("fixed"===t.position)return document.documentElement;for(var a=e;a=a.parentElement;)if(t=getComputedStyle(a),!(n&&"static"===t.position)&&l.test(t.overflow+t.overflowY+t.overflowX))return a;return document.documentElement}(l),u={placement:"bottom",maxHeight:n};if(!l||!l.offsetParent)return u;var d=c.getBoundingClientRect().height,p=l.getBoundingClientRect(),h=p.bottom,f=p.height,m=p.top,g=l.offsetParent.getBoundingClientRect().top,v=i||r5(t=c)?window.innerHeight:t.clientHeight,b=r4(c),y=parseInt(getComputedStyle(l).marginBottom,10),x=parseInt(getComputedStyle(l).marginTop,10),w=g-x,j=v-m,C=w+b,S=d-b-m,k=h-v+b+y,_=b+m-x;switch(o){case"auto":case"bottom":if(j>=f)return{placement:"bottom",maxHeight:n};if(S>=f&&!i)return r&&r9(c,k,160),{placement:"bottom",maxHeight:n};if(!i&&S>=a||i&&j>=a)return r&&r9(c,k,160),{placement:"bottom",maxHeight:i?j-y:S-y};if("auto"===o||i){var N=n,E=i?w:C;return E>=a&&(N=Math.min(E-y-s,n)),{placement:"top",maxHeight:N}}if("bottom"===o)return r&&r8(c,k),{placement:"bottom",maxHeight:n};break;case"top":if(w>=f)return{placement:"top",maxHeight:n};if(C>=f&&!i)return r&&r9(c,_,160),{placement:"top",maxHeight:n};if(!i&&C>=a||i&&w>=a){var P=n;return(!i&&C>=a||i&&w>=a)&&(P=i?w-x:C-x),r&&r9(c,_,160),{placement:"top",maxHeight:P}}return{placement:"bottom",maxHeight:n};default:throw Error('Invalid placement provided "'.concat(o,'".'))}return u}({maxHeight:l,menuEl:e,minHeight:n,placement:a,shouldScroll:i&&!t,isFixedPosition:t,controlHeight:v});h(o.maxHeight),g(o.placement),null==c||c(o.placement)}},[l,a,r,i,n,c,v]),t({ref:u,placerProps:oz(oz({},e),{},{placement:m||id(a),maxHeight:p})})},im=function(e,t){var n=e.theme,l=n.spacing.baseUnit,a=n.colors;return oz({textAlign:"center"},t?{}:{color:a.neutral40,padding:"".concat(2*l,"px ").concat(3*l,"px")})},ig=["size"],iv=["innerProps","isRtl","size"],ib={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},iy=function(e){var t=e.size,n=oW(e,ig);return rX("svg",nu({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:ib},n))},ix=function(e){return rX(iy,nu({size:20},e),rX("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"}))},iw=function(e){return rX(iy,nu({size:20},e),rX("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"}))},ij=function(e,t){var n=e.isFocused,l=e.theme,a=l.spacing.baseUnit,o=l.colors;return oz({label:"indicatorContainer",display:"flex",transition:"color 150ms"},t?{}:{color:n?o.neutral60:o.neutral20,padding:2*a,":hover":{color:n?o.neutral80:o.neutral40}})},iC=function(){var e=r$.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}(ii||(ii=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"]))),iS=function(e){var t=e.delay,n=e.offset;return rX("span",{css:r$({animation:"".concat(iC," 1s ease-in-out ").concat(t,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},ik=["data"],i_=["innerRef","isDisabled","isHidden","inputClassName"],iN={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},iE={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":oz({content:'attr(data-value) " "',visibility:"hidden",
1whiteSpace:"pre"},iN)},iP=function(e){var t=e.children,n=e.innerProps;return rX("div",n,t)},iD={ClearIndicator:function(e){var t=e.children,n=e.innerProps;return rX("div",nu({},r6(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),t||rX(ix,null))},Control:function(e){var t=e.children,n=e.isDisabled,l=e.isFocused,a=e.innerRef,o=e.innerProps,r=e.menuIsOpen;return rX("div",nu({ref:a},r6(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":l,"control--menu-is-open":r}),o,{"aria-disabled":n||void 0}),t)},DropdownIndicator:function(e){var t=e.children,n=e.innerProps;return rX("div",nu({},r6(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),t||rX(iw,null))},DownChevron:iw,CrossIcon:ix,Group:function(e){var t=e.children,n=e.cx,l=e.getStyles,a=e.getClassNames,o=e.Heading,r=e.headingProps,i=e.innerProps,s=e.label,c=e.theme,u=e.selectProps;return rX("div",nu({},r6(e,"group",{group:!0}),i),rX(o,nu({},r,{selectProps:u,theme:c,getStyles:l,getClassNames:a,cx:n}),s),rX("div",null,t))},GroupHeading:function(e){var t=r2(e);t.data;var n=oW(t,ik);return rX("div",nu({},r6(e,"groupHeading",{"group-heading":!0}),n))},IndicatorsContainer:function(e){var t=e.children,n=e.innerProps;return rX("div",nu({},r6(e,"indicatorsContainer",{indicators:!0}),n),t)},IndicatorSeparator:function(e){var t=e.innerProps;return rX("span",nu({},t,r6(e,"indicatorSeparator",{"indicator-separator":!0})))},Input:function(e){var t=e.cx,n=e.value,l=r2(e),a=l.innerRef,o=l.isDisabled,r=l.isHidden,i=l.inputClassName,s=oW(l,i_);return rX("div",nu({},r6(e,"input",{"input-container":!0}),{"data-value":n||""}),rX("input",nu({className:t({input:!0},i),ref:a,style:oz({label:"input",color:"inherit",background:0,opacity:+!r,width:"100%"},iN),disabled:o},s)))},LoadingIndicator:function(e){var t=e.innerProps,n=e.isRtl,l=e.size,a=oW(e,iv);return rX("div",nu({},r6(oz(oz({},a),{},{innerProps:t,isRtl:n,size:void 0===l?4:l}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),rX(iS,{delay:0,offset:n}),rX(iS,{delay:160,offset:!0}),rX(iS,{delay:320,offset:!n}))},Menu:function(e){var t=e.children,n=e.innerRef,l=e.innerProps;return rX("div",nu({},r6(e,"menu",{menu:!0}),{ref:n},l),t)},MenuList:function(e){var t=e.children,n=e.innerProps,l=e.innerRef,a=e.isMulti;return rX("div",nu({},r6(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:l},n),t)},MenuPortal:function(e){var t=e.appendTo,n=e.children,l=e.controlElement,a=e.innerProps,i=e.menuPlacement,c=e.menuPosition,u=(0,o.useRef)(null),d=(0,o.useRef)(null),p=oq((0,o.useState)(id(i)),2),h=p[0],f=p[1],m=(0,o.useMemo)(function(){return{setPortalPlacement:f}},[]),g=oq((0,o.useState)(null),2),v=g[0],b=g[1],y=(0,o.useCallback)(function(){if(l){var e,t={bottom:(e=l.getBoundingClientRect()).bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width},n="fixed"===c?0:window.pageYOffset,a=t[h]+n;(a!==(null==v?void 0:v.offset)||t.left!==(null==v?void 0:v.rect.left)||t.width!==(null==v?void 0:v.rect.width))&&b({offset:a,rect:t})}},[l,c,h,null==v?void 0:v.offset,null==v?void 0:v.rect.left,null==v?void 0:v.rect.width]);rZ(function(){y()},[y]);var x=(0,o.useCallback)(function(){"function"==typeof d.current&&(d.current(),d.current=null),l&&u.current&&(d.current=(0,s.k)(l,u.current,y,{elementResize:"ResizeObserver"in window}))},[l,y]);rZ(function(){x()},[x]);var w=(0,o.useCallback)(function(e){u.current=e,x()},[x]);if(!t&&"fixed"!==c||!v)return null;var j=rX("div",nu({ref:w}
1,r6(oz(oz({},e),{},{offset:v.offset,position:c,rect:v.rect}),"menuPortal",{"menu-portal":!0}),a),n);return rX(ip.Provider,{value:m},t?(0,r.createPortal)(j,t):j)},LoadingMessage:function(e){var t=e.children,n=void 0===t?"Loading...":t,l=e.innerProps,a=oW(e,iu);return rX("div",nu({},r6(oz(oz({},a),{},{children:n,innerProps:l}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),l),n)},NoOptionsMessage:function(e){var t=e.children,n=void 0===t?"No options":t,l=e.innerProps,a=oW(e,ic);return rX("div",nu({},r6(oz(oz({},a),{},{children:n,innerProps:l}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),l),n)},MultiValue:function(e){var t=e.children,n=e.components,l=e.data,a=e.innerProps,o=e.isDisabled,r=e.removeProps,i=e.selectProps,s=n.Container,c=n.Label,u=n.Remove;return rX(s,{data:l,innerProps:oz(oz({},r6(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:i},rX(c,{data:l,innerProps:oz({},r6(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:i},t),rX(u,{data:l,innerProps:oz(oz({},r6(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},r),selectProps:i}))},MultiValueContainer:iP,MultiValueLabel:iP,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return rX("div",nu({role:"button"},n),t||rX(ix,{size:14}))},Option:function(e){var t=e.children,n=e.isDisabled,l=e.isFocused,a=e.isSelected,o=e.innerRef,r=e.innerProps;return rX("div",nu({},r6(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":l,"option--is-selected":a}),{ref:o,"aria-disabled":n},r),t)},Placeholder:function(e){var t=e.children,n=e.innerProps;return rX("div",nu({},r6(e,"placeholder",{placeholder:!0}),n),t)},SelectContainer:function(e){var t=e.children,n=e.innerProps,l=e.isDisabled,a=e.isRtl;return rX("div",nu({},r6(e,"container",{"--is-disabled":l,"--is-rtl":a}),n),t)},SingleValue:function(e){var t=e.children,n=e.isDisabled,l=e.innerProps;return rX("div",nu({},r6(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),l),t)},ValueContainer:function(e){var t=e.children,n=e.innerProps,l=e.isMulti,a=e.hasValue;return rX("div",nu({},r6(e,"valueContainer",{"value-container":!0,"value-container--is-multi":l,"value-container--has-value":a}),n),t)}},iT=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function iR(e,t){if(e.length!==t.length)return!1;for(var n,l,a=0;a<e.length;a++)if(!((n=e[a])===(l=t[a])||iT(n)&&iT(l)))return!1;return!0}var iA={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"},iL=function(e){return rX("span",nu({css:iA},e))},iO={guidance:function(e){var t=e.isSearchable,n=e.isMulti,l=e.tabSelectsValue,a=e.context,o=e.isInitialFocus;switch(a){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(l?", press Tab to select the option and exit the menu":"",".");case"input":return o?"".concat(e["aria-label"]||"Select"," is focused ").concat(t?",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 t=e.action,n=e.label,l=void 0===n?"":n,a=e.labels,o=e.isDisabled;switch(t){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(l,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(a.length>1?"s":""," ").concat(a.join(","),", selected.");case"select-option":return o?"option ".concat(l," is disabled. Select another option."):"option ".concat(l,", selected.");default:return""}},onFocus:function(e){var t=e.context,n=e.focused,l=e.options,a=e.label,o=void 0===a?"":a,r=e.selectValue,i=e.isDisabled,s=e.isSelected,c=e.isAppleDevice,u=function(e,t){return e&&e.length?"".concat(e.indexOf(t)+1," of ").concat(e.length):""};if("value"===t&&r)return"value ".concat(o," focused, ").concat(u(r,n),".");if("menu"===t&&c){var d="".concat(s?" selected":"").concat(i?" disabled":"");return"".concat(o).concat(d,", ").concat(u(l,n),".")}return""},onFilter:function(e){var t=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}},iF=function(e){var t=e.ariaSelection,n=e.focusedOption,l=e.focu
1sedValue,a=e.focusableOptions,r=e.isFocused,i=e.selectValue,s=e.selectProps,c=e.id,u=e.isAppleDevice,d=s.ariaLiveMessages,p=s.getOptionLabel,h=s.inputValue,f=s.isMulti,m=s.isOptionDisabled,g=s.isSearchable,v=s.menuIsOpen,b=s.options,y=s.screenReaderStatus,x=s.tabSelectsValue,w=s.isLoading,j=s["aria-label"],C=s["aria-live"],S=(0,o.useMemo)(function(){return oz(oz({},iO),d||{})},[d]),k=(0,o.useMemo)(function(){var e="";if(t&&S.onChange){var n=t.option,l=t.options,a=t.removedValue,o=t.removedValues,r=t.value,s=a||n||(Array.isArray(r)?null:r),c=s?p(s):"",u=l||o||void 0,d=u?u.map(p):[],h=oz({isDisabled:s&&m(s,i),label:c,labels:d},t);e=S.onChange(h)}return e},[t,S,m,i,p]),_=(0,o.useMemo)(function(){var e="",t=n||l,o=!!(n&&i&&i.includes(n));if(t&&S.onFocus){var r={focused:t,label:p(t),isDisabled:m(t,i),isSelected:o,options:a,context:t===n?"menu":"value",selectValue:i,isAppleDevice:u};e=S.onFocus(r)}return e},[n,l,p,m,S,a,i,u]),N=(0,o.useMemo)(function(){var e="";if(v&&b.length&&!w&&S.onFilter){var t=y({count:a.length});e=S.onFilter({inputValue:h,resultsMessage:t})}return e},[a,h,v,S,b,y,w]),E=(null==t?void 0:t.action)==="initial-input-focus",P=(0,o.useMemo)(function(){var e="";if(S.guidance){var t=l?"value":v?"menu":"input";e=S.guidance({"aria-label":j,context:t,isDisabled:n&&m(n,i),isMulti:f,isSearchable:g,tabSelectsValue:x,isInitialFocus:E})}return e},[j,n,l,f,m,g,v,S,i,x,E]),D=rX(o.Fragment,null,rX("span",{id:"aria-selection"},k),rX("span",{id:"aria-focused"},_),rX("span",{id:"aria-results"},N),rX("span",{id:"aria-guidance"},P));return rX(o.Fragment,null,rX(iL,{id:c},E&&D),rX(iL,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},r&&!E&&D))},iM=[{base:"A",letters:"Aâ¶ï¼¡\xc0\xc1\xc2ẦẤẪẨ\xc3ÄÄáº°áº®áº´áº²È¦Ç \xc4ÇẢ\xc5ǺÇÈÈẠẬẶá¸ÄȺⱯ"},{base:"AA",letters:"ê²"},{base:"AE",letters:"\xc6ǼǢ"},{base:"AO",letters:"ê´"},{base:"AU",letters:"ê¶"},{base:"AV",letters:"ê¸êº"},{base:"AY",letters:"ê¼"},{base:"B",letters:"Bâ·ï¼¢á¸á¸á¸ÉÆÆ"},{base:"C",letters:"Câ¸ï¼£ÄÄÄÄ\xc7á¸ÆÈ»ê¾"},{base:"D",letters:"Dâ¹ï¼¤á¸Äá¸á¸á¸á¸ÄÆÆÆê¹"},{base:"DZ",letters:"DZÇ"},{base:"Dz",letters:"DzÇ
"},{base:"E",letters:"Eâºï¼¥\xc8\xc9\xcaá»áº¾á»á»áº¼Äá¸á¸ÄÄ\xcbẺÄÈÈẸá»È¨á¸Äá¸á¸ÆÆ"},{base:"F",letters:"Fâ»ï¼¦á¸Æê»"},{base:"G",letters:"Gâ¼ï¼§Ç´ÄḠÄÄ Ç¦Ä¢Ç¤Æê ê½ê¾"},{base:"H",letters:"Hâ½ï¼¨Ä¤á¸¢á¸¦ÈḤḨḪĦⱧⱵê"},{base:"I",letters:"Iâ¾ï¼©\xcc\xcd\xceĨĪĬİ\xcfḮá»ÇÈÈá»Ä®á¸¬Æ"},{base:"J",letters:"Jâ¿ï¼ªÄ´É"},{base:"K",letters:"KâKḰǨḲĶḴÆâ±©êêêê¢"},{base:"L",letters:"LâLĿĹĽḶḸĻḼḺÅȽⱢⱠêêê"},{base:"LJ",letters:"Ç"},{base:"Lj",letters:"Ç"},{base:"M",letters:"Mâï¼á¸¾á¹á¹â±®Æ"},{base:"N",letters:"NâNǸÅ\xd1á¹Åá¹Å
á¹á¹È Æêê¤"},{base:"NJ",letters:"Ç"},{base:"Nj",letters:"Ç"},{base:"O",letters:"OâO\xd2\xd3\xd4á»á»á»á»\xd5á¹È¬á¹Åá¹á¹ÅȮȰ\xd6Ȫá»ÅÇÈÈÆ á»á»á» á»á»¢á»á»ÇªÇ¬\xd8Ç¾ÆÆêê"},{base:"OI",letters:"Æ¢"},{base:"OO",letters:"ê"},{base:"OU",letters:"È¢"},{base:"P",letters:"Pâ
ï¼°á¹á¹Æ¤â±£êêê"},{base:"Q",letters:"Qâï¼±êêÉ"},{base:"R",letters:"Râï¼²Åá¹ÅÈÈá¹á¹Åá¹ÉⱤêê¦ê"},{base:"S",letters:"Sâï¼³áºÅṤÅṠŠṦṢṨÈÅâ±¾ê¨ê"},{base:"T",letters:"TâTṪŤṬÈŢṰṮŦƬƮȾê"},{base:"TZ",letters:"ê¨"},{base:"U",letters:"Uâï¼µ\xd9\xda\xdbŨṸŪṺŬ\xdcÇÇÇÇỦŮŰÇÈÈÆ¯á»ªá»¨á»®á»¬á»°á»¤á¹²Å²á¹¶á¹´É"},{base:"V",letters:"VâVṼṾƲêÉ
"},{base:"VY",letters:"ê "},{base:"W",letters:"Wâï¼·áºáºÅ´áºáºáºâ±²"},{base:"X",letters:"XâXáºáº"},{base:"Y",letters:"YâYỲ\xddŶỸȲáºÅ¸á»¶á»´Æ³ÉỾ"},{base:"Z",letters:"ZâZŹáºÅ»Å½áºáºÆµÈ¤â±¿â±«ê¢"},{base:"a",letters:"aâï½áº\xe0\xe1\xe2ầấẫẩ\xe3ÄÄằắẵẳȧǡ\xe4Çả\xe5Ç»ÇÈÈạáºáº·á¸Ä
â±¥É"},{base:"aa",letters:"ê³"},{base:"ae",letters:"\xe6ǽǣ"},{base:"ao",letters:"êµ"},{base:"au",letters:"ê·"},{base:"av",letters:"ê¹ê»"},{base:"ay",letters:"ê½"},{base:"b",letters:"bâï½á¸á¸
á¸ÆÆÉ"}
1,{base:"c",letters:"câï½ÄÄÄÄ\xe7á¸ÆÈ¼ê¿â"},{base:"d",letters:"dâï½á¸Äá¸á¸á¸á¸ÄÆÉÉêº"},{base:"dz",letters:"dzÇ"},{base:"e",letters:"eâï½
\xe8\xe9\xeaá»áº¿á»
á»áº½Äá¸á¸ÄÄ\xebẻÄÈ
Èẹá»È©á¸Äá¸á¸ÉÉÇ"},{base:"f",letters:"fâï½á¸Æê¼"},{base:"g",letters:"gâï½ÇµÄḡÄÄ¡Ç§Ä£Ç¥É ê¡áµ¹ê¿"},{base:"h",letters:"hâï½Ä¥á¸£á¸§ÈḥḩḫáºÄ§â±¨â±¶É¥"},{base:"hv",letters:"Æ"},{base:"i",letters:"iâï½\xec\xed\xeeĩīÄ\xefḯá»ÇÈÈá»Ä¯á¸É¨Ä±"},{base:"j",letters:"jâï½ÄµÇ°É"},{base:"k",letters:"kâï½á¸±Ç©á¸³Ä·á¸µÆâ±ªêêê
ê£"},{base:"l",letters:"lâï½ÅÄºÄ¾á¸·á¸¹Ä¼á¸½á¸»Å¿ÅÆÉ«â±¡êêê"},{base:"lj",letters:"Ç"},{base:"m",letters:"mâï½á¸¿á¹á¹É±É¯"},{base:"n",letters:"nâï½Ç¹Å\xf1á¹
Åá¹Åá¹á¹ÆÉ²Åêê¥"},{base:"nj",letters:"Ç"},{base:"o",letters:"oâï½\xf2\xf3\xf4á»á»á»á»\xf5á¹Èá¹Åá¹á¹Åȯȱ\xf6È«á»ÅÇÈÈÆ¡á»á»á»¡á»á»£á»á»Ç«Ç\xf8Ç¿Éêêɵ"},{base:"oi",letters:"Æ£"},{base:"ou",letters:"È£"},{base:"oo",letters:"ê"},{base:"p",letters:"pâï½á¹á¹Æ¥áµ½êêê"},{base:"q",letters:"qâ ï½Éêê"},{base:"r",letters:"râ¡ï½Åá¹ÅÈÈá¹á¹Åá¹Éɽêê§ê"},{base:"s",letters:"sâ¢ï½\xdfÅá¹¥ÅṡšṧṣṩÈÅÈ¿ê©ê
áº"},{base:"t",letters:"tâ£ï½á¹«áºÅ¥á¹ÈţṱṯŧÆÊⱦê"},{base:"tz",letters:"ê©"},{base:"u",letters:"uâ¤ï½\xf9\xfa\xfbũṹūṻÅ\xfcÇÇÇÇủůűÇÈÈÆ°á»«á»©á»¯á»á»±á»¥á¹³Å³á¹·á¹µÊ"},{base:"v",letters:"vâ¥ï½á¹½á¹¿ÊêÊ"},{base:"vy",letters:"ê¡"},{base:"w",letters:"wâ¦ï½áºáºÅµáºáº
áºáºâ±³"},{base:"x",letters:"xâ§ï½áºáº"},{base:"y",letters:"yâ¨ï½á»³\xfdŷỹȳáº\xffá»·áºá»µÆ´Éỿ"},{base:"z",letters:"zâ©ï½ÅºáºÅ¼Å¾áºáºÆ¶È¥Éⱬê£"}],iI=RegExp("["+iM.map(function(e){return e.letters}).join("")+"]","g"),iB={};for(iV=0;iV<iM.length;iV++)for(iU=iM[iV],iz=0;iz<iU.letters.length;iz++)iB[iU.letters[iz]]=iU.base;var iU,iz,iV,iH=function(e){return e.replace(iI,function(e){return iB[e]})},iq=function(e,t){void 0===t&&(t=iR);var n=null;function l(){for(var l=[],a=0;a<arguments.length;a++)l[a]=arguments[a];if(n&&n.lastThis===this&&t(l,n.lastArgs))return n.lastResult;var o=e.apply(this,l);return n={lastResult:o,lastArgs:l,lastThis:this},o}return l.clear=function(){n=null},l}(iH),iW=function(e){return e.replace(/^\s+|\s+$/g,"")},iK=function(e){return"".concat(e.label," ").concat(e.value)},iY=["innerRef"];function iG(e){var t=e.innerRef,n=is(oW(e,iY),"onExited","in","enter","exit","appear");return rX("input",nu({ref:t},n,{css:r$({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 iQ=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()},iX=["boxSizing","height","overflow","paddingRight","position"],i$={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function iZ(e){e.cancelable&&e.preventDefault()}function iJ(e){e.stopPropagation()}function i0(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function i1(){return"ontouchstart"in window||navigator.maxTouchPoints}var i3=!!("u">typeof window&&window.document&&window.document.createElement),i2=0,i6={capture:!1,passive:!1},i5=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},i4={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function i8(e){var t,n,l,a,r,i,s,c,u,d,p,h,f,m,g,v,b,y,x,w,j,C,S,k,_=e.children,N=e.lockEnabled,E=e.captureEnabled,P=(n=(t={isEnabled:void 0===E||E,onBottomArrive:e.onBottomArrive,onBottomLeave:e.onBottomLeave,onTopArrive:e.onTopArrive,onTopLeave:e.onTopLeave}).isEnabled,l=t.onBottomArrive,a=t.onBottomLeave,r=t.onTopArrive,i=t.onTopLeave,s=(0,o.useRef)(!1),c=(0,o.useRef)(!1),u=(0,o.useRef)(0),d=(0,o.useRef)(null),p=(0,o.useCallback)(function(e,t){if(null!==d.current){var n=d.current,o=n.scrollTop,u=n.scrollHeight,p=n.clientHeight,h=d.current,f=t>0,m=u-p-o,g=!1;m>t&&s.current&&(a&&a(e),s.current=!1),f&&c.current&&(i&&i(e),c.current=!1),f&&t>m?(l&&!s.current&&l(e),h.scrollTop=u,g=!0,s.current=!0):!f&&-t>o&&(r&&!c.current&&r(e),h.scrollTop=0,g=!0,c.current=!0),g&&iQ(e)}},[l,a,r,i]),h=(0,o.useCallback)(function(e){p(e,e.deltaY)},[p]),f=(0,o.useCallback)(function(e){u.current=e.changedTouches[0].clientY},[]),m=(0,o.useCallback)(function(e){var t=u.current-e.changedTouches[0].clientY;p(e,t)},[p]),g=(0,o.useCallback)(function(e){if(e){var t=!!ia&&{passive:!1};e.addEventListener("wheel",h,t),e.addEventListener("touchstart",f,t),e.addEventListener("touchmove",m,t)}},[m,f,h]),v=(0,o.useCallback)(function(e){e&&(e.removeEventListener("wheel",h,!1),e.removeEventListener("touchstart",f,!1),e.removeEventListener("touchmove",m,!1))},[m,f,h]),(0,o.useEffect)(function(){if(n){var e=d.current;return g(e),function(){v(e)}}},[n,g,v]),function(e){d.current=e}
1),D=(y=(b={isEnabled:N}).isEnabled,w=void 0===(x=b.accountForScrollbars)||x,j=(0,o.useRef)({}),C=(0,o.useRef)(null),S=(0,o.useCallback)(function(e){if(i3){var t=document.body,n=t&&t.style;if(w&&iX.forEach(function(e){var t=n&&n[e];j.current[e]=t}),w&&i2<1){var l=parseInt(j.current.paddingRight,10)||0,a=document.body?document.body.clientWidth:0,o=window.innerWidth-a+l||0;Object.keys(i$).forEach(function(e){var t=i$[e];n&&(n[e]=t)}),n&&(n.paddingRight="".concat(o,"px"))}t&&i1()&&(t.addEventListener("touchmove",iZ,i6),e&&(e.addEventListener("touchstart",i0,i6),e.addEventListener("touchmove",iJ,i6))),i2+=1}},[w]),k=(0,o.useCallback)(function(e){if(i3){var t=document.body,n=t&&t.style;i2=Math.max(i2-1,0),w&&i2<1&&iX.forEach(function(e){var t=j.current[e];n&&(n[e]=t)}),t&&i1()&&(t.removeEventListener("touchmove",iZ,i6),e&&(e.removeEventListener("touchstart",i0,i6),e.removeEventListener("touchmove",iJ,i6)))}},[w]),(0,o.useEffect)(function(){if(y){var e=C.current;return S(e),function(){k(e)}}},[y,S,k]),function(e){C.current=e});return rX(o.Fragment,null,N&&rX("div",{onClick:i5,css:i4}),_(function(e){P(e),D(e)}))}var i9={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},i7=function(e){var t=e.name,n=e.onFocus;return rX("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:i9,value:"",onChange:function(){}})};function se(e){var t;return"u">typeof window&&null!=window.navigator&&e.test((null==(t=window.navigator.userAgentData)?void 0:t.platform)||window.navigator.platform)}var st=function(e){return e.label},sn=function(e){return e.value},sl={clearIndicator:ij,container:function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":void 0,pointerEvents:t?"none":void 0,position:"relative"}},control:function(e,t){var n=e.isDisabled,l=e.isFocused,a=e.theme,o=a.colors,r=a.borderRadius;return oz({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:a.spacing.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},t?{}:{backgroundColor:n?o.neutral5:o.neutral0,borderColor:n?o.neutral10:l?o.primary:o.neutral20,borderRadius:r,borderStyle:"solid",borderWidth:1,boxShadow:l?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:l?o.primary:o.neutral30}})},dropdownIndicator:ij,group:function(e,t){var n=e.theme.spacing;return t?{}:{paddingBottom:2*n.baseUnit,paddingTop:2*n.baseUnit}},groupHeading:function(e,t){var n=e.theme,l=n.colors,a=n.spacing;return oz({label:"group",cursor:"default",display:"block"},t?{}:{color:l.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:3*a.baseUnit,paddingRight:3*a.baseUnit,textTransform:"uppercase"})},indicatorsContainer:function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},indicatorSeparator:function(e,t){var n=e.isDisabled,l=e.theme,a=l.spacing.baseUnit,o=l.colors;return oz({label:"indicatorSeparator",alignSelf:"stretch",width:1},t?{}:{backgroundColor:n?o.neutral10:o.neutral20,marginBottom:2*a,marginTop:2*a})},input:function(e,t){var n=e.isDisabled,l=e.value,a=e.theme,o=a.spacing,r=a.colors;return oz(oz({visibility:n?"hidden":"visible",transform:l?"translateZ(0)":""},iE),t?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:r.neutral80})},loadingIndicator:function(e,t){var n=e.isFocused,l=e.size,a=e.theme,o=a.colors,r=a.spacing.baseUnit;return oz({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:l,lineHeight:1,marginRight:l,textAlign:"center",verticalAlign:"middle"},t?{}:{color:n?o.neutral60:o.neutral20,padding:2*r})},loadingMessage:im,menu:function(e,t){var n,l=e.placement,a=e.theme,o=a.borderRadius,r=a.spacing,i=a.colors;return oz((oB(n={label:"menu"},l?({bottom:"top",top:"bottom"})[l]:"bottom","100%"),oB(n,"position","absolute"),oB(n,"width","100%"),oB(n,"zIndex",1),n),t?{}:{backgroundColor:i.neutral0,borderRadius:o,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:r.menuGutter,marginTop:r.menuGutter})},menuList:function(e,t){var n=e.maxHeight,l=e.theme.spacing.baseUnit;return oz({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},t?{}:{paddingBottom:l,paddingTop:l})},menuPortal:function(e){var t=e.rect,n=e.offset,l=e.position;return{left:t.left,position:l,top:n,width:t.width,zIndex:1}},multiValue:function(e,t){var n=e.theme,l=n.spacing,a=n.borderRadius,o=n.colors;return oz({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:l.baseUnit/2})},multiValueLabel:function(e,t){var n=e.theme,l=n.borderRadius,a=n.colors,o=e.cropWithEllipsis;return oz({overflow:"hidden",textOverflow:o||void 0===o?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:l/2,color:a.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},multiValueRemove:function(e,t){var n=e.theme,l=n.spacing,a=n.borderRadius,o=n.colors,r=e.isFocused;return oz({alignItems:"center",display:"flex"},t?{}:{borderRadius:a/2,backgroundColor:r?o.dangerLight:void 0,paddingLeft:l.baseUnit,paddingRight:l.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},noOptionsMessage:im,option:function(e,t){var n=e.isDisabled,l=e.isFocused,a=e.isSelected,o=e.theme,r=o.spacing,i=o.c
1olors;return oz({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:a?i.primary:l?i.primary25:"transparent",color:n?i.neutral20:a?i.neutral0:"inherit",padding:"".concat(2*r.baseUnit,"px ").concat(3*r.baseUnit,"px"),":active":{backgroundColor:n?void 0:a?i.primary:i.primary50}})},placeholder:function(e,t){var n=e.theme,l=n.spacing,a=n.colors;return oz({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:a.neutral50,marginLeft:l.baseUnit/2,marginRight:l.baseUnit/2})},singleValue:function(e,t){var n=e.isDisabled,l=e.theme,a=l.spacing,o=l.colors;return oz({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t?{}:{color:n?o.neutral40:o.neutral80,marginLeft:a.baseUnit/2,marginRight:a.baseUnit/2})},valueContainer:function(e,t){var n=e.theme.spacing,l=e.isMulti,a=e.hasValue,o=e.selectProps.controlShouldRenderValue;return oz({alignItems:"center",display:l&&a&&o?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},t?{}:{padding:"".concat(n.baseUnit/2,"px ").concat(2*n.baseUnit,"px")})}},sa={borderRadius:4,colors:{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%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}},so={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:ie(),captureMenuScroll:!ie(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:function(e,t){if(e.data.__isNew__)return!0;var n=oz({ignoreCase:!0,ignoreAccents:!0,stringify:iK,trim:!0,matchFrom:"any"},void 0),l=n.ignoreCase,a=n.ignoreAccents,o=n.stringify,r=n.trim,i=n.matchFrom,s=r?iW(t):t,c=r?iW(o(e)):o(e);return l&&(s=s.toLowerCase(),c=c.toLowerCase()),a&&(s=iq(s),c=iH(c)),"start"===i?c.substr(0,s.length)===s:c.indexOf(s)>-1},formatGroupLabel:function(e){return e.label},getOptionLabel:st,getOptionValue:sn,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:function(e){return!!e.isDisabled},loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!function(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(1!==t?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function sr(e,t,n,l){var a=sf(e,t,n),o=sm(e,t,n),r=sp(e,t),i=sh(e,t);return{type:"option",data:t,isDisabled:a,isSelected:o,label:r,value:i,index:l}}function si(e,t){return e.options.map(function(n,l){if("options"in n){var a=n.options.map(function(n,l){return sr(e,n,t,l)}).filter(function(t){return su(e,t)});return a.length>0?{type:"group",data:n,options:a,index:l}:void 0}var o=sr(e,n,t,l);return su(e,o)?o:void 0}).filter(io)}function ss(e){return e.reduce(function(e,t){return"group"===t.type?e.push.apply(e,o$(t.options.map(function(e){return e.data}))):e.push(t.data),e},[])}function sc(e,t){return e.reduce(function(e,n){return"group"===n.type?e.push.apply(e,o$(n.options.map(function(e){return{data:e.data,id:"".concat(t,"-").concat(n.index,"-").concat(e.index)}}))):e.push({data:n.data,id:"".concat(t,"-").concat(n.index)}),e},[])}function su(e,t){var n=e.inputValue,l=t.data,a=t.isSelected,o=t.label,r=t.value;return(!sv(e)||!a)&&sg(e,{label:o,value:r,data:l},void 0===n?"":n)}var sd=function(e,t){var n;return(null==(n=e.find(function(e){return e.data===t}))?void 0:n.id)||null},sp=function(e,t){return e.getOptionLabel(t)}
1,sh=function(e,t){return e.getOptionValue(t)};function sf(e,t,n){return"function"==typeof e.isOptionDisabled&&e.isOptionDisabled(t,n)}function sm(e,t,n){if(n.indexOf(t)>-1)return!0;if("function"==typeof e.isOptionSelected)return e.isOptionSelected(t,n);var l=sh(e,t);return n.some(function(t){return sh(e,t)===l})}function sg(e,t,n){return!e.filterOption||e.filterOption(t,n)}var sv=function(e){var t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},sb=1,sy=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&np(r,e);var t,n,l,a=(t=oX(),function(){var e,n=oQ(r);e=t?Reflect.construct(n,arguments,oQ(this).constructor):n.apply(this,arguments);if(e&&("object"==oM(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");if(void 0===this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return this});function r(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),(t=a.call(this,e)).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:""},t.blockOptionHover=!1,t.isComposing=!1,t.commonProps=void 0,t.initialTouchX=0,t.initialTouchY=0,t.openAfterFocus=!1,t.scrollToFocusedOptionOnUpdate=!1,t.userIsDragging=void 0,t.isAppleDevice=se(/^Mac/i)||se(/^iPhone/i)||se(/^iPad/i)||se(/^Mac/i)&&navigator.maxTouchPoints>1,t.controlRef=null,t.getControlRef=function(e){t.controlRef=e},t.focusedOptionRef=null,t.getFocusedOptionRef=function(e){t.focusedOptionRef=e},t.menuListRef=null,t.getMenuListRef=function(e){t.menuListRef=e},t.inputRef=null,t.getInputRef=function(e){t.inputRef=e},t.focus=t.focusInput,t.blur=t.blurInput,t.onChange=function(e,n){var l=t.props,a=l.onChange;n.name=l.name,t.ariaOnChange(e,n),a(e,n)},t.setValue=function(e,n,l){var a=t.props,o=a.closeMenuOnSelect,r=a.isMulti,i=a.inputValue;t.onInputChange("",{action:"set-value",prevInputValue:i}),o&&(t.setState({inputIsHiddenAfterUpdate:!r}),t.onMenuClose()),t.setState({clearFocusValueOnUpdate:!0}),t.onChange(e,{action:n,option:l})},t.selectOption=function(e){var n=t.props,l=n.blurInputOnSelect,a=n.isMulti,o=n.name,r=t.state.selectValue,i=a&&t.isOptionSelected(e,r),s=t.isOptionDisabled(e,r);if(i){var c=t.getOptionValue(e);t.setValue(r.filter(function(e){return t.getOptionValue(e)!==c}),"deselect-option",e)}else{if(s)return void t.ariaOnChange(e,{action:"select-option",option:e,name:o});a?t.setValue([].concat(o$(r),[e]),"select-option",e):t.setValue(e,"select-option")}l&&t.blurInput()},t.removeValue=function(e){var n,l=t.props.isMulti,a=t.state.selectValue,o=t.getOptionValue(e),r=a.filter(function(e){return t.getOptionValue(e)!==o}),i=(n=r[0]||null,l?r:n);t.onChange(i,{action:"remove-value",removedValue:e}),t.focusInput()},t.clearValue=function(){var e,n,l=t.state.selectValue;t.onChange((e=t.props.isMulti,n=[],e?n:null),{action:"clear",removedValues:l})},t.popValue=function(){var e,n=t.props.isMulti,l=t.state.selectValue,a=l[l.length-1],o=l.slice(0,l.length-1),r=(e=o[0]||null,n?o:e);a&&t.onChange(r,{action:"pop-value",removedValue:a})},t.getFocusedOptionId=function(e){return sd(t.state.focusableOptionsWithIds,e)},t.getFocusableOptionsWithIds=function(){return sc(si(t.props,t.state.selectValue),t.getElementId("option"))},t.getValue=function(){return t.state.selectValue},t.cx=function(){for(var e=arguments.length,n=Array(e),l=0;l<e;l++)n[l]=arguments[l];return r1.apply(void 0,[t.props.classNamePrefix].concat(n))},t.getOptionLabel=function(e){return sp(t.props,e)},t.getOptionValue=function(e){return sh(t.props,e)},t.getStyles=function(e,n){var l=t.props.unstyled,a=sl[e](n,l);a.boxSizing="border-box";var o=t.props.styles[e];return o?o(a,n):a},t.getClassNames=function(e,n){var l,a;return null==(l=(a=t.props.classNames)[e])?void 0:l.call(a,n)},t.getElementId=function(e){return"".concat(t.state.instancePrefix,"-").concat(e)},t.getComponents=function(){var e;return e=t.props,oz(oz({},iD),e.components)},t.buildCategorizedOptions=function(){return si(t.props,t.state.selectValue)},t.getCategorizedOptions=function(){return t.props.menuIsOpen?t.buildCategorizedOptions():[]},t.buildFocusableOptions=function(){return ss(t.buildCategorizedOptions())},t.getFocusableOptions=function(){return t.props.menuIsOpen?t.buildFocusableOptions():[]},t.ariaOnChange=function(e,n){t.setState({ariaSelection:oz({value:e},n)})},t.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),t.focusInput())},t.onMenuMouseMove=function(e){t.blockOptionHover=!1},t.onControlMouseDown=function(e){if(!e.defaultPrevented){var n=t.props.openMenuOnClick;t.state.isFocused?t.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&t.onMenuClose():n&&t.openMenu("first"):(n&&(t.openAfterFocus=!0),t.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()}},t.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button)&&!t.props.isDisabled){var n=t.props,l=n.isMulti,a=n.menuIsOpen;t.focusInput(),a?(t.setState({inputIsHiddenAfterUpdate:!l}),t.onMenuClose()):t.openMenu("first"),e.preventDefault()}},t.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(t.clearValue(),e.preventDefault(),t.openAfterFocus=!1,"touchend"===e.type?t.focu
vendor: 11,713 bytes, line 1
1sInput():setTimeout(function(){return t.focusInput()}))},t.onScroll=function(e){"boolean"==typeof t.props.closeMenuOnScroll?e.target instanceof HTMLElement&&r5(e.target)&&t.props.onMenuClose():"function"==typeof t.props.closeMenuOnScroll&&t.props.closeMenuOnScroll(e)&&t.props.onMenuClose()},t.onCompositionStart=function(){t.isComposing=!0},t.onCompositionEnd=function(){t.isComposing=!1},t.onTouchStart=function(e){var n=e.touches,l=n&&n.item(0);l&&(t.initialTouchX=l.clientX,t.initialTouchY=l.clientY,t.userIsDragging=!1)},t.onTouchMove=function(e){var n=e.touches,l=n&&n.item(0);if(l){var a=Math.abs(l.clientX-t.initialTouchX),o=Math.abs(l.clientY-t.initialTouchY);t.userIsDragging=a>5||o>5}},t.onTouchEnd=function(e){t.userIsDragging||(t.controlRef&&!t.controlRef.contains(e.target)&&t.menuListRef&&!t.menuListRef.contains(e.target)&&t.blurInput(),t.initialTouchX=0,t.initialTouchY=0)},t.onControlTouchEnd=function(e){t.userIsDragging||t.onControlMouseDown(e)},t.onClearIndicatorTouchEnd=function(e){t.userIsDragging||t.onClearIndicatorMouseDown(e)},t.onDropdownIndicatorTouchEnd=function(e){t.userIsDragging||t.onDropdownIndicatorMouseDown(e)},t.handleInputChange=function(e){var n=t.props.inputValue,l=e.currentTarget.value;t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange(l,{action:"input-change",prevInputValue:n}),t.props.menuIsOpen||t.onMenuOpen()},t.onInputFocus=function(e){t.props.onFocus&&t.props.onFocus(e),t.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(t.openAfterFocus||t.props.openMenuOnFocus)&&t.openMenu("first"),t.openAfterFocus=!1},t.onInputBlur=function(e){var n=t.props.inputValue;if(t.menuListRef&&t.menuListRef.contains(document.activeElement))return void t.inputRef.focus();t.props.onBlur&&t.props.onBlur(e),t.onInputChange("",{action:"input-blur",prevInputValue:n}),t.onMenuClose(),t.setState({focusedValue:null,isFocused:!1})},t.onOptionHover=function(e){if(!(t.blockOptionHover||t.state.focusedOption===e)){var n=t.getFocusableOptions().indexOf(e);t.setState({focusedOption:e,focusedOptionId:n>-1?t.getFocusedOptionId(e):null})}},t.shouldHideSelectedOptions=function(){return sv(t.props)},t.onValueInputFocus=function(e){e.preventDefault(),e.stopPropagation(),t.focus()},t.onKeyDown=function(e){var n=t.props,l=n.isMulti,a=n.backspaceRemovesValue,o=n.escapeClearsValue,r=n.inputValue,i=n.isClearable,s=n.isDisabled,c=n.menuIsOpen,u=n.onKeyDown,d=n.tabSelectsValue,p=n.openMenuOnFocus,h=t.state,f=h.focusedOption,m=h.focusedValue,g=h.selectValue;if(!s&&!("function"==typeof u&&(u(e),e.defaultPrevented))){switch(t.blockOptionHover=!0,e.key){case"ArrowLeft":if(!l||r)return;t.focusValue("previous");break;case"ArrowRight":if(!l||r)return;t.focusValue("next");break;case"Delete":case"Backspace":if(r)return;if(m)t.removeValue(m);else{if(!a)return;l?t.popValue():i&&t.clearValue()}break;case"Tab":if(t.isComposing||e.shiftKey||!c||!d||!f||p&&t.isOptionSelected(f,g))return;t.selectOption(f);break;case"Enter":if(229===e.keyCode)break;if(c){if(!f||t.isComposing)return;t.selectOption(f);break}return;case"Escape":c?(t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange("",{action:"menu-close",prevInputValue:r}),t.onMenuClose()):i&&o&&t.clearValue();break;case" ":if(r)return;if(!c){t.openMenu("first");break}if(!f)return;t.selectOption(f);break;case"ArrowUp":c?t.focusOption("up"):t.openMenu("last");break;case"ArrowDown":c?t.focusOption("down"):t.openMenu("first");break;case"PageUp":if(!c)return;t.focusOption("pageup");break;case"PageDown":if(!c)return;t.focusOption("pagedown");break;case"Home":if(!c)return;t.focusOption("first");break;case"End":if(!c)return;t.focusOption("last");break;default:return}e.preventDefault()}},t.state.instancePrefix="react-select-"+(t.props.instanceId||++sb),t.state.selectValue=r3(e.value),e.menuIsOpen&&t.state.selectValue.length){var n=t.getFocusableOptionsWithIds(),l=t.buildFocusableOptions(),o=l.indexOf(t.state.selectValue[0]);t.state.focusableOptionsWithIds=n,t.state.focusedOption=l[o],t.state.focusedOptionId=sd(n,l[o])}return t}return n=[{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&&r7(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,l=t.menuIsOpen,a=this.state.isFocused;(a&&!n&&e.isDisabled||a&&l&&!e.menuIsOpen)&&this.focusInput(),a&&n&&!e.isDisabled?this.setState({isFocused:!1},this.onMenuClose):a||n||!e.isDisabled||this.inputRef!==document.activeElement||this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(r7(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(e,t){this.props.onInputChange(e,t)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(e){var t=this,n=this.state,l=n.selectValue,a=n.isFocused,o=this.buildFocusableOptions(),r="first"===e?0:o.length-1;if(!this.props.isMulti){var i=o.indexOf(l[0]);i>-1&&(r=i)}this.scrollToFocusedOptionOnUpdate=!(a&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:o[r],focusedOptionId:this.getFocusedOptionId(o[r])},function(){return t.onMenuOpen()})}},{key:"focusValue",value:function(e){var t=this.state,n=t.selectValue,l=t.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var a=n.indexOf(l);l||(a=-1);var o=n.length-1,r=-1;if(n.length){switch(e){case"previous":r=0===a?0:-1===a?o:a-1;break;case"next":a>-1&&a<o&&(r=a+1)}this.setState({inputIsHidden:-1!==r,focusedValue:n[r]})}}}},{key:"focusOption",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props.pageSize,n=this.state.focusedOption,l=this.getFocusableOptions();if(l.length){var a=0,o=l.indexOf(n);n||(o=-1),"up"===e?a=o>0?o-1:l.length-1:"down"===e?a=(o+1)%l.length:"pageup"===e?(a=o-t)<0&&(a=0):"pagedown"===e?(a=o+t)>l.length-1&&(a=l.length-1):"last"===e&&(a=l.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:l[a],focusedValue:null,focusedOptionId:this.getFocusedOptionId(l[a])})}}},{key:"getTheme",value:function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(sa):oz(oz({},sa),this.props.theme):sa}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,l=this.getClassNames,a=this.getValue,o=this.selectOption,r=this.setValue,i=this.props,s=i.isMulti,c=i.isRtl,u=i.options;return{clearValue:e,cx:t,getStyles:n,getClassNames:l,getValue:a,hasValue:this.hasValue(),isMulti:s,isRtl:c,options:u,selectOption:o,selectProps:i,setValue:r,theme:this.getTheme()}}},{key:"hasValue",value:function(){return this.state.selectValue.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var e=this.props,t=e.isClearable,n=e.isMulti;return void 0===t?n:t}},{key:"isOptionDisabled",value:function(e,t){return sf(this.props,e,t)}},{key:"isOptionSelected",value:function(e,t){return sm(this.props,e,t)}},{key:"filterOption",value:function(e,t){return sg(this.props,e,t)}},{key:"formatOptionLabel",value:function(e,t){if("function"!=typeof this.props.formatOptionLabel)return this.getOptionLabel(e);var n=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:l})}},{key:"formatGroupLabel",value:function(e){return this.props.formatGroupLabel(e)}},{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 e=this.props,t=e.isDisabled,n=e.isSearchable,l=e.inputId,a=e.inputValue,r=e.tabIndex,i=e.form,s=e.menuIsOpen,c=e.required,u=this.getComponents().Input,d=this.state,p=d.inputIsHidden,h=d.ariaSelection,f=this.commonProps,m=l||this.getElementId("input"),g=oz(oz(oz({"aria-autocomplete":"list","aria-expanded":s,"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":c,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},s&&{"aria-controls":this.getElementId("listbox")}),!n&&{"aria-readonly":!0}),this.hasValue()?(null==h?void 0:h.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return n?o.createElement(u,nu({},f,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:m,innerRef:this.getInputRef,isDisabled:t,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:r,form:i,type:"text",value:a},g)):o.createElement(iG,nu({id:m,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:r0,onFocus:this.onInputFocus,disabled:t,tabIndex:r,inputMode:"none",form:i,value:""},g))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.getComponents(),n=t.MultiValue,l=t.MultiValueContainer,a=t.MultiValueLabel,r=t.MultiValueRemove,i=t.SingleValue,s=t.Placeholder,c=this.commonProps,u=this.props,d=u.controlShouldRenderValue,p=u.isDisabled,h=u.isMulti,f=u.inputValue,m=u.placeholder,g=this.state,v=g.selectValue,b=g.focusedValue,y=g.isFocused;if(!this.hasValue()||!d)return f?null:o.createElement(s,nu({},c,{key:"placeholder",isDisabled:p,isFocused:y,innerProps:{id:this.getElementId("placeholder")}}),m);if(h)return v.map(function(t,i){var s=t===b,u="".concat(e.getOptionLabel(t),"-").concat(e.getOptionValue(t));return o.createElement(n,nu({},c,{components:{Container:l,Label:a,Remove:r},isFocused:s,isDisabled:p,key:u,index:i,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault()}},data:t}),e.formatOptionLabel(t,"value"))});if(f)return null;var x=v[0];return o.createElement(i,nu({},c,{data:x,isDisabled:p}),this.formatOptionLabel(x,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.getComponents().
1ClearIndicator,t=this.commonProps,n=this.props,l=n.isDisabled,a=n.isLoading,r=this.state.isFocused;if(!this.isClearable()||!e||l||!this.hasValue()||a)return null;var i={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,nu({},t,{innerProps:i,isFocused:r}))}},{key:"renderLoadingIndicator",value:function(){var e=this.getComponents().LoadingIndicator,t=this.commonProps,n=this.props,l=n.isDisabled,a=n.isLoading,r=this.state.isFocused;return e&&a?o.createElement(e,nu({},t,{innerProps:{"aria-hidden":"true"},isDisabled:l,isFocused:r})):null}},{key:"renderIndicatorSeparator",value:function(){var e=this.getComponents(),t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var l=this.commonProps,a=this.props.isDisabled,r=this.state.isFocused;return o.createElement(n,nu({},l,{isDisabled:a,isFocused:r}))}},{key:"renderDropdownIndicator",value:function(){var e=this.getComponents().DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,l=this.state.isFocused,a={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,nu({},t,{innerProps:a,isDisabled:n,isFocused:l}))}},{key:"renderMenu",value:function(){var e=this,t=this.getComponents(),n=t.Group,l=t.GroupHeading,a=t.Menu,r=t.MenuList,i=t.MenuPortal,s=t.LoadingMessage,c=t.NoOptionsMessage,u=t.Option,d=this.commonProps,p=this.state.focusedOption,h=this.props,f=h.captureMenuScroll,m=h.inputValue,g=h.isLoading,v=h.loadingMessage,b=h.minMenuHeight,y=h.maxMenuHeight,x=h.menuIsOpen,w=h.menuPlacement,j=h.menuPosition,C=h.menuPortalTarget,S=h.menuShouldBlockScroll,k=h.menuShouldScrollIntoView,_=h.noOptionsMessage,N=h.onMenuScrollToTop,E=h.onMenuScrollToBottom;if(!x)return null;var P,D=function(t,n){var l=t.type,a=t.data,r=t.isDisabled,i=t.isSelected,s=t.label,c=t.value,h=p===a,f=r?void 0:function(){return e.onOptionHover(a)},m=r?void 0:function(){return e.selectOption(a)},g="".concat(e.getElementId("option"),"-").concat(n),v={id:g,onClick:m,onMouseMove:f,onMouseOver:f,tabIndex:-1,role:"option","aria-selected":e.isAppleDevice?void 0:i};return o.createElement(u,nu({},d,{innerProps:v,data:a,isDisabled:r,isSelected:i,key:g,label:s,type:l,value:c,isFocused:h,innerRef:h?e.getFocusedOptionRef:void 0}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())P=this.getCategorizedOptions().map(function(t){if("group"===t.type){var a=t.data,r=t.options,i=t.index,s="".concat(e.getElementId("group"),"-").concat(i),c="".concat(s,"-heading");return o.createElement(n,nu({},d,{key:s,data:a,options:r,Heading:l,headingProps:{id:c,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map(function(e){return D(e,"".concat(i,"-").concat(e.index))}))}if("option"===t.type)return D(t,"".concat(t.index))});else if(g){var T=v({inputValue:m});if(null===T)return null;P=o.createElement(s,d,T)}else{var R=_({inputValue:m});if(null===R)return null;P=o.createElement(c,d,R)}var A={minMenuHeight:b,maxMenuHeight:y,menuPlacement:w,menuPosition:j,menuShouldScrollIntoView:k},L=o.createElement(ih,nu({},d,A),function(t){var n=t.ref,l=t.placerProps,i=l.placement,s=l.maxHeight;return o.createElement(a,nu({},d,A,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:g,placement:i}),o.createElement(i8,{captureEnabled:f,onTopArrive:N,onBottomArrive:E,lockEnabled:S},function(t){return o.createElement(r,nu({},d,{innerRef:function(n){e.getMenuListRef(n),t(n)},innerProps:{role:"listbox","aria-multiselectable":d.isMulti,id:e.getElementId("listbox")},isLoading:g,maxHeight:s,focusedOption:p}),P)}))});return C||"fixed"===j?o.createElement(i,nu({},d,{appendTo:C,controlElement:this.controlRef,menuPlacement:w,menuPosition:j}),L):L}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,l=t.isDisabled,a=t.isMulti,r=t.name,i=t.required,s=this.state.selectValue;if(i&&!this.hasValue()&&!l)return o.createElement(i7,{name:r,onFocus:this.onValueInputFocus});if(!(!r||l))if(a)if(n){var c=s.map(function(t){return e.getOptionValue(t)}).join(n);return o.createElement("input",{name:r,type:"hidden",value:c})}else{var u=s.length>0?s.map(function(t,n){return o.createElement("input",{key:"i-".concat(n),name:r,type:"hidden",value:e.getOptionValue(t)})}):o.createElement("input",{name:r,type:"hidden",value:""});return o.createElement("div",null,u)}else{var d=s[0]?this.getOptionValue(s[0]):"";return o.createElement("input",{name:r,type:"hidden",value:d})}}},{key:"renderLiveRegion",value:function(){var e=this.commonProps,t=this.state,n=t.ariaSelection,l=t.focusedOption,a=t.focusedValue,r=t.isFocused,i=t.selectValue,s=this.getFocusableOptions();return o.createElement(iF,nu({},e,{id:this.getElementId("live-region"),ariaSelection:n,focusedOption:l,focu
1sedValue:a,isFocused:r,selectValue:i,focusableOptions:s,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var e=this.getComponents(),t=e.Control,n=e.IndicatorsContainer,l=e.SelectContainer,a=e.ValueContainer,r=this.props,i=r.className,s=r.id,c=r.isDisabled,u=r.menuIsOpen,d=this.state.isFocused,p=this.commonProps=this.getCommonProps();return o.createElement(l,nu({},p,{className:i,innerProps:{id:s,onKeyDown:this.onKeyDown},isDisabled:c,isFocused:d}),this.renderLiveRegion(),o.createElement(t,nu({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:c,isFocused:d,menuIsOpen:u}),o.createElement(a,nu({},p,{isDisabled:c}),this.renderPlaceholderOrValue(),this.renderInput()),o.createElement(n,nu({},p,{isDisabled:c}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],l=[{key:"getDerivedStateFromProps",value:function(e,t){var n,l=t.prevProps,a=t.clearFocusValueOnUpdate,o=t.inputIsHiddenAfterUpdate,r=t.ariaSelection,i=t.isFocused,s=t.prevWasFocused,c=t.instancePrefix,u=e.options,d=e.value,p=e.menuIsOpen,h=e.inputValue,f=e.isMulti,m=r3(d),g={};if(l&&(d!==l.value||u!==l.options||p!==l.menuIsOpen||h!==l.inputValue)){var v,b=p?ss(si(e,m)):[],y=p?sc(si(e,m),"".concat(c,"-option")):[],x=a?function(e,t){var n=e.focusedValue,l=e.selectValue.indexOf(n);if(l>-1){if(t.indexOf(n)>-1)return n;if(l<t.length)return t[l]}return null}(t,m):null,w=(v=t.focusedOption)&&b.indexOf(v)>-1?v:b[0],j=sd(y,w);g={selectValue:m,focusedOption:w,focusedOptionId:j,focusableOptionsWithIds:y,focusedValue:x,clearFocusValueOnUpdate:!1}}var C=null!=o&&e!==l?{inputIsHidden:o,inputIsHiddenAfterUpdate:void 0}:{},S=r,k=i&&s;return i&&!k&&(S={value:(n=m[0]||null,f?m:n),options:m,action:"initial-input-focus"},k=!s),(null==r?void 0:r.action)==="initial-input-focus"&&(S=null),oz(oz(oz({},g),C),{},{prevProps:e,ariaSelection:S,prevWasFocused:k})}}],n&&oG(r.prototype,n),l&&oG(r,l),Object.defineProperty(r,"prototype",{writable:!1}),r}(o.Component);sy.defaultProps=so;var sx=(0,o.forwardRef)(function(e,t){var n=oY(e);return o.createElement(sy,nu({ref:t},n))}),sw=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],sj=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,l=String(e).toLowerCase(),a=String(n.getOptionValue(t)).toLowerCase(),o=String(n.getOptionLabel(t)).toLowerCase();return a===l||o===l},sC={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,t,n,l){return!(!e||t.some(function(t){return sj(e,t,l)})||n.some(function(t){return sj(e,t,l)}))},getNewOptionData:function(e,t){return{label:t,value:e,__isNew__:!0}}},sS=(0,o.forwardRef)(function(e,t){var n,l,a,r,i,s,c,u,d,p,h,f,m,g,v,b,y,x,w,j,C,S,k,_,N,E,P,D,T=(a=void 0!==(l=(n=oY(e)).allowCreateWhileLoading)&&l,i=void 0===(r=n.createOptionPosition)?"last":r,c=void 0===(s=n.formatCreateLabel)?sC.formatCreateLabel:s,d=void 0===(u=n.isValidNewOption)?sC.isValidNewOption:u,h=void 0===(p=n.getNewOptionData)?sC.getNewOptionData:p,f=n.onCreateOption,g=void 0===(m=n.options)?[]:m,v=n.onChange,x=void 0===(y=(b=oW(n,sw)).getOptionValue)?sn:y,j=void 0===(w=b.getOptionLabel)?st:w,C=b.inputValue,S=b.isLoading,k=b.isMulti,_=b.value,N=b.name,E=(0,o.useMemo)(function(){return d(C,r3(_),g,{getOptionValue:x,getOptionLabel:j})?h(C,c(C)):void 0},[c,h,j,x,C,d,g,_]),P=(0,o.useMemo)(function(){return(a||!S)&&E?"first"===i?[E].c
1oncat(o$(g)):[].concat(o$(g),[E]):g},[a,i,S,E,g]),D=(0,o.useCallback)(function(e,t){if("select-option"!==t.action)return v(e,t);var n=Array.isArray(e)?e:[e];if(n[n.length-1]===E){if(f)f(C);else{var l,a=h(C,C);v((l=[].concat(o$(r3(_)),[a]),k?l:a),{action:"create-option",name:N,option:a})}return}v(e,t)},[h,C,k,N,E,f,v,_]),oz(oz({},b),{},{options:P,onChange:D}));return o.createElement(sy,nu({ref:t},T))}),sk="clear-indicator",s_=e=>{let{clearValue:t,innerProps:{ref:n,...l}}=e;return(0,u.jsx)("div",{className:sk,ref:"string"==typeof n?null:n,...l,onKeyDown:e=>{"Enter"===e.key&&(t(),e.stopPropagation())},role:"button",tabIndex:0,children:(0,u.jsx)(s.a,{className:"".concat(sk,"__icon")})})},sN=e=>{let{children:t,innerProps:n,selectProps:{customProps:{disableKeyDown:l,disableMouseDown:a}={}}={}}=e;return(0,u.jsx)(o.Fragment,{children:(0,u.jsx)(iD.Control,{...e,innerProps:{...n,onKeyDown:e=>{if(l){e.stopPropagation();let t=new CustomEvent("bypassKeyDown",{detail:e});document.dispatchEvent(t)}},onMouseDown:e=>{a||n.onMouseDown(e)}},children:t})})},sE="dropdown-indicator",sP=e=>{let{innerProps:{ref:t,...n}}=e;return(0,u.jsx)("button",{className:sE,ref:t,...n,onKeyDown:e=>{"Enter"===e.key&&(e.key=" ")},type:"button",children:(0,u.jsx)(ta,{className:"".concat(sE,"__icon")})})},sD=e=>(0,u.jsx)(o.Fragment,{children:(0,u.jsx)(iD.Input,{...e,"aria-activedescendant":void 0})}),sT="multi-value";function sR(e,t){return"function"==typeof t?t(e):null==e?void 0:e.value}var sA=e=>{let t=(0,f.c)(26),{className:n,data:l,innerProps:a,isDisabled:r,selectProps:i}=e,s;t[0]!==i?(s=void 0===i?{}:i,t[0]=i,t[1]=s):s=t[1];let{customProps:c,getOptionValue:d,isSortable:p}=s,h;t[2]!==c?(h=void 0===c?{}:c,t[2]=c,t[3]=h):h=t[3];let{disableMouseDown:m}=h,g;t[4]!==l||t[5]!==d?(g=sR(l,d),t[4]=l,t[5]=d,t[6]=g):g=t[6];let v=g,b=!p,y;t[7]!==v||t[8]!==b?(y={id:v,disabled:b},t[7]=v,t[8]=b,t[9]=y):y=t[9];let{attributes:x,isDragging:w,listeners:j,setNodeRef:C,transform:S}=t9(y),k=!r&&p&&"draggable",_=w&&"".concat(sT,"--is-dragging"),N;t[10]!==n||t[11]!==k||t[12]!==_?(N=[sT,n,k,_].filter(Boolean),t[10]=n,t[11]=k,t[12]=_,t[13]=N):N=t[13];let E=N.join(" "),P;if(t[14]!==x||t[15]!==E||t[16]!==m||t[17]!==a||t[18]!==p||t[19]!==j||t[20]!==e||t[21]!==C||t[22]!==S){let n;t[24]!==m?(n=e=>{m||e.stopPropagation()},t[24]=m,t[25]=n):n=t[25],P=(0,u.jsx)(o.Fragment,{children:(0,u.jsx)(iD.MultiValue,{...e,className:E,innerProps:{...p?{...x,...j}:{},...a,onMouseDown:n,ref:C,style:p?{transform:S,...null==x?void 0:x.style}:{}}})}),t[14]=x,t[15]=E,t[16]=m,t[17]=a,t[18]=p,t[19]=j,t[20]=e,t[21]=C,t[22]=S,t[23]=P}else P=t[23];return P},sL="multi-value-label",sO=e=>{let{data:t,selectProps:n}=e,{customProps:l}=void 0===n?{}:n,{draggableProps:a,editableProps:o}=void 0===l?{}:l,{i18n:r}=(0,s.d)(),i="".concat(sL,"__text"),c=t.label?(0,d.s)(t.label,r):"";return(0,u.jsx)("div",{className:sL,title:"string"==typeof c?c:"",children:(0,u.jsx)(iD.MultiValueLabel,{...e,innerProps:{className:i,...o&&o(t,i,e.selectProps)||{},...a||{}}})})},sF="multi-value-remove",sM=e=>{let t=(0,f.c)(12),{innerProps:n}=e,{className:l,onClick:a,onTouchEnd:r}=n,[i,c]=o.useState(!1),{t:d}=(0,s.d)(),p;if(t[0]!==l||t[1]!==a||t[2]!==r||t[3]!==i||t[4]!==d){let e,n,o,h=d("general:remove"),f;t[6]!==l?(f=[sF,l].filter(Boolean),t[6]=l,t[7]=f):f=t[7],t[8]!==a?(e=e=>{c(!1),a(e)},t[8]=a,t[9]=e):e=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(n=()=>c(!0),o=()=>c(!1),t[10]=n,t[11]=o):(n=t[10],o=t[11]),p=(0,u.jsxs)("button",{"aria-label":h,className:f.join(" "),onClick:e,onKeyDown:sI,onMouseDown:sB,onMouseEnter:n,onMouseLeave:o,onTouchEnd:r,type:"button",children:[(0,u.jsx)(tN,{className:"".concat(sF,"__tooltip"),show:i,children:d("general:remove")}),(0,u.jsx)(s.a,{className:"".concat(sF,"__icon")})]}),t[0]=l,t[1]=a,t[2]=r,t[3]=i,t[4]=d,t[5]=p}else p=t[5];return p};function sI(e){"Enter"===e.key&&e.stopPropagation()}function sB(e){return e.stopPropagation()}var sU=e=>{let{children:t,className:n}=e;return(0,u.jsx)(o.Fragment,{children:(0,u.jsx)(iD.SingleValue,{...e,className:["react-select--single-value",n].filter(Boolean).join(" "),children:t})})},sz="value-container",sV=e=>{let{selectProps:t}=e,{customProps:n,value:l}=void 0===t?{}:t,{i18n:a}=(0,s.d)(),o="";if(l&&!Array.isArray(l)&&"object"==typeof l&&"label"in l){let e=l.label?(0,d.s)(l.label,a):"";o="string"==typeof e?e:""}return(0,u.jsxs)("div",{className:sz,ref:null==n?void 0:n.droppableRef,title:o,children:[(null==n?void 0:n.valueContainerLabel)&&(0,u.jsx)("span",{className:"".concat(sz,"__label"),children:null==n?void 0:n.valueContainerLabel}),(0,u.jsx)(iD.ValueContainer,{...e})]})},sH=e=>{let{i18n:t,t:n}
1=(0,s.d)(),[l,a]=o.useState(""),r=(0,o.useId)(),[c,p]=o.useState(!1);(0,o.useEffect)(()=>{p(!0)},[]);let{className:h,components:f,customProps:m,disabled:g=!1,filterOption:v,getOptionValue:b,isClearable:y=!0,isCreatable:x,isLoading:w,isSearchable:j=!0,noOptionsMessage:C=()=>n("general:noOptions"),numberOnly:S=!1,onChange:k,onMenuClose:_,onMenuOpen:N,options:E,placeholder:P=n("general:selectValue"),showError:D,value:T}=e,R=()=>n("general:loading")+"...",A=[h,"react-select",D&&"react-select--error"].filter(Boolean).join(" "),L={menu:e=>({...e,zIndex:void 0})};return c?x?(0,u.jsx)(sS,{captureMenuScroll:!0,isLoading:w,...e,className:A,classNamePrefix:"rs",components:{ClearIndicator:s_,Control:sN,DropdownIndicator:sP,Input:sD,MultiValue:sA,MultiValueLabel:sO,MultiValueRemove:sM,SingleValue:sU,ValueContainer:sV,...f},filterOption:v,inputValue:l,instanceId:r,isClearable:y,isDisabled:g,isSearchable:j,loadingMessage:R,menuPlacement:"auto",noOptionsMessage:C,onChange:k,onInputChange:e=>a(e),onKeyDown:e=>{if(!0===S){let t=!/\D/.test(e.key),n=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"].includes(e.key);if(!t&&!n)return void e.preventDefault()}if(!(!T||!l||""===l.trim())&&!(v&&!v(null,l)))switch(e.key){case"Enter":case"Tab":k([...T,(e=>({label:e,value:e}))(l)]),a(""),e.preventDefault()}},onMenuClose:_,onMenuOpen:N,options:E,placeholder:(0,d.s)(P,t),styles:L,unstyled:!0,value:T}):(0,u.jsx)(sx,{captureMenuScroll:!0,customProps:m,isLoading:w,...e,className:A,classNamePrefix:"rs",components:{ClearIndicator:s_,Control:sN,DropdownIndicator:sP,Input:sD,MultiValue:sA,MultiValueLabel:sO,MultiValueRemove:sM,SingleValue:sU,ValueContainer:sV,...f},filterOption:v,getOptionValue:b,instanceId:r,isClearable:y,isDisabled:g,isSearchable:j,loadingMessage:R,menuPlacement:"auto",noOptionsMessage:C,onChange:k,onMenuClose:_,onMenuOpen:N,options:E,placeholder:(0,d.s)(P,t),styles:L,unstyled:!0,value:T}):(0,u.jsx)(i.f,{height:"calc(var(--base) * 2 + 2px)"})},sq=e=>{let{getOptionValue:t,onChange:n,value:l}=e,a=[];return l&&(a=(Array.isArray(l)?l:[l]).map(e=>sR(e,t))),(0,u.jsx)(ne,{className:"react-select-container",ids:a,onDragEnd:e=>{let{moveFromIndex:t,moveToIndex:a}=e,o=l;l&&Array.isArray(l)&&(o=tK(l,t,a)),n(o)},children:(0,u.jsx)(sH,{...e})})},sW=e=>{let{isMulti:t,isSortable:n}=e;return t&&n?(0,u.jsx)(sq,{...e}):(0,u.jsx)(sH,{...e})},sK=e=>e.map(e=>"object"==typeof e&&(e.value||""===e.value)?e:{label:e,value:e}),sY=e=>{let{id:t,onChange:n,options:l,readOnly:a,required:r,selectedTimezone:i}=e,{t:c}=(0,s.d)(),d=sK(l),p=(0,o.useMemo)(()=>d.find(e=>("string"==typeof e?e:e.value)===(i||"UTC")),[d,i]),h=!!a||1===d.length;return(0,u.jsxs)("div",{className:"timezone-picker-wrapper",children:[(0,u.jsx)(lD,{htmlFor:t,label:"".concat(c("general:timezone")," ").concat(r?"*":""),required:r,unstyled:!0}),(0,u.jsx)(sW,{className:"timezone-picker",disabled:h,inputId:t,isClearable:!r,isCreatable:!1,onChange:e=>{n&&n((null==e?void 0:e.value)||"")},options:d,value:p})]})},sG="date-time-field",sQ=aV(e=>{let{field:t,field:{admin:{className:n,date:l,description:a,placeholder:r}={},label:c,localized:p,required:h,timezone:f},path:m,readOnly:g,validate:v}=e,b=(null==l?void 0:l.pickerAppearance)||"default",y=Intl.DateTimeFormat().resolvedOptions().timeZone,{config:x}=(0,i.c)(),{i18n:w}=(0,s.d)(),{dispatchFields:j,setModified:C}=eP(),{customComponents:{AfterInput:S,BeforeInput:k,Description:_,Error:N,Label:E}={},disabled:P,path:D,setValue:T,showError:R,value:A}=aB({potentiallyStalePath:m,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof v)return v(e,{...t,required:h})},[v,h])}),L=D+"_tz",O=eM(e=>{let[t,n]=e;return null==t?void 0:t[L]}),F=(0,o.useMemo)(()=>f&&"object"==typeof f&&f.supportedTimezones?f.supportedTimezones:x.admin.timezones.supportedTimezones,[x.admin.timezones.supportedTimezones,f]),M=["dayOnly","default","monthOnly"].includes(b),I=null==O?void 0:O.value,B=h||f&&"object"==typeof f&&f.required,U=(0,o.useMemo)(()=>{if(f&&I&&y&&A){let e=lB.tz(I),t=lB.tz(y),n=ap(new lB(A).withTimeZone(I),e);return ap(n,t).toISOString()}return A},[f,I,A,y]),z=(0,o.useMemo)(()=>aH(t),[t]),V=(0,o.useCallback)(e=>{if(!(g||P))if(f&&I&&e){let t=lB.tz(I);if(M){let n=e.getTimezoneOffset()/60,l=e.getHours()+n;e.setHours(l),T(ap(e,t).toISOString()||null)}else T(ap(new lB(e),t).toISOString()||null)}else T((null==e?void 0:e.toISOString())||null)},[g,P,f,I,M,T]),H=(0,o.useCallback)(e=>{L&&(j({type:"UPDATE",path:L,value:e}),C(!0))},[j,C,L]);return(0,u.jsxs)("div",{className:[aq,sG,n,R&&"".concat(sG,"--has-error"),(g||P)&&"read-only"].filter(
1Boolean).join(" "),style:z,children:[(0,u.jsx)(ep,{CustomComponent:E,Fallback:(0,u.jsx)(lD,{label:c,localized:p,path:D,required:h})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),id:"field-".concat(D.replace(/\./g,"__")),children:[(0,u.jsx)(ep,{CustomComponent:N,Fallback:(0,u.jsx)(no,{path:D,showError:R})}),k,(0,u.jsx)(oF,{...l,onChange:V,overrides:{...null==l?void 0:l.overrides},placeholder:(0,d.s)(r,w),readOnly:g||P,value:U}),f&&F.length>0&&(0,u.jsx)(sY,{id:"".concat(D,"-timezone-picker"),onChange:H,options:F,readOnly:g||P,required:B,selectedTimezone:I}),S]}),(0,u.jsx)(ep,{CustomComponent:_,Fallback:(0,u.jsx)(na,{description:a,path:D})})]})}),sX=aV(e=>{let{field:t,field:{admin:{autoComplete:n,className:l,description:a,placeholder:r}={},label:i,localized:c,required:p}={},path:h,readOnly:f,validate:m}=e,{i18n:g}=(0,s.d)(),{customComponents:{AfterInput:v,BeforeInput:b,Description:y,Error:x,Label:w}={},disabled:j,path:C,setValue:S,showError:k,value:_}=aB({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,required:p})},[m,p])}),N=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsxs)("div",{className:[aq,"email",l,k&&"error",(f||j)&&"read-only"].filter(
1Boolean).join(" "),style:N,children:[(0,u.jsx)(ep,{CustomComponent:w,Fallback:(0,u.jsx)(lD,{label:i,localized:c,path:C,required:p})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:x,Fallback:(0,u.jsx)(no,{path:C,showError:k})}),b,(0,u.jsx)("input",{autoComplete:n,disabled:f||j,id:"field-".concat(C.replace(/\./g,"__")),name:C,onChange:S,placeholder:(0,d.s)(r,g),required:p,type:"email",value:_||""}),v]}),(0,u.jsx)(ep,{CustomComponent:y,Fallback:(0,u.jsx)(na,{description:a,path:C})})]})}),s$=(0,o.createContext)(!1),sZ=e=>{let{children:t,withinRow:n=!0}=e;return(0,u.jsx)(s$,{value:n,children:t})},sJ=(0,o.createContext)(!1),s0=e=>{let{children:t,withinTab:n=!0}=e;return(0,u.jsx)(sJ,{value:n,children:t})},s1=(0,o.createContext)(!1),s3=e=>{let{children:t,withinGroup:n=!0}=e;return(0,u.jsx)(s1,{value:n,children:t})},s2="group-field",s6=aV(e=>{let{field:t,field:{admin:{className:n,description:l,hideGutter:a}={},fields:r,label:i},indexPath:c,parentPath:p,parentSchemaPath:h,path:f,permissions:g,readOnly:v,schemaPath:b}=e,y=null!=b?b:"group"===t.type&&(0,m.jY)(t)?t.name:f,{i18n:x}=(0,s.d)(),{isWithinCollapsible:w}=a4(),j=(0,o.use)(s1),C=(0,o.use)(s$),S=(0,o.use)(sJ),{customComponents:{AfterInput:k,BeforeInput:_,Description:N,Label:E}={},errorPaths:P}=aB({path:f}),D=eR(),T=P.length,R=D&&T>0,A=!(w||j||C),L=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsxs)("div",{className:[aq,s2,A&&"".concat(s2,"--top-level"),w&&"".concat(s2,"--within-collapsible"),j&&"".concat(s2,"--within-group"),C&&"".concat(s2,"--within-row"),S&&"".concat(s2,"--within-tab"),!a&&j&&"".concat(s2,"--gutter"),R&&"".concat(s2,"--has-error"),n].filter(Boolean).join(" "),id:"field-".concat(null==f?void 0:f.replace(/\./g,"__")),style:L,children:[(0,u.jsx)(s3,{children:(0,u.jsxs)("div",{className:"".concat(s2,"__wrap"),children:[!!(E||N||i||R)&&(0,u.jsxs)("div",{className:"".concat(s2,"__header"),children:[!!(E||N||i)&&(0,u.jsxs)("header",{children:[(0,u.jsx)(ep,{CustomComponent:E,Fallback:(0,u.jsx)("h3",{className:"".concat(s2,"__title"),children:(0,u.jsx)(lD,{as:"span",label:(0,d.s)(i,x),localized:!1,path:f,required:!1})})}),(0,u.jsx)(ep,{CustomComponent:N,Fallback:(0,u.jsx)(na,{description:l,path:f})})]}),R&&(0,u.jsx)(nn,{count:T,i18n:x,withMessage:!0})]}),_,(0,m.jY)(t)?(0,u.jsx)(hL,{fields:r,margins:"small",parentIndexPath:"",parentPath:f,parentSchemaPath:y,permissions:!0===g?g:null==g?void 0:g.fields,readOnly:v}):(0,u.jsx)(hL,{fields:r,margins:"small",parentIndexPath:c,parentPath:p,parentSchemaPath:h,permissions:g,readOnly:v})]})}),k]})}),s5=aV(e=>{let t=(0,f.c)(13),{disableModifyingForm:n,path:l,value:a}=e,r=void 0===n||n,i;t[0]!==l?(i={potentiallyStalePath:l},t[0]=l,t[1]=i):i=t[1];let{formInitializing:s,path:c,setValue:d,value:p}=aB(i),h,m;t[2]!==r||t[3]!==s||t[4]!==d||t[5]!==a?(h=()=>{void 0===a||s||d(a,r)},m=[a,d,r,s],t[2]=r,t[3]=s,t[4]=d,t[5]=a,t[6]=h,t[7]=m):(h=t[6],m=t[7]),(0,o.useEffect)(h,m);let g="field-".concat(null==c?void 0:c.replace(/\./g,"__")),v=p||"",b;return t[8]!==c||t[9]!==d||t[10]!==g||t[11]!==v?(b=(0,u.jsx)("input",{id:g,name:c,onChange:d,type:"hidden",value:v}),t[8]=c,t[9]=d,t[10]=g,t[11]=v,t[12]=b):b=t[12],b}),s4=(0,c.e)(er(),1),s8=(0,o.createContext)({}),s9=e=>{let{children:t,...n}=e;return(0,u.jsx)(s8,{value:{isInDrawer:!!n.drawerSlug,...n},children:t})},s7=()=>{let e=(0,o.use)(s8);if(!e)throw Error("useListDrawerContext must be used within a ListDrawerContextProvider");return e};function ce(e){let t=e.toString();return N.q(t,{depth:10,ignoreQueryPrefix:!0})}var ct=(0,o.createContext)({}),cn=()=>(0,o.use)(ct),cl=(0,o.createContext)(!1),ca=e=>{let t={...e};return Object.entries(t).forEach(e=>{let[n,l]=e;if("columns"===n&&("[]"===l||Array.isArray(t[n])&&0===t[n].length)&&delete t[n],"where"!==n||"object"!=typeof l||null===l||Object.keys(l).length||delete t[n],("limit"===n||"page"===n)&&"string"==typeof l){let e=parseInt(l,10);t[n]=Number.isNaN(e)?void 0:e}"page"===n&&0===l&&delete t[n],""===l&&delete t[n]}),t},co=e=>{var t;let{children:n,collectionSlug:l,data:a,modifySearchParams:r,onQueryChange:s,orderableFieldName:c,query:d}=e,p=(0,h.useRouter)(),f=(0,h.useSearchParams)(),{startRouteTransition:m}=e8(),[g,v]=(0,o.useState)(!1),{getEntityConfig:b}=(0,i.c)(),x=b({collectionSlug:l}),w=(0,o.useMemo)(()=>ca(ce(f)),[f]),j=(0,o.useRef)({});j.current.modified=g;let{onQueryChange:C}=s7(),[S,k]=(0,o.useState)(()=>r?w:{limit:d.limit,sort:d.sort}),_=(0,o.useCallback)(async(e,t)=>{v(void 0===t||t);let n=((e,t,n)=>{var l,a,o,r,i,s;let c,u="page"in t?t.page:null==e?void 0:e.page;return["where","search","groupBy"].some(e=>e in t&&!["limit","page"].includes(e))&&(u=1),["where","search","page","limit","groupBy","
1sort"].some(e=>e in t)||(c={...(null==e?void 0:e.queryByGroup)||{},...t.queryByGroup?Object.fromEntries(Object.entries(t.queryByGroup).map(t=>{var n;let[l,a]=t;return[l,{...(null==e||null==(n=e.queryByGroup)?void 0:n[l])||{},...a}]})):{}}),{...e,...t,columns:"columns"in t?t.columns:e.columns,groupBy:"groupBy"in t?t.groupBy:null!=(r=null==e?void 0:e.groupBy)?r:null==n||null==(l=n.defaults)?void 0:l.groupBy,limit:"limit"in t?t.limit:null!=(i=null==e?void 0:e.limit)?i:null==n||null==(a=n.defaults)?void 0:a.limit,page:u,preset:"preset"in t?t.preset:null==e?void 0:e.preset,queryByGroup:c,search:"search"in t?t.search:null==e?void 0:e.search,sort:"sort"in t?t.sort:null!=(s=null==e?void 0:e.sort)?s:null==n||null==(o=n.defaults)?void 0:o.sort,where:"where"in t?t.where:null==e?void 0:e.where}})(S,e,{defaults:{limit:d.limit,sort:d.sort}});r?m(()=>p.replace("".concat(y.A({...n,columns:JSON.stringify(n.columns),queryByGroup:JSON.stringify(n.queryByGroup)},{addQueryPrefix:!0})))):("function"==typeof C||"function"==typeof s)&&(C||s)(n),k(n)},[S,d.limit,d.sort,r,C,s,m,p]),N=(0,o.useCallback)(async e=>{await _({page:e})},[_]),E=o.useCallback(async e=>{await _({limit:e,page:1})},[_]),P=(0,o.useCallback)(async e=>{await _({search:""===e?void 0:e})},[_]),D=(0,o.useCallback)(async e=>{await _({sort:e})},[_]),T=(0,o.useCallback)(async e=>{await _({where:e})},[_]),R=lv(()=>{let e=ca({...S||{},...d||{}}),t="?".concat(y.A({...e,columns:JSON.stringify(e.columns),queryByGroup:JSON.stringify(e.queryByGroup)}));window.location.search!==t&&(k(e),window.history.replaceState(null,"",t))});return(0,o.useEffect)(()=>{r&&R()},[r,d]),(0,u.jsx)(ct,{value:{collectionSlug:l,data:a,defaultLimit:null==a?void 0:a.limit,handlePageChange:N,handlePerPageChange:E,handleSearchChange:P,handleSortChange:D,handleWhereChange:T,isGroupingBy:!!((null==x||null==(t=x.admin)?void 0:t.groupBy)&&(null==S?void 0:S.groupBy)),orderableFieldName:c,query:S,refineListData:_,setModified:v,...j.current},children:(0,u.jsx)(cl,{value:g,children:n})})},cr=(0,o.createContext)(void 0),ci=()=>{let e=o.use(cr);if(void 0===e)throw Error("useServerFunctions must be used within a ServerFunctionsProvider");return e},cs=e=>{let{children:t,serverFunction:n}=e;if(!n)throw Error("ServerFunctionsProvider requires a serverFunction prop");let l=(0,o.useCallback)(async e=>await n({name:"render-document-slots",args:e}),[n]),a=(0,o.useCallback)(async e=>{let{signal:t,...l}=e;try{if(!(null==t?void 0:t.aborted)){let e=await n({name:"schedule-publish",args:{...l}});if(!(null==t?void 0:t.aborted))return e}}catch(e){console.error(e)}let a="Error scheduling ".concat(l.type);return l.doc&&(a+=" for document with ID ".concat(l.doc.value," in collection ").concat(l.doc.relationTo)),{error:a}},[n]),r=(0,o.useCallback)(async e=>{let{signal:t,...l}=e||{};try{if(!(null==t?void 0:t.aborted)){let e=await n({name:"form-state",args:{fallbackLocale:!1,...l}});if(!(null==t?void 0:t.aborted))return e}}catch(e){console.error(e)}return{state:null}},[n]),i=(0,o.useCallback)(async e=>{let{signal:t,...l}=e||{};try{if(!(null==t?void 0:t.aborted)){let e=await n({name:"table-state",args:{fallbackLocale:!1,...l}});if(!(null==t?void 0:t.aborted))return e}}catch(e){console.error(e)}},[n]),s=(0,o.useCallback)(async e=>{let{signal:t,...l}=e||{};try{return await n({name:"render-document",args:{fallbackLocale:!1,...l}})}catch(e){console.error(e)}},[n]),c=(0,o.useCallback)(async e=>{let{signal:t,...l}=e||{};try{let e=await n({name:"copy-data-from-locale",args:l});if(!(null==t?void 0:t.aborted))return e}catch(e){console.error(e)}},[n]),d=(0,o.useCallback)(async e=>{let{signal:t,...l}=e||{};try{let e=await n({name:"get-folder-results-component-and-data",args:l});if(!(null==t?void 0:t.aborted))return e}catch(e){console.error(e)}},[n]),p=(0,o.useCallback)(async e=>{try{return await n({name:"render-field",args:e})}catch(e){console.error(e)}},[n]),h=(0,o.useCallback)(async e=>{let{signal:t,...l}=e||{};try{return await n({name:"slugify",args:{...l}})}catch(e){console.error(e)}},[n]);return(0,u.jsx)(cr,{value:{_internal_renderField:p,copyDataFromLocale:c,getDocumentSlots:l,getFolderResultsComponentAndData:d,getFormState:r,getTableState:i,renderDocument:s,schedulePublish:a,serverFunction:n,slugify:h},children:t})},cc=(0,o.createContext)({}),cu=()=>(0,o.use)(cc),cd=e=>{let{children:t,collectionSlug:n,columnState:l,LinkedCellOverride:a}=e,{getEntityConfig:r}=(0,i.c)(),{query:s,refineListData:c}=cn(),{admin:{defaultColumns:d}={}}=r({collectionSlug:n}),[p,h]=o.useOptimistic(l,(e,t)=>t),f=(0,o.useRef)({}),m=(0,o.useCallback)(async e=>{let t=(p||[]).map(t=>t.accessor===e?{...t,active:!t.active}:t);(0,o.startTransition)(()=>{h(t)}),await c({columns:(0,_.F)(t)})},[c,p,h]),g=(0,o.useCallback)(async e=>{let{fromIndex:t,toIndex:n}=e,l=[...p||[]],[a]=l.splice(t,1);l.splice(n,0,a),(0,o.startTransition)(()=>{h(l)}),await c({columns:(0,_.F)(l)})},[p,c,h]),v=(0,o.useCallback)(async e=>{let t=s.columns;
1e.forEach(e=>{let n=t.findIndex(t=>e===t);void 0!==n&&"-"===t[n][0]&&(t[n]=e.slice(1))}),await c({columns:t})},[s,c]),b=o.useCallback(async()=>{await c({columns:d||[]})},[d,c]);return(0,u.jsx)(cc,{value:{columns:p,LinkedCellOverride:a,moveColumn:g,resetColumnsState:b,setActiveColumns:v,toggleColumn:m,...f.current},children:t})},cp="pill-selector",ch=e=>{let{draggable:t,onClick:n,pills:l}=e,a=o.useMemo(()=>l.map((e,l)=>{var a,o;return(0,u.jsx)(ol,{alignIcon:"left","aria-checked":e.selected,className:["".concat(cp,"__pill"),e.selected&&"".concat(cp,"__pill--selected")].filter(Boolean).join(" "),draggable:!!t,icon:e.selected?(0,u.jsx)(s.a,{}):(0,u.jsx)(ti,{}),id:e.name,onClick:()=>{n&&n({pill:e})},size:"small",children:null!=(a=e.Label)?a:(0,u.jsx)("span",{className:"".concat(cp,"__pill-label"),children:e.name})},null!=(o=e.key)?o:"".concat(e.name,"-").concat(l))}),[l,n,t]);return t?(0,u.jsx)(ne,{className:cp,ids:l.map(e=>e.name),onDragEnd:e=>{let{moveFromIndex:n,moveToIndex:l}=e;t.onDragEnd({moveFromIndex:n,moveToIndex:l})},children:a}):(0,u.jsx)("div",{className:cp,children:a})},cf=e=>{let{collectionSlug:t}=e,{columns:n,moveColumn:l,toggleColumn:a}=cu(),r=(0,o.useId)(),i=ns(),s=(0,o.useMemo)(()=>null==n?void 0:n.filter(e=>{var t,n;return!((0,m.I2)(e.field)&&!(0,m.uT)(e.field))&&!(null==e||null==(n=e.field)||null==(t=n.admin)?void 0:t.disableListColumn)}),[n]),c=(0,o.useMemo)(()=>s?s.map((e,n)=>{let{accessor:l,active:a,field:o}=e,s="labelWithPrefix"in o&&void 0!==o.labelWithPrefix?o.labelWithPrefix:"label"in o&&void 0!==o.label?o.label:"name"in o&&void 0!==o.name?o.name:void 0;return{name:l,key:"".concat(t,"-").concat(l,"-").concat(n).concat(i?"-".concat(i,"-"):"").concat(r),Label:(0,u.jsx)(lD,{label:s,unstyled:!0}),selected:a}}):null,[t,i,s,r]);return c?(0,u.jsx)(ch,{draggable:{onDragEnd:e=>{let{moveFromIndex:t,moveToIndex:n}=e;l({fromIndex:t,toIndex:n})}},onClick:e=>{let{pill:t}=e;a(t.name)},pills:c}):null},cm=e=>{let t=(0,f.c)(3),{getEntityConfig:n}=(0,i.c)(),l;t[0]!==n||t[1]!==e?(l=()=>e?("string"==typeof e?[e]:e).map(e=>n({collectionSlug:e})):[],t[0]=n,t[1]=e,t[2]=l):l=t[2];let[a]=(0,o.useState)(l);return a},cg=e=>{let t,n=(0,f.c)(13),{delayBeforeShow:l,inTimeout:a,minShowTime:r,outTimeout:s,show:c}=e,u=a+r+s,[d,p]=(0,i.e)(l),[h,m]=o.useState(!1),[g,v]=o.useState(!1),b=o.useRef(0),y=o.useRef(void 0),x;n[0]!==s?(x=()=>{v(!0),y.current=setTimeout(()=>{m(!1),v(!1)},s)},n[0]=s,n[1]=x):x=n[1];let w=x,j,C;return n[2]!==d||n[3]!==h||n[4]!==c||n[5]!==u||n[6]!==w?(j=()=>{let e=d&&!h&&c,t=h&&!c;if(e)b.current=Date.now(),m(!0);else if(t){let e=u-(Date.now()-b.current);clearTimeout(y.current),y.current=setTimeout(w,Math.max(0,e))}},C=[h,c,w,u,d],n[2]=d,n[3]=h,n[4]=c,n[5]=u,n[6]=w,n[7]=j,n[8]=C):(j=n[7],C=n[8]),o.useEffect(j,C),n[9]!==h||n[10]!==g||n[11]!==p?(t={isMounted:h,isUnmounting:g,triggerDelayedRender:p},n[9]=h,n[10]=g,n[11]=p,n[12]=t):t=n[12],t},cv={isLoading:!1,loaders:[],loadingText:"",overlayType:null},cb=(e,t)=>{let n=[...e.loaders],{type:l="fullscreen",key:a="user",loadingText:o}=t.payload;if("add"===t.type)n.push({type:l,key:a,loadingText:o});else if("remove"===t.type){let e=n.findIndex(e=>e.key===a&&e.type===l);n.splice(e,1)}let r=(null==n?void 0:n.length)>0?n[n.length-1]:null;return{isLoading:!!r,loaders:n,loadingText:(null==r?void 0:r.loadingText)||(null==e?void 0:e.loadingText),overlayType:(null==r?void 0:r.type)||(null==e?void 0:e.overlayType)}},cy=(0,o.createContext)({isOnScreen:!1,toggleLoadingOverlay:void 0}),cx=e=>{let{children:t}=e,{t:n}=(0,s.d)(),l=n("general:loading"),[a,r]=o.useReducer(cb,cv),{isMounted:i,isUnmounting:c,triggerDelayedRender:d}=cg({delayBeforeShow:1e3,inTimeout:250,minShowTime:500,outTimeout:250,show:a.isLoading}),p=o.useCallback(e=>{let{type:t,isLoading:n,key:a,loadingText:o=l}=e;n?(d(),r({type:"add",payload:{type:t,key:a,loadingText:o}})):r({type:"remove",payload:{type:t,key:a}})},[d,l]);return(0,u.jsxs)(cy,{value:{isOnScreen:i,toggleLoadingOverlay:p},children:[i&&(0,u.jsx)(cC,{animationDuration:"".concat(250,"ms"),loadingText:a.loadingText||l,overlayType:a.overlayType,show:!c}),t]})},cw=()=>{let e=o.use(cy);if(void 0===e)throw Error("useLoadingOverlay must be used within a Loa
1dingOverlayProvider");return e},cj="loading-overlay",cC=e=>{let t=(0,f.c)(8),{animationDuration:n,loadingText:l,overlayType:a,show:o}=e,{t:r}=(0,s.d)(),i=void 0===o||o?"".concat(cj,"--entering"):"".concat(cj,"--exiting"),c=a?"".concat(cj,"--").concat(a):"",d;t[0]!==i||t[1]!==c?(d=[cj,i,c].filter(Boolean),t[0]=i,t[1]=c,t[2]=d):d=t[2];let p=d.join(" "),h=n||"500ms",m;return t[3]!==l||t[4]!==r||t[5]!==p||t[6]!==h?(m=(0,u.jsxs)("div",{className:p,style:{animationDuration:h},children:[(0,u.jsxs)("div",{className:"".concat(cj,"__bars"),children:[(0,u.jsx)("div",{className:"".concat(cj,"__bar")}),(0,u.jsx)("div",{className:"".concat(cj,"__bar")}),(0,u.jsx)("div",{className:"".concat(cj,"__bar")}),(0,u.jsx)("div",{className:"".concat(cj,"__bar")}),(0,u.jsx)("div",{className:"".concat(cj,"__bar")})]}),(0,u.jsx)("span",{className:"".concat(cj,"__text"),children:l||r("general:loading")})]}),t[3]=l,t[4]=r,t[5]=p,t[6]=h,t[7]=m):m=t[7],m},cS=e=>{let t=(0,f.c)(7),{name:n,type:l,loadingText:a,show:r}=e,i=void 0===l?"fullscreen":l,{toggleLoadingOverlay:s}=cw(),c,u;return t[0]!==n||t[1]!==a||t[2]!==r||t[3]!==s||t[4]!==i?(c=()=>(s({type:i,isLoading:r,key:n,loadingText:a||void 0}),()=>{s({type:i,isLoading:!1,key:n})}),u=[r,s,n,i,a],t[0]=n,t[1]=a,t[2]=r,t[3]=s,t[4]=i,t[5]=c,t[6]=u):(c=t[5],u=t[6]),o.useEffect(c,u),null},ck=e=>{let t=(0,f.c)(6),{name:n,type:l,action:a,formIsLoading:o,loadingSuffix:r}=e,i=void 0===l?"fullscreen":l,c=void 0!==o&&o,p=eA(),{i18n:h,t:m}=(0,s.d)(),g="".concat({create:m("general:creating"),loading:m("general:loading"),update:m("general:updating")}[a]," ").concat(r?(0,d.s)(r,h):""),v;return t[0]!==c||t[1]!==p||t[2]!==n||t[3]!==g||t[4]!==i?(v=(0,u.jsx)(cS,{loadingText:g.trim(),name:n,show:c||p,type:i}),t[0]=c,t[1]=p,t[2]=n,t[3]=g,t[4]=i,t[5]=v):v=t[5],v};function c_(e){if(e)try{e.abort()}catch(e){}}function cN(e){let t=new AbortController;if(e.current)try{e.current.abort()}catch(e){}return e.current=t,t}var cE=(0,o.createContext)({}),cP=e=>{let{children:t,...n}=e;return(0,u.jsx)(cE,{value:{...n},children:t})},cD=()=>{let e=(0,o.use)(cE);if(!e)throw Error("useDocumentDrawerContext must be used within a DocumentDrawerProvider");return e},cT=e=>{let{id:t,collectionSlug:n,disableActions:l,drawerSlug:a,initialData:r,onDelete:c,onDuplicate:d,onSave:p,overrideEntityVisibility:h=!0,redirectAfterCreate:f,redirectAfterDelete:m,redirectAfterDuplicate:g,redirectAfterRestore:v}=e,{getEntityConfig:b}=(0,i.c)(),y=lN(),[x]=(0,o.useState)(()=>b({collectionSlug:n})),w=o.useRef(null),{closeModal:j}=nE(),{t:C}=(0,s.d)(),{renderDocument:S}=ci(),[k,_]=(0,o.useState)(void 0),[N,E]=(0,o.useState)(!0),P=(0,o.useRef)(!1),D=(0,o.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=cN(w);(async()=>{t&&E(!0);try{let t=await S({collectionSlug:n,disableActions:l,docID:e,drawerSlug:a,initialData:r,locale:y,overrideEntityVisibility:h,redirectAfterCreate:f,redirectAfterDelete:void 0!==m&&m,redirectAfterDuplicate:void 0!==g&&g,redirectAfterRestore:void 0!==v&&v,signal:o.signal});(null==t?void 0:t.Document)&&(_(t.Document),E(!1))}catch(e){eJ.error((null==e?void 0:e.message)||C("error:unspecific")),j(a)}w.current=null})()},[n,l,a,r,m,g,v,S,f,j,h,C,y]),T=(0,o.useCallback)(e=>{"create"===e.operation&&D(e.doc.id),"function"==typeof p&&p({...e,collectionConfig:x})},[p,x,D]),R=(0,o.useCallback)(e=>{D(e.doc.id),"function"==typeof d&&d({...e,collectionConfig:x})},[d,x,D]),A=(0,o.useCallback)(e=>{"function"==typeof c&&c({...e,collectionConfig:x}),j(a)},[c,j,a,x]),L=(0,o.useCallback)(()=>{D(void 0,!0)},[D]);return(0,o.useEffect)(()=>{k||P.current||(D(t,!0),P.current=!0)},[k,D,t]),(0,o.useEffect)(()=>{let e=w.current;return()=>{c_(e)}},[]),N?(0,u.jsx)(cC,{}):(0,u.jsx)(cP,{clearDoc:L,drawerSlug:a,onDelete:A,onDuplicate:R,onSave:T,children:k})},cR="doc-drawer",cA=e=>{let t=(0,f.c)(2),{children:n,className:l,collectionSlug:a,disabled:o,drawerSlug:r,onClick:i,operation:c,...d}=e,{t:p}=(0,s.d)(),[h]=cm(a),m=p("create"===c?"fields:addNewLabel":"general:editLabel",{label:null==h?void 0:h.labels.singular}),g;
1return t[0]!==l?(g=[l,"".concat(cR,"__toggler")].filter(Boolean),t[0]=l,t[1]=g):g=t[1],(0,u.jsx)(ls,{"aria-label":m,className:g.join(" "),disabled:o,onClick:i,slug:r,...d,children:n})},cL=e=>{let{drawerSlug:t}=e;return(0,u.jsx)(lc,{className:cR,gutter:!1,Header:null,slug:t,children:(0,u.jsx)(cT,{...e})})},cO=e=>{let t,n=(0,f.c)(38),{id:l,collectionSlug:a,overrideEntityVisibility:r}=e,i=ns(),s=(0,o.useId)(),{closeModal:c,modalState:d,openModal:p,toggleModal:h}=nE(),[m,g]=(0,o.useState)(!1),v;n[0]!==a||n[1]!==i||n[2]!==l||n[3]!==s?(v=(e=>{let{id:t,collectionSlug:n,depth:l,uuid:a}=e;return"doc-drawer_".concat(n,"_").concat(l).concat(t?"_".concat(t):"","_").concat(a)})({id:l,collectionSlug:a,depth:i,uuid:s}),n[0]=a,n[1]=i,n[2]=l,n[3]=s,n[4]=v):v=n[4];let b=v,y,x;n[5]!==b||n[6]!==d?(y=()=>{var e;g(!!(null==(e=d[b])?void 0:e.isOpen))},x=[d,b],n[5]=b,n[6]=d,n[7]=y,n[8]=x):(y=n[7],x=n[8]),(0,o.useEffect)(y,x),n[9]!==b||n[10]!==h?(t=()=>{h(b)},n[9]=b,n[10]=h,n[11]=t):t=n[11];let w=t,j;n[12]!==c||n[13]!==b?(j=()=>{c(b)},n[12]=c,n[13]=b,n[14]=j):j=n[14];let C=j,S;n[15]!==b||n[16]!==p?(S=()=>{p(b)},n[15]=b,n[16]=p,n[17]=S):S=n[17];let k=S,_;n[18]!==a||n[19]!==b||n[20]!==l||n[21]!==r?(_=e=>(0,o.createElement)(cL,{...e,collectionSlug:a,drawerSlug:b,id:l,key:b,overrideEntityVisibility:r}),n[18]=a,n[19]=b,n[20]=l,n[21]=r,n[22]=_):_=n[22];let N=_,E;n[23]!==a||n[24]!==b||n[25]!==l?(E=e=>(0,u.jsx)(cA,{...e,collectionSlug:a,drawerSlug:b,operation:l?"update":"create"}),n[23]=a,n[24]=b,n[25]=l,n[26]=E):E=n[26];let P=E,D;n[27]!==C||n[28]!==b||n[29]!==i||n[30]!==m||n[31]!==k||n[32]!==w?(D={closeDrawer:C,drawerDepth:i,drawerSlug:b,isDrawerOpen:m,openDrawer:k,toggleDrawer:w},n[27]=C,n[28]=b,n[29]=i,n[30]=m,n[31]=k,n[32]=w,n[33]=D):D=n[33];let T=D,R;return n[34]!==N||n[35]!==T||n[36]!==P?(R=[N,P,T],n[34]=N,n[35]=T,n[36]=P,n[37]=R):R=n[37],R};function cF(e,t){let n=(0,f.c)(4),[l,a]=(0,o.useState)(e),r,i;return n[0]!==t||n[1]!==e?(r=()=>{let n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},i=[e,t],n[0]=t,n[1]=e,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,o.useEffect)(r,i),l}function cM(e,t){switch(t.type){case"ADD_LOADED":{let n={...e};"object"!=typeof n[t.relationTo]&&(n[t.relationTo]={});let l=[...t.idsToLoad];return Array.isArray(t.docs)&&t.docs.forEach(e=>{l.splice(l.indexOf(e.id),1),n[t.relationTo][e.id]=e}),l.forEach(e=>{n[t.relationTo][e]=!1}),n}case"REQUEST":{let n={...e};return t.docs.forEach(e=>{let{relationTo:t,value:l}=e;"object"!=typeof n[t]&&(n[t]={}),n[t][l]=null}),n}default:return e}}var cI=(0,o.createContext)({}),cB=e=>{let t,n=(0,f.c)(16),{children:l}=e,a;n[0]===Symbol.for("react.memo_cache_sentinel")?(a={},n[0]=a):a=n[0];let[r,c]=(0,o.useReducer)(cM,a),d=cF(r,100),{config:p}=(0,i.c)(),{collections:h,routes:m,serverURL:g}=p,{api:v}=m,{i18n:b}=(0,s.d)(),{code:x}=lN(),w=(0,o.useRef)(x),j;n[1]!==v||n[2]!==h||n[3]!==d||n[4]!==b||n[5]!==x||n[6]!==g?(j=e=>{let t=void 0!==e&&e;Object.entries(d).forEach(async e=>{let[n,l]=e,a=[];if(Object.entries(l).forEach(e=>{let[n,l]=e;(null===l||t)&&a.push(n)}),a.length>0){let e="".concat(g).concat(v,"/").concat(n),t=new URLSearchParams,l={};t.append("depth","0"),t.append("limit","250");let r=h.find(e=>e.slug===n);if(r.admin.enableListViewSelectAPI){var o;l[null!=(o=r.admin.useAsTitle)?o:"id"]=!0,r.upload&&(0,E.f)({collectionConfig:r,select:l})}x&&t.append("locale",x);let i=a.map(cz);t.append("where[id][in]",i.join(","));let s="?".concat(t.toString(),"&").concat(y.A({select:l})),u=await fetch("".concat(e).concat(s),{credentials:"include",headers:{"Accept-Language":b.language}});if(u.ok){let e=await u.json();e.docs&&c({type:"ADD_LOADED",docs:e.docs,idsToLoad:a,relationTo:n})}else c({type:"ADD_LOADED",docs:[],idsToLoad:a,relationTo:n})}})},n[1]=v,n[2]=h,n[3]=d,n[4]=b,n[5]=x,n[6]=g,n[7]=j):j=n[7];let C=j,S,k;n[8]!==C||n[9]!==x?(S=()=>{C(x&&w.current!==x),w.current=x},k=[x,C],n[8]=C,n[9]=x,n[10]=S,n[11]=k):(S=n[10],k=n[11]),(0,o.useEffect)(S,k),n[12]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{c({type:"REQUEST",docs:e})},n[12]=t):t=n[12];let _=t,N;return n[13]!==l||n[14]!==r?(N=(0,u.jsx)(cI,{value:{documents:r,getRelationships:_},children:l}),n[13]=l,n[14]=r,n[15]=N):N=n[15],N},cU=()=>(0,o.use)(cI);function cz(e){return String(e)}var cV=e=>{let{allowCreate:t,baseClass:n,buttonStyle:l,className:a,collections:o,i18n:r,icon:i,label:s,onClick:c,permissions:p,relationTo:
1h}=e;return t?Array.isArray(h)?(0,u.jsx)("div",{className:"".concat(n,"__add-new-polymorphic-wrapper"),children:(0,u.jsx)(t_,{button:(0,u.jsx)(tD,{buttonStyle:l,className:a,icon:i,children:s}),buttonType:"custom",horizontalAlign:"center",render:e=>{let{close:t}=e;return(0,u.jsx)(tc.ButtonGroup,{children:h.map(e=>{var l;return(null==(l=p.collections[e])?void 0:l.create)?(0,u.jsx)(tc.Button,{className:"".concat(n,"__relation-button--").concat(e),onClick:()=>{t(),c(e)},children:(0,d.s)(o.find(t=>t.slug===e).labels.singular,r)},e):null})})},size:"medium"})}):(0,u.jsx)(tD,{buttonStyle:l,className:a,onClick:()=>c(),children:s}):null},cH=Symbol.for("react.lazy");function cq(e){return o.isValidElement(e)||(null==e?void 0:e.$$typeof)===cH}var cW=e=>{let{cellData:t,nowrap:n}=e,l=(null==t?void 0:t.length)>100?"".concat(t.substring(0,100),"â¦"):t;return(0,u.jsx)("code",{className:"code-cell",style:n?{whiteSpace:"nowrap"}:{},children:(0,u.jsx)("span",{children:l})})};function cK(e){let{blockType:t}=e;return t}var cY=e=>{let{cellData:t,field:n,rowData:l}=e,{name:a,accessor:o,admin:r,timezone:c}=n,{date:d}=void 0===r?{}:r,{config:p}=(0,i.c)(),{admin:h}=p,{dateFormat:f}=h,{i18n:m}=(0,s.d)(),g=c&&l?(0,P.v)(l,"".concat(o||a,"_tz"),void 0):void 0,v=(null==d?void 0:d.displayFormat)||f;return(0,u.jsx)("span",{children:!!t&&ah({date:t,i18n:m,pattern:v,timezone:g})})},cG=()=>(0,u.jsxs)("svg",{height:"150",style:{backgroundColor:"#333333"},viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),(0,u.jsx)("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]}),cQ="thumbnail",cX=e=>{let t=(0,f.c)(6),{className:n,doc:l,fileSrc:a,height:r,imageCacheTag:s,size:c,width:d}=e,p=void 0===n?"":n,{filename:h}=void 0===l?{}:l,[m,g]=o.useState(void 0),v="".concat(cQ,"--size-").concat(c||"medium"),b;t[0]!==p||t[1]!==v?(b=[cQ,v,p],t[0]=p,t[1]=v,t[2]=b):b=t[2];let y=b.join(" "),x,w;t[3]!==a?(x=()=>{if(!a)return void g(!1);g(void 0);let e=new Image;e.src=a,e.onload=()=>{g(!0)},e.onerror=()=>{g(!1)}},w=[a],t[3]=a,t[4]=x,t[5]=w):(x=t[4],w=t[5]),o.useEffect(x,w);let j=null;if(a){let e=(null==a?void 0:a.includes("?"))?"&":"?";j=s?"".concat(a).concat(e).concat(encodeURIComponent(s)):a}return(0,u.jsxs)("div",{className:y,children:[void 0===m&&(0,u.jsx)(i.f,{height:"100%"}),m&&(0,u.jsx)("img",{alt:h,height:r,src:j,width:d}),!1===m&&(0,u.jsx)(cG,{})]})};function c$(e){let t,n=(0,f.c)(12),{alt:l,className:a,filename:r,fileSrc:s,imageCacheTag:c,size:d}=e,p=void 0===a?"":a,[h,m]=o.useState(void 0),g="".concat(cQ,"--size-").concat(d||"medium"),v;n[0]!==p||n[1]!==g?(v=[cQ,g,p],n[0]=p,n[1]=g,n[2]=v):v=n[2];let b=v.join(" "),y,x;n[3]!==s?(y=()=>{if(!s)return void m(!1);m(void 0);let e=new Image;e.src=s,e.onload=()=>{m(!0)},e.onerror=()=>{m(!1)}},x=[s],n[3]=s,n[4]=y,n[5]=x):(y=n[4],x=n[5]),o.useEffect(y,x);let w="";if(s){let e=(null==s?void 0:s.includes("?"))?"&":"?";w=c?"".concat(s).concat(e).concat(encodeURIComponent(c)):s}return n[6]!==l||n[7]!==b||n[8]!==h||n[9]!==r||n[10]!==w?(t=(0,u.jsxs)("div",{className:b,children:[void 0===h&&(0,u.jsx)(i.f,{height:"100%"}),h&&(0,u.jsx)("img",{alt:l||r,src:w}),!1===h&&(0,u.jsx)(cG,{})]}),n[6]=l,n[7]=b,n[8]=h,n[9]=r,n[10]=w,n[11]=t):t=n[11],t}var cZ="file",cJ=e=>{var t,n,l;let{cellData:a,collectionConfig:o,field:r,rowData:i}=e;if(null!=(l=null!=(n="displayPreview"in r?r.displayPreview:void 0)?n:null==(t=o.upload)?void 0:t.displayPreview)&&!l)return(0,u.jsx)(u.Fragment,{children:String(a)});{let e=(0,D.w)(null==i?void 0:i.mimeType),t=e?(null==i?void 0:i.thumbnailURL)||(null==i?void 0:i.url):null==i?void 0:i.thumbnailURL;return e&&(t=(0,T.k)({sizes:null==i?void 0:i.sizes,thumbnailURL:null==i?void 0:i.thumbnailURL,url:null==i?void 0:i.url,width:null==i?void 0:i.width})),(0,u.jsxs)("div",{className:cZ,children:[(0,u.jsx)(cX,{className:"".concat(cZ,"__thumbnail"),collectionSlug:null==o?void 0:o.slug,doc:{...i,filename:a},fileSrc:t,size:"small",uploadConfig:null==o?void 0:o.upload}),(0,u.jsx)("span",{className:"".concat(cZ,"__filename"),children:String(a)})]})}},c0=!!("u">typeof window&&window.document&&window.document.createElement),c1=e=>{var t;let n,l,a,r,c=(0,f.c)(40),{cellData:p,customCellProps:h,field:m,field:g}=e,{label:v}=g,b="relationTo"in m&&m.relationTo||"collection"in m&&m.collection,y="collection"in m?null==p?void 0:p.docs:p,{config:x,getEntityConfig:w}=(0,i.c)(),{collections:j,routes:C}=x,[S,k]=tj(),_;c[0]===Symbol.for("react.memo_cache_sentinel")?(_=[],c[0]=_):_=c[0];let[N,E]=(0,o.useState)(_),{documents:P,getRelationships:D}=cU(),[T,R]=(0,o.useState)(!1),{i18n:A,t:L}=(0,s.d)(),O=!!c0&&(null==k||null==(t=k.boundingClientRect)?void 0:t.top)<window.innerHeight,F;if(c[1]!==y||c[2]!==D||c[3]!==T||c[4]!==O||c[5]!==b?(F=()=>
1{if((y||"number"==typeof y)&&O&&!T){let e=[],t=Array.isArray(y)?y:[y];t.slice(0,t.length<3?t.length:3).forEach(t=>{"object"==typeof t&&"relationTo"in t&&"value"in t&&e.push(t),("number"==typeof t||"string"==typeof t)&&"string"==typeof b&&e.push({relationTo:b,value:t})}),D(e),R(!0),E(e)}},c[1]=y,c[2]=D,c[3]=T,c[4]=O,c[5]=b,c[6]=F):F=c[6],c[7]!==y||c[8]!==j||c[9]!==D||c[10]!==T||c[11]!==O||c[12]!==b||c[13]!==C.api?(n=[y,b,j,O,C.api,T,D],c[7]=y,c[8]=j,c[9]=D,c[10]=T,c[11]=O,c[12]=b,c[13]=C.api,c[14]=n):n=c[14],(0,o.useEffect)(F,n),c[15]!==T?(l=()=>{T&&R(!1)},c[15]=T,c[16]=l):l=c[16],c[17]!==y?(a=[y],c[17]=y,c[18]=a):a=c[18],(0,o.useEffect)(l,a),c[19]!==y||c[20]!==x.admin||c[21]!==h||c[22]!==P||c[23]!==m||c[24]!==w||c[25]!==A||c[26]!==S||c[27]!==v||c[28]!==L||c[29]!==N){let e;c[31]!==x.admin||c[32]!==h||c[33]!==P||c[34]!==m||c[35]!==w||c[36]!==A||c[37]!==L||c[38]!==N.length?(e=(e,t)=>{var n,l,a;let{relationTo:r,value:i}=e,s=P[r][i],c=w({collectionSlug:r}),d=av({collectionConfig:c,data:s||null,dateFormat:x.admin.dateFormat,fallback:"".concat(L("general:untitled")," - ID: ").concat(i),i18n:A}),p=null;return"upload"===m.type&&(null==(a=null!=(l="displayPreview"in m?m.displayPreview:void 0)?l:null==(n=c.upload)?void 0:n.displayPreview)||a)&&s&&(p=(0,u.jsx)(cJ,{cellData:d,collectionConfig:c,collectionSlug:c.slug,customCellProps:h,field:m,rowData:s})),(0,u.jsxs)(o.Fragment,{children:[!1===s&&"".concat(L("general:untitled")," - ID: ").concat(i),null===s&&"".concat(L("general:loading"),"..."),s?p||d:null,N.length>t+1&&", "]},t)},c[31]=x.admin,c[32]=h,c[33]=P,c[34]=m,c[35]=w,c[36]=A,c[37]=L,c[38]=N.length,c[39]=e):e=c[39],r=(0,u.jsxs)("div",{className:"relationship-cell",ref:S,children:[N.map(e),Array.isArray(y)&&y.length>3&&L("fields:itemsAndMore",{count:y.length-3,items:""}),0===N.length&&L("general:noLabel",{label:(0,d.s)(v||"",A)})]}),c[19]=y,c[20]=x.admin,c[21]=h,c[22]=P,c[23]=m,c[24]=w,c[25]=A,c[26]=S,c[27]=v,c[28]=L,c[29]=N,c[30]=r}else r=c[30];return r},c3=e=>{let t=(0,f.c)(7),{cellData:n,field:l}=e,{options:a}=l,{i18n:o}=(0,s.d)(),r;t[0]!==o||t[1]!==a?(r=e=>e.map(e=>{var t,n;let l=null==(n=a.filter(t=>t.value===e))||null==(t=n[0])?void 0:t.label;return(0,d.s)(l,o)}).join(", "),t[0]=o,t[1]=a,t[2]=r):r=t[2];let i=r,c;if(t[3]!==n||t[4]!==i||t[5]!==a){let e;e=(0,m.Vh)(a)?i(Array.isArray(n)?n:[n]):Array.isArray(n)?n.join(", "):n,c=(0,u.jsx)("span",{children:e}),t[3]=n,t[4]=i,t[5]=a,t[6]=c}else c=t[6];return c},c2={array:e=>{let t=(0,f.c)(2),{cellData:n,field:l}=e,{labels:a}=l,{i18n:o}=(0,s.d)(),r=null!=n?n:[],i=1===r.length?"".concat(r.length," ").concat((0,d.s)((null==a?void 0:a.singular)||o.t("general:rows"),o)):"".concat(r.length," ").concat((0,d.s)((null==a?void 0:a.plural)||o.t("general:rows"),o)),c;return t[0]!==i?(c=(0,u.jsx)("span",{children:i}),t[0]=i,t[1]=c):c=t[1],c},blocks:e=>{var t;let n,l=(0,f.c)(2),{cellData:a,field:o}=e,{blockReferences:r,blocks:c,labels:p}=o,{i18n:h}=(0,s.d)(),{config:m}=(0,i.c)(),g=Array.isArray(a)?a.map(cK):[],v=null==(t=null!=r?r:c)?void 0:t.map(e=>{let t="string"==typeof e?m.blocksMap[e]:e;return{slug:t.slug,label:(0,d.s)(t.labels.singular,h)}}),b="0 ".concat((0,d.s)(null==p?void 0:p.plural,h)),y=e=>e.map(e=>{var t,n;return null==(n=v.filter(t=>t.slug===e))||null==(t=n[0])?void 0:t.label}).join(", ");if(g.length>5){let e=g.length-5;b="".concat(g.length," ").concat((0,d.s)(null==p?void 0:p.plural,h)," - ").concat(h.t("fields:itemsAndMore",{count:e,items:y(g.slice(0,5))}))}else g.length>0&&(b="".concat(g.length," ").concat((0,d.s)(1===g.length?null==p?void 0:p.singular:null==p?void 0:p.plural,h)," - ").concat(y(g)));return l[0]!==b?(n=(0,u.jsx)("span",{children:b}),l[0]=b,l[1]=n):n=l[1],n},checkbox:e=>{let t=(0,f.c)(3),{cellData:n}=e,{t:l}=(0,s.d)(),a="general:".concat(n),o;return t[0]!==l||t[1]!==a?(o=(0,u.jsx)("code",{className:"bool-cell",children:(0,u.jsx)("span",{children:l(a).toLowerCase()})}),t[0]=l,t[1]=a,t[2]=o):o=t[2],o},code:cW,date:cY,File:cJ,join:c1,json:e=>{let{cellData:t}=e,n=(null==t?void 0:t.length)>100?"".concat(t.substring(0,100),"â¦"):t;return(0,u.jsx)("code",{className:"json-cell",children:(0,u.jsx)("span",{children:JSON.stringify(n)})})},radio:c3,relationship:c1,select:c3,textarea:e=>{let{cellData:t}=e,n=(null==t?void 0:t.length)>100?"".concat(t.substring(0,100),"â¦"):t;return(0,u.jsx)("span",{children:n})},upload:c1},c6=e=>{let t=(0,f.c)(17),{cellData:n,className:l,collectionSlug:a,field:o,field:r,link:c,linkURL:p,onClick:h,rowData:g,viewType:b}=e,{admin:y}=r,{i18n:x}=(0,s.d)(),{config:w,getEntityConfig:j}=(0,i.c)(),{routes:C,serverURL:S}=w,{admin:k}=C,_,N;if(t[0]!==y||t[1]!==k||t[2]!==n||t[3]!==l||t[4]!==a||t[5]!==o||t[6]!==j||t[7]!==x||t[8]!==c||t[9]!==p||t[10]!==h||t[11]!==e||t[12]!==g||t[13]!==S||t[14]!==b){N=Symbol.for("react.early_return_sentinel");e:{let t=j({collectionSlug:a}),r=y&&"className"in y?y.className:void 0,i=l||(o.admin&&"className"in o.admin?o.admin.className:null)||r,s="span",f={className:i};if(c&&(f.prefetch=!1,s=tt,p?f.href=p:f.href=(null==t?void 0:t.slug)?(0,v.Q)({adminRoute:k,path:"/collections/".concat(null==t?void 0:t.slug).concat("trash"===b?"/tras
1h":"","/").concat(encodeURIComponent(g.id)),serverURL:S}):""),"function"==typeof h&&(s="button",f.type="button",f.onClick=()=>{h({cellData:n,collectionSlug:null==t?void 0:t.slug,rowData:g})}),(0,m.uT)(o)){N=(0,u.jsx)(s,{...f,children:(0,u.jsx)(cW,{cellData:"ID: ".concat(n),collectionConfig:t,collectionSlug:a,field:{...o,type:"code"},nowrap:!0,rowData:g})});break e}let w=((e,t,n)=>{if(((null==t?void 0:t.type)==="select"||(null==t?void 0:t.type)==="radio")&&Array.isArray(t.options)){let l=t.options.find(t=>"object"==typeof t?t.value===e:t===e);if(l)return"object"==typeof l&&"label"in l?cq(l.label)?l.label:(0,d.s)(l.label,n)||l.value:l}return e})(n,o,x),C="u">typeof n&&c2[o.type],E=null;if(cq(w))E=w;else if(C)E=(0,u.jsx)(C,{cellData:n,rowData:g,...e});else if(!C)if((null==t?void 0:t.upload)&&(0,m.Z7)(o)&&"filename"===o.name&&"text"===o.type){let l=c2.File;E=(0,u.jsx)(l,{cellData:n,rowData:g,...e,collectionConfig:t,field:o})}else{N=(0,u.jsxs)(s,{...f,children:[(""===w||typeof w>"u"||null===w)&&x.t("general:noLabel",{label:(0,d.s)(("label"in o?o.label:null)||"data",x)}),"string"==typeof w&&w,"number"==typeof w&&w,"object"==typeof w&&null!==w&&JSON.stringify(w)]});break e}if(("select"===o.type||"radio"===o.type)&&o.options.length&&n){let e=Array.isArray(n)?n.map(c5).join(" "):"selected--".concat(n),t=[f.className,e].filter(
1Boolean).join(" ");N=(0,u.jsx)(s,{...f,className:t,children:E});break e}_=(0,u.jsx)(s,{...f,children:E})}t[0]=y,t[1]=k,t[2]=n,t[3]=l,t[4]=a,t[5]=o,t[6]=j,t[7]=x,t[8]=c,t[9]=p,t[10]=h,t[11]=e,t[12]=g,t[13]=S,t[14]=b,t[15]=_,t[16]=N}else _=t[15],N=t[16];return N!==Symbol.for("react.early_return_sentinel")?N:_};function c5(e){return"selected--".concat(e)}var c4=o.createContext(null),c8=()=>o.use(c4),c9=e=>{let t=(0,f.c)(9),{clientProps:n,columnIndex:l,isLinkedColumn:a}=e,{drawerSlug:o,onSelect:r}=s7(),{LinkedCellOverride:i}=cu(),s;if(t[0]!==i||t[1]!==n||t[2]!==l||t[3]!==o||t[4]!==a||t[5]!==r){let e={...n,columnIndex:l};if(a&&o){let n;e.className="".concat("default-cell","__first-cell"),e.link=!1,t[7]!==r?(n=e=>{let{collectionSlug:t,rowData:n}=e;"function"==typeof r&&r({collectionSlug:t,doc:n,docID:n.id})},t[7]=r,t[8]=n):n=t[8],e.onClick=n}s=(0,u.jsx)(c4,{value:e,children:a&&i?i:(0,u.jsx)(c6,{...e})}),t[0]=i,t[1]=n,t[2]=l,t[3]=o,t[4]=a,t[5]=r,t[6]=s}else s=t[6];return s},c7=e=>{let t=(0,f.c)(3),{onDrawerOpen:n}=e,l=c8(),a;return t[0]!==l||t[1]!==n?(a=(0,u.jsxs)("div",{className:"drawer-link",children:[(0,u.jsx)(c6,{...l,className:"drawer-link__cell",link:!1,onClick:null}),(0,u.jsx)("button",{className:"drawer-link__doc-drawer-toggler",onClick:()=>{n(l.rowData.id)},type:"button",children:(0,u.jsx)(to,{})})]}),t[0]=l,t[1]=n,t[2]=a):a=t[2],a},ue="clickable-arrow",ut="paginator__page",un=e=>{let{isCurrent:t,isFirstPage:n=!1,isLastPage:l=!1,page:a=1,updatePage:o}=e,r=[ut,t&&"".concat(ut,"--is-current"),n&&"".concat(ut,"--is-first-page"),l&&"".concat(ut,"--is-last-page")].filter(Boolean).join(" ");return(0,u.jsx)("button",{className:r,onClick:()=>o(a),type:"button",children:a})},ul={ClickableArrow:e=>{let{direction:t="right",isDisabled:n=!1,updatePage:l}=e,a=[ue,n&&"".concat(ue,"--is-disabled"),t&&"".concat(ue,"--").concat(t)].filter(Boolean).join(" ");return(0,u.jsx)("button",{className:a,disabled:n,onClick:n?void 0:l,type:"button",children:(0,u.jsx)(ta,{})})},Page:un,Separator:()=>(0,u.jsx)("span",{className:"paginator__separator",children:"â"})},ua=e=>{let{hasNextPage:t=!1,hasPrevPage:n=!1,nextPage:l=null,numberOfNeighbors:a=1,onChange:o,page:r,prevPage:i=null,totalPages:s=null}=e;if(!n&&!t)return null;let c=e=>{"function"==typeof o&&o(e)},d=Array.from({length:s},(e,t)=>t+1),p=r-1-a;p<=0&&(p=0);let h=r-1+a+1,f=d.slice(p,h);return r-a-1>=2&&f.unshift({type:"Separator"}),r>a+1&&f.unshift({type:"Page",props:{isFirstPage:!0,page:1,updatePage:c}}),r+a+1<s&&f.push({type:"Separator"}),h<s&&f.push({type:"Page",props:{isLastPage:!0,page:s,updatePage:c}}),f.unshift({type:"ClickableArrow",props:{direction:"right",isDisabled:!t,updatePage:()=>c(null!=l?l:r+1)}}),f.unshift({type:"ClickableArrow",props:{direction:"left",isDisabled:!n,updatePage:()=>c(null!=i?i:Math.max(1,r-1))}}),(0,u.jsx)("div",{className:"paginator",children:f.map((e,t)=>{if("number"==typeof e)return(0,u.jsx)(un,{isCurrent:r===e,page:e,updatePage:c},t);let n=ul[e.type];return(0,u.jsx)(n,{...e.props},t)})})},uo=()=>{let e=(0,f.c)(11),{data:t,handlePageChange:n}=cn(),l=t.nextPage||2,a;e[0]!==n?(a=e=>{n(e)},e[0]=n,e[1]=a):a=e[1];let o=t.page||1,r=t.prevPage||void 0,i;return e[2]!==t.hasNextPage||e[3]!==t.hasPrevPage||e[4]!==t.limit||e[5]!==t.totalPages||e[6]!==l||e[7]!==a||e[8]!==o||e[9]!==r?(i=(0,u.jsx)(ua,{hasNextPage:t.hasNextPage,hasPrevPage:t.hasPrevPage,limit:t.limit,nextPage:l,numberOfNeighbors:1,onChange:a,page:o,prevPage:r,totalPages:t.totalPages}),e[2]=t.hasNextPage,e[3]=t.hasPrevPage,e[4]=t.limit,e[5]=t.totalPages,e[6]=l,e[7]=a,e[8]=o,e[9]=r,e[10]=i):i=e[10],i},ur="relationship-table",ui=e=>{var t,n,l,a,r,c;let{AfterInput:p,allowCreate:h=!0,BeforeInput:f,disableTable:m=!1,field:g,fieldPath:v,filterOptions:b,initialData:y,initialDrawerData:x,Label:w,parent:j,relationTo:C}=e,[S,N]=(0,o.useState)(null),{config:E,getEntityConfig:P}=(0,i.c)(),{i18n:D,t:T}=(0,s.d)(),[R,A]=(0,o.useState)(),[L,O]=(0,o.useState)(!1),[F]=(0,o.useState)(()=>P({collectionSlug:C})),M=Array.isArray(C),[I,B]=(0,o.useState)(M?void 0:C),{permissions:U}=lw(),z=(0,o.useRef)(!1),[V,H]=(0,o.useState)(void 0),[q,,{closeDrawer:W,isDrawerOpen:K,openDrawer:Y}]=cO({id:V,collectionSlug:I}),[G,Q]=(0,o.useState)(!m),[X,$]=(0,o.useState)(()=>y?{...y,docs:Array.isArray(y.docs)?y.docs.reduce((e,t)=>
1"string"==typeof t||"number"==typeof t?[...e,{id:t}]:[...e,t],[]):[]}:void 0),[Z,J]=(0,o.useState)(),{getTableState:ee}=ci(),et=(0,o.useCallback)(async e=>{var t,n;let l={limit:(null==g?void 0:g.defaultLimit)||(null==F||null==(n=F.admin)||null==(t=n.pagination)?void 0:t.defaultLimit),sort:g.defaultSort||(null==F?void 0:F.defaultSort),...R||{},where:{...(null==R?void 0:R.where)||{}}};b&&(l.where=(0,k.Y)(l.where,b));let a=g.admin.defaultColumns?g.admin.defaultColumns.map(e=>({accessor:e,active:!0})):void 0,o="boolean"==typeof g.admin.disableRowTypes?!g.admin.disableRowTypes:Array.isArray(C),{data:r,state:i,Table:s}=await ee({collectionSlug:C,columns:(0,_.l)(null==R?void 0:R.columns)||a,data:e,enableRowSelections:!1,orderableFieldName:!g.orderable||Array.isArray(g.collection)?void 0:"_".concat(g.collection,"_").concat(g.name,"_order"),parent:j,query:l,renderRowTypes:o,tableAppearance:"condensed"});$(r),N(s),J(i),Q(!1)},[g.defaultLimit,g.defaultSort,g.admin.defaultColumns,g.admin.disableRowTypes,g.collection,g.name,g.orderable,null==F||null==(n=F.admin)||null==(t=n.pagination)?void 0:t.defaultLimit,null==F?void 0:F.defaultSort,R,b,ee,C,j]),en=lv((e,t)=>{t||S&&!e||et()});(0,o.useEffect)(()=>{en(R,m)},[R,m]);let el=(0,o.useCallback)(e=>{var t;let{doc:n,operation:l}=e;"create"===l&&W();let a=null==X||null==(t=X.docs)?void 0:t.findIndex(e=>e.id===n.id),o={docs:[]};if(-1!==a){let e=[...X.docs];e[a]=n,o.docs=e}else o.docs=[n,...X.docs];et(o)},[null==X?void 0:X.docs,et,W]),ea=(0,o.useCallback)(e=>{let t=X.docs.filter(t=>t.id!==e.id);et({...X,docs:t}),H(void 0)},[X,et]),eo=(0,o.useCallback)(e=>{z.current=!0,H(e||void 0)},[]);(0,o.useEffect)(()=>{z.current&&(z.current=!1,Y())},[Y]),(0,o.useEffect)(()=>{K||H(void 0)},[K]);let er=!1!==h&&(null==U||null==(a=U.collections)||null==(l=a[M?C[0]:C])?void 0:l.create);(0,o.useEffect)(()=>{M&&I&&Y()},[I,Y,M]),(0,o.useEffect)(()=>{M&&!K&&I&&B(void 0)},[K]);let ei=o.useMemo(()=>{var e,t,n,l,a;return{columns:null==(e=(0,_.l)(Z))?void 0:e.map(e=>{let{accessor:t}=e;return t}),limit:null!=(l=g.defaultLimit)?l:null==F||null==(n=F.admin)||null==(t=n.pagination)?void 0:t.defaultLimit,sort:null!=(a=g.defaultSort)?a:null==F?void 0:F.defaultSort}},[Z,g,F]);return(0,u.jsxs)("div",{className:ur,children:[(0,u.jsxs)("div",{className:"".concat(ur,"__header"),children:[w,(0,u.jsxs)("div",{className:"".concat(ur,"__actions"),children:[(0,u.jsx)(cV,{allowCreate:!1!==h,baseClass:ur,buttonStyle:"none",className:"".concat(ur,"__add-new").concat(M?"-polymorphic":" doc-drawer__toggler"),collections:E.collections,i18n:D,icon:M?"plus":void 0,label:D.t("fields:addNew"),onClick:M?B:Y,permissions:U,relationTo:C}),(0,u.jsx)(ol,{"aria-controls":"".concat(ur,"-columns"),"aria-expanded":L,className:"".concat(ur,"__toggle-columns ").concat(L?"".concat(ur,"__buttons-active"):""),icon:(0,u.jsx)(ta,{direction:L?"up":"down"}),onClick:()=>O(!L),pillStyle:"light",size:"small",children:T("general:columns")})]})]}),f,G?(0,u.jsx)("p",{children:T("general:loading")}):(0,u.jsxs)(o.Fragment,{children:[(null==X?void 0:X.docs)&&0===X.docs.length&&(0,u.jsxs)("div",{className:"".concat(ur,"__no-results"),children:[(0,u.jsx)("p",{children:D.t("general:noResults",{label:M?D.t("general:documents"):(0,d.s)(null==F||null==(r=F.labels)?void 0:r.plural,D)})}),(0,u.jsx)(cV,{allowCreate:er,baseClass:ur,collections:E.collections,i18n:D,label:D.t("general:createNewLabel",{label:M?D.t("general:document"):(0,d.s)(null==F||null==(c=F.labels)?void 0:c.singular,D)}),onClick:M?B:Y,permissions:U,relationTo:C})]}),(null==X?void 0:X.docs)&&X.docs.length>0&&(0,u.jsx)(cB,{children:(0,u.jsx)(co,{data:X,modifySearchParams:!1,onQueryChange:A,orderableFieldName:!g.orderable||Array.isArray(g.collection)?void 0:"_".concat(g.collection,"_").concat(v.replaceAll(".","_"),"_order"),query:ei,children:(0,u.jsxs)(cd,{collectionSlug:M?C[0]:C,columnState:Z,LinkedCellOverride:(0,u.jsx)(c7,{currentDrawerID:V,onDrawerOpen:eo}),children:[(0,u.jsx)(a2,{className:"".concat(ur,"__columns"),height:L?"auto":0,id:"".concat(ur,"-columns"),children:(0,u.jsx)("div",{className:"".concat(ur,"__columns-inner"),children:F&&(0,u.jsx)(cf,{collectionSlug:F.slug})})}),S,(0,u.jsx)(uo,{})]})})})]}),p,(0,u.jsx)(q,{initialData:x,onDelete:ea,onSave:el})]})},us="default"in s4.default?s4.default.default:s4.default,uc=e=>{var t;let{collectionSlug:n,config:l,docID:a,fields:o,segments:r}=e,i=(0,S.L)(o,{keepPresentationalFields:!0}),s=r[0],c=i.find(e=>e.name===s);if(!c)return null;if("relationship"===c.type||"upload"===c.type){let e=a;return Array.isArray(c.relationTo)&&(e={relationTo:n,value:a}),{[c.name]:c.hasMany?[e]:e}}let u=r.slice(1,r.length);if("tab"===c.type||"group"===c.type&&(0,m.Z7)(c))return{[c.name]:uc({collectionSlug:n,config:l,docID:a,fields:c.fields,segments:u})};if("array"===c.type){let e=uc({collectionSlug:n,config:l,docID:a,fields:c.fields,segments:u});return e.id=us().toHexString(),{[c.name]:[e]}}if("blocks"===c.type)for(let e of null!=(t=c.blockReferences)?t:c.blocks){let t="string"==typeof e?l.blocksMap[e]:e,o=uc({collectionSlug:n,config:l,docID:a,fields:t.fields,segments:u});if(o)return o.id=us().toHexString(),o.blockType=t.slug,{[c.name]:[o]}}},uu=aV(e=>{let{field:t,field:{admin:{allowCreate:n,description:l}
1,collection:a,label:r,localized:s,on:c,required:d},path:p}=e,{id:h,docConfig:f}=aD(),{config:m,getEntityConfig:g}=(0,i.c)(),{customComponents:{AfterInput:v,BeforeInput:b,Description:y,Error:x,Label:w}={},path:j,showError:C,value:S}=aB({potentiallyStalePath:p}),k=(0,o.useMemo)(()=>{if(!h)return null;let e=h;Array.isArray(t.targetField.relationTo)&&(e={relationTo:f.slug,value:e});let n=Array.isArray(a)?{}:{[c]:{equals:e}};return t.where?{and:[n,t.where]}:n},[h,a,t.targetField.relationTo,t.where,c,null==f?void 0:f.slug]),_=(0,o.useMemo)(()=>{let e=g({collectionSlug:Array.isArray(t.collection)?t.collection[0]:t.collection});return uc({collectionSlug:null==f?void 0:f.slug,config:m,docID:h,fields:null==e?void 0:e.fields,segments:t.on.split(".")})},[g,t.collection,t.on,null==f?void 0:f.slug,h,m]);return f?(0,u.jsxs)("div",{className:[aq,C&&"error","join"].filter(Boolean).join(" "),id:"field-".concat(null==j?void 0:j.replace(/\./g,"__")),children:[(0,u.jsx)(ep,{CustomComponent:x,Fallback:(0,u.jsx)(no,{path:j,showError:C})}),(0,u.jsx)(ui,{AfterInput:v,allowCreate:"u">typeof h&&n,BeforeInput:b,disableTable:null===k,field:t,fieldPath:j,filterOptions:k,initialData:h&&S?S:{docs:[]},initialDrawerData:_,Label:(0,u.jsx)("h4",{style:{margin:0},children:w||(0,u.jsx)(lD,{label:r,localized:s,path:j,required:d})}),parent:Array.isArray(a)?{id:h,collectionSlug:f.slug,joinPath:j}:void 0,relationTo:a}),(0,u.jsx)(ep,{CustomComponent:y,Fallback:(0,u.jsx)(na,{description:l,path:j})})]}):null}),ud=aV(e=>{let{field:t,field:{admin:{className:n,description:l,editorOptions:a,maxHeight:r}={},jsonSchema:s,label:c,localized:d,required:p},path:h,readOnly:f,validate:m}=e,{insertSpaces:g=i.k.insertSpaces,tabSize:v=i.k.tabSize}=a||{},b=(0,o.useCallback)(e=>{if(void 0!==e)return null===e?"":g?JSON.stringify(e,null,v):JSON.stringify(e,null," ")},[v,g]),[y,x]=(0,o.useState)(),w=o.useRef("formState"),[j,C]=(0,o.useState)(Date.now()),{customComponents:{AfterInput:S,BeforeInput:k,Description:_,Error:N,Label:E}={},disabled:P,initialValue:D,path:T,setValue:R,showError:A,value:L}=aB({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,jsonError:y,required:p})},[m,p,y])}),O=o.useRef(b(null!=L?L:D)),F=(0,o.useCallback)((e,t)=>{if(!s)return;t.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...t.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],s],validate:!0});let n=s.uri,l=n.includes("?")?"".concat(n,"&").concat(crypto.randomUUID?crypto.randomUUID():op()):"".concat(n,"?").concat(crypto.randomUUID?crypto.randomUUID():op());e.setModel(t.editor.createModel(b(L)||"","json",t.Uri.parse(l)))},[s,b,L]),M=(0,o.useCallback)(e=>{if(!(f||P)){w.current="internalEditor";try{R(e?JSON.parse(e):null),O.current=e,x(void 0)}catch(t){R(e||null),O.current=e,x(t)}}},[f,P,R]);(0,o.useEffect)(()=>{if("formState"===w.current){let e=b(null!=L?L:D);e!==O.current&&(O.current=e,C(Date.now()))}w.current="formState"},[D,T,b,L]);let I=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsxs)("div",{className:[aq,"json-field",n,A&&"error",(f||P)&&"read-only"].filter(
1Boolean).join(" "),style:I,children:[(0,u.jsx)(ep,{CustomComponent:E,Fallback:(0,u.jsx)(lD,{label:c,localized:d,path:T,required:p})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:N,Fallback:(0,u.jsx)(no,{message:y,path:T,showError:A})}),k,(0,u.jsx)(oE,{defaultLanguage:"json",maxHeight:r,onChange:M,onMount:F,options:a,readOnly:f||P,recalculatedHeightAt:j,value:O.current,wrapperProps:{id:"field-".concat(null==T?void 0:T.replace(/\./g,"__"))}}),S]}),(0,u.jsx)(ep,{CustomComponent:_,Fallback:(0,u.jsx)(na,{description:l,path:T})})]})}),up=aV(e=>{let{field:t,field:{admin:{className:n,description:l,placeholder:a,step:r=1}={},hasMany:i=!1,label:c,localized:p,max:h=1/0,maxRows:f=1/0,min:m=-1/0,required:g},onChange:v,path:b,readOnly:y,validate:x}=e,{i18n:w,t:j}=(0,s.d)(),{customComponents:{AfterInput:C,BeforeInput:S,Description:k,Error:_,Label:N}={},disabled:E,path:P,setValue:D,showError:T,value:A}=aB({potentiallyStalePath:b,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof x)return x(e,{...t,max:h,min:m,required:g})},[x,m,h,g])}),L=(0,o.useCallback)(e=>{let t=parseFloat(e.target.value),n=t;Number.isNaN(t)&&(n=null),"function"==typeof v&&v(n),D(n)},[v,D]),[O,F]=(0,o.useState)([]),M=(0,o.useCallback)(e=>{if(!(y||E)){var t;D(e?Array.isArray(e)?e.map(e=>{var t;return Number((null==(t=e.value)?void 0:t.value)||e.value)}):[Number((null==(t=e.value)?void 0:t.value)||e.value)]:[])}},[y,E,D]);(0,o.useEffect)(()=>{i&&Array.isArray(A)&&F(A.map((e,t)=>({id:"".concat(e).concat(t),label:"".concat(e),value:{toString:()=>"".concat(e).concat(t),value:(null==e?void 0:e.value)||e}})))},[A,i]);let I=(0,o.useMemo)(()=>aH(t),[t]),B=(0,d.s)(a,w);return(0,u.jsxs)("div",{className:[aq,"number",n,T&&"error",(y||E)&&"read-only",i&&"has-many"].filter(Boolean).join(" "),style:I,children:[(0,u.jsx)(ep,{CustomComponent:N,Fallback:(0,u.jsx)(lD,{label:c,localized:p,path:P,required:g})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:_,Fallback:(0,u.jsx)(no,{path:P,showError:T})}),S,i?(0,u.jsx)(sW,{className:"field-".concat(P.replace(/\./g,"__")),disabled:y||E,filterOption:(e,t)=>{let n=Array.isArray(A)&&A.length>=f;return(0,R.E)(t)&&!n},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(A)&&A.length>=f?j("validation:limitReached",{max:f,value:A.length+1}):null,onChange:M,options:[],placeholder:B,showError:T,value:O}):(0,u.jsx)("div",{children:(0,u.jsx)("input",{disabled:y||E,id:"field-".concat(P.replace(/\./g,"__")),max:h,min:m,name:P,onChange:L,onWheel:e=>{e.target.blur()},placeholder:B,step:r,type:"number",value:"number"==typeof A?A:""})}),C,(0,u.jsx)(ep,{CustomComponent:k,Fallback:(0,u.jsx)(na,{description:l,path:P})})]})]})}),uh="point",uf=aV(e=>{let{field:t,field:{admin:{className:n,description:l,placeholder:a,step:r}={},label:i,localized:c,required:p},path:h,readOnly:f,validate:m}=e,{i18n:g,t:v}=(0,s.d)(),{customComponents:{AfterInput:b,BeforeInput:y,Description:x,Error:w,Label:j}={},disabled:C,path:S,setValue:k,showError:_,value:N=[null,null]}=aB({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,required:p})},[m,p])}),E=(0,o.useCallback)((e,t)=>{let n=parseFloat(e.target.value);Number.isNaN(n)&&(n=e.target.value);let l=[...N];l[t]=n,k(l)},[k,N]),P=e=>{let t=v("longitude"===e?"fields:longitude":"fields:latitude"),n=i?(0,d.s)(i,g):"";return"".concat(n).concat(n?" - ":"").concat(t)},D=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsxs)("div",{className:[aq,uh,n,_&&"error",(f||C)&&"read-only"].filter(
1Boolean).join(" "),style:D,children:[(0,u.jsxs)("ul",{className:"".concat(uh,"__wrap"),children:[(0,u.jsxs)("li",{children:[(0,u.jsx)(ep,{CustomComponent:j,Fallback:(0,u.jsx)(lD,{label:P("longitude"),localized:c,path:S,required:p})}),(0,u.jsxs)("div",{className:"input-wrapper",children:[y,(0,u.jsx)("input",{disabled:f||C,id:"field-longitude-".concat(null==S?void 0:S.replace(/\./g,"__")),name:"".concat(S,".longitude"),onChange:e=>E(e,0),placeholder:(0,d.s)(a,g),step:r,type:"number",value:N&&"number"==typeof N[0]?N[0]:""}),b]})]}),(0,u.jsxs)("li",{children:[(0,u.jsx)(ep,{CustomComponent:j,Fallback:(0,u.jsx)(lD,{label:P("latitude"),localized:c,path:S,required:p})}),(0,u.jsxs)("div",{className:"input-wrapper",children:[(0,u.jsx)(ep,{CustomComponent:w,Fallback:(0,u.jsx)(no,{path:S,showError:_})}),y,(0,u.jsx)("input",{disabled:f||C,id:"field-latitude-".concat(null==S?void 0:S.replace(/\./g,"__")),name:"".concat(S,".latitude"),onChange:e=>E(e,1),placeholder:(0,d.s)(a,g),step:r,type:"number",value:N&&"number"==typeof N[1]?N[1]:""}),b]})]})]}),(0,u.jsx)(ep,{CustomComponent:x,Fallback:(0,u.jsx)(na,{description:l,path:S})})]})}),um="radio-input",ug=e=>{let t,n=(0,f.c)(16),{isSelected:l,onChange:a,option:o,path:r,readOnly:i,uuid:c}=e,{i18n:p}=(0,s.d)(),h=ns(),m="field-".concat(r,"-").concat(o.value).concat(h>1?"-".concat(h):"").concat(c?"-".concat(c):""),g=l&&"".concat(um,"--is-selected"),v;n[0]!==g?(v=[um,g].filter(Boolean),n[0]=g,n[1]=v):v=n[1];let b=v.join(" "),y;if(n[2]!==a||n[3]!==o.value?(y=()=>"function"==typeof a?a(o.value):null,n[2]=a,n[3]=o.value,n[4]=y):y=n[4],n[5]!==p||n[6]!==m||n[7]!==l||n[8]!==o.label||n[9]!==r||n[10]!==i||n[11]!==b||n[12]!==y){let e=(0,u.jsx)("input",{checked:l,disabled:i,id:m,name:r,onChange:y,type:"radio"}),a=i&&"".concat(um,"__styled-radio--disabled"),s;n[14]!==a?(s=["".concat(um,"__styled-radio"),a].filter(Boolean),n[14]=a,n[15]=s):s=n[15],t=(0,u.jsx)("label",{htmlFor:m,children:(0,u.jsxs)("div",{className:b,children:[e,(0,u.jsx)("span",{className:s.join(" ")}),(0,u.jsx)("span",{className:"".concat(um,"__label"),children:(0,d.s)(o.label,p)})]})}),n[5]=p,n[6]=m,n[7]=l,n[8]=o.label,n[9]=r,n[10]=i,n[11]=b,n[12]=y,n[13]=t}else t=n[13];return t},uv="radio-group",ub=aV(e=>{let{disableModifyingForm:t,field:n,field:{admin:{className:l,description:a,layout:r="horizontal"}={},label:i,localized:s,options:c=[],required:d}={},onChange:p,path:h,readOnly:f,validate:g,value:v}=e,{uuid:b}=eP(),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:j,Label:C}={},disabled:S,path:k,setValue:_,showError:N,value:E}=aB({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof g)return g(e,{...t,options:c,required:d})},[g,c,d])}),P=E||v,D=(0,o.useMemo)(()=>aH(n),[n]);return(0,u.jsxs)("div",{className:[aq,uv,l,"".concat(uv,"--layout-").concat(r),N&&"error",(f||S)&&"".concat(uv,"--read-only")].filter(Boolean).join(" "),style:D,children:[(0,u.jsx)(ep,{CustomComponent:j,Fallback:(0,u.jsx)(no,{path:k,showError:N})}),(0,u.jsx)(ep,{CustomComponent:C,Fallback:(0,u.jsx)(lD,{label:i,localized:s,path:k,required:d})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[x,(0,u.jsx)("ul",{className:"".concat(uv,"--group"),id:"field-".concat(k.replace(/\./g,"__")),children:c.map(e=>{let n="",l=String(n=(0,m.vs)(e)?e.value:e)===String(P),a="field-".concat(k,"-").concat(n).concat(b?"-".concat(b):"");return(0,u.jsx)("li",{children:(0,u.jsx)(ug,{id:a,isSelected:l,onChange:()=>{"function"==typeof p&&p(n),f||S||_(n,!!t)},option:(0,m.vs)(e)?e:{label:e,value:e},path:k,readOnly:f||S,uuid:b})},"".concat(k," - ").concat(n))})}),y,(0,u.jsx)(ep,{CustomComponent:w,Fallback:(0,u.jsx)(na,{description:a,path:k})})]})]})}),uy="relationship-add-new",ux=e=>{var t,n;let l,a,r,i,c,p,h=(0,f.c)(46),{Button:m,hasMany:g,onChange:v,path:b,relationTo:y,unstyled:x,value:w}=e,j=cm(y),{permissions:C}=lw(),[S,k]=(0,o.useState)(!1),[_,N]=(0,o.useState)(),E=j.length>1,P;h[0]!==j[0]||h[1]!==E?(P=()=>E?void 0:j[0],h[0]=j[0],h[1]=E,h[2]=P):P=h[2];let[D,T]=(0,o.useState)(P),[R,A]=(0,o.useState)(!1),{i18n:O,t:F}=(0,s.d)(),[M,I]=(0,o.useState)(!1),B=null==D?void 0:D.slug,U;h[3]!==B?(U={collectionSlug:B},h[3]=B,h[4]=U):U=h[4];let[z,V,H]=cO(U),{isDrawerOpen:q,toggleDrawer:W}=H,K;h[5]!==D||h[6]!==g||h[7]!==v||h[8]!==w?(K=e=>{let{doc:t,operation:n}=e;("create"===n||"update"===n&&(0,L.s8)(D))&&(w&&(Array.isArray(w)?w.some(e=>e&&e.value===t.id):w.value===t.id)||v(!0===g?[...Array.isArray(w)?w:[],{relationTo:null==D?void 0:D.slug,value:t.id}]:{relationTo:null==D?void 0:D.slug,value:t.id}),N(void 0))},h[5]=D,h[6]=g,h[7]=v,h[8]=w,h[9]=K):K=h[9];let Y=K,G;h[10]===Symbol.for("react.memo_cache_sentinel")?(G=e=>{A(e)},h[10]=G):G=h[10];let Q=G,X,$;h[11]!==C||h[12]!==j?(X=()=>{var e,t;C&&(1===j.length?k(null==(e=C.collections[null==(t=j[0])?void 0:t.slug])?void 0:e.create):k(j.some(e=>{var t;return null==(t=C.collections[null==e?void 0:e.slug])?void 0:t.create})))},$=[C,j],h[11]=C,h[12]=j,h[13]=X,h[14]=$):(X=h[13],$=h[14]),(0,o.useEffect)(X,$),h[15]!==j||h[16]!==E||h[17]!==_?
1(a=()=>{E&&_&&T(j.find(e=>(null==e?void 0:e.slug)===_))},l=[_,E,j],h[15]=j,h[16]=E,h[17]=_,h[18]=l,h[19]=a):(l=h[18],a=h[19]),(0,o.useEffect)(a,l),h[20]!==D||h[21]!==E||h[22]!==W?(r=()=>{E&&D&&(W(),N(void 0))},i=[W,E,D],h[20]=D,h[21]=E,h[22]=W,h[23]=r,h[24]=i):(r=h[23],i=h[24]),(0,o.useEffect)(r,i),h[25]!==q||h[26]!==E?(c=()=>{E&&!q&&T(void 0)},p=[q,E],h[25]=q,h[26]=E,h[27]=c,h[28]=p):(c=h[27],p=h[28]),(0,o.useEffect)(c,p);let Z=null==(t=j[0])?void 0:t.labels.singular,J,ee;if(h[29]!==m||h[30]!==z||h[31]!==V||h[32]!==D||h[33]!==O||h[34]!==Y||h[35]!==b||h[36]!==C||h[37]!==R||h[38]!==j||h[39]!==S||h[40]!==M||h[41]!==F||h[42]!==Z||h[43]!==x){ee=Symbol.for("react.early_return_sentinel");e:{let e=F("fields:addNewLabel",{label:(0,d.s)(Z,O)});if(!S){ee=null;break e}J=(0,u.jsxs)("div",{className:uy,id:"".concat(b,"-add-new"),children:[1===j.length&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(V,{className:["".concat(uy,"__add-button"),x&&"".concat(uy,"__add-button--unstyled")].filter(Boolean).join(" "),onClick:()=>{I(!1)},onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),children:m||(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tN,{className:"".concat(uy,"__tooltip"),show:M,children:e}),(0,u.jsx)(ti,{})]})}),(0,u.jsx)(z,{onSave:Y})]}),j.length>1&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(t_,{button:m||(0,u.jsx)(tD,{buttonStyle:"none",className:"".concat(uy,"__add-button"),tooltip:R?void 0:F("fields:addNew"),children:(0,u.jsx)(ti,{})}),buttonType:"custom",horizontalAlign:"center",onToggleOpen:Q,render:e=>{let{close:t}=e;return(0,u.jsx)(th,{children:j.map(e=>{var n,l;return(null==(n=C.collections[null==e?void 0:e.slug])?void 0:n.create)?(0,u.jsx)(tf,{className:"".concat(uy,"__relation-button--").concat(null==e?void 0:e.slug),onClick:()=>{t(),N(null==e?void 0:e.slug)},children:(0,d.s)(null==e||null==(l=e.labels)?void 0:l.singular,O)},null==e?void 0:e.slug):null})})},size:"medium"}),D&&(null==(n=C.collections[null==D?void 0:D.slug])?void 0:n.create)&&(0,u.jsx)(z,{onSave:Y})]})]})}h[29]=m,h[30]=z,h[31]=V,h[32]=D,h[33]=O,h[34]=Y,h[35]=b,h[36]=C,h[37]=R,h[38]=j,h[39]=S,h[40]=M,h[41]=F,h[42]=Z,h[43]=x,h[44]=J,h[45]=ee}else J=h[44],ee=h[45];return ee!==Symbol.for("react.early_return_sentinel")?ee:J},uw=e=>{let{allowCreate:t=!0,collectionSlugs:n,disableQueryPresets:l,drawerSlug:a,enableRowSelections:r,filterOptions:s,onBulkSelect:c,onSelect:d,overrideEntityVisibility:p=!0,selectedCollection:h}=e,{closeModal:f,isModalOpen:m}=nE(),{serverFunction:g}=ci(),[v,b]=(0,o.useState)(void 0),[y,x]=(0,o.useState)(!0),{config:{collections:w},getEntityConfig:j}=(0,i.c)(),C=m(a),S=w.filter(e=>{let{slug:t}=e;return n.includes(t)}),[_,N]=(0,o.useState)(()=>{var e;let t=j({collectionSlug:h||(null==(e=S[0])?void 0:e.slug)});return t?{label:t.labels,value:t.slug}:void 0}),[E,P,{drawerSlug:D}]=cO({collectionSlug:_.value}),T=lv(e=>{var t;e&&e!==(null==_?void 0:_.value)&&N({label:null==(t=j({collectionSlug:e}))?void 0:t.labels,value:e})});(0,o.useEffect)(()=>{T(h)},[h]);let R=(0,o.useCallback)(async e=>{let{slug:t,query:n}=e;try{let e={...n||{},where:{...(null==n?void 0:n.where)||{}}},o=null==s?void 0:s[t];if(s&&"boolean"!=typeof o&&(e.where=(0,k.Y)(e.where,o)),t){let n=await g({name:"render-list",args:{collectionSlug:t,disableBulkDelete:!0,disableBulkEdit:!0,disableQueryPresets:l,drawerSlug:a,enableRowSelections:r,overrideEntityVisibility:p,query:e}});b((null==n?void 0:n.List)||null)}else b(null);x(!1)}catch(e){console.error("Error rendering List View: ",e),C&&f(a)}},[g,f,a,C,r,s,p,l]);(0,o.useEffect)(()=>{v||R({slug:null==_?void 0:_.value})},[R,v,_.value]);let A=(0,o.useCallback)(e=>{let{doc:t}=e;"function"==typeof d&&d({collectionSlug:null==_?void 0:_.value,doc:t,docID:t.id}),f(D),f(a)},[f,D,a,d,_.value]),L=(0,o.useCallback)(e=>{R({slug:null==_?void 0:_.value,query:e})},[R,_.value]),O=(0,o.useCallback)(e=>{N(e),R({slug:null==e?void 0:e.value})},[R]),F=(0,o.useCallback)(async e=>{var t;e&&N({label:null==(t=j({collectionSlug:e}))?void 0:t.labels,value:e}),await R({slug:_.value||e})},[j,R,_.value]);return y?(0,u.jsx)(cC,{}):(0,u.jsxs)(s9,{allowCreate:t,createNewDrawerSlug:D,DocumentDrawerToggler:P,drawerSlug:a,enabledCollections:n,onBulkSelect:c,onQueryChange:L,onSelect:d,refresh:F,selectedOption:_,setSelectedOption:O,children:[v,(0,u.jsx)(E,{onSave:A})]})},uj="list-drawer",uC=e=>{let{children:t,className:n,disabled:l,drawerSlug:a,onClick:o,...r}=e;return(0,u.jsx)(ls,{className:[n,"".concat(uj,"__toggler")].filter(
1Boolean).join(" "),disabled:l,onClick:o,slug:a,...r,children:t})},uS=e=>{let{drawerSlug:t}=e;return(0,u.jsx)(lc,{className:uj,gutter:!1,Header:null,slug:t,children:(0,u.jsx)(uw,{...e})})},uk=e=>{let t,n,l,a=(0,f.c)(42),{collectionSlugs:r,filterOptions:s,selectedCollection:c,uploads:d}=e,{config:p}=(0,i.c)(),{collections:h}=p,m=ns(),g=(0,o.useId)(),{closeModal:v,modalState:b,openModal:y,toggleModal:x}=nE(),[w,j]=(0,o.useState)(!1),[C,S]=(0,o.useState)(r),k;a[0]!==m||a[1]!==g?(k=(e=>{let{depth:t,uuid:n}=e;return"list-drawer_".concat(t,"_").concat(n)})({depth:m,uuid:g}),a[0]=m,a[1]=g,a[2]=k):k=a[2];let _=k,N,E;a[3]!==_||a[4]!==b?(N=()=>{var e;j(!!(null==(e=b[_])?void 0:e.isOpen))},E=[b,_],a[3]=_,a[4]=b,a[5]=N,a[6]=E):(N=a[5],E=a[6]),(0,o.useEffect)(N,E),a[7]!==C||a[8]!==h||a[9]!==d?(t=()=>{C&&0!==C.length||S(h.filter(e=>{let{upload:t}=e;return!d||!!t}).map(u_))},n=[C,d,h],a[7]=C,a[8]=h,a[9]=d,a[10]=t,a[11]=n):(t=a[10],n=a[11]),(0,o.useEffect)(t,n),a[12]!==_||a[13]!==x?(l=()=>{x(_)},a[12]=_,a[13]=x,a[14]=l):l=a[14];let P=l,D;a[15]!==v||a[16]!==_?(D=()=>{v(_)},a[15]=v,a[16]=_,a[17]=D):D=a[17];let T=D,R;a[18]!==_||a[19]!==y?(R=()=>{y(_)},a[18]=_,a[19]=y,a[20]=R):R=a[20];let A=R,L;a[21]!==T||a[22]!==C||a[23]!==_||a[24]!==s||a[25]!==c||a[26]!==d?(L=e=>(0,o.createElement)(uS,{...e,closeDrawer:T,collectionSlugs:C,drawerSlug:_,filterOptions:s,key:_,selectedCollection:c,uploads:d}),a[21]=T,a[22]=C,a[23]=_,a[24]=s,a[25]=c,a[26]=d,a[27]=L):L=a[27];let O=L,F;a[28]!==_?(F=e=>(0,u.jsx)(uC,{...e,drawerSlug:_}),a[28]=_,a[29]=F):F=a[29];let M=F,I;a[30]!==T||a[31]!==C||a[32]!==m||a[33]!==_||a[34]!==w||a[35]!==A||a[36]!==P?(I={closeDrawer:T,collectionSlugs:C,drawerDepth:m,drawerSlug:_,isDrawerOpen:w,openDrawer:A,setCollectionSlugs:S,toggleDrawer:P},a[30]=T,a[31]=C,a[32]=m,a[33]=_,a[34]=w,a[35]=A,a[36]=P,a[37]=I):I=a[37];let B=I,U;return a[38]!==O||a[39]!==B||a[40]!==M?(U=[O,M,B],a[38]=O,a[39]=B,a[40]=M,a[41]=U):U=a[41],U};function u_(e){let{slug:t}=e;return t}var uN=(e,t)=>{let n=(0,f.c)(3),l=(0,o.useRef)(void 0),a;return n[0]!==e||n[1]!==t?(a=function(){for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(l.current),l.current=setTimeout(()=>{clearTimeout(l.current),e(...a)},t)},n[0]=e,n[1]=t,n[2]=a):a=n[2],a};function uE(){let e=(0,o.useRef)([]),t=(0,o.useRef)(!1);return{queueTask:(0,o.useCallback)((n,l)=>{e.current.push(n),async function(){if(!t.current&&("function"!=typeof(null==l?void 0:l.beforeProcess)||!1!==l.beforeProcess()))for(;e.current.length>0;){let n=e.current.pop();e.current=[],t.current=!0;try{await n()}catch(e){console.error("Error in queued function:",e)}finally{t.current=!1,"function"==typeof(null==l?void 0:l.afterProcess)&&l.afterProcess()}}}()},[])}}
1var uP=(0,o.createContext)({mostRecentUpdate:null,reportUpdate:()=>null}),uD=e=>{let t=(0,f.c)(3),{children:n}=e,[l,a]=(0,o.useState)(null),r;return t[0]!==n||t[1]!==l?(r=(0,u.jsx)(uP,{value:{mostRecentUpdate:l,reportUpdate:a},children:n}),t[0]=n,t[1]=l,t[2]=r):r=t[2],r},uT=()=>(0,o.use)(uP),uR=e=>{for(let t in e){let n=e[t];if(("and"===t.toLowerCase()||"or"===t.toLowerCase())&&Array.isArray(n))for(let e of n)uR(e);else n&&"object"==typeof n&&"in"in n&&Array.isArray(n.in)&&0===n.in.length&&(e[t]={exists:!1})}return e},uA=e=>{let{hasMany:t,relationTo:n,value:l}=e,a=n.reduce((e,t)=>({...e,[t]:[]}),{});if(null===l)return a;if(l){let e=(e,t)=>{("string"==typeof t||"number"==typeof t)&&"string"==typeof e&&(a[e]?a[e].push(t):a[e]=[t])};!0===t?l.forEach(t=>{t&&e(t.relationTo,t.value)}):e(l.relationTo,l.value)}return a},uL=e=>e.reduce((e,t)=>t.options?[...e,...uL(t.options)]:[...e,{id:t.value,relationTo:t.relationTo}],[]),uO=e=>e.sort((e,t)=>{var n,l;return"function"==typeof(null==e||null==(n=e.label)?void 0:n.localeCompare)&&"function"==typeof(null==t||null==(l=t.label)?void 0:l.localeCompare)?e.label.localeCompare(t.label):0}),uF=(e,t)=>{switch(t.type){case"ADD":{let{collection:n,config:l,docs:a,i18n:o,ids:r=[],sort:i}=t,s=n.slug,c=uL(e),u=[...e],p=u.find(e=>e.label===n.labels.plural),h=a.reduce((e,t)=>0===c.filter(e=>e.id===t.id&&e.relationTo===s).length?(c.push({id:t.id,relationTo:s}),[...e,{label:av({collectionConfig:n,data:t,dateFormat:l.admin.dateFormat,fallback:"".concat(o.t("general:untitled")," - ID: ").concat(t.id),i18n:o}),relationTo:s,value:t.id}]):e,[]);if(r.forEach(e=>{0===c.filter(t=>t.id===e&&t.relationTo===s).length&&(c.push({id:e,relationTo:s}),h.push({allowEdit:!1,label:"".concat(o.t("general:untitled")," - ID: ").concat(e),relationTo:s,value:e}))}),p){let e=[...p.options,...h];p.options=i?uO(e):e}else u.push({label:(0,d.s)(n.labels.plural,o),options:i?uO(h):h});return u}case"CLEAR":{let n=t.exemptValues?Array.isArray(t.exemptValues)?t.exemptValues:[t.exemptValues]:[];return e.filter(e=>{let t=e.options.filter(e=>!!n&&n.some(t=>t&&e.value===t.value));return e.options=t,t.length>0})}case"REMOVE":{let{id:n,collection:l}=t,a=[...e],o=a.findIndex(e=>e.label===l.labels.plural);return -1===o||(a[o]={...a[o],options:a[o].options.filter(e=>e.value!==n)}),a}case"UPDATE":{var n,l;let{collection:a,config:o,doc:r,i18n:i}=t,s=a.slug,c=[...e],u=av({collectionConfig:a,data:r,dateFormat:o.admin.dateFormat,fallback:"".concat(i.t("general:untitled")," - ID: ").concat(r.id),i18n:i}),d=null==(l=c.find(e=>e.label===a.labels.plural))||null==(n=l.options)?void 0:n.find(e=>e.value===r.id);return d&&(d.label=u,d.relationTo=s),c}default:return e}},uM="relationship--multi-value-label",uI=e=>{var t,n;let{data:l,selectProps:a}=e,{allowEdit:r,label:i,relationTo:c,value:d}=l,{customProps:p}=void 0===a?{}:a,{draggableProps:h,onDocumentOpen:f}=void 0===p?{}:p,{permissions:m}=lw(),[g,v]=(0,o.useState)(!1),{t:b}=(0,s.d)(),y=!!(null==m||null==(n=m.collections)||null==(t=n[c])?void 0:t.read);return(0,u.jsxs)("div",{className:uM,title:i||"",children:[(0,u.jsx)("div",{className:"".concat(uM,"__content"),children:(0,u.jsx)(iD.MultiValueLabel,{...e,innerProps:{className:"".concat(uM,"__text"),...h||{}}})}),c&&y&&!1!==r&&(0,u.jsx)(o.Fragment,{children:(0,u.jsxs)("button",{"aria-label":"Edit ".concat(i),className:"".concat(uM,"__drawer-toggler"),onClick:e=>{v(!1),f({id:d,collectionSlug:c,hasReadPermission:y,openInNewTab:e.metaKey||e.ctrlKey})},onKeyDown:uB,onMouseDown:uU,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),onTouchEnd:uz,type:"button",children:[(0,u.jsx)(tN,{className:"".concat(uM,"__tooltip"),show:g,children:b("general:editLabel",{label:""})}),(0,u.jsx)(to,{className:"".concat(uM,"__icon")})]})})]})};function uB(e){"Enter"===e.key&&e.stopPropagation()}function uU(e){return e.stopPropagation()}function uz(e){return e.stopPropagation()}var uV="relationship--single-value",uH=e=>{var t,n;let l=(0,f.c)(16),{children:a,data:r,selectProps:i}=e,{allowEdit:c,label:d,relationTo:p,value:h}=r,m;l[0]!==i?(m=void 0===i?{}:i,l[0]=i,l[1]=m):m=l[1];let{customProps:g}=m,v;l[2]!==g?(v=void 0===g?{}:g,l[2]=g,l[3]=v):v=l[3];let{onDocumentOpen:b}=v,[y,x]=(0,o.useState)(!1),{t:w}=(0,s.d)(),{permissions:j}=lw(),C=!!(null==j||null==(n=j.collections)||null==(t=n[p])?void 0:t.read),S=d||"",k;return l[4]!==c||l[5]!==a||l[6]!==C||l[7]!==d||l[8]!==b||l[9]!==e||l[10]!==p||l[11]!==y||l[12]!==w||l[13]!==S||l[14]!==h?(k=(0,u.jsx)(iD.SingleValue,{...e,className:uV,children:(0,u.jsx)("div",{className:"".concat(uV,"__label"),title:S,children:(0,u.jsxs)("div",{className:"".concat(uV,"__label-text"),children:[(0,u.jsx)("div",{className:"".concat(uV,"__text"),children:a}),p&&C&&!1!==c&&(0,u.jsx)(o.Fragment,{children:(0,u.jsxs)("button",{"aria-label":w("general:editLabel",{label:d}
1),className:"".concat(uV,"__drawer-toggler"),onClick:e=>{x(!1),b({id:h,collectionSlug:p,hasReadPermission:C,openInNewTab:e.metaKey||e.ctrlKey})},onKeyDown:uq,onMouseDown:uW,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),onTouchEnd:uK,type:"button",children:[(0,u.jsx)(tN,{className:"".concat(uV,"__tooltip"),show:y,children:w("general:edit")}),(0,u.jsx)(to,{})]})})]})})}),l[4]=c,l[5]=a,l[6]=C,l[7]=d,l[8]=b,l[9]=e,l[10]=p,l[11]=y,l[12]=w,l[13]=S,l[14]=h,l[15]=k):k=l[15],k};function uq(e){"Enter"===e.key&&e.stopPropagation()}function uW(e){return e.stopPropagation()}function uK(e){return e.stopPropagation()}var uY="relationship",uG=e=>{let{AfterInput:t,allowCreate:n=!0,allowEdit:l=!0,appearance:a="select",BeforeInput:r,className:c,description:d,Description:p,Error:h,filterOptions:f,formatDisplayedOptions:m,hasMany:g,initialValue:b,isSortable:x=!0,label:j,Label:C,localized:S,maxResultsPerRequest:k=10,onChange:_,path:N,placeholder:E,readOnly:P,relationTo:D,required:T,showError:R,sortOptions:L,style:O,value:F}=e,{config:M,getEntityConfig:I}=(0,i.c)(),{routes:{api:B},serverURL:U}=M,{i18n:z,t:V}=(0,s.d)(),{permissions:H}=lw(),{code:q}=lN(),[W,K]=(0,o.useState)({id:void 0,collectionSlug:void 0,hasReadPermission:!1}),[Y,G]=(0,o.useState)(-1),[Q,X]=(0,o.useState)({}),[$,Z]=(0,o.useState)(""),[J,ee]=(0,o.useState)(""),[et,en]=(0,o.useState)(!1),[el,ea]=(0,o.useState)(!1),[eo,er]=(0,o.useState)(!1),ei=(0,o.useRef)(!1),{queueTask:es}=uE(),[ec,eu]=(0,o.useReducer)(uF,[]),ed=(0,o.useRef)(F),[eh,,{drawerSlug:ef,isDrawerOpen:em,openDrawer:eg}]=cO({id:W.id,collectionSlug:W.collectionSlug}),ev=(0,o.useMemo)(()=>{let e=f;if(F){let t=(!1===g?[F]:F).reduce((e,t)=>(e[t.relationTo]||(e[t.relationTo]=[]),e[t.relationTo].push(t.value),e),{});(Array.isArray(D)?D:[D]).forEach(n=>{e={...e||{},[n]:{..."object"==typeof(null==f?void 0:f[n])?f[n]:{},...t[n]?{id:{not_in:t[n]}}:{}}}})}return e},[f,F,g,D]),[eb,,{closeDrawer:ey,isDrawerOpen:ex,openDrawer:ew}]=uk({collectionSlugs:D,filterOptions:ev}),ej=(0,o.useCallback)(e=>{let{collectionSlug:t,doc:n}=e;g?_([...Array.isArray(F)?F:[],{relationTo:t,value:n.id}]):!1===g&&_({relationTo:t,value:n.id}),ey()},[g,_,ey,F]),eC=(0,o.useRef)(!1),eS=(0,o.useCallback)(e=>{let{filterOptions:t,hasMany:n,lastFullyLoadedRelation:l,lastLoadedPage:a,onSuccess:o,search:r,sort:i,value:s}=e;H&&es(async()=>{let e="u">typeof l?l:-1,c=Array.isArray(D)?D:[D],u=-1===e?c:c.slice(e+1),d=0,p=uA(!0===n?{hasMany:!0,relationTo:D,value:s}:{hasMany:!1,relationTo:D,value:s});$||(await u.reduce(async(e,n)=>{let l=null==t?void 0:t[n],o;if(o=J!==r?1:(a[n]||0)+1,await e,!1===l)return G(c.indexOf(n)),Promise.resolve();if(d<10){var s;let e=I({collectionSlug:n}),t=(null==e||null==(s=e.admin)?void 0:s.useAsTitle)||"id",a=(null==e?void 0:e.defaultSort)||"id";"string"==typeof L?a=L:(null==L?void 0:L[n])&&(a=L[n]);let u={depth:0,draft:!0,limit:k,locale:q,page:o,select:{[t]:!0},sort:a,where:{and:[{id:{not_in:p[n]}}]}};r&&u.where.and.push({[t]:{like:r}}),l&&"boolean"!=typeof l&&u.where.and.push(l),uR(u.where);let h=await fetch("".concat(U).concat(B,"/").concat(n),{body:y.A(u),credentials:"include",headers:{"Accept-Language":z.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"});if(h.ok){let t=await h.json();X(e=>({...e,[n]:o})),t.nextPage||G(c.indexOf(n)),t.docs.length>0&&(d+=t.docs.length,eu({type:"ADD",collection:e,config:M,docs:t.docs,i18n:z,sort:i}))}else 403===h.status?(G(c.indexOf(n)),eu({type:"ADD",collection:e,config:M,docs:[],i18n:z,ids:p[n],sort:i})):Z(V("error:unspecific"))}},Promise.resolve()),"function"==typeof o&&o())})},[H,es,D,$,J,I,L,k,q,U,B,z,M,V]),ek=uN(e=>{let{hasMany:t,search:n,value:l}=e;eL({filterOptions:f,lastLoadedPage:{},onSuccess:()=>{en(!1)},search:n,sort:!0,hasMany:t,value:l}),ee(n)},300),e_=(0,o.useCallback)(e=>{J!==e.search&&(en(!0),X({}),ek(e))},[J,ek]),eN=lv(e=>{let{hasMany:t,value:n}=e;Object.entries(uA({hasMany:t,relationTo:D,value:n})).reduce(async(e,t)=>{let[n,l]=t;await e;let a=l.filter(e=>!ec.find(t=>{var l;return null==t||null==(l=t.options)?void 0:l.find(t=>t.value===e&&t.relationTo===n)}));if(a.length>0){var o;let e=I({collectionSlug:n}),t=(null==e||null==(o=e.admin)?void 0:o.useAsTitle)||"id",l={depth:0,draft:!0,limit:a.length,locale:q,select:{[t]:!0},where:{id:{in:a}}};if(!$){let t=await fetch("".concat(U).concat(B,"/").concat(n),{body:y.A(l),credentials:"include",headers:{"Accept-Language":z.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),o=[];t.ok&&(o=(await t.json()).docs),eu({type:"ADD",collection:e,config:M,docs:o,i18n:z,ids:a,sort:!0})}}},Promise.resolve())}),{mostRecentUpdate:eE}=uT(),eP=lv(e=>{if(!F)return!1;let t=e.doc.id,n=!1;"update"===e.operation?!0===g?n=(Array.isArray(F)?F:[F]).some(n=>n.value===t&&n.relationTo===e.entitySlug):!1===g&&(n=(null==F?void 0:F.value)===t&&(null==F?void 0:F.relationTo)===e.entitySlug):"create"===e.operation&&(n=e.drawerSlug===ef),n&&((eu({type:"UPDATE",collection:I({collectionSlug:e.entitySlug}),config:M,doc:e.doc,i18n:z}),g)?_((F?Array.isArray(F)?F:[F]:[]).map(n=>({relationTo:n.value===t?e.entitySlug:n.relationTo,value:n.value}))):!1===g&&_({relationTo:e.entitySlug,value:t}))});(0,o.useEffect)(()=>{eE&&eP(eE)},[eE]);let eD=(0,o.useCallback)(e=>{eu({type:"ADD",collection:e.collectionConfig,config:M,docs:[e.doc],i18n:z,sort:!0}),g?_(F?F.concat({relationTo:e.collectionConfig.slug,value:e.doc.id}):null):!1===g&&_({relationTo:e.collectionConfig.slug,value:e.doc.id})},[z,M,g,_,F]),eT=(0,o.useCallback)(e=>{eu({id:e.id,type:"REMOVE",collection:e.collectionConfig,config:M,i18n:z}),_(g&&F?F.filter(t=>t.value!==e.id):null)},[z,M,g,_,F]),eR=(0,o.useCallback)((e,t)=>{if(!t)return!0;let n=(0,A.m)(t||""),l=String(e.label);for(;l.length>250;){let e=l.indexOf(" ",t.length);if(n.test(l.slice(0,-1===e?t.length:e+1)))return!0;l=l.slice(-1===e?t.length:e+1)}return n.test(l.slice(-250))},[]),eA=(0,o.useCallback)(e=>{let{id:t,collectionSlug:n,hasReadPermission:l,openInNewTab:a}=e;if(a){if(l&&t&&n){let e=(0,v.Q)({adminRoute:M.routes.admin,path:"/collections/".concat(n,"/").concat(t),serverURL:U});window.open(e,"_blank")}}else eC.current=!0,K({id:t,collectionSlug:n,hasReadPermission:l})},[M.routes.admin,U]),eL=lv(e=>eS(e));(0,o.useEffect)(()=>{ei.current&&eo&&(en(!0),eL({filterOptions:f,lastLoadedPage:{},onSuccess:()=>{ei.current=!0,en(!1)},...{hasMany:g,value:ed.current}})),eu({type:"CLEAR",exemptValues:ed.current}),G(-1),X({})},[D,f,q,N,eo,g]);let eO=(0,o.useRef)(F),eF=(0,o.useRef)(!0);(0,o.useEffect)(()=>{(eF.current||!(0,w.j)(F,eO.current))&&eN({hasMany:g,value:F}),eF.current=!1,eO.current=F},[F,g]),(0,o.useEffect)(()=>{ea(!(Array.isArray(D)?D:[D]).reduce((e,t)=>
1{var n,l;return"id"===((null==(l=I({collectionSlug:t}))||null==(n=l.admin)?void 0:n.useAsTitle)||"id")&&e},!0))},[D,I]),(0,o.useEffect)(()=>{eC.current&&(eg(),eC.current=!1)},[eg,W]),(0,o.useEffect)(()=>{ed.current=F},[F]);let eM=(e=>{let{allowEdit:t,options:n,value:l}=e;if(l||"number"==typeof l){let e;return Array.isArray(l)?l.map(e=>{let l;return n.forEach(t=>{l||(l=t.options.find(t=>t.value===e.value&&t.relationTo===e.relationTo))}),l?{allowEdit:t,...l}:void 0}):(n.forEach(t=>{e||(e=t.options.find(e=>e.value===l.value&&e.relationTo===l.relationTo))}),e?{allowEdit:t,...e}:void 0)}})({allowEdit:l,options:ec,value:F});return Array.isArray(eM)||(null==eM?void 0:eM.value)!=="null"||(eM.value=null),(0,u.jsxs)("div",{className:[aq,uY,c,R&&"error",$&&"error-loading",P&&"".concat(uY,"--read-only"),!P&&n&&"".concat(uY,"--allow-create")].filter(Boolean).join(" "),id:"field-".concat(N.replace(/\./g,"__")),style:O,children:[(0,u.jsx)(ep,{CustomComponent:C,Fallback:(0,u.jsx)(lD,{label:j,localized:S,path:N,required:T})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:h,Fallback:(0,u.jsx)(no,{path:N,showError:R})}),r,$?(0,u.jsx)("div",{className:"".concat(uY,"__error-loading"),children:$}):(0,u.jsxs)("div",{className:"".concat(uY,"__wrap"),children:[(0,u.jsx)(sW,{backspaceRemovesValue:!(em||ex),components:{MultiValueLabel:uI,SingleValue:uH,..."select"!==a&&{DropdownIndicator:null}},customProps:{disableKeyDown:em||ex,disableMouseDown:em||ex,onDocumentOpen:eA},disabled:P||em||ex,filterOption:el?eR:void 0,getOptionValue:e=>{if(e)return g&&Array.isArray(D)?"".concat(e.relationTo,"_").concat(e.value):e.value},isLoading:"select"===a&&et,isMulti:g,isSearchable:"select"===a,isSortable:x,menuIsOpen:"select"===a&&eo,onChange:P?void 0:e=>{g?null===e?(ed.current=[],_([])):(ed.current=e,_(e)):!1===g&&(null===e?(ed.current=null,_(null)):(ed.current=e,_(e)))},onInputChange:e=>e_({search:e,hasMany:g,value:F}),onMenuClose:()=>{er(!1)},onMenuOpen:()=>{"drawer"===a?ew():"select"===a&&(er(!0),ei.current||(en(!0),eL({filterOptions:f,lastLoadedPage:{},onSuccess:()=>{ei.current=!0,en(!1)},hasMany:g,value:F})))},onMenuScrollToBottom:()=>{en(!0),eL({filterOptions:f,lastFullyLoadedRelation:Y,lastLoadedPage:Q,onSuccess:()=>{en(!1)},search:J,sort:!1,hasMany:g,value:b})},options:"function"==typeof m?m(ec):ec,placeholder:E,showError:R,value:null!=eM?eM:null}),!P&&n&&(0,u.jsx)(ux,{path:N,relationTo:D,hasMany:g,onChange:_,value:F})]}),t,(0,u.jsx)(ep,{CustomComponent:p,Fallback:(0,u.jsx)(na,{description:d,path:N})})]}),W.collectionSlug&&W.hasReadPermission&&(0,u.jsx)(eh,{onDelete:eT,onDuplicate:eD}),"drawer"===a&&!P&&(0,u.jsx)(eb,{allowCreate:n,enableRowSelections:!1,onSelect:ej})]})},uQ=aV(e=>{let{field:t,field:{admin:{allowCreate:n=!0,allowEdit:l=!0,appearance:a="select",className:r,description:i,isSortable:s=!0,placeholder:c,sortOptions:d}={},hasMany:p,label:h,localized:f,relationTo:m,required:g},path:v,readOnly:b,validate:y}=e,{customComponents:{AfterInput:x,BeforeInput:w,Description:j,Error:C,Label:S}={},disabled:k,filterOptions:_,initialValue:N,path:E,setValue:P,showError:D,value:T}=aB({potentiallyStalePath:v,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof y)return y(e,{...t,required:g})},[y,g])}),R=(0,o.useMemo)(()=>aH(t),[t]),A=Array.isArray(m),[L]=o.useState(()=>Array.isArray(m)?m:[m]),O=(0,o.useCallback)(e=>{if(!e)return void P(null,e===T);let t=!1;t=A?Array.isArray(T)&&Array.isArray(e)&&T.length===e.length&&T.every((t,n)=>{let l=e[n];return t.value===l.value&&t.relationTo===l.relationTo}):Array.isArray(T)&&Array.isArray(e)&&T.length===e.length&&T.every((t,n)=>t===e[n].value),P(e.map(e=>A?e:e.value),t)},[A,P,T]),F=(0,o.useCallback)(e=>{if(!e)return void P(null,e===T);let t=!1;t=A?T&&e&&T.value===e.value&&T.relationTo===e.relationTo:T&&e&&T===e.value,P(A?e:e.value,t)},[A,P,T]),M=o.useMemo(()=>!0===p?Array.isArray(T)?T.map(e=>A?e:{relationTo:Array.isArray(L)?L[0]:L,value:e}):T:T&&(A?T:{relationTo:Array.isArray(L)?L[0]:L,value:T}),[p,T,A,L]),I=o.useMemo(()=>!0===p?Array.isArray(N)?N.map(e=>A?e:{relationTo:Array.isArray(L)?L[0]:L,value:e}):N:N&&(A?N:{relationTo:Array.isArray(L)?L[0]:L,value:N}),[N,A,L,p]);return(0,u.jsx)(uG,{AfterInput:x,allowCreate:n,allowEdit:l,appearance:a,BeforeInput:w,className:r,Description:j,description:i,Error:C,filterOptions:_,formatDisplayedOptions:A?void 0:e=>e.map(e=>e.options).flat(),isSortable:s,Label:S,label:h,localized:f,maxResultsPerRequest:10,maxRows:null==t?void 0:t.maxRows,minRows:null==t?void 0:t.minRows,path:E,placeholder:c,readOnly:b||k,relationTo:L,required:g,showError:D,sortOptions:d,style:R,...!0===
1p?{hasMany:!0,initialValue:I,onChange:O,value:M}:{hasMany:!1,initialValue:I,onChange:F,value:M}})}),uX=()=>null,u$=aV(e=>{let{field:{admin:{className:t,style:n}={},fields:l},forceRender:a=!1,indexPath:o="",parentPath:r="",parentSchemaPath:i="",permissions:s,readOnly:c}=e;return(0,u.jsx)(sZ,{children:(0,u.jsx)("div",{className:[aq,"row",t].filter(Boolean).join(" "),style:n||void 0,children:(0,u.jsx)(hL,{className:"".concat("row","__fields"),fields:l,forceRender:a,margins:!1,parentIndexPath:o,parentPath:r,parentSchemaPath:i,permissions:s,readOnly:c})})})}),uZ=e=>{let t=(0,f.c)(37),{id:n,AfterInput:l,BeforeInput:a,className:o,Description:r,description:i,Error:c,filterOption:p,hasMany:h,isClearable:m,isSortable:g,label:v,Label:b,localized:y,onChange:x,onInputChange:w,options:j,path:C,placeholder:S,readOnly:k,required:_,showError:N,style:E,value:P}=e,D=void 0!==h&&h,T=void 0===m||m,R=void 0===g||g,{i18n:A}=(0,s.d)(),L;if(t[0]!==l||t[1]!==a||t[2]!==r||t[3]!==c||t[4]!==b||t[5]!==o||t[6]!==i||t[7]!==p||t[8]!==D||t[9]!==A||t[10]!==n||t[11]!==T||t[12]!==R||t[13]!==v||t[14]!==y||t[15]!==x||t[16]!==w||t[17]!==j||t[18]!==C||t[19]!==S||t[20]!==k||t[21]!==_||t[22]!==N||t[23]!==E||t[24]!==P){let e,s;if(D&&Array.isArray(P)){let n;t[26]!==A||t[27]!==j?(n=e=>{var t;let n=j.find(t=>t.value===e);return{label:n?(0,d.s)(n.label,A):e,value:null!=(t=null==n?void 0:n.value)?t:e}},t[26]=A,t[27]=j,t[28]=n):n=t[28],e=P.map(n)}else if(P){var O;let n;t[29]!==P?(n=e=>e.value===P,t[29]=P,t[30]=n):n=t[30];let l=j.find(n);e={label:l?(0,d.s)(l.label,A):P,value:null!=(O=null==l?void 0:l.value)?O:P}}else e=null;let h=N&&"error",f=k&&"read-only",m;t[31]!==o||t[32]!==h||t[33]!==f?(m=[aq,"select",o,h,f].filter(Boolean),t[31]=o,t[32]=h,t[33]=f,t[34]=m):m=t[34],t[35]!==A?(s=e=>({...e,label:(0,d.s)(e.label,A)}),t[35]=A,t[36]=s):s=t[36],L=(0,u.jsxs)("div",{className:m.join(" "),id:"field-".concat(C.replace(/\./g,"__")),style:E,children:[(0,u.jsx)(ep,{CustomComponent:b,Fallback:(0,u.jsx)(lD,{label:v,localized:y,path:C,required:_})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:c,Fallback:(0,u.jsx)(no,{path:C,showError:N})}),a,(0,u.jsx)(sW,{disabled:k,filterOption:p,id:n,isClearable:T,isMulti:D,isSortable:R,onChange:x,onInputChange:w,options:j.map(s),placeholder:S,showError:N,value:e}),l]}),(0,u.jsx)(ep,{CustomComponent:r,Fallback:(0,u.jsx)(na,{description:i,path:C})})]}),t[0]=l,t[1]=a,t[2]=r,t[3]=c,t[4]=b,t[5]=o,t[6]=i,t[7]=p,t[8]=D,t[9]=A,t[10]=n,t[11]=T,t[12]=R,t[13]=v,t[14]=y,t[15]=x,t[16]=w,t[17]=j,t[18]=C,t[19]=S,t[20]=k,t[21]=_,t[22]=N,t[23]=E,t[24]=P,t[25]=L}else L=t[25];return L},uJ=e=>e.map(e=>"object"==typeof e&&(e.value||""===e.value)?e:{label:e,value:e}),u0=aV(e=>{let{field:t,field:{name:n,admin:{className:l,description:a,isClearable:r=!0,isSortable:i=!0,placeholder:s}={},hasMany:c=!1,label:d,localized:p,options:h=[],required:f},onChange:m,path:g,readOnly:v,validate:b}=e,y=o.useMemo(()=>uJ(h),[h]),{customComponents:{AfterInput:x,BeforeInput:w,Description:j,Error:C,Label:S}={},disabled:k,path:_,selectFilterOptions:N,setValue:E,showError:P,value:D}=aB({potentiallyStalePath:g,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof b)return b(e,{...t,hasMany:c,options:y,required:f})},[b,f,c,y])}),T=(0,o.useCallback)(e=>{if(!v||k){let t=null;e&&c?t=Array.isArray(e)?e.map(e=>e.value):[]:e&&!Array.isArray(e)&&(t=e.value),"function"==typeof m&&m(t),E(t)}},[v,k,c,E,m]),R=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsx)(uZ,{AfterInput:x,BeforeInput:w,className:l,Description:j,description:a,Error:C,filterOption:N?(e,t)=>{let{label:n,value:l}=e;return(null==N?void 0:N.some(e=>("string"==typeof e?e:e.value)===l))&&n.toLowerCase().includes(t.toLowerCase())}:void 0,hasMany:c,isClearable:r,isSortable:i,Label:S,label:d,localized:p,name:n,onChange:T,options:y,path:_,placeholder:s,readOnly:v||k,required:f,showError:P,style:R,value:D})}),u1=(0,c.e)(ei(),1);function u3(e){let t=(0,f.c)(5),{errorMessage:n}=e,l;t[0]!==n?(l=()=>(function(e){let[t,n]=e.split(":");if(!n)return{message:t};let l=n.split(",").map(e=>e.replaceAll(" > "," â ").trim());return 1===l.length?{errors:l,message:"".concat(t,": ")}:{errors:function(e){let t=[];for(let n of e)if(n){let e=n.split(" â "),l=!1;for(let a=0;a<t.length;a++)if(t[a].startsWith(e[0])){t.splice(a+1,0,n),l=!0;break}l||t.push(n)}return t}(l),message:"".concat(t," (").concat(l.length,"):")}})(n),t[0]=n,t[1]=l):l=t[1];
1let[a]=o.useState(l),{errors:r,message:i}=a,s;return t[2]!==r||t[3]!==i?(s=(0,u.jsxs)("div",{children:[i,Array.isArray(r)&&r.length>0?1===r.length?(0,u.jsx)("span",{"data-testid":"field-error",children:r[0]}):(0,u.jsx)("ul",{"data-testid":"field-errors",children:r.map(u2)}):null]}),t[2]=r,t[3]=i,t[4]=s):s=t[4],s}function u2(e,t){return(0,u.jsx)("li",{children:e},t)}function u6(e,t,n){let l,a,r,i=(0,f.c)(11),s;i[0]!==e?(s=()=>e,i[0]=e,i[1]=s):s=i[1];let[c,u]=(0,o.useState)(s),d;i[2]!==n||i[3]!==e?(d=()=>{let t=setTimeout(()=>{u(()=>e)},n);return()=>{clearTimeout(t)}},i[2]=n,i[3]=e,i[4]=d):d=i[4],i[5]!==n||i[6]!==t?(l=[...t,n],i[5]=n,i[6]=t,i[7]=l):l=i[7],(0,o.useEffect)(d,l),i[8]!==c?(a=()=>{c()},r=[c],i[8]=c,i[9]=a,i[10]=r):(a=i[9],r=i[10]),(0,o.useEffect)(a,r)}var u5=o.createContext(null),u4=e=>{let t=(0,f.c)(6),{children:n}=e,[l,a]=(0,o.useState)(u9),r;t[0]!==l?(r=e=>{let{collectionSlug:t}=e;return l.get(t)},t[0]=l,t[1]=r):r=t[1];let i=r,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{let{collectionSlug:t,handler:n}=e;a(e=>{let l=new Map(e);return l.set(t,n),l})},t[2]=s):s=t[2];let c=s,d;return t[3]!==n||t[4]!==i?(d=(0,u.jsx)(u5,{value:{getUploadHandler:i,setUploadHandler:c},children:n}),t[3]=n,t[4]=i,t[5]=d):d=t[5],d},u8=()=>{let e=o.use(u5);if(null===e)throw Error("useUploadHandlers must be used within UploadHandlersProvider");return e};function u9(){return new Map}var u7={413:"Your request was too large to submit successfully."},de=(0,c.e)(er(),1),dt=(e,t)=>{let n={},l=Object.entries(t).reduce((t,l)=>{let[a,o]=l;if(0===a.indexOf("".concat(e,"."))){let[n]=a.replace("".concat(e,"."),"").split(".");t[n]||(t[n]={}),t[n][a.replace("".concat(e,".").concat(String(n),"."),"")]={...o}}else n[a]=o;return t},[]);return{remainingFields:n,rows:l}},dn=(e,t)=>t.reduce((t,n,l)=>({...t,...Object.entries(n).reduce((t,n)=>{let[a,o]=n;return{...t,["".concat(e,".").concat(l,".").concat(a)]:{...o}}},{})}),{}),dl="default"in de.default?de.default.default:de.default;function da(e,t){var n,l,a,o,r,i,s,c,u,d;switch(t.type){case"ADD_ROW":{let{blockType:r,path:i,rowIndex:s,subFieldState:c={}}=t,u="number"==typeof s?s:(null==(l=e[i])||null==(n=l.rows)?void 0:n.length)||0,d=[...(null==(a=e[i])?void 0:a.rows)||[]],p={id:(null==c||null==(o=c.id)?void 0:o.value)||new dl().toHexString(),isLoading:!0};r&&(p.blockType=r),d.splice(u,0,p),r&&(c.blockType={initialValue:r,valid:!0,value:r});let{remainingFields:h,rows:f}=dt(i,e);return f.splice(u,0,c),{...h,...dn(i,f),["".concat(i,".").concat(u,".id")]:{initialValue:p.id,passesCondition:!0,valid:!0,value:p.id},[i]:{...e[i],disableFormData:!0,rows:d,value:f.length}}}case"ADD_SERVER_ERRORS":{let n={...e},l=[];return t.errors.forEach(e=>{let{message:t,path:a}=e;n[a]={...n[a]||{initialValue:null,value:null},errorMessage:t,valid:!1};let o=a.split(".");o.length>1&&l.push({fieldErrorPath:a,parentPath:o.slice(0,o.length-1).join(".")})}),n=Object.entries(n).reduce((e,t)=>{let[n,a]=t,o=l.reduce((e,t)=>{let{fieldErrorPath:l,parentPath:a}=t;return a.startsWith(n)&&e.push(l),e},[]),r=!1;if(o.length>0){let t=Array.isArray(a.errorPaths)?a.errorPaths:[];o.forEach(e=>{t.includes(e)||(t.push(e),r=!0)}),r&&(e[n]={...a,errorPaths:t})}return r||(e[n]=a),e},{})}case"DUPLICATE_ROW":{let{path:n,rowIndex:l}=t,{remainingFields:a,rows:o}=dt(n,e),c=[...e[n].rows||[]],u=(0,I.KS)(c[l]),d=new dl().toHexString();u.id&&(u.id=d),(null==(i=c[l])||null==(r=i.customComponents)?void 0:r.RowLabel)&&(u.customComponents={RowLabel:c[l].customComponents.RowLabel});let p=(0,I.KS)(o[l]);for(let e of(p.id&&(p.id.value=d,p.id.initialValue=d),Object.keys(p).filter(e=>e.endsWith(".id")))){let t=p[e],n=new dl().toHexString();if(t&&"string"==typeof t.value&&dl.isValid(t.value)){p[e].value=n,p[e].initialValue=n;let t=e.split("."),l=parseInt(t[t.length-2],10),a=t.slice(0,t.length-2).join("."),o=null==p||null==(s=p[a])?void 0:s.rows;p[a]&&Array.isArray(o)&&(o[l]?o[l].id=n:o[l]={id:n})}}return Object.keys(p).length>0&&(o.splice(l+1,0,p),c.splice(l+1,0,u)),{...a,...dn(n,o),[n]:{...e[n],disableFormData:!0,rows:c,value:o.length}}}case"MERGE_SERVER_STATE":{let{acceptValues:n,prevStateRef:l,serverState:a}=t,o=(e=>{let{acceptValues:t,currentState:n={},incomingState:l}=e,a={...n};for(let[e,i]of Object.entries(l||{})){var o,r;if(!(e in n)&&!i.addedByServer)continue;let l=i.addedByServer||!0===t||"object"==typeof t&&null!==t&&!1===t.overrideLocalChanges&&!(null==(o=n[e])?void 0:o.isModified),s=i;if(!l){let{initialValue:e,value:t,...n}=i;s=n}a[e]={...n[e],...s}
1,n[e]&&"errorPaths"in n[e]&&!("errorPaths"in i)&&(a[e].errorPaths=[]),Array.isArray(i.rows)&&e in n&&(a[e].rows=[...(null==(r=n[e])?void 0:r.rows)||[]],i.rows.forEach(t=>{var l;let o=null==(l=n[e].rows)?void 0:l.findIndex(e=>e.id===t.id);if(o>-1)a[e].rows[o]={...n[e].rows[o],...t};else if(t.addedByServer){let n={...t};delete n.addedByServer,a[e].rows.push(n)}})),!1!==i.valid&&(a[e].valid=!0),!1!==i.passesCondition&&(a[e].passesCondition=!0),i.blocksFilterOptions||delete a[e].blocksFilterOptions,delete a[e].addedByServer}return(0,w.j)(a,n)?n:a})({acceptValues:n,currentState:e||{},incomingState:a});return l.current=o,o}case"MOVE_ROW":{let{moveFromIndex:n,moveToIndex:l,path:a}=t,{remainingFields:o,rows:r}=dt(a,e),i=r[n];r.splice(n,1),r.splice(l,0,i);let s=[...(null==(c=e[a])?void 0:c.rows)||[]],u={...s[n]};return s.splice(n,1),s.splice(l,0,u),{...o,...dn(a,r),[a]:{...e[a],rows:s}}}case"REMOVE":{let n={...e};return n[t.path]&&delete n[t.path],n}case"REMOVE_ROW":{let{path:n,rowIndex:l}=t,{remainingFields:a,rows:o}=dt(n,e),r=[...(null==(u=e[n])?void 0:u.rows)||[]];return o.splice(l,1),r.splice(l,1),{...a,[n]:{...e[n],disableFormData:o.length>0,rows:r,value:o.length},...dn(n,o)}}case"REPLACE_ROW":{let{blockType:n,path:l,rowIndex:a,subFieldState:o={}}=t,{remainingFields:r,rows:i}=dt(l,e),s=Math.max(0,Math.min(a,(null==i?void 0:i.length)-1||0)),c=[...(null==(d=e[l])?void 0:d.rows)||[]];return c[s]={id:new dl().toHexString(),blockType:n||void 0,collapsed:!1},n&&(o.blockType={initialValue:n,valid:!0,value:n}),i[s]=o,{...r,...dn(l,i),[l]:{...e[l],disableFormData:!0,rows:c,value:i.length}}}case"REPLACE_STATE":if(!1!==t.optimize){let n={};for(let[l,a]of Object.entries(t.state)){let t=e[l];!1!==a.valid&&(a.valid=!0),!1!==a.passesCondition&&(a.passesCondition=!0),(0,w.j)(t,a)?t&&(n[l]=t):n[l]=a}return n}if(t.sanitize)for(let e of Object.values(t.state))!1!==e.valid&&(e.valid=!0),!1!==e.passesCondition&&(e.passesCondition=!0);return t.state;case"SET_ALL_ROWS_COLLAPSED":{let{path:n,updatedRows:l}=t;return{...e,[n]:{...e[n],rows:l}}}case"SET_ROW_COLLAPSED":{let{path:n,updatedRows:l}=t;return{...e,[n]:{...e[n],rows:l}}}case"UPDATE":{let n=Object.entries(t).reduce((e,t)=>{let[n,l]=t;return["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(n)?{...e,[n]:l,..."value"===n?{isModified:!0}:{}}:e},(null==e?void 0:e[t.path])||{}),l={...e,[t.path]:n};if("value"in t)for(let[e,n]of Object.entries(l))e!==t.path&&"isModified"in n&&delete l[e].isModified;return l}case"UPDATE_MANY":{let n={...e};return Object.entries(t.formState).forEach(e=>{let[t,l]=e;n[t]=l}),n}default:return e}}var dr={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:()=>{},disabled:!1,dispatchFields:()=>{},fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:()=>{},initializing:void 0,isValid:!0,moveFieldRow:()=>{},removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:()=>{},setBackgroundProcessing:()=>{},setDisabled:()=>{},setIsValid:()=>{},setModified:()=>{},setProcessing:()=>{},setSubmitted:()=>{},submit:()=>{},validateForm:()=>{}},di=e=>{let{id:t,collectionSlug:n,docConfig:l,docPermissions:a,getDocPreferences:r,globalSlug:c}=aD(),d=(0,L.wA)(l),{action:p,beforeSubmit:f,children:m,className:g,disabled:v,disableSuccessStatus:b,disableValidationOnSubmit:y,el:x,handleResponse:j,initialState:C,isDocumentForm:S,isInitializing:k,onChange:_,onSubmit:N,onSuccess:E,redirect:P,submitted:D,uuid:T,waitForAutocomplete:R}=e,A="method"in e?null==e?void 0:e.method:void 0,O=(0,h.useRouter)(),z=eD(),{code:V}=lN(),{i18n:H,t:q}=(0,s.d)(),{refreshCookie:W,user:K}=lw(),Y=aO(),{queueTask:G}=uE(),{getFormState:Q}=ci(),{startRouteTransition:X}=e8(),{getUploadHandler:$}=u8(),{config:Z}=(0,i.c)(),[J,ee]=(0,o.useState)(v||!1),[et,en]=(0,o.useState)(!1),[el,ea]=(0,o.useState)(!1),[eo,er]=(0,o.useState)(!0),[ei,es]=(0,o.useState)(k),[ec,eu]=(0,o.useState)(!1),[ed,ep]=(0,o.useState)(!1),eh=(0,o.useRef)(ed),ef=(0,o.useRef)(!1),em=(0,o.useCallback)(e=>{eh.current=e,ep(e)},[]),[eg,ev]=(0,o.useState)(!1),eb=(0,o.useCallback)(e=>{eh.current&&(ef.current=!0),ev(e)},[]),ey=(0,o.useRef)(null),eP=(0,o.useRef)({}),eT=(0,o.useRef)(null),eR=(0,o.useRef)(!0),eA=(0,o.useReducer)(da,{},()=>C),[eL,eO]=eA;eP.current.fields=eL;let eF=(0,o.useRef)(eL),eM=(0,o.useCallback)(async()=>{let e={},l=!0,a=eP.current.getData(),o=Object.entries(eP.current.fields).map(async o=>{let[r,i]=o,s=r?r.split("."):[];if(!1!==i.passesCondition){let e=i.valid;
1if("validate"in i&&"function"==typeof i.validate){let l=i.value;(null==i?void 0:i.rows)&&Array.isArray(i.rows)&&(l=eP.current.getDataByPath(r)),"string"==typeof(e=await i.validate(l,{...i,id:t,collectionSlug:n,blockData:void 0,data:(null==z?void 0:z.getData)?z.getData():a,event:"submit",operation:Y,path:s,preferences:{},req:{payload:{config:Z},t:q,user:K},siblingData:eP.current.getSiblingData(r)}))?(i.errorMessage=e,i.valid=!1):(i.valid=!0,i.errorMessage=void 0)}!1===i.valid&&(l=!1)}e[r]=i});return await Promise.all(o),(0,w.j)(eP.current.fields,e)||eO({type:"REPLACE_STATE",state:e}),er(l),l},[n,Z,eO,t,Y,q,K,z]),eI=(0,o.useCallback)(async(e,t)=>{let{acceptValues:n=!0,action:l=p,context:a,disableFormWhileProcessing:o=!0,disableSuccessStatus:r,method:i=A,overrides:s={},skipValidation:c}=e||{},h=null!=r?r:b;if(J){t&&t.preventDefault();return}let m,g,v=new Promise((e,t)=>{g=e,m=t}),x=l||"string"==typeof p||"function"==typeof p;P||h||!x?(g=e=>eJ.success(e),m=e=>eJ.error(e)):eJ.promise(v,{error:e=>e,loading:q("general:submitting"),success:e=>e}),t&&(t.stopPropagation(),t.preventDefault()),o&&(eu(!0),ee(!0)),R&&await (0,F.u)(100);let w=(0,M.r)(eP.current.fields,!0),C=(0,I.KS)(eP.current.fields);if(Array.isArray(f)){let e;await f.reduce(async(t,n)=>{await t,e=await n({formState:C})},Promise.resolve());let t=Object.entries(e).every(e=>{let[,t]=e;return!1!==t.valid});if(er(t),!t)return eu(!1),ea(!0),ee(!1),eO({type:"REPLACE_STATE",state:e})}let S=!!c||!!y||await eP.current.validateForm();if(er(S),!S){m(q("error:correctInvalidFields")),eu(!1),ea(!0),ee(!1);return}let k={};if("function"==typeof s?k=s(eP.current.fields):"object"==typeof s&&(k=s),N){for(let[e,t]of Object.entries(k))w[e]=t;N(eP.current.fields,w)}if(!x){eu(!1),ea(!0),ee(!1);return}let _=await eP.current.createFormData(k,{data:w,mergeOverrideData:"function"!=typeof s});try{let e;if("string"==typeof l?e=await lb[i.toLowerCase()](l,{body:_,headers:{"Accept-Language":H.language}}
1):"function"==typeof p&&(e=await p(_)),ef.current?ef.current=!1:eb(!1),ee(!1),"function"==typeof j)return void j(e,g,m);let t=e.headers.get("content-type"),o=t&&-1!==t.indexOf("application/json"),r={};if(o&&(r=await e.json()),e.status<400){if("function"==typeof E){let e=await E(r,{context:a,formState:C});e&&eO({type:"MERGE_SERVER_STATE",acceptValues:n,prevStateRef:eF,serverState:e})}ea(!1),eu(!1),P?X(()=>O.push(P)):h||g(r.message||q("general:submissionSuccessful"))}else{if(eu(!1),ea(!0),"draft"===s._status&&(eb(!0),d||ea(!1)),eP.current={...eP.current},r.message)return void m(r.message);if(Array.isArray(r.errors)){let[e,t]=r.errors.reduce((e,t)=>{var n,l;let[a,o]=e,r=[],i=[];return(null==t?void 0:t.message)&&i.push(t),Array.isArray(null==t||null==(n=t.data)?void 0:n.errors)&&(null==(l=t.data)||l.errors.forEach(e=>{(null==e?void 0:e.path)?r.push(e):i.push(e)})),[[...a,...r],[...o,...i]]},[[],[]]);er(!1),eO({type:"ADD_SERVER_ERRORS",errors:e}),t.forEach(e=>{m((0,u.jsx)(u3,{errorMessage:e.message||q("error:unknown")}))});return}let t=(null==u7?void 0:u7[e.status])||(null==e?void 0:e.statusText)||q("error:unknown");m(t)}return{formState:eP.current.fields,res:e}}catch(e){console.error("Error submitting form",e),eu(!1),ea(!0),ee(!1),m(e.message)}},[f,X,p,b,y,J,eO,j,A,N,E,P,O,q,H,d,R,eb,ea]),eB=(0,o.useCallback)(()=>eP.current.fields,[]),eU=(0,o.useCallback)(e=>eP.current.fields[e],[]),ez=(0,o.useCallback)(()=>(0,M.r)(eP.current.fields,!0),[]),eV=(0,o.useCallback)(e=>(0,B.d)(eP.current.fields,e),[]),eH=(0,o.useCallback)(e=>(0,U.Z)(eP.current.fields,e),[]),eq=(0,o.useCallback)(async(e,t)=>{let{data:a,mergeOverrideData:o=!0}=t,r=a||(0,M.r)(eP.current.fields,!0),i=null==r?void 0:r.file;if(l&&"upload"in l&&l.upload&&i){delete r.file;let e=$({collectionSlug:n});if("function"==typeof e){let t=i.name;i=JSON.stringify({clientUploadContext:await e({file:i,updateFilename:e=>{t=e}}),collectionSlug:n,filename:t,mimeType:i.type,size:i.size})}}let s={_payload:JSON.stringify(r=o?{...r,...e}:e)};return l&&"upload"in l&&l.upload&&i&&(s.file=i),(0,u1.serialize)(s,{indices:!0,nullsAsUndefineds:!1})},[n,l,$]),eW=(0,o.useCallback)(async e=>{let l=cN(eT),o=await r(),{state:i}=await Q({id:t,collectionSlug:n,data:e,docPermissions:a,docPreferences:o,globalSlug:c,locale:V,operation:Y,renderAllFields:!0,schemaPath:n||c,signal:l.signal,skipValidation:!0});eP.current={...dr},eb(!1),eO({type:"REPLACE_STATE",state:i}),eT.current=null},[n,eO,c,t,Y,Q,a,r,V,eb]),eK=(0,o.useCallback)(e=>{eP.current={...dr},eb(!1),eO({type:"REPLACE_STATE",state:e})},[eO,eb]),eY=(0,o.useCallback)(e=>{let{blockType:t,path:n,rowIndex:l,subFieldState:a}=e,o=eH(n)||[];eO({type:"ADD_ROW",blockType:t,path:n,rowIndex:void 0===l?o.length:l,subFieldState:a}),eb(!0)},[eO,eH,eb]),eG=(0,o.useCallback)(e=>{let{moveFromIndex:t,moveToIndex:n,path:l}=e;eO({type:"MOVE_ROW",moveFromIndex:t,moveToIndex:n,path:l}),eb(!0)},[eO,eb]),eQ=(0,o.useCallback)(e=>{let{path:t,rowIndex:n}=e;eO({type:"REMOVE_ROW",path:t,rowIndex:n}),eb(!0)},[eO,eb]),eX=(0,o.useCallback)(e=>{let{blockType:t,path:n,rowIndex:l,subFieldState:a}=e,o=eH(n);eO({type:"REPLACE_ROW",blockType:t,path:n,rowIndex:void 0===l?o.length:l,subFieldState:a}),eb(!0)},[eO,eH,eb]);(0,o.useEffect)(()=>{let e=eT.current;return()=>{c_(e)}},[]),(0,o.useEffect)(()=>{void 0!==k&&es(k)},[k]),eP.current.submit=eI,eP.current.getFields=eB,eP.current.getField=eU,eP.current.getData=ez,eP.current.getSiblingData=eV,eP.current.getDataByPath=eH,eP.current.validateForm=eM,eP.current.createFormData=eq,eP.current.setModified=eb,eP.current.setProcessing=eu,eP.current.setBackgroundProcessing=em,eP.current.setSubmitted=ea,eP.current.setIsValid=er,eP.current.disabled=J,eP.current.setDisabled=ee,eP.current.formRef=ey,eP.current.reset=eW,eP.current.replaceState=eK,eP.current.dispatchFields=eO,eP.current.addFieldRow=eY,eP.current.removeFieldRow=eQ,eP.current.moveFieldRow=eG,eP.current.replaceFieldRow=eX,eP.current.uuid=T,eP.current.initializing=ei,eP.current.isValid=eo,(0,o.useEffect)(()=>{en(!0)},[]),(0,o.useEffect)(()=>{"boolean"==typeof v&&ee(v)},[v]),(0,o.useEffect)(()=>{"boolean"==typeof D&&ea(D)},[D]),(0,o.useEffect)(()=>{C&&(eP.current={...dr},eO({type:"REPLACE_STATE",optimize:!1,sanitize:!0,state:C}))},[C,eO]),lA(()=>{W()},15e3,[eL]);let e$=lv(()=>{eP.current={...eP.current},eb(!1)});(0,o.useEffect)(()=>{e$()},[V]);
1let eZ=[g,"form"].filter(Boolean).join(" "),e0=lv(e=>{G(async()=>{if(Array.isArray(_)){let t;for(let n of _)t=await n({formState:(0,I.KS)(eL),submitted:e});eO({type:"MERGE_SERVER_STATE",prevStateRef:eF,serverState:t})}})});u6(()=>{(eR.current||!(0,w.j)(eL,eF.current))&&eg&&e0(el),eF.current=eL,eR.current=!1},[eg,el,eL],250);let e1=S?ew:o.Fragment,e3=S?{value:eP.current}:{};return(0,u.jsx)(x||"form",{action:"function"==typeof p?void 0:p,className:eZ,method:A,noValidate:!0,onSubmit:e=>void eP.current.submit({},e),ref:ey,children:(0,u.jsx)(e1,{...e3,children:(0,u.jsx)(ex,{value:eP.current,children:(0,u.jsx)(ej,{value:{fields:eL,...eP.current},children:(0,u.jsx)(eC,{value:el,children:(0,u.jsx)(eN,{value:!et||et&&ei,children:(0,u.jsx)(eS,{value:ec,children:(0,u.jsx)(ek,{value:ed,children:(0,u.jsx)(e_,{value:eg,children:(0,u.jsx)(eE.Provider,{value:eA,children:m})})})})})})})})})})},ds="tabs-field__tab-button",dc=e=>{let t=(0,f.c)(12),{hidden:n,isActive:l,parentPath:a,setIsActive:r,tab:i}=e,{i18n:c}=(0,s.d)(),[p,h]=(0,o.useState)(void 0),g;if(t[0]!==p||t[1]!==n||t[2]!==c||t[3]!==l||t[4]!==a||t[5]!==r||t[6]!==i){let e=[...a?a.split(".").slice(0,-1):[],...(0,m.pz)(i)?[i.name]:[]],s=p>0,f=(0,u.jsx)(oR,{fields:i.fields,path:e,setErrorCount:h}),v=s&&"".concat(ds,"--has-error"),b=l&&"".concat(ds,"--active"),y=n&&"".concat(ds,"--hidden"),x;t[8]!==v||t[9]!==b||t[10]!==y?(x=[ds,v,b,y].filter(Boolean),t[8]=v,t[9]=b,t[10]=y,t[11]=x):x=t[11],g=(0,u.jsxs)(o.Fragment,{children:[f,(0,u.jsxs)("button",{className:x.join(" "),onClick:r,type:"button",children:[i.label?(0,d.s)(i.label,c):(0,m.pz)(i)?i.name:"",s&&(0,u.jsx)(nn,{count:p,i18n:c})]})]}),t[0]=p,t[1]=n,t[2]=c,t[3]=l,t[4]=a,t[5]=r,t[6]=i,t[7]=g}else g=t[7];return g},du="tabs-field";function dd(e){let{activeTabConfig:t,path:n}=e,l=n;return(0,m.pz)(t)&&t.name&&(l=n?"".concat(n,".").concat(t.name):t.name),l}var dp=aV(e=>{var t,n;let l,a,r,i=(0,f.c)(59),{field:c,forceRender:d,indexPath:p,parentPath:h,parentSchemaPath:g,path:v,permissions:b,readOnly:y}=e,{admin:x,tabs:w}=c,j;i[0]!==x?(j=void 0===x?{}:x,i[0]=x,i[1]=j):j=i[1];let{className:C}=j,S;i[2]!==w?(S=void 0===w?[]:w,i[2]=w,i[3]=S):S=i[3];let k=S,_=void 0===p?"":p,N=void 0===h?"":h,E=void 0===g?"":g,P=void 0===v?"":v,{getPreference:D,setPreference:T}=aS(),{preferencesKey:R}=aD(),{i18n:A}=(0,s.d)(),{isWithinCollapsible:L}=a4(),O;i[4]!==k?(O=e=>{let[t]=e;return k.map((e,n)=>{var l,a;let o=null==e?void 0:e.id;return{index:n,passesCondition:null==(a=null==t||null==(l=t[o])?void 0:l.passesCondition)||a,tab:e}})},i[4]=k,i[5]=O):O=i[5];let F=eM(O),M;i[6]!==F?(M=()=>{var e,t,n;return null!=(n=null==(t=F.filter(df))||null==(e=t[0])?void 0:e.index)?n:0},i[6]=F,i[7]=M):M=i[7];let[I,B]=(0,o.useState)(M),U="tabs-".concat(_),z;i[8]!==I||i[9]!==N||i[10]!==k?(z=()=>dd({activeTabConfig:k[I],path:N}),i[8]=I,i[9]=N,i[10]=k,i[11]=z):z=i[11];let[V,H]=(0,o.useState)(z),q;i[12]!==E||i[13]!==k[0]?(q=()=>dd({activeTabConfig:k[0],path:E}),i[12]=E,i[13]=k[0],i[14]=q):q=i[14];let[W,K]=(0,o.useState)(q),Y;i[15]!==I||i[16]!==V||i[17]!==N||i[18]!==k?(Y=(0,m.pz)(k[I])?V:N,i[15]=I,i[16]=V,i[17]=N,i[18]=k,i[19]=Y):Y=i[19];let G=Y,Q=F[I],X=null==Q?void 0:Q.tab,$;i[20]!==I||i[21]!==W||i[22]!==E||i[23]!==k?($=(0,m.pz)(k[I])?W:E,i[20]=I,i[21]=W,i[22]=E,i[23]=k,i[24]=$):$=i[24];let Z=$,J=null!=(n=null==(t=X.admin)?void 0:t.description)?n:X.description,ee="function"==typeof J?J({i18n:A,t:A.t}):J,et=F.some(dm),en;i[25]!==D||i[26]!==N||i[27]!==E||i[28]!==P||i[29]!==R||i[30]!==T||i[31]!==k||i[32]!==U?(en=async e=>{var t,n;B(e),H(dd({activeTabConfig:k[e],path:N})),K(dd({activeTabConfig:k[e],path:E}));let l=await D(R);R&&T(R,{...l,...P?{fields:{...(null==l?void 0:l.fields)||{},[P]:{...null==l||null==(t=l.fields)?void 0:t[P],tabIndex:e}}}:{fields:{...null==l?void 0:l.fields,[U]:{...null==l||null==(n=l.fields)?void 0:n[U],tabIndex:e}}}})},i[25]=D,i[26]=N,i[27]=E,i[28]=P,i[29]=R,i[30]=T,i[31]=k,i[32]=U,i[33]=en):en=i[33];let el=en,ea,eo;i[34]!==D||i[35]!==N||i[36]!==E||i[37]!==P||i[38]!==R||i[39]!==k||i[40]!==U?(ea=()=>{R&&(async()=>{var e,t,n,l;let a=await D(R),o=(P?null==a||null==(t=a.fields)||null==(e=t[P])?void 0:e.tabIndex:null==a||null==(l=a.fields)||null==(n=l[U])?void 0:n.tabIndex)||0;B(o),H(dd({activeTabConfig:k[o],path:N})),K(dd({activeTabConfig:k[o],path:E}))})()},eo=[P,D,R,U,k,N,E],i[34]=D,i[35]=N,i[36]=E,i[37]=P,i[38]=R,i[39]=k,i[40]=U,i[41]=ea,i[42]=eo):(ea=i[41],eo=i[42]),(0,o.useEffect)(ea,eo),i[43]!==(null==Q?void 0:Q.passesCondition)||i[44]!==el||i[45]!==F?(l=()=>{if((null==Q?void 0:Q.passesCondition)===!1){let e=F.find(dg);e&&el(e.index)}},i[43]=null==Q?void 0:Q.passesCondition,i[44]=el,i[45]=F,i[46]=l):l=i[46],i[47]!==Q||i[48]!==el||i[49]!==F?(a=[Q,F,el],i[47]=Q,i[48]=el,i[49]=F,i[50]=a):a=i[50],(0,o.useEffect)(l,a);let er=L&&"".concat(du,"--within-collapsible"),ei=!et&&"".concat(du,"--hidden"),es;return i[51]!==C||i[52]!==er||i[53]!==ei?(es=[aq,C,du,er,ei].filter(
1Boolean),i[51]=C,i[52]=er,i[53]=ei,i[54]=es):es=i[54],i[55]!==I||i[56]!==el||i[57]!==P?(r=e=>{let{index:t,passesCondition:n,tab:l}=e;return(0,u.jsx)(dc,{hidden:!n,isActive:I===t,parentPath:P,setIsActive:()=>{el(t)},tab:l},t)},i[55]=I,i[56]=el,i[57]=P,i[58]=r):r=i[58],(0,u.jsx)("div",{className:es.join(" "),children:(0,u.jsxs)(s0,{children:[(0,u.jsx)("div",{className:"".concat(du,"__tabs-wrap"),children:(0,u.jsx)("div",{className:"".concat(du,"__tabs"),children:F.map(r)})}),(0,u.jsx)("div",{className:"".concat(du,"__content-wrap"),children:X&&(0,u.jsx)(dh,{description:ee,fields:X.fields,forceRender:void 0!==d&&d,hidden:!1,parentIndexPath:(0,m.pz)(X)?"":"".concat(_?_+"-":"")+String(Q.index),parentPath:G,parentSchemaPath:Z,path:V,permissions:b&&"object"==typeof b&&"name"in X?b[X.name]&&"object"==typeof b[X.name]&&"fields"in b[X.name]?b[X.name].fields:b[X.name]:b,readOnly:y})})]})})});function dh(e){let t=(0,f.c)(21),{description:n,fields:l,forceRender:a,hidden:o,label:r,parentIndexPath:i,parentPath:c,parentSchemaPath:p,permissions:h,readOnly:m}=e,{i18n:g}=(0,s.d)(),{customComponents:v,path:b}=aB(),y,x;if(t[0]!==n||t[1]!==l||t[2]!==a||t[3]!==o||t[4]!==g||t[5]!==r||t[6]!==i||t[7]!==c||t[8]!==p||t[9]!==b||t[10]!==h||t[11]!==m||t[12]!==v){x=Symbol.for("react.early_return_sentinel");e:{let e,{AfterInput:s,BeforeInput:f,Description:w,Field:j}=void 0===v?{}:v;if(j){x=j;break e}let C=o&&"".concat(du,"__tab--hidden"),S;t[15]!==g||t[16]!==r?(S=r&&"".concat(du,"__tabConfigLabel-").concat((0,O.f)((0,d.s)(r,g))),t[15]=g,t[16]=r,t[17]=S):S=t[17],t[18]!==C||t[19]!==S?(e=[C,"".concat(du,"__tab"),S].filter(Boolean),t[18]=C,t[19]=S,t[20]=e):e=t[20],y=(0,u.jsxs)("div",{className:e.join(" "),children:[(0,u.jsx)(ep,{CustomComponent:w,Fallback:(0,u.jsx)(na,{description:n,marginPlacement:"bottom",path:b})}),f,(0,u.jsx)(hL,{fields:l,forceRender:a,parentIndexPath:i,parentPath:c,parentSchemaPath:p,permissions:h,readOnly:m}),s]})}t[0]=n,t[1]=l,t[2]=a,t[3]=o,t[4]=g,t[5]=r,t[6]=i,t[7]=c,t[8]=p,t[9]=b,t[10]=h,t[11]=m,t[12]=v,t[13]=y,t[14]=x}else y=t[13],x=t[14];return x!==Symbol.for("react.early_return_sentinel")?x:y}function df(e){let{passesCondition:t}=e;return t}function dm(e){let{passesCondition:t}=e;return t}function dg(e){let{passesCondition:t}=e;return t}var dv=e=>{let t=(0,f.c)(32),{AfterInput:n,BeforeInput:l,className:a,Description:o,description:r,Error:i,hasMany:c,htmlAttributes:p,inputRef:h,Label:m,label:g,localized:v,maxRows:b,onChange:y,onKeyDown:x,path:w,placeholder:j,readOnly:C,required:S,rtl:k,showError:_,style:N,value:E,valueToRender:P}=e,{i18n:D,t:T}=(0,s.d)(),R;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==i||t[4]!==m||t[5]!==a||t[6]!==r||t[7]!==c||t[8]!==p||t[9]!==D||t[10]!==h||t[11]!==g||t[12]!==v||t[13]!==b||t[14]!==y||t[15]!==x||t[16]!==w||t[17]!==j||t[18]!==C||t[19]!==S||t[20]!==k||t[21]!==_||t[22]!==N||t[23]!==T||t[24]!==E||t[25]!==P){let e=(0,d.s)(j,D),s=_&&"error",f=C&&"read-only",A=c&&"has-many",L;t[27]!==a||t[28]!==s||t[29]!==f||t[30]!==A?(L=[aq,"text",a,s,f,A].filter(
1Boolean),t[27]=a,t[28]=s,t[29]=f,t[30]=A,t[31]=L):L=t[31],R=(0,u.jsxs)("div",{className:L.join(" "),style:N,children:[(0,u.jsx)(ep,{CustomComponent:m,Fallback:(0,u.jsx)(lD,{label:g,localized:v,path:w,required:S})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:i,Fallback:(0,u.jsx)(no,{path:w,showError:_})}),l,c?(0,u.jsx)(sW,{className:"field-".concat(w.replace(/\./g,"__")),components:{DropdownIndicator:null},customProps:{editableProps:dy},disabled:C,filterOption:()=>!b||!(Array.isArray(E)&&b&&E.length>=b),isClearable:!1,isCreatable:!0,isMulti:!0,isSortable:!0,menuIsOpen:!1,noOptionsMessage:()=>Array.isArray(E)&&E.length>=b?T("validation:limitReached",{max:b,value:E.length+1}):null,onChange:y,options:[],placeholder:e,showError:_,value:P}):(0,u.jsx)("input",{"data-rtl":k,disabled:C,id:"field-".concat(null==w?void 0:w.replace(/\./g,"__")),name:w,onChange:y,onKeyDown:x,placeholder:e,ref:h,type:"text",value:E||"",...null!=p?p:{}}),n,(0,u.jsx)(ep,{CustomComponent:o,Fallback:(0,u.jsx)(na,{description:r,path:w})})]})]}),t[0]=n,t[1]=l,t[2]=o,t[3]=i,t[4]=m,t[5]=a,t[6]=r,t[7]=c,t[8]=p,t[9]=D,t[10]=h,t[11]=g,t[12]=v,t[13]=b,t[14]=y,t[15]=x,t[16]=w,t[17]=j,t[18]=C,t[19]=S,t[20]=k,t[21]=_,t[22]=N,t[23]=T,t[24]=E,t[25]=P,t[26]=R}else R=t[26];return R};function db(e){e.currentTarget.contentEditable="false"}function dy(e,t,n){let l="".concat(t,"--editable");return{onBlur:db,onClick:e=>{e.currentTarget.contentEditable="true",e.currentTarget.classList.add(l),e.currentTarget.focus()},onKeyDown:t=>{if("Enter"===t.key||"Tab"===t.key||"Escape"===t.key){if(t.currentTarget.contentEditable="false",t.currentTarget.classList.remove(l),e.value.value=t.currentTarget.innerText,e.label=t.currentTarget.innerText,e.value.value.replaceAll("\n",""))n.onChange(n.value,{action:"create-option",option:e});else if(Array.isArray(n.value)){let t=n.value.filter(t=>t.id!==e.id);n.onChange(t,{action:"pop-value",removedValue:e})}t.preventDefault()}t.stopPropagation()}}}var dx=aV(e=>{let{field:t,field:{admin:{autoComplete:n,className:l,description:a,placeholder:r,rtl:s}={},hasMany:c,label:d,localized:p,maxLength:h,maxRows:f,minLength:m,minRows:g,required:v},inputRef:b,path:y,readOnly:x,validate:w}=e,j=lN(),{config:{localization:C}}=(0,i.c)(),{customComponents:{AfterInput:S,BeforeInput:k,Description:_,Error:N,Label:E}={},disabled:P,path:D,setValue:T,showError:R,value:A}=aB({potentiallyStalePath:y,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof w)return w(e,{...t,maxLength:h,minLength:m,required:v})},[w,m,h,v])}),L=aW({fieldLocalized:p,fieldRTL:s,locale:j,localizationConfig:C||void 0}),[O,F]=(0,o.useState)([]),M=(0,o.useCallback)(e=>{if(!(x||P)){var t;T(e?Array.isArray(e)?e.map(e=>{var t;return(null==(t=e.value)?void 0:t.value)||e.value}):[(null==(t=e.value)?void 0:t.value)||e.value]:[])}},[x,T,P]);(0,o.useEffect)(()=>{c&&Array.isArray(A)&&F(A.map((e,t)=>({id:"".concat(e).concat(t),label:"".concat(e),value:{toString:()=>"".concat(e).concat(t),value:(null==e?void 0:e.value)||e}})))},[A,c]);let I=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsx)(dv,{AfterInput:S,BeforeInput:k,className:l,Description:_,description:a,Error:N,hasMany:c,htmlAttributes:{autoComplete:n||void 0},inputRef:b,Label:E,label:d,localized:p,maxRows:f,minRows:g,onChange:c?M:e=>{T(e.target.value)},path:D,placeholder:r,readOnly:x||P,required:v,rtl:L,showError:R,style:I,value:A||"",valueToRender:O})}),dw=e=>{let t=(0,f.c)(26),{AfterInput:n,BeforeInput:l,className:a,Description:o,description:r,Error:i,Label:c,label:p,localized:h,onChange:m,path:g,placeholder:v,readOnly:b,required:y,rows:x,rtl:w,showError:j,style:C,value:S}=e,{i18n:k}=(0,s.d)(),_=j&&"error",N=b&&"read-only",E;t[0]!==a||t[1]!==_||t[2]!==N?(E=[aq,"textarea",a,_,N].filter(Boolean),t[0]=a,t[1]=_,t[2]=N,t[3]=E):E=t[3];let P=E.join(" "),D="field-".concat(g.replace(/\./g,"__")),T;return t[4]!==n||t[5]!==l||t[6]!==o||t[7]!==i||t[8]!==c||t[9]!==r||t[10]!==k||t[11]!==p||t[12]!==h||t[13]!==m||t[14]!==g||t[15]!==v||t[16]!==b||t[17]!==y||t[18]!==x||t[19]!==w||t[20]!==j||t[21]!==C||t[22]!==P||t[23]!==D||t[24]!==S?(T=(0,u.jsxs)("div",{className:P,style:C,children:[(0,u.jsx)(ep,{CustomComponent:c,Fallback:(0,u.jsx)(lD,{htmlFor:D,label:p,localized:h,path:g,required:y})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:i,Fallback:(0,u.jsx)(no,{path:g,showError:j})}),l,(0,u.jsx)("div",{className:"textarea-outer",children:(0,u.jsx)("textarea",{"data-rtl":w,disabled:b,id:"field-".concat(g.replace(/\./g,"__")),name:g,onChange:m,placeholder:(0,d.s)(v,k),rows:x,style:{"--rows":x},value:S||""})}),n,(0,u.jsx)(ep,{CustomComponent:o,Fallback:(0,u.jsx)(na,{description:r,path:g})})]})]}),t[4]=n,t[5]=l,t[6]=o,t[7]=i,t[8]=c,t[9]=r,t[10]=k,t[11]=p,t[12]=h,t[13]=m,t[14]=g,t[15]=v,t[16]=b,t[17]=y,t[18]=x,t[19]=w,t[20]=j,t[21]=C,t[22]=P,t[23]=D,t[24]=S,t[25]=T):T=t[25],T},dj=aV(e=>{let{field:t,field:{admin:{className:n,description:l,placeholder:a,rows:r,rtl:c}={},label:p,localized:h,maxLength:f,minLength:m,required:g},path:v,readOnly:b,validate:y}=e,{i18n:x}=(0,s.d)(),{config:{localization:w}}=(0,i.c)(),j=aW({fieldLocalized:h,fieldRTL:c,locale:lN(),localizationConfig:w||void 0}),{customComponents:{AfterInput:C,BeforeInput:S,Description:k,Error:_,Label:N}={},disabled:E,path:P,setValue:D,showError:T,value:R}=aB({potentiallyStalePath:v,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof y)return y(e,{...t,maxLength:f,minLength:m,required:g})},[y,g,f,m])}),A=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsx)(dw,{AfterInput:C,BeforeInput:S,className:n,Description:k,description:l,Error:_,Label:N,label:p,localized:h,onChange:e=>{D(e.target.value)},path:P,placeholder:(0,d.s)(a,x),readOnly:b||E,required:g,rows:r,rtl:j,showError:T,style:A,value:R})}),dC=()=>null,dS=(0,o.createContext)(void 0),dk=e=>{let t=(0,f.c)(5),{children:n}=e,[l,a]=(0,o.useState)(null),[r,i]=(0,o.useState)(""),[s,c]=(0,o.useState)(null),d;return t[0]!==n||t[1]!==s||t[2]!==l||t[3]!==r?(d=(0,u.jsx)(dS,{value:{setUploadControlFile:c,setUploadControlFileName:a,setUploadControlFileUrl:i,uploadControlFile:s,uploadControlFileName:l,uploadControlFileUrl:r},children:n}),t[0]=n,t[1]=s,t[2]=l,t[3]=r,t[4]=d):d=t[4],d},d_=()=>{let e=(0,o.use)(dS);
1if(!e)throw Error("useUploadControls must be used within an UploadControlsProvider");return e},dN=e=>{e.preventDefault(),e.stopPropagation()};function dE(e){let{children:t,className:n,disabled:l=!1,dropzoneStyle:a="default",multipleFiles:r,onChange:i}=e,s=o.useRef(null),[c,d]=o.useState(!1),p=o.useCallback(e=>{if(!r&&e.length>1){let t=new DataTransfer;t.items.add(e[0]),i(t.files)}else i(e)},[r,i]),h=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),e.clipboardData.files&&e.clipboardData.files.length>0&&p(e.clipboardData.files)},[p]),f=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),d(!0)},[]),m=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),d(!1)},[]),g=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),d(!1),e.dataTransfer.files&&e.dataTransfer.files.length>0&&(p(e.dataTransfer.files),d(!1),e.dataTransfer.clearData())},[p]);o.useEffect(()=>{let e=s.current;return e&&!l?(e.addEventListener("dragenter",f),e.addEventListener("dragleave",m),e.addEventListener("dragover",dN),e.addEventListener("drop",g),e.addEventListener("paste",h),()=>{e.removeEventListener("dragenter",f),e.removeEventListener("dragleave",m),e.removeEventListener("dragover",dN),e.removeEventListener("drop",g),e.removeEventListener("paste",h)}):()=>null},[l,f,m,g,h]);let v=["dropzone",n,c?"dragging":"","dropzoneStyle--".concat(a)].filter(Boolean).join(" ");return(0,u.jsx)("div",{className:v,ref:s,children:t})}function dP(e){let t=(0,f.c)(3),{onClick:n}=e,{t:l}=(0,s.d)(),a;return t[0]!==n||t[1]!==l?(a=(0,u.jsx)("button",{"aria-label":l("general:close"),className:"drawer-close-button",onClick:n,type:"button",children:(0,u.jsx)(s.a,{})}),t[0]=n,t[1]=l,t[2]=a):a=t[2],a}function dD(e){let{onClose:t,title:n}=e;return(0,u.jsxs)("div",{className:"bulk-upload--drawer-header",children:[(0,u.jsx)("h2",{title:n,children:n}),(0,u.jsx)(dP,{onClick:t})]})}var dT="bulk-upload--add-files";function dR(e){let{acceptMimeTypes:t,onCancel:n,onDrop:l}=e,{t:a}=(0,s.d)(),r=o.useRef(null);return(0,u.jsxs)("div",{className:dT,children:[(0,u.jsx)(dD,{onClose:n,title:a("upload:addFiles")}),(0,u.jsx)("div",{className:"".concat(dT,"__dropArea"),children:(0,u.jsxs)(dE,{multipleFiles:!0,onChange:l,children:[(0,u.jsx)(tD,{buttonStyle:"subtle",iconPosition:"left",onClick:()=>{r.current&&r.current.click()},size:"small",children:a("upload:selectFile")}),(0,u.jsx)("input",{accept:t,"aria-hidden":"true",className:"".concat(dT,"__hidden-input"),hidden:!0,multiple:!0,onChange:e=>{e.target.files&&e.target.files.length>0&&l(e.target.files)},ref:r,type:"file"}),(0,u.jsxs)("p",{className:"".concat(dT,"__dragAndDropText"),children:[a("general:or")," ",a("upload:dragAndDrop")]})]})})]})}var dA=(0,c.e)(ei(),1);async function dL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,l=arguments.length>3?arguments[3]:void 0,a=(0,M.r)(e,!0),o=null==a?void 0:a.file;if(o&&delete a.file,o&&"function"==typeof l){let e=o.name;o=JSON.stringify({clientUploadContext:await l({file:o,updateFilename:t=>{e=t}}),collectionSlug:n,filename:e,mimeType:o.type,size:o.size})}let r={_payload:JSON.stringify({...a,...t}),file:o};return(0,dA.serialize)(r,{indices:!0,nullsAsUndefineds:!1})}function dO(e,t){switch(t.type){case"ADD_FORMS":{var n;let l=[];for(let e=0;e<t.forms.length;e++)l[e]={errorCount:0,formID:null!=(n=t.forms[e].formID)?n:crypto.randomUUID?crypto.randomUUID():op(),formState:{...t.forms[e].initialState||{},file:{initialValue:t.forms[e].file,valid:!0,value:t.forms[e].file}},uploadEdits:{}};return{...e,activeIndex:0,forms:[...l,...e.forms]}}case"REMOVE_FORM":{let n=[...e.forms],[l]=n.splice(t.index,1),a=e.activeIndex>=t.index,o=Math.min(n.length-1,e.activeIndex===t.index?t.index:a?e.activeIndex-1:e.activeIndex);return{...e,activeIndex:a?o:e.activeIndex,forms:n,totalErrorCount:e.totalErrorCount-l.errorCount}}case"REPLACE":return{...e,...t.state};case"SET_ACTIVE_INDEX":return{...e,activeIndex:t.index};case"UPDATE_ERROR_COUNT":{let n=[...e.forms];return n[t.index].errorCount=t.count,{...e,forms:n,totalErrorCount:e.forms.reduce((e,t)=>
1e+t.errorCount,0)}}case"UPDATE_FORM":{let n=[...e.forms];return n[t.index].errorCount=t.errorCount,n[t.index]={...n[t.index],formState:{...n[t.index].formState,...t.formState},uploadEdits:{...n[t.index].uploadEdits,...t.uploadEdits}},{...e,forms:n,totalErrorCount:e.forms.reduce((e,t)=>e+t.errorCount,0)}}default:return e}}var dF=o.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:()=>{}}),dM={activeIndex:0,forms:[],totalErrorCount:0};function dI(e){let{children:t}=e,{config:n}=(0,i.c)(),{routes:{api:l},serverURL:a}=n,{code:r}=lN(),{i18n:c,t:d}=(0,s.d)(),{getDocumentSlots:p,getFormState:h}=ci(),{getUploadHandler:f}=u8(),[m,g]=o.useState({}),[v,b]=o.useState(!1),[x,w]=o.useState(),[j,C]=o.useState(!1),[S,k]=o.useState(!1),[_,N]=o.useState(!1),[E,P]=o.useState(!1),[D,T]=o.useState(!1),[R,A]=o.useReducer(dO,dM),{activeIndex:L,forms:O,totalErrorCount:F}=R;o.useRef(O).current=O;let{toggleLoadingOverlay:M}=cw(),{closeModal:I}=nE(),{collectionSlug:B,drawerSlug:U,initialFiles:z,initialForms:V,onSuccess:H,setInitialFiles:q,setInitialForms:W,setSuccessfullyUploaded:K}=hy(),[Y,G]=o.useState(!1),[Q,X]=o.useState(""),$=o.useRef(!1),Z=o.useRef(null),J=o.useRef(()=>({})),ee="".concat(a).concat(l,"/").concat(B),et=o.useCallback(async()=>{let e={locale:r||void 0},t="/".concat(B,"/access"),n=await (await fetch("".concat(a).concat(l).concat(t,"?").concat(y.A(e)),{credentials:"include",headers:{"Accept-Language":c.language,"Content-Type":"application/json"},method:"post"})).json(),o=await fetch("".concat(a).concat(l).concat(t,"?").concat(y.A(e)),{body:JSON.stringify({_status:"published"}),credentials:"include",headers:{"Accept-Language":c.language,"Content-Type":"application/json"},method:"POST"}).then(e=>e.json());w(n),C(aE({collectionSlug:B,docPermissions:n,isEditing:!1})),k(null==o?void 0:o.update),P(!0)},[l,r,B,c.language,a]),en=o.useCallback(async e=>{(null==e?void 0:e.signal)&&e.abort("aborting previous fetch for initial form state without files"),g(await p({collectionSlug:B}));try{let{state:e}=await h({collectionSlug:B,docPermissions:x,docPreferences:{fields:{}},locale:r,operation:"create",renderAllFields:!0,schemaPath:B,skipValidation:!0});Z.current=e,N(!0)}catch(e){}},[p,B,h,x,r]),el=o.useCallback(e=>{let t=J.current();A({type:"REPLACE",state:{activeIndex:e,forms:O.map((e,n)=>n===L?{errorCount:e.errorCount,formID:e.formID,formState:t,uploadEdits:e.uploadEdits}:e)}})},[O,L]),ea=o.useCallback(async e=>{O.length&&A({type:"UPDATE_FORM",errorCount:O[L].errorCount,formState:J.current(),index:L}),M({isLoading:!0,key:"addingDocs"}),_||await en(),A({type:"ADD_FORMS",forms:Array.from(e).map(e=>({file:e,initialState:Z.current}))}),M({isLoading:!1,key:"addingDocs"})},[en,_,M,L,O]),eo=lv(ea),er=lv(async e=>{M({isLoading:!0,key:"addingDocs"}),_||await en(),A({type:"ADD_FORMS",forms:e.map(e=>({...e,initialState:(null==e?void 0:e.initialState)||Z.current}))}),M({isLoading:!1,key:"addingDocs"})}),ei=o.useCallback(e=>{A({type:"REMOVE_FORM",index:e})},[]),es=o.useCallback(e=>{let{errorCount:t,index:n}=e;A({type:"UPDATE_ERROR_COUNT",count:t,index:n})},[]),ec=o.useCallback(async function(){let{overrides:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=J.current(),n=[...O];n[L]={errorCount:n[L].errorCount,formID:n[L].formID,formState:t,uploadEdits:n[L].uploadEdits};let l=[];G(!0);for(let t=0;t<n.length;t++)try{var a,o,i;let s=n[t],c=null==(o=s.formState)||null==(a=o.file)?void 0:a.value;if(c&&"object"==typeof c&&"name"in c&&(!c.name||""===c.name)){n[t]={...n[t],errorCount:1};continue}X(d("general:uploadingBulk",{current:t+1,total:n.length}));let u="".concat(ee).concat(y.A({locale:r,uploadEdits:(null==s?void 0:s.uploadEdits)||void 0},{addQueryPrefix:!0})),p=await fetch(u,{body:await dL(s.formState,e,B,f({collectionSlug:B})),credentials:"include",method:"POST"}),h=await p.json();201===p.status&&(null==h?void 0:h.doc)&&l.push({collectionSlug:B,doc:h.doc,formID:s.formID});let[m,g]=((null==h?void 0:h.errors)||[]).reduce((e,t)=>
1{var n,l;let[a,o]=e,r=[],i=[];return(null==t?void 0:t.message)&&i.push(t),Array.isArray(null==t||null==(n=t.data)?void 0:n.errors)&&(null==(l=t.data)||l.errors.forEach(e=>{(null==e?void 0:e.path)?r.push(e):i.push(e)})),[[...a,...r],[...o,...i]]},[[],[]]);n[t]={errorCount:m.length,formID:n[t].formID,formState:da(n[t].formState,{type:"ADD_SERVER_ERRORS",errors:m})},(413===p.status||400===p.status)&&(n[t]={...n[t],errorCount:n[t].errorCount+1},eJ.error(null==(i=g[0])?void 0:i.message))}catch(e){}b(!0),X(""),G(!1);let s=[];n.forEach((e,t)=>{let{errorCount:l}=e;l&&s.push(n[t])});let c=Math.max(0,n.length-s.length),u=n.length-c;c&&(eJ.success("Successfully saved ".concat(c," files")),K(!0),"function"==typeof H&&H(l,u)),u?eJ.error("Failed to save ".concat(u," files")):I(U),A({type:"REPLACE",state:{activeIndex:0,forms:s,totalErrorCount:s.reduce((e,t)=>{let{errorCount:n}=t;return e+n},0)}}),0===s.length&&(q(void 0),W(void 0))},[O,L,d,ee,r,B,f,H,I,K,U,q,W]),eu=o.useCallback(async(e,t)=>{for(let n=0;n<O.length;n++)if(Object.entries(e).forEach(e=>{let[t,l]=e;O[n].formState[t]&&(O[n].formState[t].value=l,A({type:"UPDATE_FORM",errorCount:O[n].errorCount,formState:O[n].formState,index:n}))}),"function"==typeof t&&t(),v){let{state:e}=await h({collectionSlug:B,docPermissions:x,docPreferences:null,formState:O[n].formState,operation:"create",schemaPath:B});A({type:"UPDATE_FORM",errorCount:Object.values(e).reduce((e,t)=>(null==t?void 0:t.valid)===!1?e+1:e,0),formState:e,index:n})}},[B,x,O,h,v]),ed=o.useCallback(e=>{A({type:"UPDATE_FORM",errorCount:O[L].errorCount,formState:O[L].formState,index:L,uploadEdits:e})},[L,O]),ep=o.useCallback(()=>{A({type:"REPLACE",state:{forms:O.map(e=>({...e,uploadEdits:{}}))}})},[O]);return o.useEffect(()=>{B&&(_||en(),E||et(),(z||V)&&T(!_||!E),_&&((null==V?void 0:V.length)||(null==z?void 0:z.length))&&!$.current&&((null==V?void 0:V.length)&&er(V),(null==z?void 0:z.length)&&eo(z),$.current=!0))},[z,en,et,B,_,E,V]),(0,u.jsxs)(dF,{value:{activeIndex:R.activeIndex,addFiles:ea,bulkUpdateForm:eu,collectionSlug:B,docPermissions:x,documentSlots:m,forms:O,getFormDataRef:J,hasPublishPermission:S,hasSavePermission:j,hasSubmitted:v,isInitializing:D,removeFile:ei,resetUploadEdits:ep,saveAllDocs:ec,setActiveIndex:el,setFormTotalErrorCount:es,totalErrorCount:F,updateUploadEdits:ed},children:[Y&&(0,u.jsx)(cC,{animationDuration:"250ms",loadingText:Q,overlayType:"fullscreen",show:!0}),t]})}function dB(){return o.use(dF)}var dU=(e,t)=>e?(0,m.Z7)(t)&&t.name?"".concat(e,".").concat(t.name):e:(0,m.Z7)(t)?t.name:"",dz=e=>{let{CustomLabel:t,field:n,prefix:l}=e;return(0,u.jsxs)(o.Fragment,{children:[l?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("span",{style:{display:"inline-block"},children:l})," > "]}):null,(0,u.jsx)("span",{style:{display:"inline-block"},children:(0,u.jsx)(ep,{CustomComponent:t,Fallback:(0,u.jsx)(lD,{label:"label"in n&&n.label})})})]})},dV=e=>{var t,n;let{fields:l,formState:a,labelPrefix:o=null,parentPath:r="",path:i="",permissions:s}=e;if(!l)return[];let c=null==a||null==(n=a[i])||null==(t=n.customComponents)?void 0:t.Label;return null==l?void 0:l.reduce((e,t)=>{var n;let{operation:l,permissions:a,read:u}=(0,j.P)({field:t,operation:"update",parentName:(null==r?void 0:r.includes("."))?r.split(".")[r.split(".").length-1]:r,permissions:s});return((0,m.Z7)(t)||"ui"===t.type)&&((null==(n=t.admin)?void 0:n.disableBulkEdit)||t.unique||(0,m.I2)(t)||"readOnly"in t&&t.readOnly||!l||!u)?e:"array"!==t.type&&"blocks"!==t.type&&(0,m.sd)(t)?[...e,...dV({fields:t.fields,labelPrefix:dz({CustomLabel:c,field:t,prefix:o}),parentPath:i,path:dU(i,t),permissions:a})]:"tabs"===t.type&&"tabs"in t?[...e,...t.tabs.reduce((e,n)=>{if("fields"in n){let l="name"in n&&n.name;return[...e,...dV({fields:n.fields,labelPrefix:o,parentPath:i,path:l?dU(i,t):i,permissions:a})]}},[])]:[...e,{label:dz({CustomLabel:c,field:t,prefix:o}),value:{field:t,fieldPermissions:a,path:dU(i,t)}}]},[])},dH=e=>{let t=(0,f.c)(14),{fields:n,onChange:l,permissions:a}=e,{t:r}=(0,s.d)(),{dispatchFields:i,getFields:c}=eP(),d;t[0]!==n||t[1]!==c||t[2]!==a?(d=()=>dV({fields:(e=>{let t=["file","mimeType","thumbnailURL","width","height","filesize","filename","url","focalX","focalY","sizes"];return e.filter(e=>!t.includes("name"in e&&e.name))})(n),formState:c(),permissions:a}),t[0]=n,t[1]=c,t[2]=a,t[3]=d):d=t[3];let[p]=(0,o.useState)(d),h;if(t[4]!==i||t[5]!==c||t[6]!==l||t[7]!==p||t[8]!==r){let e;
1t[10]!==i||t[11]!==c||t[12]!==l?(e=e=>l({dispatchFields:i,formState:c(),selected:e}),t[10]=i,t[11]=c,t[12]=l,t[13]=e):e=t[13],h=(0,u.jsxs)("div",{className:"field-select",children:[(0,u.jsx)(lD,{label:r("fields:selectFieldsToEdit")}),(0,u.jsx)(sW,{getOptionValue:dq,isMulti:!0,onChange:e,options:p})]}),t[4]=i,t[5]=c,t[6]=l,t[7]=p,t[8]=r,t[9]=h}else h=t[9];return h};function dq(e){return"object"==typeof e.value&&"path"in e.value?String(e.value.path):String(e.value)}var dW=e=>{var t;let{collection:{fields:n,labels:{plural:l,singular:a}}={},collection:r,drawerSlug:i,forms:c}=e,[p,h]=(0,o.useState)(!1),{permissions:f}=lw(),{i18n:m,t:g}=(0,s.d)(),{closeModal:v}=nE(),{bulkUpdateForm:b}=dB(),{getFormState:y}=ci(),x=o.useRef(null),[w,j]=(0,o.useState)([]),C=null==f||null==(t=f.collections)?void 0:t[r.slug],S=(0,o.useMemo)(()=>(0,V.s)(w.reduce((e,t)=>(e[t.value.path]=!0,e),{})),[w]),k=(0,o.useCallback)(async e=>{let{formState:t,submitted:n}=e,l=cN(x),{state:a}=await y({collectionSlug:r.slug,docPermissions:C,docPreferences:null,formState:t,operation:"update",schemaPath:r.slug,select:S,signal:l.signal,skipValidation:!n});return x.current=null,a},[y,r,C,S]);(0,o.useEffect)(()=>{let e=x.current;return()=>{c_(e)}},[]);let _=(0,o.useCallback)(e=>{b(w.reduce((t,n)=>(e[n.value.path]&&(t[n.value.path]=e[n.value.path].value),t),{}),()=>v(i))},[v,i,b,w]),N=(0,o.useCallback)(async e=>{let{dispatchFields:t,formState:n,selected:l}=e;h(!0),j(l||[]);let{state:a}=await y({collectionSlug:r.slug,docPermissions:C,docPreferences:null,formState:n,operation:"update",schemaPath:r.slug,select:(0,V.s)(l.reduce((e,t)=>(e[t.value.path]=!0,e),{})),skipValidation:!0});t({type:"UPDATE_MANY",formState:a}),h(!1)},[y,r,C]);return(0,u.jsxs)("div",{className:"".concat(dK,"__main"),children:[(0,u.jsxs)("div",{className:"".concat(dK,"__header"),children:[(0,u.jsx)("h2",{className:"".concat(dK,"__header__title"),children:g("general:editingLabel",{count:c.length,label:(0,d.s)(c.length>1?l:a,m)})}),(0,u.jsx)("button",{"aria-label":g("general:close"),className:"".concat(dK,"__header__close"),id:"close-drawer__".concat(i),onClick:()=>v(i),type:"button",children:(0,u.jsx)(s.a,{})})]}),(0,u.jsxs)(di,{className:"".concat(dK,"__form"),isInitializing:p,onChange:[k],onSubmit:_,children:[(0,u.jsx)(dH,{fields:n,onChange:N,permissions:C.fields}),0===w.length?null:(0,u.jsx)("div",{className:"render-fields",children:(0,u.jsx)(aF,{value:void 0,children:w.map((e,t)=>{let{value:{field:n,fieldPermissions:l,path:a}}=e;return(0,u.jsx)(hR,{clientFieldConfig:n,indexPath:"",parentPath:"",parentSchemaPath:"",path:a,permissions:l},"".concat(a,"-").concat(t))})})}),(0,u.jsx)("div",{className:"".concat(dK,"__sidebar-wrap"),children:(0,u.jsx)("div",{className:"".concat(dK,"__sidebar"),children:(0,u.jsx)("div",{className:"".concat(dK,"__sidebar-sticky-wrap"),children:(0,u.jsx)("div",{className:"".concat(dK,"__document-actions"),children:(0,u.jsx)(tD,{type:"submit",children:g("general:applyChanges")})})})})})]})]})},dK="edit-many-bulk-uploads",dY=e=>{var t,n;let l,a=(0,f.c)(5),{collection:o,collection:r}=e,{slug:i}=void 0===o?{}:o,{permissions:c}=lw(),{t:d}=(0,s.d)(),{forms:p}=dB(),h=null==c||null==(n=c.collections)||null==(t=n[i])?void 0:t.update,m="edit-".concat(i,"-bulk-uploads");return h?(a[0]!==r||a[1]!==m||a[2]!==p||a[3]!==d?(l=(0,u.jsxs)("div",{className:dK,children:[(0,u.jsx)(ls,{"aria-label":d("general:editAll"),className:"".concat(dK,"__toggle"),slug:m,children:d("general:editAll")}),(0,u.jsx)(ni,{children:(0,u.jsx)(lc,{Header:null,slug:m,children:(0,u.jsx)(dW,{collection:r,drawerSlug:m,forms:p})})})]}),a[0]=r,a[1]=m,a[2]=p,a[3]=d,a[4]=l):l=a[4],l):null},dG="bulk-upload--actions-bar";function dQ(e){let t=(0,f.c)(15),{collectionConfig:n}=e,{activeIndex:l,forms:a,setActiveIndex:o}=dB(),{t:r}=(0,s.d)(),i=l+1,c;if(t[0]!==l||t[1]!==n||t[2]!==a.length||t[3]!==o||t[4]!==r||t[5]!==i){let e,s;t[7]!==l||t[8]!==a.length||t[9]!==o?(e=()=>{let e=l-1;e<0?o(a.length-1):o(e)},t[7]=l,t[8]=a.length,t[9]=o,t[10]=e):e=t[10],t[11]!==l||t[12]!==a.length||t[13]!==o?(s=()=>{let e=l+1;e===a.length?o(0):o(e)},t[11]=l,t[12]=a.length,t[13]=o,t[14]=s):s=t[14],c=(0,u.jsxs)("div",{className:dG,children:[(0,u.jsxs)("div",{className:"".concat(dG,"__navigation"),children:[(0,u.jsxs)("p",{className:"".concat(dG,"__locationText"),children:[(0,u.jsx)("strong",{children:i})," ".concat(r("general:of")," "),(0,u.jsx)("strong",{children:a.length})]}),(0,u.jsxs)("div",{className:"".concat(dG,"__controls"),children:[(0,u.jsx)(tD,{"aria-label":r("general:previous"),buttonStyle:"none",onClick:e,type:"button",children:(0,u.jsx)(ta,{direction:"left"})}),(0,u.jsx)(tD,{"aria-label":r("general:next"),buttonStyle:"none",onClick:s,type:"button",children:(0,u.jsx)(ta,{direction:"right"})})]}),(0,u.jsx)(dY,{collection:n})]}),(0,u.jsx)(dX,{className:"".concat(dG,"__saveButtons")})]}),t[0]=l,t[1]=n,t[2]=a.length,t[3]=o,t[4]=r,t[5]=i,t[6]=c}else c=t[6];return c}function dX(e){var t,n,l,a,o;let r=(0,f.c)(12),{className:c}=e,{getEntityConfig:d}=(0,i.c)(),{t:p}=(0,s.d)(),{collectionSlug:h,hasPublishPermission:m,hasSavePermission:g,saveAllDocs:v}=dB(),b;
1r[0]!==h||r[1]!==d?(b=d({collectionSlug:h}),r[0]=h,r[1]=d,r[2]=b):b=r[2];let y=b,x;r[3]!==c?(x=["".concat(dG,"__buttons"),c].filter(Boolean),r[3]=c,r[4]=x):x=r[4];let w=x.join(" "),j;return r[5]!==(null==y||null==(t=y.versions)?void 0:t.drafts)||r[6]!==m||r[7]!==g||r[8]!==v||r[9]!==p||r[10]!==w?(j=(0,u.jsxs)("div",{className:w,children:[(null==y||null==(n=y.versions)?void 0:n.drafts)&&g?(0,u.jsx)(tD,{buttonStyle:"secondary",onClick:()=>void v({overrides:{_status:"draft"}}),children:p("version:saveDraft")}):null,(null==y||null==(l=y.versions)?void 0:l.drafts)&&m?(0,u.jsx)(tD,{onClick:()=>void v({overrides:{_status:"published"}}),children:p("version:publish")}):null,(null==y||null==(a=y.versions)?void 0:a.drafts)||!g?null:(0,u.jsx)(tD,{onClick:()=>void v(),children:p("general:save")})]}),r[5]=null==y||null==(o=y.versions)?void 0:o.drafts,r[6]=m,r[7]=g,r[8]=v,r[9]=p,r[10]=w,r[11]=j):j=r[11],j}var d$="bulk-upload--discard-without-saving";function dZ(){let e=(0,f.c)(9),{t:t}=(0,s.d)(),{closeModal:n}=nE(),{drawerSlug:l}=hy(),a;e[0]!==n?(a=()=>{n(d$)},e[0]=n,e[1]=a):a=e[1];let o=a,r;e[2]!==n||e[3]!==l?(r=()=>{n(l),n(d$)},e[2]=n,e[3]=l,e[4]=r):r=e[4];let i=r,c;return e[5]!==o||e[6]!==i||e[7]!==t?(c=(0,u.jsx)(lf,{body:t("general:changesNotSaved"),cancelLabel:t("general:stayOnThisPage"),confirmLabel:t("general:leaveAnyway"),heading:t("general:leaveWithoutSaving"),modalSlug:d$,onCancel:o,onConfirm:i}),e[5]=o,e[6]=i,e[7]=t,e[8]=c):c=e[8],c}function dJ(e){let{className:t}=e;
1return(0,u.jsx)("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:(0,u.jsx)("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 d0=()=>{let{getEntityConfig:e}=(0,i.c)(),{collectionSlug:t}=aD(),{labels:n}=e({collectionSlug:t}),{i18n:l}=(0,s.d)();return(0,u.jsxs)("div",{className:"trash-banner",children:[(0,u.jsx)(dJ,{}),(0,u.jsx)("p",{children:l.t("general:documentIsTrashed",{label:"".concat((0,d.s)(null==n?void 0:n.singular,l))})})]})},d1="document-fields",d3=e=>{let{AfterFields:t,BeforeFields:n,docPermissions:l,fields:a,forceSidebarWrap:r,isTrashed:i=!1,readOnly:s,schemaPathSegments:c}=e,{hasSidebarFields:d,mainFields:p,sidebarFields:h}=(0,o.useMemo)(()=>a.reduce((e,t)=>((0,m.zj)(t)?(e.sidebarFields.push(t),e.mainFields.push(null),e.hasSidebarFields=!0):(e.mainFields.push(t),e.sidebarFields.push(null)),e),{hasSidebarFields:!1,mainFields:[],sidebarFields:[]}),[a]);return(0,u.jsxs)("div",{className:[d1,d?"".concat(d1,"--has-sidebar"):"".concat(d1,"--no-sidebar"),r&&"".concat(d1,"--force-sidebar-wrap")].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:"".concat(d1,"__main"),children:(0,u.jsxs)(la,{className:"".concat(d1,"__edit"),children:[i&&(0,u.jsx)(d0,{}),n,(0,u.jsx)(hL,{className:"".concat(d1,"__fields"),fields:p,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:c.join("."),permissions:null==l?void 0:l.fields,readOnly:s}),t]})}),d?(0,u.jsx)("div",{className:"".concat(d1,"__sidebar-wrap"),children:(0,u.jsx)("div",{className:"".concat(d1,"__sidebar"),children:(0,u.jsx)("div",{className:"".concat(d1,"__sidebar-fields"),children:(0,u.jsx)(hL,{fields:h,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:c.join("."),permissions:null==l?void 0:l.fields,readOnly:s})})})}):null]})};function d2(e){let{className:t}=e;return(0,u.jsx)("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:(0,u.jsx)("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"})})}var d6=o.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 d5(e){var t,n;let{activeCollectionFolderSlugs:l,allCollectionFolderSlugs:a=[],allowCreateCollectionSlugs:r,allowMultiSelection:c=!0,baseFolderPath:d,breadcrumbs:p=[],children:f,documents:m,folderFieldName:g,folderID:b,FolderResultsComponent:x,onItemClick:w,search:j,sort:C="name",subfolders:S}=e,k=d4(),{config:_}=(0,i.c)(),{routes:N,serverURL:E}=_,P=lp(),{t:D}=(0,s.d)(),T=(0,h.useRouter)(),{startRouteTransition:R}
1=e8(),A=lN(),L=A?A.code:void 0,O=o.useRef(new Set),[F,M]=o.useState([]),[I,B]=o.useState(x||(()=>null)),[U]=o.useState(()=>_.collections.find(e=>_.folders&&e.slug===_.folders.slug)),z=U.slug,V=(0,h.useSearchParams)(),W=o.useMemo(()=>ce(V),[V]),[K,Y]=o.useState(W),[G,Q]=o.useState(!1),[X,$]=o.useState(()=>new Set),[Z,J]=o.useState(-1),[ee,et]=o.useState(),[en,el]=o.useState(p),ea=o.useRef(null),eo=S.length+m.length,er=o.useCallback(()=>{J(-1),$(new Set),et(void 0),O.current=new Set},[]),ei=o.useCallback(function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="page"in t?t.page:null==K?void 0:K.page;return"search"in t&&(n="1"),{...K,...t,locale:L,page:n,relationTo:"relationTo"in t?t.relationTo:null==K?void 0:K.relationTo,search:"search"in t?t.search:null==K?void 0:K.search,sort:"sort"in t?t.sort:null!=(e=null==K?void 0:K.sort)?e:void 0}},[K,L]),es=o.useCallback(e=>{let{query:t,updateURL:n}=e;if(n){let e=ei(t);R(()=>T.replace("".concat(y.A({...e,relationTo:JSON.stringify(e.relationTo)},{addQueryPrefix:!0})))),Y(e)}},[ei,T,R]),ec=o.useCallback(e=>{let t=y.A(ei({page:"1",search:""}),{addQueryPrefix:!0});return(0,v.Q)({adminRoute:_.routes.admin,path:"".concat(d).concat(e?"/".concat(e):"").concat(t),serverURL:_.serverURL})},[d,_.routes.admin,_.serverURL,ei]),eu=o.useCallback(e=>[...S,...m].find(t=>t.itemKey===e),[m,S]),ed=o.useCallback(()=>Array.from(X).reduce((e,t)=>{let n=eu(t);return n&&e.push(n),e},[]),[X,eu]),ep=o.useCallback(e=>{let{collectionSlug:t,docID:n}=e;1===P?t===z?R(()=>{T.push(ec(n)),er()}):t&&R(()=>{T.push((0,v.Q)({adminRoute:_.routes.admin,path:"/collections/".concat(t,"/").concat(n),serverURL:E})),er()}):er(),"function"==typeof w&&w(eu("".concat(t,"-").concat(n)))},[E,er,_.routes.admin,P,z,ec,eu,w,T,R]),eh=o.useCallback(e=>{let t=[...S,...m].reduce((e,t,n)=>(X.has(t.itemKey)&&e.push(n),e),[]);if(0===t.length)return[e];let n=Math.min(...t),l=Math.max(...t),a=e>=n&&e<=l,o=e,r=Math.min(o=a?e===n||e===l?e:Math.abs(e-n)>=Math.abs(e-l)?n:l:Math.abs(e-n)<=Math.abs(e-l)?n:l,e),i=Array.from({length:Math.max(o,e)-r+1},(e,t)=>r+t);return a?i:[...new Set([...t,...i])]},[S,m,X]),ef=o.useCallback(e=>{let{indexes:t}=e,{newSelectedFolderCollections:n,newSelectedItemKeys:l}=[...S,...m].reduce((e,n,l)=>{var a;return t.includes(l)&&(e.newSelectedItemKeys.add(n.itemKey),n.relationTo===z?null==(a=n.value.folderType)||a.forEach(t=>{e.newSelectedFolderCollections.includes(t)||e.newSelectedFolderCollections.push(t)}):e.newSelectedFolderCollections.includes(n.relationTo)||e.newSelectedFolderCollections.push(n.relationTo)),e},{newSelectedFolderCollections:[],newSelectedItemKeys:new Set});M(n),$(l)},[m,z,S]),em=o.useCallback(e=>{let{event:t,item:n}=e,{code:l,ctrlKey:a,metaKey:o,shiftKey:r}=t,i=a||o,s=X.has(n.itemKey),u=[...S,...m],d=u.findIndex(e=>e.itemKey===n.itemKey);switch(l){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":{if(t.preventDefault(),-1===d)break;let e="ArrowLeft"===l||"ArrowUp"===l?d-1:d+1;if(e<0||e>eo-1)return;if(J(e),i)break;if(r&&c)return void ef({indexes:eh(e)});r||$(new Set([u[e].itemKey]));break}case"Enter":if(1===X.size){J(void 0),ep({collectionSlug:n.relationTo,docID:(0,H.r)(n.value)});return}break;case"Escape":er();break;case"KeyA":c&&i&&(t.preventDefault(),J(eo-1),ef({indexes:Array.from({length:eo},(e,t)=>t)}));break;case"Space":c&&r?(t.preventDefault(),ef({indexes:[...S,...m].reduce((e,t,l)=>{if(t.itemKey===n.itemKey){if(s)return e;e.push(l)}else X.has(t.itemKey)&&e.push(l);return e},[])})):(t.preventDefault(),ef({indexes:s?[]:[d]}));break;case"Tab":if(c&&r){let e=d-1;e<0&&(null==X?void 0:X.size)>0&&J(e)}else d+1===eo&&X.size>0&&J(eo-1)}},[X,S,m,c,eh,ef,ep,er,eo]),eg=o.useCallback(e=>{let{event:t,item:n}=e,l=!1,a=t.ctrlKey||t.metaKey,o=t.shiftKey,r=X.has(n.itemKey),i=[...S,...m],s=i.findIndex(e=>e.itemKey===n.itemKey);if(c&&a){let e;t.preventDefault(),ef({indexes:i.reduce((l,a,o)=>{if(a.itemKey===n.itemKey){if(r&&"pointermove"!==t.type)return l;l.push(o),e=a.itemKey}else X.has(a.itemKey)&&l.push(o);return l},[])}),e&&et(eu(e))}else if(c&&o)-1!==s&&ef({indexes:eh(s)});else if(c&&"pointermove"===t.type)r||ef({indexes:i.reduce((e,t,l)=>(t.itemKey===n.itemKey&&e.push(l),e),[])}
1),et(eu(n.itemKey));else{let e=Date.now();l=e-ea.current<400&&(null==ee?void 0:ee.itemKey)===n.itemKey,ea.current=e,l||ef({indexes:r&&1===X.size?[]:[s]}),et(eu(n.itemKey))}l&&ep({collectionSlug:n.relationTo,docID:(0,H.r)(n.value)})},[X,S,m,c,ee,eu,ef,ep,eh]),ev=o.useCallback(async e=>{let{itemsToMove:t,toFolderID:n}=e;if(t.length){if(1===t.length&&t[0].relationTo===z&&t[0].value.id===b){let e=y.A({depth:0,locale:L},{addQueryPrefix:!0});200!==(await fetch("".concat(E).concat(N.api,"/").concat(z,"/").concat(b).concat(e),{body:JSON.stringify({[g]:n||null}),credentials:"include",headers:{"content-type":"application/json"},method:"PATCH"})).status&&eJ.error(D("general:error"))}else for(let[e,l]of Object.entries(t.reduce((e,t)=>(e[t.relationTo]||(e[t.relationTo]=[]),e[t.relationTo].push(t.value.id),e),{}))){let t=y.A({depth:0,limit:0,locale:L,where:{id:{in:l}}},{addQueryPrefix:!0});try{await fetch("".concat(E).concat(N.api,"/").concat(e).concat(t),{body:JSON.stringify({[g]:n||null}),credentials:"include",headers:{"content-type":"application/json"},method:"PATCH"})}catch(e){eJ.error(D("general:error")),console.error(e);continue}}er()}},[b,er,z,g,N.api,E,D,L]),eb=o.useCallback(e=>{var t;function n(e){let{item:t,selectedFolderCollections:n}=e;return!(!t.value.folderType||Array.isArray(t.value.folderType)&&0===t.value.folderType.length)&&(0===n.length?!!(t.value.folderType||t.value.folderType.length>0):n.some(e=>!t.value.folderType.includes(e)))}return G?!!X.has(e.itemKey)||e.relationTo!==z||n({item:e,selectedFolderCollections:F}):(null==k||null==(t=k.selectedItemKeys)?void 0:t.size)?!!k.selectedItemKeys.has(e.itemKey)||e.relationTo!==z||n({item:e,selectedFolderCollections:k.selectedFolderCollections}):void 0},[F,G,X,z,null==k?void 0:k.selectedFolderCollections,null==k?void 0:k.selectedItemKeys]);return o.useEffect(()=>{x&&B(x)},[x]),(0,u.jsx)(d6,{value:{activeCollectionFolderSlugs:l||a,allCollectionFolderSlugs:a,allowCreateCollectionSlugs:r,breadcrumbs:en,checkIfItemIsDisabled:eb,clearSelections:er,currentFolder:(null==en||null==(t=en[en.length-1])?void 0:t.id)!==void 0?(0,q.p)({folderFieldName:g,isUpload:!1,relationTo:z,useAsTitle:U.admin.useAsTitle,value:en[en.length-1]}):null,documents:m,dragOverlayItem:ee,focusedRowIndex:Z,folderCollectionConfig:U,folderCollectionSlug:z,folderFieldName:g,folderID:b,FolderResultsComponent:I,folderType:null==en||null==(n=en[en.length-1])?void 0:n.folderType,getFolderRoute:ec,getSelectedItems:ed,isDragging:G,itemKeysToMove:k.selectedItemKeys,moveToFolder:ev,onItemClick:eg,onItemKeyPress:em,refineFolderData:es,search:j,selectedFolderCollections:F,selectedItemKeys:X,setBreadcrumbs:el,setFocusedRowIndex:J,setIsDragging:Q,sort:C,subfolders:S},children:f})}function d4(){let e=o.use(d6);if(void 0===e)throw Error("useFolder must be used within a FolderProvider");return e}var d8=(0,o.createContext)({cachingEnabled:!0,clearRouteCache:()=>{}}),d9=e=>{let t,n,l,a,r=(0,f.c)(17),{cachingEnabled:i,children:s}=e,c=void 0===i||i,d=(0,h.usePathname)(),p=(0,h.useRouter)(),m=(0,o.useRef)(!1),g;r[0]!==p?(g=()=>{p.refresh()},r[0]=p,r[1]=g):g=r[1];let v=g,b;r[2]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{let e=()=>{m.current=!0};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},r[2]=b):b=r[2],r[3]!==p?(t=[p],r[3]=p,r[4]=t):t=r[4],(0,o.useEffect)(b,t),r[5]!==c||r[6]!==v?(n=e=>{(c||m.current)&&(m.current=!1,v())},r[5]=c,r[6]=v,r[7]=n):n=r[7];let y=lv(n),x;return r[8]!==y||r[9]!==d?(x=()=>{y(d)},r[8]=y,r[9]=d,r[10]=x):x=r[10],r[11]!==d?(l=[d],r[11]=d,r[12]=l):l=r[12],(0,o.useEffect)(x,l),r[13]!==c||r[14]!==s||r[15]!==v?(a=(0,u.jsx)(d8,{value:{cachingEnabled:c,clearRouteCache:v},children:s}),r[13]=c,r[14]=s,r[15]=v,r[16]=a):a=r[16],a},d7=()=>(0,o.use)(d8),pe=e=>{let{type:t="submit",buttonId:n,children:l,disabled:a,onClick:o,programmaticSubmit:r,ref:i}=e,s=eA(),c=eL(),d=eF(),{disabled:p,submit:h}=eP();return(0,u.jsx)("div",{className:"form-submit",children:(0,u.jsx)(tD,{ref:i,...e,disabled:!!(a||d||s||c||p)||void 0,id:n,onClick:null!=o?o:r?()=>{h()}:void 0,type:t,children:l})})},pt="drawer-action-header",pn=e=>{let t=(0,f.c)(10),{cancelLabel:n,className:l,onCancel:a,onSave:o,saveLabel:r,title:i}=e,{t:c}=(0,s.d)(),d;
1t[0]!==l?(d=[pt,l].filter(Boolean),t[0]=l,t[1]=d):d=t[1];let p=d.join(" "),h;return t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==c||t[7]!==p||t[8]!==i?(h=(0,u.jsx)("div",{className:p,children:(0,u.jsxs)("div",{className:"".concat(pt,"__content"),children:[(0,u.jsx)("h1",{className:"".concat(pt,"__title"),children:i}),(0,u.jsxs)("div",{className:"".concat(pt,"__actions"),children:[(0,u.jsx)(tD,{"aria-label":c("general:cancel"),buttonStyle:"secondary",onClick:a,children:n||c("general:cancel")}),(0,u.jsx)(pe,{"aria-label":c("general:applyChanges"),onClick:o,children:r||c("general:applyChanges")})]})]})}),t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=p,t[8]=i,t[9]=h):h=t[9],h};function pl(e){let{children:t,className:n}=e;return(0,u.jsx)("div",{className:["drawer-content-container",n].filter(Boolean).join(" "),children:t})}var pa="create-new-doc-in-folder";function po(e){let t,n=(0,f.c)(22),{buttonLabel:l,collectionSlugs:a,folderAssignedCollections:r,onCreateSuccess:c,slugPrefix:p}=e,h="".concat(p,"-new-doc-in-folder-drawer"),{i18n:m}=(0,s.d)(),{closeModal:g,openModal:v}=nE(),{config:b}=(0,i.c)(),{folderCollectionConfig:y,folderCollectionSlug:x,folderFieldName:w,folderID:j}=d4(),C;n[0]!==x?(C={collectionSlug:x},n[0]=x,n[1]=C):C=n[1];let[S,,k]=cO(C),{closeDrawer:_,openDrawer:N}=k,[E,P]=o.useState(),D;n[2]!==a||n[3]!==b?(D=()=>a.reduce((e,t)=>{let n=b.collections.find(e=>{let{slug:n}=e;return n===t});return n&&e.push(n),e},[]),n[2]=a,n[3]=b,n[4]=D):D=n[4];let[T]=o.useState(D);return 0===T.length?null:(n[5]!==S||n[6]!==l||n[7]!==_||n[8]!==g||n[9]!==a||n[10]!==E||n[11]!==T||n[12]!==r||n[13]!==y.slug||n[14]!==w||n[15]!==j||n[16]!==m||n[17]!==h||n[18]!==c||n[19]!==N||n[20]!==v?(t=(0,u.jsxs)(o.Fragment,{children:[1===T.length?(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(pa,"__button"),el:"div",onClick:()=>{T[0].slug===y.slug?N():(P(T[0].slug),v(h))},size:"small",children:l}):(0,u.jsx)(t_,{button:(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(pa,"__popup-button"),el:"div",icon:"chevron",size:"small",children:l}),buttonType:"default",className:"".concat(pa,"__action-popup"),children:(0,u.jsx)(tc.ButtonGroup,{children:T.map((e,t)=>(0,u.jsx)(tc.Button,{onClick:()=>{e.slug===y.slug?N():(P(e.slug),v(h))},children:(0,d.s)(e.labels.singular,m)},t))})}),E&&(0,u.jsx)(cL,{collectionSlug:E,drawerSlug:h,initialData:{[w]:j},onSave:async e=>{let{doc:t}=e;await c({collectionSlug:E,doc:t}),g(h)},redirectAfterCreate:!1}),a.includes(y.slug)&&(0,u.jsx)(S,{initialData:{[w]:j,folderType:E?r||[E]:r},onSave:async e=>{await c({collectionSlug:y.slug,doc:e.doc}),_()},redirectAfterCreate:!1})]}),n[5]=S,n[6]=l,n[7]=_,n[8]=g,n[9]=a,n[10]=E,n[11]=T,n[12]=r,n[13]=y.slug,n[14]=w,n[15]=j,n[16]=m,n[17]=h,n[18]=c,n[19]=N,n[20]=v,n[21]=t):t=n[21],t)}var pr="no-results";function pi(e){let{Actions:t,Message:n}=e;return(0,u.jsxs)("div",{className:pr,children:[n,t&&t.length>0&&(0,u.jsx)("div",{className:"".concat(pr,"__actions"),children:t.map((e,t)=>(0,u.jsx)(o.Fragment,{children:e},t))})]})}var ps=e=>{let{elements:t,translationString:n}=e,l=n.split(/(<[^>]+>.*?<\/[^>]+>)/g);return(0,u.jsx)("span",{children:l.map((e,n)=>{if(t&&e.startsWith("<")&&e.endsWith(">")){let l=e[1],a=t[l];if(a){let t=RegExp("<".concat(l,">(.*?)</").concat(l,">"),"g"),o=e.replace(t,(e,t)=>t);return(0,u.jsx)(a,{children:(0,u.jsx)(ps,{translationString:o})},n)}}return e})})},pc=e=>{let{elements:t,i18nKey:n,t:l,variables:a}=e,o=l(n,a||{});return t?(0,u.jsx)(ps,{elements:t,translationString:o}):o},pu="folderBreadcrumbs";function pd(e){let{breadcrumbs:t,className:n}=e;return(0,u.jsx)("div",{className:"".concat(pu," ").concat(n||"").trim(),children:null==t?void 0:t.map((e,n)=>(0,u.jsxs)("div",{className:"".concat(pu,"__crumb"),children:[e.onClick?(0,u.jsx)(pp,{className:"".concat(pu,"__crumb-item"),id:e.id,onClick:e.onClick,children:e.name}):e.name,t.length>0&&n!==t.length-1&&(0,u.jsx)(ta,{className:"".concat(pu,"__crumb-chevron"),direction:"right"})]},n))})}function pp(e){let t,n=(0,f.c)(13),{id:l,children:a,className:o,onClick:r}=e,i="folder-".concat(l),s;n[0]!==l?(s={id:l,type:"folder"},n[0]=l,n[1]=s):s=n[1],n[2]!==i||n[3]!==s?(t={id:i,data:s},n[2]=i,n[3]=s,n[4]=t):t=n[4];let{isOver:c,setNodeRef:d}=(0,g.zM)(t),p=c&&"droppable-button--hover",h;
1n[5]!==o||n[6]!==p?(h=["droppable-button",o,p].filter(Boolean),n[5]=o,n[6]=p,n[7]=h):h=n[7];let m=h.join(" "),v;return n[8]!==a||n[9]!==r||n[10]!==d||n[11]!==m?(v=(0,u.jsx)("button",{className:m,onClick:r,ref:d,type:"button",children:a}),n[8]=a,n[9]=r,n[10]=d,n[11]=m,n[12]=v):v=n[12],v}function ph(){return(0,u.jsx)(d2,{className:"colored-folder-icon"})}var pf="move-folder-drawer",pm="".concat("move-folder-drawer","-confirm-move");function pg(e){return(0,u.jsx)(lc,{gutter:!1,Header:null,slug:e.drawerSlug,children:(0,u.jsx)(pv,{...e})})}function pv(e){var t;let{permissions:n}=lw(),[l,a]=o.useState([]),[r,i]=o.useState([]),[s,c]=o.useState([]),[d,p]=o.useState(null),[h,f]=o.useState(!1),[m,g]=o.useState(e.fromFolderID||null),v=o.useRef(!1),{getFolderResultsComponentAndData:b}=ci(),y=o.useCallback(async t=>{try{let n=await b({browseByFolder:!1,collectionsToDisplay:[e.folderCollectionSlug],displayAs:"grid",folderAssignedCollections:e.folderAssignedCollections,folderID:t,sort:"name"});c(n.breadcrumbs||[]),a((null==n?void 0:n.subfolders)||[]),i((null==n?void 0:n.documents)||[]),p(n.FolderResultsComponent||null),g(t),f(!0)}catch(e){c([]),a([]),i([])}v.current=!0},[b,e.folderAssignedCollections,e.folderCollectionSlug]);return o.useEffect(()=>{v.current||y(e.fromFolderID)},[y,e.fromFolderID]),h?(0,u.jsx)(d5,{allCollectionFolderSlugs:[e.folderCollectionSlug],allowCreateCollectionSlugs:(null==(t=n.collections[e.folderCollectionSlug])?void 0:t.create)?[e.folderCollectionSlug]:[],allowMultiSelection:!1,breadcrumbs:s,documents:r,folderFieldName:e.folderFieldName,folderID:m,FolderResultsComponent:d,onItemClick:async e=>{await y(e.value.id)},subfolders:l,children:(0,u.jsx)(pb,{...e,populateMoveToFolderDrawer:y})},m):(0,u.jsx)(cC,{})}function pb(e){var t,n,l;let a,r,i,c,p=(0,f.c)(34),{drawerSlug:h,fromFolderID:m,fromFolderName:g,itemsToMove:v,onConfirm:b,populateMoveToFolderDrawer:y,skipConfirmModal:x,...w}=e,{clearRouteCache:j}=d7(),{closeModal:C,isModalOpen:S,openModal:k}=nE(),_;p[0]!==v?(_=()=>v.length,p[0]=v,p[1]=_):_=p[1];let[N]=o.useState(_),[E,P]=o.useState(!1),{i18n:D,t:T}=(0,s.d)(),{breadcrumbs:R,folderCollectionConfig:A,folderCollectionSlug:L,folderFieldName:O,folderID:F,FolderResultsComponent:M,folderType:I,getSelectedItems:B,subfolders:U}=d4(),z;p[2]!==L?(z={collectionSlug:L},p[2]=L,p[3]=z):z=p[3];let[V,,q]=cO(z),{closeDrawer:W,openDrawer:K}=q,Y;p[4]!==R||p[5]!==B?(Y=()=>{let e=B();if(0!==e.length)return{id:e[0].value.id,name:e[0].value._folderOrDocumentTitle};{let e=null==R?void 0:R[R.length-1];return{id:(null==e?void 0:e.id)||null,name:(null==e?void 0:e.name)||null}}},p[4]=R,p[5]=B,p[6]=Y):Y=p[6];let G=Y,Q;p[7]!==L||p[8]!==F||p[9]!==m||p[10]!==y?(Q=async e=>{let{collectionSlug:t,doc:n}=e;await y(F),t!==L||(null==n||!n.folder||m!==(0,H.r)(null==n?void 0:n.folder))&&(m||(null==n?void 0:n.folder))||P(!0)},p[7]=L,p[8]=F,p[9]=m,p[10]=y,p[11]=Q):Q=p[11];let X=Q,$;p[12]!==G||p[13]!==b?($=()=>{"function"==typeof b&&b(G())},p[12]=G,p[13]=b,p[14]=$):$=p[14];let Z=$,J,ee;return p[15]!==j||p[16]!==h||p[17]!==E||p[18]!==S?(J=()=>{!S(h)&&E&&(P(!1),j())},ee=[h,S,j,E],p[15]=j,p[16]=h,p[17]=E,p[18]=S,p[19]=J,p[20]=ee):(J=p[19],ee=p[20]),o.useEffect(J,ee),p[21]!==C||p[22]!==h?(a=()=>{C(h)},p[21]=C,p[22]=h,p[23]=a):a=p[23],p[24]!==Z||p[25]!==k||p[26]!==x?(r=()=>{x?Z():k(pm)},p[24]=Z,p[25]=k,p[26]=x,p[27]=r):r=p[27],p[28]!==R.length||p[29]!==y?(i=R.length?()=>{y(null)}:void 0,p[28]=R.length,p[29]=y,p[30]=i):i=p[30],p[31]!==R.length||p[32]!==y?(c=(e,t)=>({id:e.id,name:e.name,onClick:t!==R.length-1?()=>{y(e.id)}:void 0}),p[31]=R.length,p[32]=y,p[33]=c):c=p[33],(0,u.jsxs)("div",{className:pf,children:[(0,u.jsx)(pn,{onCancel:a,onSave:r,saveLabel:T("general:select"),title:(0,u.jsx)(py,{action:w.action,count:N,fromFolderName:m?g:void 0,title:"moveItemToFolder"===w.action?w.title:void 0})}),(0,u.jsxs)("div",{className:"".concat(pf,"__breadcrumbs-section"),children:[(0,u.jsx)(pd,{breadcrumbs:[{id:null,name:(0,u.jsxs)("span",{className:"".concat(pf,"__folder-breadcrumbs-root"),children:[(0,u.jsx)(ph,{}),T("folder:folders")]}),onClick:i},...R.map(c)]}),U.length>0&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(pf,"__add-folder-button"),margin:!1,onClick:()=>{K()},children:T("fields:addLabel",{label:(0,d.s)(null==(t=A.labels)?void 0:t.singular,D)})}),(0,u.jsx)(V,{initialData:{[O]:F,folderType:I},onSave:e=>{X({collectionSlug:A.slug,doc:e.doc}),W()},redirectAfterCreate:!1})]})]}),(0,u.jsx)(pl,{className:"".concat(pf,"__body-section"),children:U.length>0?M:(0,u.jsx)(pi,{Actions:[(0,u.jsx)(po,{buttonLabel:"".concat(T("general:create")," ").concat((0,d.s)(null==(n=A.labels)?void 0:n.singular,D).toLowerCase()),collectionSlugs:[L],folderAssignedCollections:w.folderAssignedCollections,onCreateSuccess:X,slugPrefix:"create-new-folder-from-drawer--no-results"},"create-folder")],Message:(0,u.jsx)("p",{children:D.t("general:noResults",{label:"".concat((0,d.s)(null==(l=A.labels)?void 0:l.plural,D))})})})}),!x&&(0,u.jsx)(lf,{body:(0,u.jsx)(px,{action:w.action,count:N,fromFolderName:g,title:"moveItemToFolder"===w.action?w.title:void 0,toFolderName:G().name}),confirmingLabel:T("general:moving"),confirmLabel:T("general:move"),heading:T("general:confirmMove"),modalSlug:pm,onConfirm:Z})]})}function py(e){let t=(0,f.c)(14),{t:n}=(0,s.d)();switch(e.action){case"moveItemToFolder":if(e.fromFolderName){let l;return t[0]!==e.fromFolderName||t[1]!==e.title||t[2]!==n?(l=n("folder:movingFromFolder",{fromFolder:e.fromFolderName,title:e.title}),t[0]=e.fromFolderName,t[1]=e.title,t[2]=n,t[3]=l):l=t[3],l}{let l;return t[4]!==e.title||t[5]!==n?(l=n("folder:selectFolderForItem",{title:e.title}),t[4]=e.title,t[5]=n,t[6]=l):l=t[6],l}case"moveItemsToFolder":if(e.fromFolderName){let l="".concat(e.count," ").concat(n(e.count>1?"general:items":"general:item")),a;return t[7]!==e.fromFolderName||t[8]!==n||t[9]!==l?(a=n("folder:movingFromFolder",{fromFolder:e.fromFolderName,title:l}),t[7]=e.fromFolderName,t[8]=n,t[9]=l,t[10]=a):a=t[10],a}{let l="".concat(e.count," ").concat(n(e.count>1?"general:items":"general:item")),a;
1return t[11]!==n||t[12]!==l?(a=n("folder:selectFolderForItem",{title:l}),t[11]=n,t[12]=l,t[13]=a):a=t[13],a}}}function px(e){let t=(0,f.c)(14),{t:n}=(0,s.d)();switch(e.action){case"moveItemToFolder":if(e.toFolderName){let l;return t[0]!==e.title||t[1]!==e.toFolderName||t[2]!==n?(l=(0,u.jsx)(pc,{elements:{1:p_,2:pk},i18nKey:"folder:moveItemToFolderConfirmation",t:n,variables:{title:e.title,toFolder:e.toFolderName}}),t[0]=e.title,t[1]=e.toFolderName,t[2]=n,t[3]=l):l=t[3],l}{let l;return t[4]!==e.title||t[5]!==n?(l=(0,u.jsx)(pc,{elements:{1:pS},i18nKey:"folder:moveItemToRootConfirmation",t:n,variables:{title:e.title}}),t[4]=e.title,t[5]=n,t[6]=l):l=t[6],l}case"moveItemsToFolder":if(e.toFolderName){let l;return t[7]!==e.count||t[8]!==e.toFolderName||t[9]!==n?(l=(0,u.jsx)(pc,{elements:{1:pC,2:pj},i18nKey:"folder:moveItemsToFolderConfirmation",t:n,variables:{count:e.count,label:n(e.count>1?"general:items":"general:item"),toFolder:e.toFolderName}}),t[7]=e.count,t[8]=e.toFolderName,t[9]=n,t[10]=l):l=t[10],l}{let l;return t[11]!==e.count||t[12]!==n?(l=(0,u.jsx)(pc,{elements:{1:pw},i18nKey:"folder:moveItemsToRootConfirmation",t:n,variables:{count:e.count,label:n(e.count>1?"general:items":"general:item")}}),t[11]=e.count,t[12]=n,t[13]=l):l=t[13],l}}}function pw(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function pj(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function pC(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function pS(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function pk(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function p_(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function pN(e){let t=(0,f.c)(29),{buttonProps:n,className:l,folderCollectionSlug:a,folderFieldName:r}=e,c=void 0===l?"":l,{t:d}=(0,s.d)(),p=eM(pE),h;t[0]!==r?(h=e=>{let[t]=e;return t&&(null==t?void 0:t[r])||null},t[0]=r,t[1]=h):h=t[1];let m=eM(h),g=null==m?void 0:m.value,{id:v,collectionSlug:b,initialData:y,title:x}=aD(),{setModified:w}=eP(),j;t[2]!==d?(j=()=>"".concat(d("general:loading"),"..."),t[2]=d,t[3]=j):j=t[3];let[C,S]=o.useState(j),{config:k}=(0,i.c)(),_=(0,o.useId)(),N,E;t[4]!==k.routes.api||t[5]!==a||t[6]!==g||t[7]!==d?(N=()=>{!async function(){if(g&&("string"==typeof g||"number"==typeof g)){let e=await (await fetch("".concat(k.routes.api,"/").concat(a,"/").concat(g))).json();S((null==e?void 0:e.name)||d("folder:noFolder"))}else S(d("folder:noFolder"))}()},E=[a,k.routes.api,g,d],t[4]=k.routes.api,t[5]=a,t[6]=g,t[7]=d,t[8]=N,t[9]=E):(N=t[8],E=t[9]),o.useEffect(N,E);let P="move-to-folder-".concat(_),D;t[10]!==m||t[11]!==p||t[12]!==r||t[13]!==w?(D=e=>{let{id:t}=e;m.value!==t&&(p({type:"UPDATE",path:r,value:t}),w(!0))},t[10]=m,t[11]=p,t[12]=r,t[13]=w,t[14]=D):D=t[14];let T=!(null==m?void 0:m.value),R;return t[15]!==n||t[16]!==c||t[17]!==b||t[18]!==a||t[19]!==r||t[20]!==g||t[21]!==C||t[22]!==v||t[23]!==y||t[24]!==P||t[25]!==D||t[26]!==T||t[27]!==x?(R=(0,u.jsx)(pP,{buttonProps:n,className:c,collectionSlug:b,docData:y,docID:v,docTitle:x,folderCollectionSlug:a,folderFieldName:r,fromFolderID:g,fromFolderName:C,modalSlug:P,onConfirm:D,skipConfirmModal:T}),t[15]=n,t[16]=c,t[17]=b,t[18]=a,t[19]=r,t[20]=g,t[21]=C,t[22]=v,t[23]=y,t[24]=P,t[25]=D,t[26]=T,t[27]=x,t[28]=R):R=t[28],R}function pE(e){let[,t]=e;return t}var pP=e=>{let t=(0,f.c)(22),{buttonProps:n,className:l,collectionSlug:a,docData:o,docID:r,docTitle:c,folderCollectionSlug:p,folderFieldName:h,fromFolderID:m,fromFolderName:g,modalSlug:v,onConfirm:b,skipConfirmModal:y}=e,{getEntityConfig:x}=(0,i.c)(),{i18n:w,t:j}=(0,s.d)(),{closeModal:C,openModal:S}=nE(),k=lp(),_;if(t[0]!==n||t[1]!==l||t[2]!==C||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==c||t[7]!==k||t[8]!==p||t[9]!==h||t[10]!==m||t[11]!==g||t[12]!==x||t[13]!==w||t[14]!==v||t[15]!==b||t[16]!==S||t[17]!==y||t[18]!==j){let e=li({slug:v,depth:k}),i=c||(0,d.s)(x({collectionSlug:a}).labels.singular,w),s;t[20]!==l?(s=["move-doc-to-folder",l].filter(Boolean),t[20]=l,t[21]=s):s=t[21],_=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"subtle",className:s.join(" "),icon:(0,u.jsx)(d2,{}),iconPosition:"left",onClick:()=>{S(e)},...n,children:g}),(0,u.jsx)(pg,{action:"moveItemToFolder",drawerSlug:e,folderAssignedCollections:[a],folderCollectionSlug:p,folderFieldName:h,fromFolderID:m,fromFolderName:g,itemsToMove:[{itemKey:"".concat(a,"-").concat(r),relationTo:a,value:{...o,id:r}}],onConfirm:async t=>{if(m!==t.id&&"function"==typeof b)try{await b(t),t.id?eJ.success(j("folder:itemHasBeenMoved",{folderName:'"'.concat(t.name,'"'),title:i})):eJ.success(j("folder:itemHasBeenMovedToRoot",{title:i}))}catch(e){}C(e)},skipConfirmModal:y,title:i})]}),t[0]=n,t[1]=l,t[2]=C,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=k,t[8]=p,t[9]=h,t[10]=m,t[11]=g,t[12]=x,t[13]=w,t[14]=v,t[15]=b,t[16]=S,t[17]=y,t[18]=j,t[19]=_}else _=t[19];return _},pD={x:0,y:0,width:0,height:0,unit:"px"},pT=(e,t,n)=>Math.min(Math.max(e,t),n),pR=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(e=>e&&"string"==typeof e).join(" ")},pA=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function pL(e,t,n){return"%"===e.unit?{...pD,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function pO(e,t,n){return e.unit?"px"===e.unit?{...pD,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...pD,...e,unit:"px"}}function pF(e,t,n,l,a){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,i=arguments.length>7&&void 0!==arguments[7]?arguments[7]:l,s=arguments.length>8&&void 0!==arguments[8]?arguments[8]:a,c={...e},u=Math.min(o,l),d=Math.min(r,a),p=Math.min(i,l),h=Math.min(s,a);t&&(t>
11?(d=(u=r?r*t:u)/t,p=i*t):(u=(d=o?o/t:d)*t,h=s/t)),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 f=l-(c.x+c.width);f<0&&(c.x=Math.min(c.x,l-u),c.width+=f);let m=a-(c.y+c.height);if(m<0&&(c.y=Math.min(c.y,a-d),c.height+=m),c.width<u&&(("sw"===n||"nw"==n)&&(c.x-=u-c.width),c.width=u),c.height<d&&(("nw"===n||"ne"==n)&&(c.y-=d-c.height),c.height=d),c.width>p&&(("sw"===n||"nw"==n)&&(c.x-=p-c.width),c.width=p),c.height>h&&(("nw"===n||"ne"==n)&&(c.y-=h-c.height),c.height=h),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,d);("nw"===n||"ne"==n)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,u);("sw"===n||"nw"==n)&&(c.x-=e-c.width),c.width=e}}return c}var pM={capture:!0,passive:!1},pI=class e extends o.PureComponent{get document(){return document}getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:n,width:l,height:a}=e.getBoundingClientRect();return{x:t,y:n,width:l,height:a}}componentDidUpdate(e){let{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){let{width:e,height:l}=this.getBox();e&&l&&n(pO(t,e,l),pL(t,e,l))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,pM),this.document.addEventListener("pointerup",this.onDocPointerDone,pM),this.document.addEventListener("pointercancel",this.onDocPointerDone,pM),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,pM),this.document.removeEventListener("pointerup",this.onDocPointerDone,pM),this.document.removeEventListener("pointercancel",this.onDocPointerDone,pM),this.docMoveBound=!1)}getCropStyle(){let{crop:e}=this.props;if(e)return{top:"".concat(e.y).concat(e.unit),left:"".concat(e.x).concat(e.unit),width:"".concat(e.width).concat(e.unit),height:"".concat(e.height).concat(e.unit)}}dragCrop(){let{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(t),l=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return n.x=pT(e.startCropX+l,0,t.width-n.width),n.y=pT(e.startCropY+a,0,t.height-n.height),n}getPointRegion(e,t,n,l){let{evData:a}=this,o=a.clientX-e.x,r=a.clientY-e.y,i;return i=l&&t?"nw"===t||"n"===t||"ne"===t:r<a.startCropY,(n&&t?"nw"===t||"w"===t||"sw"===t:o<a.startCropX)?i?"nw":"sw":i?"ne":"se"}resolveMinDimensions(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=Math.min(n,e.width),o=Math.min(l,e.height);return t&&(a||o)?t>1?a?[a,a/t]:[o*t,o]:o?[o*t,o]:[a,a/t]:[a,o]}resizeCrop(){let{evData:t}=this,{aspect:n=0,maxWidth:l,maxHeight:a}=this.props,o=this.getBox(),[r,i]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight),s=this.makePixelCrop(o),c=this.getPointRegion(o,t.ord,r,i),u=t.ord||c,d=t.clientX-t.startClientX,p=t.clientY-t.startClientY;(r&&"nw"===u||"w"===u||"sw"===u)&&(d=Math.min(d,-r)),(i&&"nw"===u||"n"===u||"ne"===u)&&(p=Math.min(p,-i));let h={unit:"px",x:0,y:0,width:0,height:0};"ne"===c?(h.x=t.startCropX,h.width=d,n?h.height=h.width/n:h.height=Math.abs(p),h.y=t.startCropY-h.height):"se"===c?(h.x=t.startCropX,h.y=t.startCropY,h.width=d,n?h.height=h.width/n:h.height=p):"sw"===c?(h.x=t.startCropX+d,h.y=t.startCropY,h.width=Math.abs(d),n?h.height=h.width/n:h.height=p):"nw"===c&&(h.x=t.startCropX+d,h.width=Math.abs(d),n?(h.height=h.width/n,h.y=t.startCropY-h.height):(h.height=Math.abs(p),h.y=t.startCropY+p));let f=pF(h,n,c,o.width,o.height,r,i,l,a);return n||e.xyOrds.indexOf(u)>-1?s=f:e.xOrds.indexOf(u)>-1?(s.x=f.x,s.width=f.width):e.yOrds.indexOf(u)>-1&&(s.y=f.y,s.height=f.height),s.x=pT(s.x,0,o.width-s.width),s.y=pT(s.y,0,o.height-s.height),s}createCropSelection(){let{ariaLabels:t=e.defaultProps.ariaLabels,disabled:n,locked:l,renderSelectionAddon:a,ruleOfThirds:r,crop:i}=this.props,s=this.getCropStyle();if(i)return o.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!l&&o.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},o.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),o.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),o.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),o.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&o.createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:e=>e.stopPropagation()},a(this.state)),r&&o.createElement(o.Fragment,null,o.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),o.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return pO({...pD,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:t,circularCrop:n,className:l,crop:a,disabled:r,locked:i,style:s,ruleOfThirds:c}=this.props,{cropIsActive:u,newCropIsBeingDrawn:d}=this.state,p=a?this.createCropSelection():null,h=pR("ReactCrop",l,u&&"ReactCrop--active",r&&"ReactCrop--disabled",i&&"ReactCrop--locked",d&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&c&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return o.createElement("div",{ref:this.componentRef,className:h,style:s},o.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),p)}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=(0,o.createRef)(),this.mediaRef=(0,o.createRef)(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{let{crop:t,disabled:n}=this.props,l=this.getBox();if(!t)return;let a=pO(t,l.width,l.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let o=e.target.dataset.ord,r=e.clientX,i=e.clientY,s=a.x,c=a.y;if(o){let t=e.clientX-l.x,n=e.clientY-l.y,u=0,d=0;"ne"===o||"e"==o?(u=t-(a.x+a.width),d=n-a.y,s=a.x,c=a.y+a.height):"se"===o||"s"===o?(u=t-(a.x+a.width),d=n-(a.y+a.height),s=a.x,c=a.y):"sw"===o||"w"==o?(u=t-a.x,d=n-(a.y+a.height),s=a.x+a.width,c=a.y):("nw"===o||"n"==o)&&(u=t-a.x,d=n-a.y,s=a.x+a.width,c=a.y+a.height),r=s+l.x+u,i=c+l.y+d}this.evData={startClientX:r,startClientY:i,startCropX:s,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!o,ord:o},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{let{crop:t,disabled:n,locked:l,keepSelection:a,onChange:o}=this.props,r=this.getBox();if(n||l||a&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let i=e.clientX-r.x,s=e.clientY-r.y,c={unit:"px",x:i,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:i,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(pO(c,r.width,r.height),pL(c,r.width,r.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{let t,{crop:n,disabled:l,onChange:a,onDragStart:o}=this.props,r=this.getBox();if(l||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(e));let{evData:i}=this;i.clientX=e.clientX,i.clientY=e.clientY,pA(n,t=i.isResize?this.resizeCrop():this.dragCrop())||a(pO(t,r.width,r.height),pL(t,r.width,r.height))},this.onComponentKeyDown=t=>{let{crop:n,disabled:l,onChange:a,onComplete:o}=this.props;if(l)return;let r=t.key,i=!1;if(!n)return;let s=this.getBox(),c=this.makePixelCrop(s),u=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===r?(c.x-=u,i=!0):"ArrowRight"===r?(c.x+=u,i=!0):"ArrowUp"===r?(c.y-=u,i=!0):"ArrowDown"===r&&(c.y+=u,i=!0),i){t.cancelable&&t.preventDefault(),c.x=pT(c.x,0,s.width-c.width),c.y=pT(c.y,0,s.height-c.height);let e=pO(c,s.width,s.height),n=pL(c,s.width,s.height);a(e,n),o&&o(e,n)}},this.onHandlerKeyDown=(t,n)=>{let{aspect:l=0,crop:a,disabled:o,minWidth:r=0,minHeight:i=0,maxWidth:s,maxHeight:c,onChange:u,onComplete:d}=this.props,p=this.getBox();if(o||!a||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let h=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,f=pF(function(e,t,n,l){let a={...e};return"ArrowLeft"===t?"nw"===l?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):"w"===l?(a.x-=n,a.width+=n):"sw"===l?(a.x-=n,a.width+=n,a.height+=n):"ne"===l?(a.y+=n,a.width-=n,a.height-=n):"e"===l?a.width-=n:"se"===l&&(a.width-=n,a.height-=n):"ArrowRight"===t&&("nw"===l?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):"w"===l?(a.x+=n,a.width-=n):"sw"===l?(a.x+=n,a.width-=n,a.height-=n):"ne"===l?(a.y-=n,a.width+=n,a.height+=n):"e"===l?a.width+=n:"se"===l&&(a.width+=n,a.height+=n)),"ArrowUp"===t?"nw"===l?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):"n"===l?(a.y-=n,a.height+=n):"ne"===l?(a.y-=n,a.width+=n,a.height+=n):"sw"===l?(a.x+=n,a.width-=n,a.height-=n):"s"===l?a.height-=n:"se"===l&&(a.width-=n,a.height-=n):"ArrowDown"===t&&("nw"===l?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):"n"===l?(a.y+=n,a.height-=n):"ne"===l?(a.y+=n,a.width-=n,a.height-=n):"sw"===l?(a.x-=n,a.width+=n,a.height+=n):"s"===l?a.height+=n:"se"===l&&(a.width+=n,a.height+=n)),a}(pO(a,p.width,p.height),t.key,h,n),l,n,p.width,p.height,r,i,s,c);if(!pA(a,f)){let e=pL(f,p.width,p.height);u(f,e),d&&d(f,e)}},this.onDocPointerDone=e=>{let{crop:t,disabled:n,onComplete:l,onDragEnd:a}=this.props,o=this.getBox();this.unbindDocMove(),!(n||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,a&&a(e),l&&l(pO(t,o.width,o.height),pL(t,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=e=>{var t;null==(t=this.componentRef.current)||t.scrollTo(0,0)}}};pI.xOrds=["e","w"],pI.yOrds=["n","s"],pI.xyOrds=["nw","ne","se","sw"],pI.nudgeStep=1,pI.nudgeStepMedium=10,pI.nudgeStepLarge=100,pI.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 pB="edit-upload",pU=e=>{let{name:t,onChange:n,ref:l,value:a}=e;return(0,u.jsxs)("div",{className:"".concat(pB,"__input"),children:[t,(0,u.jsx)("input",{name:t,onChange:e=>n(e.target.value),ref:l,type:"number",value:a})]})},pz={height:100,unit:"%",width:100,x:0,y:0},pV=e=>{let{fileName:t,fileSrc:n,imageCacheTag:l,initialCrop:a,initialFocalPoint:r,onSave:i,showCrop:c,show
1FocalPoint:d}=e,{closeModal:p}=nE(),{t:h}=(0,s.d)(),[f,m]=(0,o.useState)(()=>({...pz,...a||{}})),g={x:50,y:50},[v,b]=(0,o.useState)(()=>({...g,...r})),[y,x]=(0,o.useState)(!1),[w,j]=(0,o.useState)(0),[C,S]=(0,o.useState)(0),k=(0,o.useRef)(void 0),_=(0,o.useRef)(void 0),N=(0,o.useRef)(void 0),E=(0,o.useRef)(null),P=(0,o.useRef)(null),[D,T]=(0,o.useState)(!1),R=e=>{j(e.currentTarget.naturalHeight),S(e.currentTarget.naturalWidth),T(!0)},A=e=>{let{dimension:t,value:n}=e,l=parseInt(n);if("width"===t&&l>=C||"height"===t&&l>=w)return null;let a=l/("width"===t?C:w)*100;if(100===a||0===a)return null;m({...f,[t]:a})},L=e=>{let{coordinate:t,value:n}=e,l=parseInt(n);l>=0&&l<=100&&b(e=>({...e,[t]:l}))},O=o.useCallback(e=>{let{x:t,y:n}=e;b({x:t,y:n}),x(!1)},[]),F=l?"".concat(n,"?").concat(encodeURIComponent(l)):n;return(0,u.jsxs)("div",{className:pB,children:[(0,u.jsxs)("div",{className:"".concat(pB,"__header"),children:[(0,u.jsxs)("h2",{title:"".concat(h("general:editing")," ").concat(t),children:[h("general:editing")," ",t]}),(0,u.jsxs)("div",{className:"".concat(pB,"__actions"),children:[(0,u.jsx)(tD,{"aria-label":h("general:cancel"),buttonStyle:"secondary",className:"".concat(pB,"__cancel"),onClick:()=>p(p2),children:h("general:cancel")}),(0,u.jsx)(tD,{"aria-label":h("general:applyChanges"),buttonStyle:"primary",className:"".concat(pB,"__save"),disabled:!D,onClick:()=>{var e,t,n,l;"function"==typeof i&&i({crop:f||void 0,focalPoint:v,heightInPixels:Number(null!=(n=null==E||null==(e=E.current)?void 0:e.value)?n:w),widthInPixels:Number(null!=(l=null==P||null==(t=P.current)?void 0:t.value)?l:C)}),p(p2)},children:h("general:applyChanges")})]})]}),(0,u.jsxs)("div",{className:"".concat(pB,"__toolWrap"),children:[(0,u.jsx)("div",{className:"".concat(pB,"__crop"),children:(0,u.jsxs)("div",{className:"".concat(pB,"__focal-wrapper"),ref:k,style:{aspectRatio:"".concat(C/w)},children:[c?(0,u.jsx)(pI,{className:"".concat(pB,"__reactCrop"),crop:f,onChange:(e,t)=>
1m(t),onComplete:()=>x(!0),renderSelectionAddon:()=>(0,u.jsx)("div",{className:"".concat(pB,"__crop-window"),ref:N}),children:(0,u.jsx)("img",{alt:h("upload:setCropArea"),onLoad:R,ref:_,src:F})}):(0,u.jsx)("img",{alt:h("upload:setFocalPoint"),onLoad:R,ref:_,src:F}),d&&(0,u.jsx)(pH,{boundsRef:c?N:_,checkBounds:!!c&&y,className:"".concat(pB,"__focalPoint"),containerRef:k,initialPosition:v,onDragEnd:O,setCheckBounds:!!c&&x,children:(0,u.jsx)(ti,{})})]})}),(c||d)&&(0,u.jsxs)("div",{className:"".concat(pB,"__sidebar"),children:[c&&(0,u.jsxs)("div",{className:"".concat(pB,"__groupWrap"),children:[(0,u.jsx)("div",{children:(0,u.jsxs)("div",{className:"".concat(pB,"__titleWrap"),children:[(0,u.jsx)("h3",{children:h("upload:crop")}),(0,u.jsx)(tD,{buttonStyle:"none",className:"".concat(pB,"__reset"),onClick:()=>m({height:100,unit:"%",width:100,x:0,y:0}),children:h("general:reset")})]})}),(0,u.jsx)("span",{className:"".concat(pB,"__description"),children:h("upload:cropToolDescription")}),(0,u.jsxs)("div",{className:"".concat(pB,"__inputsWrap"),children:[(0,u.jsx)(pU,{name:"".concat(h("upload:width")," (px)"),onChange:e=>A({dimension:"width",value:e}),ref:P,value:(f.width/100*C).toFixed(0)}),(0,u.jsx)(pU,{name:"".concat(h("upload:height")," (px)"),onChange:e=>A({dimension:"height",value:e}),ref:E,value:(f.height/100*w).toFixed(0)})]})]}),d&&(0,u.jsxs)("div",{className:"".concat(pB,"__groupWrap"),children:[(0,u.jsx)("div",{children:(0,u.jsxs)("div",{className:"".concat(pB,"__titleWrap"),children:[(0,u.jsx)("h3",{children:h("upload:focalPoint")}),(0,u.jsx)(tD,{buttonStyle:"none",className:"".concat(pB,"__reset"),onClick:()=>{let e=k.current.getBoundingClientRect(),t=c?N.current.getBoundingClientRect():_.current.getBoundingClientRect();b({x:(t.left-e.left+t.width/2)/e.width*100,y:(t.top-e.top+t.height/2)/e.height*100})},children:h("general:reset")})]})}),(0,u.jsx)("span",{className:"".concat(pB,"__description"),children:h("upload:focalPointDescription")}),(0,u.jsxs)("div",{className:"".concat(pB,"__inputsWrap"),children:[(0,u.jsx)(pU,{name:"X %",onChange:e=>L({coordinate:"x",value:e}),value:v.x.toFixed(0)}),(0,u.jsx)(pU,{name:"Y %",onChange:e=>L({coordinate:"y",value:e}),value:v.y.toFixed(0)})]})]})]})]})]})},pH=e=>{let{boundsRef:t,checkBounds:n,children:l,className:a,containerRef:r,initialPosition:i={x:50,y:50},onDragEnd:s,setCheckBounds:c}=e,[d,p]=(0,o.useState)({x:i.x,y:i.y}),[h,f]=(0,o.useState)(!1),m=(0,o.useRef)(void 0),g=o.useCallback((e,n,l)=>{let a=r.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),i=null!=e?e:o.left,s=null!=n?n:o.top,c=i<o.left||i>o.right,u=s<o.top||s>o.bottom,d=(i-a.left)/a.width*100,p=(s-a.top)/a.height*100,h=(o.left-a.left+o.width/2)/a.width*100,m=(o.top-a.top+o.height/2)/a.height*100;return(c||u)&&(f(!1),i<o.left?d=(o.left-a.left)/a.width*100:i>o.right&&(d=(a.width-(a.right-o.right))/a.width*100),s<o.top?p=(o.top-a.top)/a.height*100:s>o.bottom&&(p=(a.height-(a.bottom-o.bottom))/a.height*100),l&&(d=c?h:d,p=u?m:p)),{x:d,y:p}},[t,r]);return o.useEffect(()=>{if(!(h||!m.current)&&n){let{height:e,left:t,top:n,width:l}=m.current.getBoundingClientRect(),{x:a,y:o}=g(t+l/2,n+e/2,!0);s({x:a,y:o}),p({x:a,y:o}),c(!1);return}},[g,h,n,c,d.x,d.y,s]),o.useEffect(()=>{p({x:i.x,y:i.y})},[i.x,i.y]),(0,u.jsxs)("div",{className:["".concat(pB,"__draggable-container"),h&&"".concat(pB,"__draggable-container--dragging")].filter(Boolean).join(" "),onMouseMove:e=>{if(!h)return null;let{x:t,y:n}=g(e.clientX,e.clientY);p({x:t,y:n})},children:[(0,u.jsx)("button",{className:["".concat(pB,"__draggable"),a].filter(Boolean).join(" "),onMouseDown:e=>{e.preventDefault(),f(!0)},onMouseUp:()=>{f(!1),s(d)},ref:m,style:{left:"".concat(d.x,"%"),top:"".concat(d.y,"%")},type:"button",children:l}),(0,u.jsx)("div",{})]})},pq="file-details-draggable",pW=e=>{let t,n=(0,f.c)(20),{collectionSlug:l,doc:a,hideRemoveFile:o,imageCacheTag:r,isSortable:i,removeItem:s,rowIndex:c,uploadConfig:d}=e,{id:p,filename:h,thumbnailURL:m,url:g}=a,v;n[0]!==l||n[1]!==p?(v={id:p,collectionSlug:l},n[0]=l,n[1]=p,n[2]=v):v=n[2];let[b,y]=cO(v),x;return n[3]!==b||n[4]!==y||n[5]!==l||n[6]!==a||n[7]!==h||n[8]!==o||n[9]!==r||n[10]!==i||n[11]!==s||n[12]!==c||n[13]!==m||n[14]!==d||n[15]!==g?(x=e=>(0,u.jsxs)("div",{className:[pq,e&&i&&"".concat(pq,"--has-drag-handle")].filter(
1Boolean).join(" "),ref:e.setNodeRef,style:{transform:e.transform,transition:e.transition,zIndex:e.isDragging?1:void 0},children:[(0,u.jsxs)("div",{className:"".concat(pq,"--drag-wrapper"),children:[i&&e&&(0,u.jsx)("div",{className:"".concat(pq,"__drag"),...e.attributes,...e.listeners,children:(0,u.jsx)(a3,{})}),(0,u.jsx)(cX,{className:"".concat(pq,"__thumbnail"),collectionSlug:l,doc:a,fileSrc:m||g,imageCacheTag:r,uploadConfig:d})]}),(0,u.jsx)("div",{className:"".concat(pq,"__main-detail"),children:h}),(0,u.jsxs)("div",{className:"".concat(pq,"__actions"),children:[(0,u.jsx)(b,{}),(0,u.jsx)(y,{children:(0,u.jsx)(to,{})}),!o&&s&&(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(pq,"__remove"),icon:"x",iconStyle:"none",onClick:()=>s(c),round:!0})]})]}),n[3]=b,n[4]=y,n[5]=l,n[6]=a,n[7]=h,n[8]=o,n[9]=r,n[10]=i,n[11]=s,n[12]=c,n[13]=m,n[14]=d,n[15]=g,n[16]=x):x=n[16],n[17]!==p||n[18]!==x?(t=(0,u.jsx)(t7,{id:p,children:x},p),n[17]=p,n[18]=x,n[19]=t):t=n[19],t},pK=e=>{let t=(0,f.c)(11),{defaultMessage:n,successMessage:l,value:a}=e,[r,i]=(0,o.useState)(!1),[c,d]=(0,o.useState)(!1),{t:p}=(0,s.d)();if(a){let e,o,s,h;return t[0]!==a?(e=async()=>{await navigator.clipboard.writeText(a),i(!0)},t[0]=a,t[1]=e):e=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{d(!0),i(!1)},s=()=>{d(!1),i(!1)},t[2]=o,t[3]=s):(o=t[2],s=t[3]),t[4]!==r||t[5]!==n||t[6]!==c||t[7]!==l||t[8]!==p||t[9]!==e?(h=(0,u.jsxs)("button",{className:"copy-to-clipboard",onClick:e,onMouseEnter:o,onMouseLeave:s,type:"button",children:[(0,u.jsx)(tF,{}),(0,u.jsxs)(tN,{delay:r?0:void 0,show:c||r,children:[r&&(null!=l?l:p("general:copied")),!r&&(null!=n?n:p("general:copy"))]})]}),t[4]=r,t[5]=n,t[6]=c,t[7]=l,t[8]=p,t[9]=e,t[10]=h):h=t[10],h}return null},pY="file-meta",pG=e=>{let{filename:t,filesize:n,height:l,mimeType:a,url:r,width:i}=e;return(0,u.jsxs)("div",{className:pY,children:[(0,u.jsxs)("div",{className:"".concat(pY,"__url"),children:[(0,u.jsx)("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:t}),(0,u.jsx)(pK,{defaultMessage:"Copy URL",value:r})]}),(0,u.jsxs)("div",{className:"".concat(pY,"__size-type"),children:[(0,W.B)(n),"number"==typeof i&&"number"==typeof l&&(0,u.jsxs)(o.Fragment,{children:["\xa0-\xa0",i,"x",l]}),a&&(0,u.jsxs)(o.Fragment,{children:["\xa0-\xa0",a]})]})]})},pQ="file-details",pX=e=>{var t;let{customUploadActions:n,doc:l,enableAdjustments:a,handleRemove:o,hasImageSizes:r,hideRemoveFile:i,imageCacheTag:s,uploadConfig:c}=e,{filename:d,filesize:p,height:h,mimeType:f,thumbnailURL:m,url:g,width:v}=l,b=null==(t=c.displayPreview)||t;return(0,u.jsx)("div",{className:pQ,children:(0,u.jsxs)("header",{children:[b&&(0,u.jsx)(cX,{className:"".concat(pQ,"__thumbnail"),doc:l,fileSrc:m||g,imageCacheTag:s,uploadConfig:c}),(0,u.jsxs)("div",{className:"".concat(pQ,"__main-detail"),children:[(0,u.jsx)(pG,{filename:d,filesize:p,height:h,mimeType:f,url:g,width:v}),(a||r&&l.filename||n)&&(0,u.jsx)(p4,{customActions:n,enableAdjustments:!!a,enablePreviewSizes:r&&l.filename,mimeType:f})]}),!i&&o&&(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(pQ,"__remove"),icon:"x",iconStyle:"with-border",onClick:o,round:!0})]})})},p$=e=>{let{hasMany:t}=e;return t?(0,u.jsx)(pW,{...e}):(0,u.jsx)(pX,{...e})},pZ="preview-sizes",pJ=(e,t)=>{if(!t||0===t.length)return e;let n={};return t.forEach(t=>{let{name:l}=t;e[l]&&(n[l]=e[l])}),n},p0=e=>{let{name:t,active:n,meta:l,onClick:a,previewSrc:o}=e;return(0,u.jsxs)("div",{className:["".concat(pZ,"__sizeOption"),n&&"".concat(pZ,"--selected")].filter(Boolean).join(" "),onClick:"function"==typeof a?a:void 0,onKeyDown:e=>{"function"==typeof a&&"Enter"===e.key&&a()},role:"button",tabIndex:0,children:[(0,u.jsx)("div",{className:"".concat(pZ,"__image"),children:(0,u.jsx)("img",{alt:l.filename,src:o})}),(0,u.jsxs)("div",{className:"".concat(pZ,"__sizeMeta"),children:[(0,u.jsx)("div",{className:"".concat(pZ,"__sizeName"),children:t}),(0,u.jsx)(pG,{...l})]})]})},p1=e=>{let{doc:t,imageCacheTag:n,uploadConfig:l}=e,{imageSizes:a}=l,{sizes:r}=t,[i,s]=(0,o.useState)(()=>pJ(r,a)),[c,d]=(0,o.useState)(null),p=e=>e.filename?e.url?"".concat(e.url).concat(n?"?".concat(encodeURIComponent(n)):""):void 0:null;(0,o.useEffect)(()=>{s(pJ(r,a))},[r,a,n]);let h=p(c?t.sizes[c]:t),f=(0,o.useMemo)(()=>({filename:t.filename,filesize:t.filesize,height:t.height,mimeType:t.mimeType,url:t.url,width:t.width}),[t]),m="Original";return(0,u.jsxs)("div",{className:pZ,children:[(0,u.jsxs)("div",{className:"".concat(pZ,"__imageWrap"),children:[(0,u.jsxs)("div",{className:"".concat(pZ,"__meta"),children:[(0,u.jsx)("div",{className:"".concat(pZ,"__sizeName"),children:c||m}),(0,u.jsx)(pG,{...c?i[c]:f})]}),(0,u.jsx)("img",{alt:t.filename,className:"".concat(pZ,"__preview"),src:h})]}),(0,u.jsx)("div",{className:"".concat(pZ,"__listWrap"),children:(0,u.jsxs)("div",{className:"".concat(pZ,"__list"),children:[(0,u.jsx)(p0,{active:!c,meta:f,name:m,onClick:()=>d(null),previewSrc:p(t)}),Object.entries(i).map(e=>{let[t,n]=e,l=c===t,a=p(n);return a?(0,u.jsx)(p0,{active:l,meta:n,name:t,onClick:()=>d(t),previewSrc:a},t):null})]})})]})},p3="file-field",p2="edit-upload",p6="preview-sizes",p5=e=>e||void 0===e?!e||!!e.name&&""!==e.name||"A file name is required.":"A file is required.",p4=e=>{let t=(0,f.c)(8),{customActions:n,enableAdjustments:l,enablePreviewSizes:a,mimeType:r}=e,{t:i}=(0,s.d)(),{openModal:c}=nE(),d,p;if(t[0]!==n||t[1]!==l||t[2]!==a||t[3]!==r||t[4]!==c||t[5]!==i){p=Symbol.for("react.early_return_sentinel");e:{let e=(0,D.w)(r)&&"image/svg+xml"!==r&&"image/jxl"!==r;if(!e&&(!n||0===n.length)){p=null;break e}d=(0,u.jsxs)("div",{className:"".concat(p3,"__upload-actions"),children:[e&&(0,u.jsxs)(o.Fragment,{children:[a&&(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(p3,"__previewSizes"),margin:!1,onClick:()=>{c(p6)},size:"small",children:i("upload:previewSizes")}),l&&(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(p3,"__edit"),margin:!1,onClick:()=>{c(p2)}
1,size:"small",children:i("upload:editImage")})]}),n&&n.map(p7)]})}t[0]=n,t[1]=l,t[2]=a,t[3]=r,t[4]=c,t[5]=i,t[6]=d,t[7]=p}else d=t[6],p=t[7];return p!==Symbol.for("react.early_return_sentinel")?p:d},p8=e=>{let t=(0,f.c)(5),{resetUploadEdits:n,updateUploadEdits:l,uploadEdits:a}=aN(),o;return t[0]!==e||t[1]!==n||t[2]!==l||t[3]!==a?(o=(0,u.jsx)(dk,{children:(0,u.jsx)(p9,{...e,resetUploadEdits:n,updateUploadEdits:l,uploadEdits:a})}),t[0]=e,t[1]=n,t[2]=l,t[3]=a,t[4]=o):o=t[4],o},p9=e=>{var t,n,l,a,r,c;let{collectionSlug:d,customActions:p,initialState:h,onChange:f,resetUploadEdits:m,updateUploadEdits:g,uploadConfig:v,UploadControls:b,uploadEdits:y}=e,{setUploadControlFile:x,setUploadControlFileName:w,setUploadControlFileUrl:j,uploadControlFile:C,uploadControlFileName:S,uploadControlFileUrl:k}=d_(),{config:{routes:{api:_},serverURL:N}}=(0,i.c)(),{t:E}=(0,s.d)(),{setModified:P}=eP(),{id:T,data:R,docPermissions:A,setUploadStatus:L}=aD(),O=eA(),{errorMessage:F,setValue:M,showError:I,value:B}=aB({path:"file",validate:p5}),[U,z]=(0,o.useState)(null),[V,H]=(0,o.useState)(!1),[q,W]=(0,o.useState)((null==B?void 0:B.name)||""),[K,Y]=(0,o.useState)(!1),[G,Q]=(0,o.useState)(""),X=(0,o.useRef)(null),$=(0,o.useRef)(null),Z="object"==typeof(null==v?void 0:v.pasteURL)&&(null==(t=v.pasteURL.allowList)?void 0:t.length)>0,J=(0,o.useCallback)(e=>{let{file:t,isNewFile:n=!0}=e;n&&t instanceof File&&z(URL.createObjectURL(t)),M(t),Y(!1),j(""),w(null),x(null),"function"==typeof f&&f(t)},[f,M,x,w,j]),ee=o.useCallback(e=>{let t=e.target.value;B&&(J({file:((e,t)=>new File([e],t,{type:e.type,lastModified:e.lastModified}))(B,t),isNewFile:!1}),W(t))},[J,B]),et=(0,o.useCallback)(e=>{J({file:null==e?void 0:e[0]})},[J]),en=(0,o.useCallback)(()=>{H(!0),J({file:null}),z(""),Q(""),m(),Y(!1),j(""),w(null),x(null)},[J,m,x,w,j]),el=(0,o.useCallback)(e=>{P(!0),g(e)},[P,g]),ea=(0,o.useCallback)(async()=>{if(!(!G||(null==v?void 0:v.pasteURL)===!1)){L("uploading");try{let e=await fetch(G);if(!e.ok)throw Error("Fetch failed with status: ".concat(e.status));let t=await e.blob(),n=S||decodeURIComponent(G.split("/").pop()||""),l=new File([t],n,{type:t.type});J({file:l}),L("idle");return}catch(e){if(!Z){eJ.error("Failed to fetch the file."),L("failed");return}}try{let e="/".concat(d,"/paste-url").concat(T?"/".concat(T,"?"):"?","src=").concat(encodeURIComponent(G)),t=await fetch("".concat(N).concat(_).concat(e));if(!t.ok)throw Error("Fetch failed with status: ".concat(t.status));let n=await t.blob(),l=decodeURIComponent(G.split("/").pop()||""),a=new File([n],l,{type:n.type});J({file:a}),L("idle")}catch(e){eJ.error("The provided URL is not allowed."),L("failed")}}},[_,d,G,J,T,N,L,v,S,Z]);(0,o.useEffect)(()=>{var e;(null==h||null==(e=h.file)?void 0:e.value)instanceof File&&(z(URL.createObjectURL(h.file.value)),H(!1))},[h]),(0,o.useEffect)(()=>{K&&X.current},[K]),(0,o.useEffect)(()=>{O&&H(!1)},[O]);let eo=null==A?void 0:A.update,er=(null==v||null==(n=v.imageSizes)?void 0:n.length)>0,ei=!!(null==v?void 0:v.resizeOptions),es=(null==v?void 0:v.focalPoint)===!0,{crop:ec=!0,focalPoint:eu=!0}=v,ed=eu&&(er||ei||es),ep=null==(l=v.mimeTypes)?void 0:l.join(", "),eh=(null==v?void 0:v.cacheTags)&&(null==R?void 0:R.updatedAt);return(0,o.useEffect)(()=>{(async()=>{k&&(Q(k),await ea())})()},[k,ea]),(0,o.useEffect)(()=>{C&&J({file:C})},[C,J]),(0,u.jsxs)("div",{className:[aq,p3].filter(Boolean).join(" "),children:[(0,u.jsx)(no,{message:F,showError:I}),R&&R.filename&&!V&&(0,u.jsx)(p$,{collectionSlug:d,customUploadActions:p,doc:R,enableAdjustments:ec||ed,handleRemove:eo?en:void 0,hasImageSizes:er,hideRemoveFile:v.hideRemoveFile,imageCacheTag:eh,uploadConfig:v}),(!v.hideFileInputOnCreate&&!(null==R?void 0:R.filename)||V)&&(0,u.jsxs)("div",{className:"".concat(p3,"__upload"),children:[!B&&!K&&(0,u.jsx)(dE,{onChange:et,children:(0,u.jsxs)("div",{className:"".concat(p3,"__dropzoneContent"),children:[(0,u.jsxs)("div",{className:"".concat(p3,"__dropzoneButtons"),children:[(0,u.jsx)(tD,{buttonStyle:"pill",onClick:()=>{$.current&&$.current.click()},size:"small",children:E("upload:selectFile")}),(0,u.jsx)("input",{accept:ep,"aria-hidden":"true",className:"".concat(p3,"__hidden-input"),hidden:!0,onChange:e=>{e.target.files&&e.target.files.length>0&&et(e.target.files)},ref:$,type:"file"}),(null==v?void 0:v.pasteURL)!==!1&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("span",{className:"".concat(p3,"__orText"),children:E("general:or")}),(0,u.jsx)(tD,{buttonStyle:"pill",onClick:()=>{Y(!0),j(""),x(null),w(null)},size:"small",children:E("upload:pasteURL")})]}),b||null]}),(0,u.jsxs)("p",{className:"".concat(p3,"__dragAndDropText"),children:[E("general:or")," ",E("upload:dragAndDrop")]})]})}),K&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("div",{className:"".concat(p3,"__remote-file-wrap"),children:[(0,u.jsx)("input",{className:"".concat(p3,"__remote-file"),onChange:e=>{Q(e.target.value)},ref:X,title:G,type:"text",value:G}),(0,u.jsx)("div",{className:"".concat(p3,"__add-file-wrap"),children:(0,u.jsx)("button",{className:"".concat(p3,"__add-file"),onClick:()=>{ea()},type:"button",children:E("upload:addFile")})})]}),(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(p3,"__remove"),icon:"x",iconStyle:"with-border",onClick:()=>{Y(!1),j(""),x(null),w(null)},round:!0,tooltip:E("general:cancel")})]}),B&&U&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("div",{className:"".concat(p3,"__thumbnail-wrap"),children:(0,u.jsx)(cX,{collectionSlug:d,fileSrc:(0,D.w)(B.type)?U:null})}),(0,u.jsxs)("div",{className:"".concat(p3,"__file-adjustments"),children:[(0,u.jsx)("input",{className:"".concat(p3,"__filename"),onChange:ee,title:q||B.name,type:"text",value:q||B.name}),(0,u.jsx)(p4,{customActions:p,enableAdjustments:ec||ed,enablePreviewSizes:er&&(null==R?void 0:R.filename)&&!V,mimeType:B.type})]}),(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(p3,"__remove"),icon:"x",iconStyle:"with-border",onClick:en,round:!0,tooltip:E("general:cancel")})]})]}),(B||(null==R?void 0:R.filename))&&(0,u.jsx)(ni,{children:(0,u.jsx)(lc,{Header:null,slug:p2,children:(0,u.jsx)(pV,{fileName:(null==B?void 0:B.name)||(null==R?void 0:R.filename),fileSrc:(null==R?void 0:R.url)||U,imageCacheTag:eh,initialCrop:null!=(c=null==y?void 0:y.crop)?c:void 0,initialFocalPoint:{x:(null==y||null==(a=y.focalPoint)?void 0:a.x)||(null==R?void 0:R.focalX)||50,y:(null==y||null==(r=y.focalPoint)?void 0:r.y
1)||(null==R?void 0:R.focalY)||50},onSave:el,showCrop:ec,showFocalPoint:ed})})}),R&&er&&(0,u.jsx)(lc,{className:"".concat(p3,"__previewDrawer"),hoverTitle:!0,slug:p6,title:E("upload:sizesFor",{label:R.filename}),children:(0,u.jsx)(p1,{doc:R,imageCacheTag:eh,uploadConfig:v})})]})};function p7(e,t){return(0,u.jsx)(o.Fragment,{children:e},t)}function he(e){let{resetUploadEdits:t,submitted:n,updateUploadEdits:l,uploadEdits:a}=e,{action:r,collectionSlug:s,docPermissions:c,getDocPreferences:d,hasSavePermission:p,initialState:h,isInitializing:f,Upload:m}=aD(),{drawerSlug:g,onSave:v}=cD(),{getFormState:b}=ci(),{config:{folders:y},getEntityConfig:x}=(0,i.c)(),w=o.useRef(null),j=x({collectionSlug:s}),{reportUpdate:C}=uT(),S=j.slug,[k]=o.useState(S),_=(0,o.useCallback)(e=>{var n;C({doc:(null==e?void 0:e.doc)||(null==e?void 0:e.result),drawerSlug:g,entitySlug:S,operation:"create",updatedAt:(null==e||null==(n=e.result)?void 0:n.updatedAt)||new Date().toISOString()}),"function"==typeof v&&v({...e,operation:"create"}),t()},[S,v,C,t,g]),N=(0,o.useCallback)(async e=>{let{formState:t,submitted:n}=e,l=cN(w),a=await d(),{state:o}=await b({collectionSlug:S,docPermissions:c,docPreferences:a,formState:t,operation:"create",schemaPath:k,signal:l.signal,skipValidation:!n});return w.current=null,o},[S,k,d,b,c]);return(0,o.useEffect)(()=>{let e=w.current;return()=>{c_(e)}},[]),(0,u.jsx)(aL,{operation:"create",children:(0,u.jsxs)(di,{action:r,className:"".concat("collection-edit","__form"),disabled:f||!p,initialState:f?void 0:h,isInitializing:f,method:"POST",onChange:[N],onSuccess:_,submitted:n,children:[(0,u.jsx)(d3,{BeforeFields:(0,u.jsx)(o.Fragment,{children:m||(0,u.jsx)(p9,{collectionSlug:j.slug,customActions:[y&&j.folders&&(0,u.jsx)(pN,{buttonProps:{buttonStyle:"pill",size:"small"},folderCollectionSlug:y.slug,folderFieldName:y.fieldName},"move-doc-to-folder")].filter(Boolean),initialState:h,resetUploadEdits:t,updateUploadEdits:l,uploadConfig:j.upload,uploadEdits:a})}),docPermissions:c,fields:j.fields,schemaPathSegments:[j.slug]}),(0,u.jsx)(hn,{}),(0,u.jsx)(ht,{})]})})}function ht(){let e=(0,f.c)(4),{getFields:t}=eP(),{getFormDataRef:n}=dB(),l,a;return e[0]!==t||e[1]!==n?(l=()=>{n.current=t},a=[t,n],e[0]=t,e[1]=n,e[2]=l,e[3]=a):(l=e[2],a=e[3]),(0,o.useEffect)(l,a),null}function hn(){let{docConfig:e}=aD(),{activeIndex:t,setFormTotalErrorCount:n}=dB(),l=o.useRef(0),a=o.useCallback(e=>{e!==l.current&&(n({errorCount:e,index:t}),l.current=e)},[t,n]);return e?(0,u.jsx)(oR,{fields:e.fields,path:[],setErrorCount:a}):null}var hl="bulk-upload-drawer--add-more-files",ha="file-selections";function ho(){var e;let t=(0,f.c)(39),{activeIndex:n,addFiles:l,forms:a,isInitializing:r,removeFile:c,setActiveIndex:d,totalErrorCount:p}=dB(),{initialFiles:h,initialForms:m,maxFiles:g}=hy(),{i18n:v,t:b}=(0,s.d)(),{closeModal:y,openModal:x}=nE(),[w,j]=o.useState(!1),{breakpoints:C}=tv(),S;t[0]!==c?(S=e=>{c(e)},t[0]=c,t[1]=S):S=t[1];let k=S,_;t[2]!==l||t[3]!==y?(_=e=>{l(e),y(hl)},t[2]=l,t[3]=y,t[4]=_):_=t[4];let N=_,E=r?null!=(e=null==h?void 0:h.length)?e:null==m?void 0:m.length:a.length,{collectionSlug:P,selectableCollections:D,setCollectionSlug:T}=hy(),{getEntityConfig:R}=(0,i.c)(),A=w&&"".concat(ha,"__showingFiles"),L;t[5]!==A?(L=[ha,A].filter(Boolean),t[5]=A,t[6]=L):L=t[6];let O=L.join(" "),F;if(t[7]!==n||t[8]!==C.m||t[9]!==P||t[10]!==y||t[11]!==a||t[12]!==R||t[13]!==N||t[14]!==k||t[15]!==v||t[16]!==h||t[17]!==m||t[18]!==r||t[19]!==g||t[20]!==x||t[21]!==D||t[22]!==d||t[23]!==T||t[24]!==w||t[25]!==b||t[26]!==O||t[27]!==p||t[28]!==E){let e,l,o;t[30]===Symbol.for("react.memo_cache_sentinel")?(e=()=>j(hi),t[30]=e):e=t[30],t[31]!==y?(l=()=>y(hl),t[31]=y,t[32]=l):l=t[32],t[33]!==n||t[34]!==k||t[35]!==v||t[36]!==d||t[37]!==b?(o=(e,t)=>{var l;let{errorCount:a,formID:o,formState:r}=e,i=(null==r||null==(l=r.file)?void 0:l.value)||{};return(0,u.jsxs)("div",{className:["".concat(ha,"__fileRowContainer"),t===n&&"".concat(ha,"__fileRowContainer--active"),a&&a>0&&"".concat(ha,"__fileRowContainer--error")].filter(Boolean).join(" "),children:[(0,u.jsxs)("button",{className:"".concat(ha,"__fileRow"),onClick:()=>d(t),type:"button",children:[(0,u.jsx)(hs,{file:i,formID:o}),(0,u.jsx)("div",{className:"".concat(ha,"__fileDetails"),children:(0,u.jsx)("p",{className:"".concat(ha,"__fileName"),title:i.name,children:i.name||b("upload:noFile")})}),i instanceof File?(0,u.jsx)("p",{className:"".concat(ha,"__fileSize"),children:function(e){let t=e.size,n=0===t?0:Math.floor(Math.log(t)/Math.log(1024));return(t/Math.pow(1024,n)).toFixed(+(n>1))+" "+["B","kB","MB","GB","TB"][n]}(i)}):null,(0,u.jsx)("div",{className:"".concat(ha,"__remove ").concat(ha,"__remove--underlay"),children:(0,u.jsx)(s.a,{})}),a?(0,u.jsx)(nn,{className:"".concat(ha,"__errorCount"),count:a,i18n:v}):null]}),(0,u.jsx)("button",{"aria-label":b("general:remove"),className:"".concat(ha,"__remove ").concat(ha,"__remove--overlay"),onClick:()=>k(t),type:"button",children:(0,u.jsx)(s.a,{})})]},o)},t[33]=n,t[34]=k,t[35]=v,t[36]=d,t[37]=b,t[38]=o):o=t[38],F=(0,u.jsxs)("div",{className:O,children:[C.m&&w?(0,u.jsx)("div",{className:"".concat(ha,"__mobileBlur")}):null,(0,u.jsxs)("div",{className:"".concat(ha,"__header"),children:[(null==D?void 0:D.length)>1&&(0,u.jsx)(uZ,{className:"".concat(ha,"__collectionSelect"),isClearable:!1,name:"groupBy",onChange:e=>{T("object"==typeof e&&"value"in e?null==e?void 0:e.value:e)},options:(null==D?void 0:D.map(e=>{let t=R({collectionSlug:e});return{label:t.labels.singular,value:t.slug}}))||[],path:"groupBy",required:!0,value:P}),(0,u.jsxs)("div",{className:"".concat(ha,"__headerTopRow"),children:[(0,u.jsxs)("div",{className:"".concat(ha,"__header__text"),children:[(0,u.jsx)(nn,{count:p,i18n:v,withMessage:!0}),(0,u.jsx)("p",{children:(0,u.jsxs)("strong",{title:"".concat(E," ").concat(b(E>1?"upload:filesToUpload":"upload:fileToUpload")),children:[E," ",b(E>1?"upload:filesToUpload":"upload:fileToUpload")]})})]}),(0,u.jsxs)("div",{className:"".concat(ha,"__header__actions"),children:["number"!=typeof g||E<g?(0,u.jsx)(ol,{className:"".concat(ha,"__header__addFile"),onClick:()=>x(hl),size:"small",children:b("upload:addFile")}):null,(0,u.jsxs)(tD,{buttonStyle:"transparent",className:"".concat(ha,"__toggler"),onClick:e,children:[(0,u.jsx)("span",{className:"".concat(ha,"__toggler__label"),children:(0,u.jsxs)("strong",{title:"".concat(E," ").concat(b(E>1?"upload:filesToUpload":"upload:fileToUpload")),children:[E," ",b(E>1?"upload:filesToUpload":"upload:fileToUpload")]})}),(0,u.jsx)(ta,{direction:w?"down":"up"})]}),(0,u.jsx)(lc,{gutter:!1,Header:null,slug:hl,children:(0,u.jsx)(dR,{onCancel:l,onDrop:N})})]})]}),(0,u.jsx)("div",{className:"".concat(ha,"__header__mobileDocActions"),children:(0,u.jsx)(dX,{})})]}),(0,u.jsx)("div",{className:"".concat(ha,"__animateWrapper"),children:(0,u.jsx)(a2,{height:!C.m||w?"auto":0,children:(0,u.jsxs)("div",{className:"".concat(ha,"__filesContainer"),children:[r&&0===a.length&&((null==h?void 0:h.length)>0||(null==m?void 0:m.length)>0)?(h?Array.from(h):m).map(hr):null,a.map(o)]})})})]}),t[7]=n,t[8]=C.m,t[9]=P,t[10]=y,t[11]=a,t[12]=R,t[13]=N,t[14]=k,t[15]=v,t[16]=h,t[17]=m,t[18]=r,t[19]=g,t[20]=x,t[21]=D,t[22]=d,t[23]=T,t[24]=w,t[25]=b,t[26]=O,t[27]=p,t[28]=E,t[29]=F}else F=t[29];return F}function hr(e,t){return(0,u.jsx)(i.f,{animationDelay:"calc(".concat(t," * 60ms)"),height:"35px"},t)}function hi(e){return!e}function hs(e){let{file:t,formID:n}
1=e,[l,a]=o.useState(null),[r,s]=o.useState(!0);return o.useEffect(()=>{let e=!1;return async function(){s(!0),a(null);try{if((0,D.w)(t.type)){let n=await new Promise((e,n)=>{let l=new Image;l.src=URL.createObjectURL(t),l.onload=()=>{let a,o,r=l.width/l.height;r>1?(o=280,a=280/r):(o=280*r,a=280);let i=new OffscreenCanvas(o,a),s=i.getContext("2d"),c="image/png"===t.type?"image/png":"image/jpeg",u="image/png"===t.type?void 0:.8;s.drawImage(l,0,0,o,a),i.convertToBlob({type:c,...u&&{quality:u}}).then(t=>{URL.revokeObjectURL(l.src);let a=new FileReader;a.onload=()=>e(a.result),a.onerror=n,a.readAsDataURL(t)}).catch(n)},l.onerror=e=>{URL.revokeObjectURL(l.src),n(e)}});e||a(n)}else a(null)}catch(t){e||a(null)}finally{e||s(!1)}}(),()=>{e=!0}},[t]),r?(0,u.jsx)(i.f,{className:"".concat(ha,"__thumbnail-shimmer"),disableInlineStyles:!0}):(0,u.jsx)(cX,{className:"".concat(ha,"__thumbnail"),fileSrc:l},"".concat(n,"-").concat(l||"placeholder"))}var hc="bulk-upload--file-manager";function hu(){let e=(0,f.c)(18),{activeIndex:t,collectionSlug:n,docPermissions:l,documentSlots:a,forms:o,hasPublishPermission:r,hasSavePermission:c,hasSubmitted:p,resetUploadEdits:h,updateUploadEdits:m}=dB(),g=o[t],{getEntityConfig:v}=(0,i.c)(),{i18n:b}=(0,s.d)(),{user:y}=lw(),{openModal:x}=nE(),w;if(e[0]!==g||e[1]!==t||e[2]!==n||e[3]!==l||e[4]!==a||e[5]!==o.length||e[6]!==v||e[7]!==r||e[8]!==c||e[9]!==p||e[10]!==b||e[11]!==x||e[12]!==h||e[13]!==m||e[14]!==y){let i=v({collectionSlug:n}),s;e[16]!==x?(s=()=>x(d$),e[16]=x,e[17]=s):s=e[17],w=(0,u.jsxs)("div",{className:hc,children:[(0,u.jsx)(ho,{}),(0,u.jsxs)("div",{className:"".concat(hc,"__editView"),children:[(0,u.jsx)(dD,{onClose:s,title:(0,d.s)(i.labels.singular,b)}),g?(0,u.jsxs)(aR,{collectionSlug:n,currentEditor:y,docPermissions:l,hasPublishedDoc:!1,hasPublishPermission:r,hasSavePermission:c,id:null,initialData:(0,M.r)(g.formState,!0),initialState:g.formState,isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,Upload:a.Upload,versionCount:0,children:[(0,u.jsx)(dQ,{collectionConfig:i}),(0,u.jsx)(he,{resetUploadEdits:h,submitted:p,updateUploadEdits:m,uploadEdits:null==g?void 0:g.uploadEdits})]},"".concat(t,"-").concat(o.length)):null]}),(0,u.jsx)(dZ,{})]}),e[0]=g,e[1]=t,e[2]=n,e[3]=l,e[4]=a,e[5]=o.length,e[6]=v,e[7]=r,e[8]=c,e[9]=p,e[10]=b,e[11]=x,e[12]=h,e[13]=m,e[14]=y,e[15]=w}else w=e[15];return w}function hd(){var e,t;let{addFiles:n,forms:l,isInitializing:a}=dB(),{closeModal:r}=nE(),{collectionSlug:c,drawerSlug:d}=hy(),{getEntityConfig:p}=(0,i.c)(),{t:h}=(0,s.d)(),f=null==(t=p({collectionSlug:c}))||null==(e=t.upload)?void 0:e.mimeTypes,m=o.useCallback(e=>{let t=new DataTransfer;for(let n of e)(void 0===f||0===f.length||(0,z.d)(n.type,f))&&t.items.add(n);0===t.files.length?eJ.error(h("error:invalidFileType")):n(t.files)},[n,h,f]);return c?l.length||a?(0,u.jsx)(hu,{}):(0,u.jsx)(dR,{acceptMimeTypes:null==f?void 0:f.join(", "),onCancel:()=>r(d),onDrop:m}):null}function hp(){let e,t,n=(0,f.c)(17),{drawerSlug:l,onCancel:a,setInitialFiles:r,setInitialForms:i,setOnCancel:s,setOnSuccess:c,setSelectableCollections:d,setSuccessfullyUploaded:p,successfullyUploaded:h}=hy(),{modalState:m}=nE(),g=o.useRef(m),v;n[0]!==l||n[1]!==a||n[2]!==r||n[3]!==i||n[4]!==s||n[5]!==c||n[6]!==d||n[7]!==p||n[8]!==h?(v=e=>{let t=g.current[l],n=e[l];typeof n>"u"&&typeof t>"u"||((null==t?void 0:t.isOpen)!==(null==n?void 0:n.isOpen)&&((null==n?void 0:n.isOpen)||(h||"function"==typeof a&&a(),r(void 0),i(void 0),s(hm),c(hh),d(null),p(!1))),g.current=e)},n[0]=l,n[1]=a,n[2]=r,n[3]=i,n[4]=s,n[5]=c,n[6]=d,n[7]=p,n[8]=h,n[9]=v):v=n[9];let b=lv(v),y;return n[10]!==m||n[11]!==b?(y=()=>{b(m)},n[10]=m,n[11]=b,n[12]=y):y=n[12],n[13]!==m?(e=[m],n[13]=m,n[14]=e):e=n[14],(0,o.useEffect)(y,e),n[15]!==l?(t=(0,u.jsx)(lc,{gutter:!1,Header:null,slug:l,children:(0,u.jsx)(dI,{children:(0,u.jsx)(dk,{children:(0,u.jsx)(ni,{children:(0,u.jsx)(hd,{})})})})}),n[15]=l,n[16]=t):t=n[16],t}function hh(){return hf}function hf(){return null}function hm(){return hg}function hg(){return null}var hv=o.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 hb(e){let t,n,l=(0,f.c)(17),{children:a,drawerSlugPrefix:r}
1=e,[i,s]=o.useState(null),[c,d]=o.useState(),[p,h]=o.useState(),[m,g]=o.useState(),[v,b]=o.useState(void 0),[y,x]=o.useState(void 0),[w,j]=o.useState(void 0),[C,S]=o.useState(!1),k="".concat(r?"".concat(r,"-"):"").concat(hx()),_;l[0]===Symbol.for("react.memo_cache_sentinel")?(_=e=>{h(()=>e)},l[0]=_):_=l[0];let N=_,E;l[1]===Symbol.for("react.memo_cache_sentinel")?(E=e=>{g(()=>e)},l[1]=E):E=l[1];let P=E,D;return l[2]!==m?(D=()=>{"function"==typeof m&&m()},l[2]=m,l[3]=D):D=l[3],l[4]!==p?(t=(e,t)=>{"function"==typeof p&&p(e,t)},l[4]=p,l[5]=t):t=l[5],l[6]!==a||l[7]!==c||l[8]!==k||l[9]!==v||l[10]!==y||l[11]!==w||l[12]!==i||l[13]!==C||l[14]!==D||l[15]!==t?(n=(0,u.jsx)(hv,{value:{collectionSlug:c,drawerSlug:k,initialFiles:v,initialForms:y,maxFiles:w,onCancel:D,onSuccess:t,selectableCollections:i,setCollectionSlug:d,setInitialFiles:b,setInitialForms:x,setMaxFiles:j,setOnCancel:P,setOnSuccess:N,setSelectableCollections:s,setSuccessfullyUploaded:S,successfullyUploaded:C},children:(0,u.jsxs)(o.Fragment,{children:[a,(0,u.jsx)(hp,{})]})}),l[6]=a,l[7]=c,l[8]=k,l[9]=v,l[10]=y,l[11]=w,l[12]=i,l[13]=C,l[14]=D,l[15]=t,l[16]=n):n=l[16],n}var hy=()=>o.use(hv);function hx(){let e=lp();return"".concat("bulk-upload-drawer-slug","-").concat(e||1)}var hw="upload-relationship-details";function hj(e){var t,n;let l=(0,f.c)(11),{id:a,allowEdit:o,allowRemove:r,alt:c,byteSize:p,className:h,collectionSlug:m,displayPreview:g,filename:v,mimeType:b,onRemove:y,reloadDoc:x,showCollectionSlug:w,src:j,thumbnailSrc:C,withMeta:S,x:k,y:_}=e,N=void 0===S||S,{config:E}=(0,i.c)(),{i18n:P}=(0,s.d)(),D="collections"in E?E.collections.find(e=>e.slug===m):void 0,T=j?a:void 0,R;l[0]!==m||l[1]!==T?(R={id:T,collectionSlug:m},l[0]=m,l[1]=T,l[2]=R):R=l[2];let[A,,L]=cO(R),{openDrawer:O}=L,F;l[3]!==m||l[4]!==x?(F=async e=>{let{doc:t}=e;return x(t.id,m)},l[3]=m,l[4]=x,l[5]=F):F=l[5];let M=F,I;l[6]!==k||l[7]!==_?(I=function(e,t){let n=[];return t&&n.push((0,W.B)(t)),k&&_&&n.push("".concat(k,"x").concat(_)),e&&n.push(e),n.join(" â ")},l[6]=k,l[7]=_,l[8]=I):I=l[8];let B=N?I(b,p):"",U=null==(n=null!=g?g:null==D||null==(t=D.upload)?void 0:t.displayPreview)||n,z;return l[9]!==h?(z=[hw,h].filter(Boolean),l[9]=h,l[10]=z):z=l[10],(0,u.jsxs)("div",{className:z.join(" "),children:[(0,u.jsxs)("div",{className:"".concat(hw,"__imageAndDetails"),children:[U&&(0,u.jsx)(c$,{alt:c,className:"".concat(hw,"__thumbnail"),filename:v,fileSrc:C,size:"small"}),void 0!==w&&w&&D?(0,u.jsx)(ol,{size:"small",children:(0,d.s)(D.labels.singular,P)}):null,(0,u.jsxs)("div",{className:"".concat(hw,"__details"),children:[(0,u.jsx)("p",{className:"".concat(hw,"__filename"),children:j?(0,u.jsx)("a",{href:j,target:"_blank",children:v}):v}),N?(0,u.jsx)("p",{className:"".concat(hw,"__meta"),children:B}):null]})]}),!1!==o||!1!==r?(0,u.jsxs)("div",{className:"".concat(hw,"__actions"),children:[!1!==o?(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(hw,"__edit"),icon:"edit",iconStyle:"none",onClick:O}):null,!1!==r?(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(hw,"__remove"),icon:"x",iconStyle:"none",onClick:()=>y()}):null,(0,u.jsx)(A,{onSave:M})]}):null]})}var hC="upload-field-card";function hS(e){let{children:t,className:n,size:l="medium"}=e;return(0,u.jsx)("div",{className:[hC,n,"".concat(hC,"--size-").concat(l)].filter(Boolean).join(" "),children:t})}var hk="upload upload--has-many";function h_(e){let t=(0,f.c)(29),{className:n,displayPreview:l,fileDocs:a,isSortable:o,onRemove:r,onReorder:i,readonly:s,reloadDoc:c,serverURL:d,showCollectionSlug:p}=e,h=void 0!==p&&p,m;t[0]!==a||t[1]!==i?(m=(e,t)=>{if(e===t)return;let n=[...a],[l]=n.splice(e,1);n.splice(t,0,l),i(n)},t[0]=a,t[1]=i,t[2]=m):m=t[2];let g=m,v;t[3]!==a||t[4]!==r?(v=e=>{let t=[...a||[]];t.splice(e,1),r(0===t.length?[]:t)},t[3]=a,t[4]=r,t[5]=v):v=t[5];let b=v,y;t[6]!==n?(y=[hk,n].filter(Boolean),t[6]=n,t[7]=y):y=t[7];let x=y.join(" "),w;if(t[8]!==l||t[9]!==a||t[10]!==o||t[11]!==g||t[12]!==s||t[13]!==c||t[14]!==b||t[15]!==d||t[16]!==h||t[17]!==x){let e,n;t[19]!==g?(e=e=>{let{moveFromIndex:t,moveToIndex:n}=e;return g(t,n)},t[19]=g,t[20]=e):e=t[20],t[21]!==l||t[22]!==o||t[23]!==s||t[24]!==c||t[25]!==b||t[26]!==d||t[27]!==h?(n=(e,t)=>{let{relationTo:n,value:a}=e,r=String(a.id),i,p;if(a.url)try{i=new URL(a.url,d).toString()}catch(e){i="".concat(d).concat(a.url)}if(a.thumbnailURL)try{p=new URL(a.thumbnailURL,d).toString()}catch(e){p="".concat(d).concat(a.thumbnailURL)}return(0,D.w)(a.mimeType)&&(p=(0,T.k)({sizes:a.sizes,thumbnailURL:p,url:i,width:a.width})),(0,u.jsx)(t7,{disabled:!o||s,id:r,children:e=>(0,u.jsx)("div",{className:["".concat(hk,"__dragItem"),e&&o&&"".concat(hk,"--has-drag-handle")].filter(
1Boolean).join(" "),ref:e.setNodeRef,style:{transform:e.transform,transition:e.transition,zIndex:e.isDragging?1:void 0},children:(0,u.jsxs)(hS,{size:"small",children:[e&&(0,u.jsx)("div",{className:"".concat(hk,"__drag"),...e.attributes,...e.listeners,children:(0,u.jsx)(a3,{})}),(0,u.jsx)(hj,{allowEdit:!s,allowRemove:!s,alt:(null==a?void 0:a.alt)||(null==a?void 0:a.filename),byteSize:a.filesize,collectionSlug:n,displayPreview:l,filename:a.filename,id:r,mimeType:null==a?void 0:a.mimeType,onRemove:()=>b(t),reloadDoc:c,showCollectionSlug:h,src:i,thumbnailSrc:p,withMeta:!1,x:null==a?void 0:a.width,y:null==a?void 0:a.height})]})})},r)},t[21]=l,t[22]=o,t[23]=s,t[24]=c,t[25]=b,t[26]=d,t[27]=h,t[28]=n):n=t[28],w=(0,u.jsx)("div",{className:x,children:(0,u.jsx)(ne,{className:"".concat(hk,"__draggable-rows"),ids:null==a?void 0:a.map(hN),onDragEnd:e,children:a.map(n)})}),t[8]=l,t[9]=a,t[10]=o,t[11]=g,t[12]=s,t[13]=c,t[14]=b,t[15]=d,t[16]=h,t[17]=x,t[18]=w}else w=t[18];return w}function hN(e){let{value:t}=e;return String(t.id)}function hE(e){let{className:t,displayPreview:n,fileDoc:l,onRemove:a,readonly:o,reloadDoc:r,serverURL:i,showCollectionSlug:s=!1}=e,{relationTo:c,value:d}=l,p=String(null==d?void 0:d.id),h,f;if(d.url)try{h=new URL(d.url,i).toString()}catch(e){h="".concat(i).concat(d.url)}if(d.thumbnailURL)try{f=new URL(d.thumbnailURL,i).toString()}catch(e){f="".concat(i).concat(d.thumbnailURL)}return(0,D.w)(d.mimeType)&&(f=(0,T.k)({sizes:d.sizes,thumbnailURL:f,url:h,width:d.width})),(0,u.jsx)(hS,{className:["upload upload--has-one",t].filter(Boolean).join(" "),children:(0,u.jsx)(hj,{allowEdit:!o,allowRemove:!o,alt:(null==d?void 0:d.alt)||(null==d?void 0:d.filename),byteSize:d.filesize,collectionSlug:c,displayPreview:n,filename:d.filename,id:p,mimeType:null==d?void 0:d.mimeType,onRemove:a,reloadDoc:r,showCollectionSlug:s,src:h,thumbnailSrc:f,x:null==d?void 0:d.width,y:null==d?void 0:d.height})})}var hP="upload";function hD(e){var t;let{AfterInput:n,allowCreate:l,api:a,BeforeInput:r,className:c,Description:d,description:p,displayPreview:h,Error:f,filterOptions:m,hasMany:g,isSortable:v,Label:b,label:x,localized:w,maxRows:j,onChange:C,path:S,readOnly:k,relationTo:_,required:N,serverURL:E,showError:P,style:D,value:T}=e,[R,A]=o.useState(),[L]=o.useState(Array.isArray(_)?_[0]:_),{openModal:O}=nE(),{drawerSlug:F,setCollectionSlug:M,setInitialFiles:I,setMaxFiles:B,setOnSuccess:U,setSelectableCollections:z}=hy(),{permissions:V}=lw(),{code:H}=lN(),{i18n:q,t:W}=(0,s.d)(),K=(0,o.useMemo)(()=>Array.isArray(_)?_.filter(e=>{var t,n;return(null==V?void 0:V.collections)&&(null==(n=V.collections)||null==(t=n[e])?void 0:t.create)}):[],[_,V]),Y=(0,o.useMemo)(()=>{let e=Array.isArray(_);if(!T)return m;let t={};for(let n of Array.isArray(T)?T:[T])if(e&&"object"==typeof n&&"relationTo"in n)t[n.relationTo]||(t[n.relationTo]=[]),t[n.relationTo].push(n.value);else if(!e){t[_]||(t[_]=[]);let e="object"==typeof n&&"value"in n?n.value:n;("string"==typeof e||"number"==typeof e)&&t[_].push(e)}let n={...m};return(e?_:[_]).forEach(e=>{var l,a,o;let r=t[e]||[];n[e]={...(null==m?void 0:m[e])||{},id:{...(null==m||null==(l=m[e])?void 0:l.id)||{},not_in:((null==m||null==(o=m[e])||null==(a=o.id)?void 0:a.not_in)||[]).concat(r)}}}),n},[T,m,_]),[G,,{closeDrawer:Q,openDrawer:X}]=uk({collectionSlugs:"string"==typeof _?[_]:_,filterOptions:Y}),[$,,{closeDrawer:Z,openDrawer:J}]=cO({collectionSlug:L}),ee=o.useRef(null),et=(0,o.useMemo)(()=>{var e,t;return!!l&&!!("string"==typeof L&&(null==V?void 0:V.collections)&&(null==(t=V.collections)||null==(e=t[L])?void 0:e.create))},[L,V,l]),en=o.useCallback(e=>{"function"==typeof C&&C(e)},[C]),el=o.useCallback(async e=>{if(!(null==e?void 0:e.length))return[];let t={};e.forEach(e=>{let{relationTo:n,value:l}=e;t[n]||(t[n]=[]);let a=l;l&&"object"==typeof l&&"value"in l&&(a=l.value),t[n].push(a)});let n=Object.entries(t).map(async e=>{let[t,n]=e,l={depth:0,draft:!0,limit:n.length,locale:H,where:{and:[{id:{in:n}}]}},o=await fetch("".concat(E).concat(a,"/").concat(t),{body:y.A(l),credentials:"include",headers:{"Accept-Language":q.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),r=[];return o.ok&&(r=(await o.json()).docs),{collection:t,docsById:r.reduce((e,t)=>
1(e[t.id]=t,e),{})}}),l=await Promise.all(n),o={};return l.forEach(e=>{let{collection:t,docsById:n}=e;o[t]=n}),e.map(e=>{var t;let{relationTo:n,value:l}=e,a=(null==(t=o[n])?void 0:t[l])||{id:l,filename:"".concat(W("general:untitled")," - ID: ").concat(l),isPlaceholder:!0};return{relationTo:n,value:a}})},[E,a,H,q.language,W]),ea=(0,o.useCallback)(e=>(function(e,t){let n=Array.isArray(t);if("string"==typeof e||"number"==typeof e)return e;if(e&&"object"==typeof e&&"relationTo"in e&&"value"in e){let t=e.value;for(;t&&"object"==typeof t&&null!==t&&"value"in t;)t=t.value;return t&&"object"==typeof t&&null!==t&&"id"in t&&(t=t.id),n?{relationTo:e.relationTo,value:t}:t}return e&&"object"==typeof e&&"id"in e?e.id:e})(e,_),[_]),eo=(0,o.useCallback)(e=>{let t=Array.isArray(_);if(g){let n=e.map(e=>t?{relationTo:e.collectionSlug,value:e.doc.id}:e.doc.id);en([...Array.isArray(T)?T.map(ea):[],...n]),A(t=>[...t||[],...e.map(e=>({relationTo:e.collectionSlug,value:e.doc}))])}else{let n=e[0];en(t?{relationTo:n.collectionSlug,value:n.doc.id}:n.doc.id),A([{relationTo:n.collectionSlug,value:n.doc}])}},[T,en,g,_,ea]),er=o.useCallback(e=>{let t=e;if(!g&&e&&e.length>1){let n=new DataTransfer;n.items.add(e[0]),t=n.files}t&&I(t),M(Array.isArray(_)?L:_),Array.isArray(K)&&z(K),"number"==typeof j&&B(j),O(F)},[g,_,L,M,K,j,O,F,I,z,B]),ei=o.useCallback(async e=>{let t=Array.isArray(_),n=[];for(let[t,l]of e)l&&n.push(t);let l=n.map(e=>({relationTo:L,value:e})),a=await el(l);a&&A(e=>[...e||[],...a]);let o=n.map(e=>t?{relationTo:L,value:e}:e);en([...Array.isArray(T)?T.map(ea):[],...o]),Q()},[L,Q,en,el,T,_,ea]),es=o.useCallback(e=>{let t=Array.isArray(_);e.doc&&(A(t=>[...t||[],{relationTo:L,value:e.doc}]),en(t?{relationTo:L,value:e.doc.id}:e.doc.id)),Z()},[Z,L,en,_]),ec=(0,o.useCallback)(async e=>{var t;let{collectionSlug:n,doc:l}=e,a=Array.isArray(_),o=(null==(t=await el([{relationTo:n,value:l.id}]))?void 0:t[0])||null;if(A(e=>o?g?[...e||[],o]:[o]:e),g){let e=a?{relationTo:n,value:l.id}:l.id;en([...Array.isArray(T)?T.map(ea):[],e])}else en(a?{relationTo:n,value:l.id}:l.id);Q()},[Q,g,el,en,T,_,ea]),eu=o.useCallback(async(e,t)=>{let n=await el([{relationTo:t,value:e}]);if(n[0]){let e=[];A(l=>{let a=null==l?void 0:l.findIndex(e=>{var l,a;return((null==(l=e.value)?void 0:l.id)===n[0].value.id||(null==(a=e.value)?void 0:a.isPlaceholder))&&e.relationTo===t});if(a>-1){let t=[...l];return t[a]=n[0],e=t,t}return l}),e.length&&g&&en(e.map(e=>{var t;return null==(t=e.value)?void 0:t.id}))}},[el,en,g]),ed=o.useCallback(e=>{let t=Array.isArray(_);en(e.map(e=>{let{relationTo:n,value:l}=e;return t?{relationTo:n,value:l.id}:l.id})),A(e)},[en,_]),eh=o.useCallback(e=>{let t=Array.isArray(_);if(!e||0===e.length){en(g?[]:null),A(g?[]:null);return}let n=e.map(e=>{let{relationTo:n,value:l}=e;return t?{relationTo:n,value:l.id}:l.id});en(g?n:n[0]),A(e)},[en,g,_]);(0,o.useEffect)(()=>{async function e(){if(T){let e=[];
1if(Array.isArray(_)&&("object"==typeof T&&"relationTo"in T||Array.isArray(T)&&T.length>0&&"object"==typeof T[0]&&"relationTo"in T[0])?e=(Array.isArray(T)?T:[T]).filter(e=>"object"==typeof e&&"relationTo"in e).map(e=>{let t=e.value;for(;t&&"object"==typeof t&&null!==t&&"value"in t;)t=t.value;return{relationTo:e.relationTo,value:t}}):Array.isArray(_)||(e=(Array.isArray(T)?T:[T]).map(e=>{let t=e;for(;t&&"object"==typeof t&&null!==t&&"value"in t;)t=t.value;return{relationTo:_,value:t}})),e.length>0){let t=await el(e);t&&(A(t),ee.current=T)}}else A([]),ee.current=null}ee.current!==T&&e()},[el,T,_]),(0,o.useEffect)(()=>{U(eo)},[T,S,eo,U]);let ef=!T||g&&Array.isArray(T)&&("number"!=typeof j||T.length<j)||!g&&(null==R?void 0:R[0])&&typeof R[0].value>"u";return(0,u.jsxs)("div",{className:[aq,hP,c,P&&"error",k&&"read-only"].filter(Boolean).join(" "),id:"field-".concat(null==S?void 0:S.replace(/\./g,"__")),style:D,children:[(0,u.jsx)(ep,{CustomComponent:b,Fallback:(0,u.jsx)(lD,{label:x,localized:w,path:S,required:N})}),(0,u.jsx)("div",{className:"".concat(hP,"__wrap"),children:(0,u.jsx)(ep,{CustomComponent:f,Fallback:(0,u.jsx)(no,{path:S,showError:P})})}),r,(0,u.jsxs)("div",{className:"".concat(hP,"__dropzoneAndUpload"),children:[g&&Array.isArray(T)&&T.length>0?(0,u.jsx)(u.Fragment,{children:R&&(null==R?void 0:R.length)>0?(0,u.jsx)(h_,{displayPreview:h,fileDocs:R,isSortable:v&&!k,onRemove:eh,onReorder:ed,readonly:k,reloadDoc:eu,serverURL:E,showCollectionSlug:Array.isArray(_)}):(0,u.jsx)("div",{className:"".concat(hP,"__loadingRows"),children:T.map(e=>(0,u.jsx)(i.f,{height:"40px"},"object"==typeof e?e.value:e))})}):null,!g&&T?(0,u.jsx)(u.Fragment,{children:R&&(null==R?void 0:R.length)>0&&R[0].value?(0,u.jsx)(hE,{displayPreview:h,fileDoc:R[0],onRemove:eh,readonly:k,reloadDoc:eu,serverURL:E,showCollectionSlug:Array.isArray(_)}):!R||!T||(null==R||null==(t=R[0])?void 0:t.value)?(0,u.jsx)(i.f,{height:"62px"}):(0,u.jsxs)(u.Fragment,{children:[W("general:untitled")," - ID: ",T]})}):null,ef?(0,u.jsx)(dE,{disabled:k||!et,multipleFiles:g,onChange:er,children:(0,u.jsxs)("div",{className:"".concat(hP,"__dropzoneContent"),children:[(0,u.jsxs)("div",{className:"".concat(hP,"__dropzoneContent__buttons"),children:[et&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(hP,"__createNewToggler"),disabled:k||!et,onClick:()=>{k||(g?er():J())},size:"small",children:W("general:createNew")}),(0,u.jsx)("span",{className:"".concat(hP,"__dropzoneContent__orText"),children:W("general:or")})]}),(0,u.jsx)(tD,{buttonStyle:"pill",className:"".concat(hP,"__listToggler"),disabled:k,onClick:X,size:"small",children:W("fields:chooseFromExisting")}),(0,u.jsx)($,{onSave:es}),(0,u.jsx)(G,{allowCreate:et,enableRowSelections:g,onBulkSelect:ei,onSelect:ec})]}),et&&!k&&(0,u.jsxs)("p",{className:"".concat(hP,"__dragAndDropText"),children:[W("general:or")," ",W("upload:dragAndDrop")]})]})}):(0,u.jsx)(u.Fragment,{children:!k&&!R&&(!T||"number"!=typeof j||Array.isArray(T)&&T.length<j)?(0,u.jsx)(i.f,{height:"40px"}):null})]}),n,(0,u.jsx)(ep,{CustomComponent:d,Fallback:(0,u.jsx)(na,{description:p,path:S})})]})}var hT=aV(function(e){let{field:t,field:{admin:{allowCreate:n,className:l,description:a,isSortable:r}={},hasMany:s,label:c,localized:d,maxRows:p,relationTo:h,required:f},path:m,readOnly:g,validate:v}=e,{config:b}=(0,i.c)(),y=t.displayPreview,{customComponents:{AfterInput:x,BeforeInput:w,Description:j,Error:C,Label:S}={},disabled:k,filterOptions:_,path:N,setValue:E,showError:P,value:D}=aB({potentiallyStalePath:m,validate:o.useCallback((e,t)=>{if("function"==typeof v)return v(e,{...t,required:f})},[v,f])}),T=Array.isArray(h),R=o.useMemo(()=>!0===s&&Array.isArray(D)?D.map(e=>T?e:{relationTo:Array.isArray(h)?h[0]:h,value:e}):D,[s,D,T,h]),A=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsx)(hb,{drawerSlugPrefix:m,children:(0,u.jsx)(hD,{AfterInput:x,allowCreate:!1!==n,api:b.routes.api,BeforeInput:w,className:l,Description:j,description:a,displayPreview:y,Error:C,filterOptions:_,hasMany:s,isSortable:r,label:c,Label:S,localized:d,maxRows:p,onChange:E,path:N,readOnly:g||k,relationTo:
1h,required:f,serverURL:b.serverURL,showError:P,style:A,value:R})})});function hR(e){let t=(0,f.c)(13),{clientFieldConfig:n,forceRender:l,indexPath:a,parentPath:o,parentSchemaPath:r,path:i,permissions:s,readOnly:c,schemaPath:d}=e,p;t[0]!==i?(p=e=>{var t,n;let[l]=e;return l&&(null==l||null==(n=l[i])||null==(t=n.customComponents)?void 0:t.Field)},t[0]=i,t[1]=p):p=t[1];let h=eM(p),m;if(t[2]!==h||t[3]!==n||t[4]!==l||t[5]!==a||t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==c||t[11]!==d){m=Symbol.for("react.early_return_sentinel");e:{var g;let e={forceRender:l,permissions:s,readOnly:c,schemaPath:d};if(null==(g=n.admin)?void 0:g.hidden){m=(0,u.jsx)(s5,{...e,path:i});break e}if(void 0!==h){m=h||null;break e}let t={...e,indexPath:a,parentPath:o,parentSchemaPath:r};switch(n.type){case"array":m=(0,u.jsx)(hI,{...t,field:n,path:i});break e;case"blocks":m=(0,u.jsx)(o_,{...t,field:n,path:i});break e;case"checkbox":m=(0,u.jsx)(a$,{...e,field:n,path:i});break e;case"code":m=(0,u.jsx)(oD,{...e,field:n,path:i});break e;case"collapsible":m=(0,u.jsx)(oL,{...t,field:n,path:i});break e;case"date":m=(0,u.jsx)(sQ,{...e,field:n,path:i});break e;case"email":m=(0,u.jsx)(sX,{...e,field:n,path:i});break e;case"group":m=(0,u.jsx)(s6,{...t,field:n,path:i});break e;case"join":m=(0,u.jsx)(uu,{...e,field:n,path:i});break e;case"json":m=(0,u.jsx)(ud,{...e,field:n,path:i});break e;case"number":m=(0,u.jsx)(up,{...e,field:n,path:i});break e;case"point":m=(0,u.jsx)(uf,{...e,field:n,path:i});break e;case"radio":m=(0,u.jsx)(ub,{...e,field:n,path:i});break e;case"relationship":m=(0,u.jsx)(uQ,{...e,field:n,path:i});break e;case"richText":m=(0,u.jsx)(uX,{...e,field:n,path:i});break e;case"row":m=(0,u.jsx)(u$,{...t,field:n});break e;case"select":m=(0,u.jsx)(u0,{...e,field:n,path:i});break e;case"tabs":m=(0,u.jsx)(dp,{...t,field:n,path:i});break e;case"text":m=(0,u.jsx)(dx,{...e,field:n,path:i});break e;case"textarea":m=(0,u.jsx)(dj,{...e,field:n,path:i});break e;case"ui":m=(0,u.jsx)(dC,{});break e;case"upload":m=(0,u.jsx)(hT,{...e,field:n,path:i});break e}}t[2]=h,t[3]=n,t[4]=l,t[5]=a,t[6]=o,t[7]=r,t[8]=i,t[9]=s,t[10]=c,t[11]=d,t[12]=m}else m=t[12];if(m!==Symbol.for("react.early_return_sentinel"))return m}var hA="render-fields",hL=e=>{let t=(0,f.c)(22),{className:n,fields:l,forceRender:a,margins:o,parentIndexPath:r,parentPath:i,parentSchemaPath:s,permissions:c,readOnly:d}=e,p=aO();if(l&&l.length>0){let e=o&&"".concat(hA,"--margins-").concat(o),h=!1===o&&"".concat(hA,"--margins-none"),f;t[0]!==n||t[1]!==e||t[2]!==h?(f=[hA,n,e,h].filter(Boolean),t[0]=n,t[1]=e,t[2]=h,t[3]=f):f=t[3];let g=f.join(" "),v;if(t[4]!==l||t[5]!==a||t[6]!==p||t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==c||t[11]!==d||t[12]!==g){let e;t[14]!==a||t[15]!==p||t[16]!==r||t[17]!==i||t[18]!==s||t[19]!==c||t[20]!==d?(e=(e,t)=>{var n,l;if(!e||(0,m.I2)(e))return null;let{operation:o,permissions:h,read:f}=(0,j.P)({field:e,operation:p,parentName:(null==i?void 0:i.includes("."))?i.split(".")[i.split(".").length-1]:i,permissions:c});if("name"in e&&!f)return null;let g=d||(null==e||null==(n=e.admin)?void 0:n.readOnly);g&&(null==(l=e.admin)?void 0:l.readOnly)===!1&&(g=!1),"name"in e&&!o&&(g=!0);let{indexPath:v,path:b,schemaPath:y}=(0,C.Z)({field:e,index:t,parentIndexPath:r,parentPath:i,parentSchemaPath:s});return(0,u.jsx)(aF,{value:b,children:(0,u.jsx)(hR,{clientFieldConfig:e,forceRender:a,indexPath:v,parentPath:i,parentSchemaPath:s,path:b,permissions:h,readOnly:g,schemaPath:y})},"".concat(b,"-").concat(t))},t[14]=a,t[15]=p,t[16]=r,t[17]=i,t[18]=s,t[19]=c,t[20]=d,t[21]=e):e=t[21],v=(0,u.jsx)(a7,{className:g,forceRender:a,children:l.map(e)}),t[4]=l,t[5]=a,t[6]=p,t[7]=r,t[8]=i,t[9]=s,t[10]=c,t[11]=d,t[12]=g,t[13]=v}else v=t[13];return v}return null},hO="array-field",hF=e=>{let t=(0,f.c)(40),{addRow:n,attributes:l,copyRow:a,CustomRowLabel:o,duplicateRow:r,errorCount:c,fields:p,forceRender:h,hasMaxRows:m,isDragging:g,isLoading:v,isSortable:b,labels:y,listeners:x,moveRow:w,parentPath:j,pasteRow:C,path:S,permissions:k,readOnly:_,removeRow:N,row:E,rowCount:P,rowIndex:D,schemaPath:T,setCollapse:R,setNodeRef:A,transform:L,transition:O}=e,F=void 0!==h&&h,M=oa(v,500),{i18n:I}=(0,s.d)(),B=eR(),U="".concat((0,d.s)(y.singular,I)," ").concat(String(D+1).padStart(2,"0")),z=c>
10&&B,V=z?"".concat(hO,"__row--has-errors"):"".concat(hO,"__row--no-errors"),H;t[0]!==V?(H=["".concat(hO,"__row"),V].filter(Boolean),t[0]=V,t[1]=H):H=t[1];let q=H.join(" "),W="".concat(j.split(".").join("-"),"-row-").concat(D),K=g?1:void 0,Y;if(t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==q||t[6]!==a||t[7]!==r||t[8]!==c||t[9]!==U||t[10]!==z||t[11]!==p||t[12]!==F||t[13]!==m||t[14]!==I||t[15]!==M||t[16]!==b||t[17]!==x||t[18]!==w||t[19]!==j||t[20]!==C||t[21]!==S||t[22]!==k||t[23]!==_||t[24]!==N||t[25]!==E.collapsed||t[26]!==E.id||t[27]!==P||t[28]!==D||t[29]!==T||t[30]!==R||t[31]!==A||t[32]!==W||t[33]!==K||t[34]!==L||t[35]!==O){let e;t[37]!==E.id||t[38]!==R?(e=e=>R(E.id,e),t[37]=E.id,t[38]=R,t[39]=e):e=t[39],Y=(0,u.jsx)("div",{id:W,ref:A,style:{transform:L,transition:O,zIndex:K},children:(0,u.jsx)(a9,{actions:_?void 0:(0,u.jsx)(a1,{addRow:n,copyRow:a,duplicateRow:r,hasMaxRows:m,index:D,isSortable:b,moveRow:w,pasteRow:C,removeRow:N,rowCount:P}),className:q,collapsibleStyle:z?"error":"default",dragHandleProps:b?{id:E.id,attributes:l,listeners:x}:void 0,header:(0,u.jsxs)("div",{className:"".concat(hO,"__row-header"),children:[M?(0,u.jsx)(i.f,{height:"1rem",width:"8rem"}):(0,u.jsx)(eV,{CustomComponent:o,label:U,path:S,rowNumber:D}),z&&(0,u.jsx)(nn,{count:c,i18n:I,withMessage:!0})]}),isCollapsed:E.collapsed,onToggle:e,children:M?(0,u.jsx)(i.f,{}):(0,u.jsx)(hL,{className:"".concat(hO,"__fields"),fields:p,forceRender:F,margins:"small",parentIndexPath:"",parentPath:S,parentSchemaPath:T,permissions:!0===k?k:null==k?void 0:k.fields,readOnly:_})})},"".concat(j,"-row-").concat(E.id)),t[2]=o,t[3]=n,t[4]=l,t[5]=q,t[6]=a,t[7]=r,t[8]=c,t[9]=U,t[10]=z,t[11]=p,t[12]=F,t[13]=m,t[14]=I,t[15]=M,t[16]=b,t[17]=x,t[18]=w,t[19]=j,t[20]=C,t[21]=S,t[22]=k,t[23]=_,t[24]=N,t[25]=E.collapsed,t[26]=E.id,t[27]=P,t[28]=D,t[29]=T,t[30]=R,t[31]=A,t[32]=W,t[33]=K,t[34]=L,t[35]=O,t[36]=Y}else Y=t[36];return Y},hM="array-field",hI=aV(e=>{let{field:t,field:{name:n,type:l,admin:{className:a,description:r,isSortable:c=!0}={},fields:p,label:h,localized:f,maxRows:m,minRows:g,required:v},forceRender:b=!1,path:y,permissions:x,readOnly:w,schemaPath:j,validate:C}=e,S=null!=j?j:n,k=null!=g?g:+!!v,{setDocFieldPreferences:_}=aD(),{addFieldRow:N,dispatchFields:E,getFields:P,moveFieldRow:D,removeFieldRow:T,replaceState:R,setModified:A}=eP(),L=eR(),{code:O}=lN(),{i18n:F,t:M}=(0,s.d)(),{config:{localization:I}}=(0,i.c)(),B=!I||!I.fallback||O===I.defaultLocale,U=(e=>{var t,n;return"labels"in e&&(null==e?void 0:e.labels)?e.labels:"labels"in e.field&&e.field.labels?{plural:null==(t=e.field.labels)?void 0:t.plural,singular:null==(n=e.field.labels)?void 0:n.singular}:"label"in e.field&&e.field.label?{plural:void 0,singular:e.field.label}:{plural:M("general:rows"),singular:M("general:row")}})(e),{customComponents:{AfterInput:z,BeforeInput:V,Description:H,Error:q,Label:W}={},disabled:K,errorPaths:Y,path:G,rows:Q=[],showError:X,valid:$,value:Z}=aB({hasRows:!0,potentiallyStalePath:y,validate:(0,o.useCallback)((e,t)=>!B&&null===e||("function"==typeof C?C(e,{...t,maxRows:m,minRows:k,required:v}):void 0),[m,k,v,C,B])}),J=(0,o.useCallback)(e=>{N({path:G,rowIndex:e,schemaPath:S}),setTimeout(()=>{aJ("".concat(G,"-row-").concat(e))},0)},[N,G,S]),ee=(0,o.useCallback)(e=>{E({type:"DUPLICATE_ROW",path:G,rowIndex:e}),A(!0),setTimeout(()=>{aJ("".concat(G,"-row-").concat(e))},0)},[E,G,A]),et=(0,o.useCallback)(e=>{T({path:G,rowIndex:e})},[T,G]),en=(0,o.useCallback)((e,t)=>{D({moveFromIndex:e,moveToIndex:t,path:G})},[G,D]),el=(0,o.useCallback)(e=>{let{collapsedIDs:t,updatedRows:n}=lR({collapsed:e,rows:Q});_(G,{collapsed:t}),E({type:"SET_ALL_ROWS_COLLAPSED",path:G,updatedRows:n})},[E,G,Q,_]),ea=(0,o.useCallback)((e,t)=>{let{collapsedIDs:n,updatedRows:l}=lT({collapsed:t,rowID:e,rows:Q});E({type:"SET_ROW_COLLAPSED",path:G,updatedRows:l}),_(G,{collapsed:n})},[E,G,Q,_]),eo=(0,o.useCallback)(e=>{let t={...P()},n=tA({type:l,fields:p,getDataToCopy:()=>tB({formState:t,path:G,rowIndex:e}),path:G,rowIndex:e,t:M});"string"==typeof n?eJ.error(n):eJ.success(M("general:copied"))},[p,P,G,M,l]),er=(0,o.useCallback)(e=>{let t={...P()},n=tL({onPaste:n=>{R(tU({dataFromClipboard:n,formState:t,path:G,rowIndex:e})),A(!0)},path:G,schemaFields:p,t:M});"string"==typeof n&&eJ.error(n)},[p,P,G,R,A,M]),ei=(0,o.useCallback)(e=>{R(tU({dataFromClipboard:e,formState:{...P()},path:G})),A(!0)},[P,G,R,A]),es=(0,o.useCallback)(()=>tB({formState:{...P()},path:G}),[P,G]),ec=m&&Q.length>=m,eu=Y.length,ed=L&&Y.length>0,eh=(w||K)&&0===Q.length,ef=Q.length&&Q.length<k||v&&0===Q.length,em=(0,o.useMemo)(()=>aH(t),[t]);return(0,u.jsxs)("div",{className:[aq,hM,a,ed?"".concat(hM,"--has-error"):"".concat(hM,"--has-no-error")].filter(
1Boolean).join(" "),id:"field-".concat(G.replace(/\./g,"__")),style:em,children:[X&&(0,u.jsx)(ep,{CustomComponent:q,Fallback:(0,u.jsx)(no,{path:G,showError:X})}),(0,u.jsxs)("header",{className:"".concat(hM,"__header"),children:[(0,u.jsxs)("div",{className:"".concat(hM,"__header-wrap"),children:[(0,u.jsxs)("div",{className:"".concat(hM,"__header-content"),children:[(0,u.jsx)("h3",{className:"".concat(hM,"__title"),children:(0,u.jsx)(ep,{CustomComponent:W,Fallback:(0,u.jsx)(lD,{as:"span",label:h,localized:f,path:G,required:v})})}),ed&&eu>0&&(0,u.jsx)(nn,{count:eu,i18n:F,withMessage:!0})]}),(0,u.jsxs)("ul",{className:"".concat(hM,"__header-actions"),children:[(null==Q?void 0:Q.length)>0&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("li",{children:(0,u.jsx)("button",{className:"".concat(hM,"__header-action"),onClick:()=>el(!0),type:"button",children:M("fields:collapseAll")})}),(0,u.jsx)("li",{children:(0,u.jsx)("button",{className:"".concat(hM,"__header-action"),onClick:()=>el(!1),type:"button",children:M("fields:showAll")})})]}),(0,u.jsx)("li",{children:(0,u.jsx)(tI,{allowCopy:(null==Q?void 0:Q.length)>0,allowPaste:!w,className:"".concat(hM,"__header-action"),disabled:K,fields:p,getDataToCopy:es,onPaste:ei,path:G,type:l})})]})]}),(0,u.jsx)(ep,{CustomComponent:H,Fallback:(0,u.jsx)(na,{description:r,path:G})})]}),(0,u.jsx)(aZ,{fieldValue:Z,localized:f,path:G,readOnly:w}),V,((null==Q?void 0:Q.length)>0||!$&&(eh||ef))&&(0,u.jsxs)(ne,{className:"".concat(hM,"__draggable-rows"),ids:Q.map(e=>e.id),onDragEnd:e=>{let{moveFromIndex:t,moveToIndex:n}=e;return en(t,n)},children:[Q.map((e,t)=>{let{id:n,isLoading:l}=e,a="".concat(G,".").concat(t),o=null==Y?void 0:Y.filter(e=>e.startsWith(a+".")).length;return(0,u.jsx)(t7,{disabled:w||K||!c,id:n,children:n=>{var r,i;return(0,u.jsx)(hF,{...n,addRow:J,copyRow:eo,CustomRowLabel:null==Q||null==(i=Q[t])||null==(r=i.customComponents)?void 0:r.RowLabel,duplicateRow:ee,errorCount:o,fields:p,forceRender:b,hasMaxRows:ec,isLoading:l,isSortable:c,labels:U,moveRow:en,parentPath:G,pasteRow:er,path:a,permissions:x,readOnly:w||K,removeRow:et,row:e,rowCount:null==Q?void 0:Q.length,rowIndex:t,schemaPath:S,setCollapse:ea})}},n)}),!$&&(0,u.jsxs)(o.Fragment,{children:[eh&&(0,u.jsx)(tl,{children:M("validation:fieldHasNo",{label:(0,d.s)(U.plural,F)})}),ef&&(0,u.jsx)(tl,{type:"error",children:M("validation:requiresAtLeast",{count:k,label:(0,d.s)(k>1?U.plural:U.singular,F)||M(k>1?"general:rows":"general:row")})})]})]}),!ec&&!w&&(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(hM,"__add-row"),disabled:K,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{J(Z||0)},children:M("fields:addLabel",{label:(0,d.s)(U.singular,F)})}),z]})}),hB=e=>{let t=(0,f.c)(12),{disabled:n,path:l}=e,a=void 0===l?"confirm-password":l,{t:o}=(0,s.d)(),r;t[0]!==a?(r={path:a,validate:hU},t[0]=a,t[1]=r):r=t[1];let{disabled:i,setValue:c,showError:d,value:p}=aB(r),h=d&&"error",m;t[2]!==h?(m=[aq,"confirm-password",h].filter(Boolean),t[2]=h,t[3]=m):m=t[3];let g=m.join(" "),v;return t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==o||t[9]!==g||t[10]!==p?(v=(0,u.jsxs)("div",{className:g,children:[(0,u.jsx)(lD,{htmlFor:"field-confirm-password",label:o("authentication:confirmPassword"),required:!0}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(no,{path:a}),(0,u.jsx)("input",{"aria-label":o("authentication:confirmPassword"),autoComplete:"off",disabled:!!(i||n),id:"field-confirm-password",name:"confirm-password",onChange:c,type:"password",value:p||""})]})]}),t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=o,t[9]=g,t[10]=p,t[11]=v):v=t[11],v};function hU(e,t){return(0,K.C5)(e,{name:"confirm-password",type:"text",required:!0,...t})}var hz=e=>{let t=(0,f.c)(28),{AfterInput:n,autoComplete:l,BeforeInput:a,className:o,description:r,Description:i,Error:c,inputRef:p,Label:h,label:m,localized:g,onChange:v,onKeyDown:b,path:y,placeholder:x,readOnly:w,required:j,rtl:C,showError:S,style:k,value:_,width:N}=e,E=void 0===l?"off":l,{i18n:P}=(0,s.d)(),D=S&&"error",T=w&&"read-only",R;
1t[0]!==o||t[1]!==D||t[2]!==T?(R=[aq,"password",o,D,T].filter(Boolean),t[0]=o,t[1]=D,t[2]=T,t[3]=R):R=t[3];let A=R.join(" "),L;return t[4]!==n||t[5]!==a||t[6]!==i||t[7]!==c||t[8]!==h||t[9]!==E||t[10]!==r||t[11]!==P||t[12]!==p||t[13]!==m||t[14]!==g||t[15]!==v||t[16]!==b||t[17]!==y||t[18]!==x||t[19]!==w||t[20]!==j||t[21]!==C||t[22]!==S||t[23]!==k||t[24]!==A||t[25]!==_||t[26]!==N?(L=(0,u.jsxs)("div",{className:A,style:{...k,width:N},children:[(0,u.jsx)(ep,{CustomComponent:h,Fallback:(0,u.jsx)(lD,{label:m,localized:g,path:y,required:j})}),(0,u.jsxs)("div",{className:"".concat(aq,"__wrap"),children:[(0,u.jsx)(ep,{CustomComponent:c,Fallback:(0,u.jsx)(no,{path:y,showError:S})}),(0,u.jsxs)("div",{children:[a,(0,u.jsx)("input",{"aria-label":(0,d.s)(m,P),autoComplete:E,"data-rtl":C,disabled:w,id:"field-".concat(y.replace(/\./g,"__")),name:y,onChange:v,onKeyDown:b,placeholder:(0,d.s)(x,P),ref:p,type:"password",value:_||""}),n]}),(0,u.jsx)(ep,{CustomComponent:i,Fallback:(0,u.jsx)(na,{description:r,path:y})})]})]}),t[4]=n,t[5]=a,t[6]=i,t[7]=c,t[8]=h,t[9]=E,t[10]=r,t[11]=P,t[12]=p,t[13]=m,t[14]=g,t[15]=v,t[16]=b,t[17]=y,t[18]=x,t[19]=w,t[20]=j,t[21]=C,t[22]=S,t[23]=k,t[24]=A,t[25]=_,t[26]=N,t[27]=L):L=t[27],L},hV=aV(e=>{let{autoComplete:t,field:n,field:{admin:{className:l,disabled:a,placeholder:r,rtl:c}={},label:d,localized:p,required:h}={},inputRef:f,path:m,validate:g}=e,{t:v}=(0,s.d)(),b=lN(),{config:y}=(0,i.c)(),x=(0,o.useCallback)((e,t)=>{let n=m?m.split("."):[];return"function"==typeof g?g(e,{...t,required:h}):(0,K.wJ)(e,{name:"password",type:"text",blockData:{},data:{},event:"onChange",path:n,preferences:{fields:{}},req:{payload:{config:y},t:v},required:!0,siblingData:{}})},[g,y,v,h,m]),{customComponents:{AfterInput:w,BeforeInput:j,Description:C,Error:S,Label:k}={},disabled:_,setValue:N,showError:E,value:P}=aB({path:m,validate:x}),D=aW({fieldLocalized:!1,fieldRTL:c,locale:b,localizationConfig:y.localization||void 0}),T=(0,o.useMemo)(()=>aH(n),[n]);return(0,u.jsx)(hz,{AfterInput:w,autoComplete:t,BeforeInput:j,className:l,Description:C,Error:S,inputRef:f,Label:k,label:d,localized:p,onChange:e=>{N(e.target.value)},path:m,placeholder:r,readOnly:_||a,required:h,rtl:D,showError:E,style:T,value:P||""})}),hH={array:hI,blocks:o_,checkbox:a$,code:oD,collapsible:oL,confirmPassword:hB,date:sQ,email:sX,group:s6,hidden:s5,join:uu,json:ud,number:up,password:hV,point:uf,radio:ub,relationship:uQ,richText:uX,row:u$,select:u0,tabs:dp,text:dx,textarea:dj,ui:dC,upload:hT},hq={...hH,Description:na,Error:no,Label:lD,RowLabel:eV},hW=new Map([]),hK={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"},hY=e=>(hK[e.toLowerCase()]||e).trim().toLowerCase().replace("key",""),hG=(e,t)=>{let n=(0,f.c)(9),{cmdCtrlKey:l,editDepth:a,keyCodes:r}=e,{modalState:i}=nE(),s;n[0]!==l||n[1]!==a||n[2]!==t||n[3]!==r||n[4]!==i?(s=e=>{var n,o;let s=(null==(n=e.detail)?void 0:n.key)?e.detail:e;if(void 0===s.key)return;hW.forEach(hQ),s.code&&(e=>{let t=hY(e);"meta"===t&&hW.forEach((e,t)=>"meta"!==t&&hW.delete(t)),hW.set(t,Date.now())})(s.code);let c=window.navigator.userAgent.includes("Mac OS X"),u=[...hW.keys()].filter(hX);if((0,Y._)(new Set(u),new Set(r))&&(!l||c&&hW.has("meta")||!c&&s.ctrlKey)){if(((null==(o=Object.keys(i).filter(e=>{var t;return null==(t=i[e])?void 0:t.isOpen}))?void 0:o.length)+1||1)!==a)return;t(s)}},n[0]=l,n[1]=a,n[2]=t,n[3]=r,n[4]=i,n[5]=s):s=n[5];let c=s,u,d;n[6]!==c?(u=()=>(document.addEventListener("keydown",c,!1),document.addEventListener("bypassKeyDown",c,!1),document.addEventListener("keyup",h$,!1),()=>{document.removeEventListener("keydown",c),document.removeEventListener("bypassKeyDown",c),document.removeEventListener("keyup",h$)}),d=[c,h$],n[6]=c,n[7]=u,n[8]=d):(u=n[7],d=n[8]),(0,o.useEffect)(u,d)};function hQ(e,t){Date.now()-e>3e3&&hW.delete(t)}function hX(e){return!["alt","ctrl","meta","shift"].includes(e)}function h$(e){let t;e.code&&("meta"===(t=hY(e.code))&&hW.clear(),hW.delete(t))}var hZ=(e,t)=>{let n,l,a,r,i,c,u=(0,f.c)(30),d;u[0]!==t?(d=void 0===t?{}:t,u[0]=t,u[1]=d):d=u[1];let{initialData:p,initialParams:h}=d,m;u[2]!==h?(m=void 0===h?{}:h,u[2]=h,u[3]=m):m=u[3];let g=m,{i18n:v}=(0,s.d)(),b;u[4]!==p?(b=p||{},u[4]=p,u[5]=b):b=u[5];let[x,w]=(0,o.useState)(b),[j,C]=(0,o.useState)(g),[S,k]=(0,o.useState)(!p),[_,N]=(0,o.useState)(!1),{code:E}=lN(),P=(0,o.useRef)(!1),D;u[6]!==E||u[7]!==j?(D=y.A({locale:E,..."object"==typeof j?j:{}},{addQueryPrefix:!0}),u[6]=E,u[7]=j,u[8]=D):D=u[8];let T=D,R;
1return u[9]!==v.language||u[10]!==p||u[11]!==T||u[12]!==e?(R=()=>{if(p&&!P.current){P.current=!0;return}let t=new AbortController;return e?(async()=>{N(!1),k(!0);try{let n=await lb.get("".concat(e).concat(T),{headers:{"Accept-Language":v.language},signal:t.signal});n.status>201&&N(!0);let l=await n.json();w(l),k(!1)}catch(e){t.signal.aborted||(N(!0),k(!1))}})():(N(!1),k(!1)),()=>{try{t.abort()}catch(e){}}},u[9]=v.language,u[10]=p,u[11]=T,u[12]=e,u[13]=R):R=u[13],u[14]!==v.language||u[15]!==p||u[16]!==E||u[17]!==T||u[18]!==e?(n=[e,E,T,v.language,p],u[14]=v.language,u[15]=p,u[16]=E,u[17]=T,u[18]=e,u[19]=n):n=u[19],(0,o.useEffect)(R,n),u[20]!==p?(l=()=>{p&&P.current&&w(p)},a=[p],u[20]=p,u[21]=l,u[22]=a):(l=u[21],a=u[22]),(0,o.useEffect)(l,a),u[23]!==x||u[24]!==_||u[25]!==S?(r={data:x,isError:_,isLoading:S},u[23]=x,u[24]=_,u[25]=S,u[26]=r):r=u[26],u[27]===Symbol.for("react.memo_cache_sentinel")?(i={setParams:C},u[27]=i):i=u[27],u[28]!==r?(c=[r,i],u[28]=r,u[29]=c):c=u[29],c},hJ=e=>{let t,n=(0,f.c)(5),[l,a]=(0,o.useState)(),r,i;return n[0]!==e?(r=()=>{let t;return e&&(t=new ResizeObserver(e=>{e.forEach(e=>{let{contentBoxSize:t,contentRect:n}=e,l=0,o=0;if(t){let e=Array.isArray(t)?t[0]:t;if(e){let{blockSize:t,inlineSize:n}=e;l=n,o=t}}else if(n){let{height:e,width:t}=n;l=t,o=e}a({height:o,width:l})})})).observe(e),()=>{t&&t.unobserve(e)}},i=[e],n[0]=e,n[1]=r,n[2]=i):(r=n[1],i=n[2]),(0,o.useEffect)(r,i),n[3]!==l?(t={size:l},n[3]=l,n[4]=t):t=n[4],t},h0=e=>{var t;let n=(0,f.c)(4),{admin:l,fields:a}=e,{useAsTitle:o}=l,{i18n:r}=(0,s.d)(),i;return n[0]!==a||n[1]!==r||n[2]!==o?(i=null==(t=(0,S.L)(a,{i18n:r,moveSubFieldsToTop:!0}))?void 0:t.find(e=>"name"in e&&e.name===o),n[0]=a,n[1]=r,n[2]=o,n[3]=i):i=n[3],i},h1=e=>{let{className:t}=e;return(0,u.jsx)("svg",{className:"icon icon--sort",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("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"})})},h3=e=>{let{className:t}=e;return(0,u.jsx)("svg",{className:"icon icon--sort",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("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"})})},h2="sort-header",h6=e=>{let t=(0,f.c)(7),{appearance:n}=e,{handleSortPress:l,isActive:a}=function(){let e=(0,f.c)(7),{handleSortChange:t,orderableFieldName:n,query:l}=cn(),a=(Array.isArray(l.sort)?l.sort[0]:l.sort)===n,o;e[0]!==t||e[1]!==a||e[2]!==n?(o=()=>{a||t(n)},e[0]=t,e[1]=a,e[2]=n,e[3]=o):o=e[3];let r=o,i;return e[4]!==r||e[5]!==a?(i={handleSortPress:r,isActive:a},e[4]=r,e[5]=a,e[6]=i):i=e[6],i}(),{t:o}=(0,s.d)(),r=n&&"".concat(h2,"--appearance-").concat(n),i;t[0]!==r?(i=[h2,r].filter(Boolean),t[0]=r,t[1]=i):i=t[1];let c=i.join(" "),d;return t[2]!==l||t[3]!==a||t[4]!==o||t[5]!==c?(d=(0,u.jsx)("div",{className:c,children:(0,u.jsx)("div",{className:"".concat(h2,"__buttons"),children:(0,u.jsx)("button",{"aria-label":o("general:sortByLabelDirection",{direction:o("general:ascending"),label:"Order"}),className:"".concat(h2,"__button ").concat(a?"".concat(h2,"--active"):""),onClick:l,type:"button",children:(0,u.jsx)(h1,{})})})}),t[2]=l,t[3]=a,t[4]=o,t[5]=c,t[6]=d):d=t[6],d},h5="sort-row",h4=()=>{let e=(0,f.c)(2),{orderableFieldName:t,query:n}=cn(),l=n.sort===t||n.sort==="-".concat(t),a="".concat(h5," ").concat(l?"active":""),o;return e[0]!==a?(o=(0,u.jsx)("div",{className:a,role:"button",tabIndex:0,children:(0,u.jsx)(a3,{className:"".concat(h5,"__icon")})}),e[0]=a,e[1]=o):o=e[1],o},h8=e=>{let{cellMap:t,columns:n,dragAttributes:l={},dragListeners:a={},rowId:o,...r}=e;return(0,u.jsx)("tr",{...r,children:n.map((e,n)=>{let{accessor:r}=e,i=e.renderedCells[t[o]];return"_dragHandle"===r?(0,u.jsx)("td",{className:"cell-".concat(r),children:(0,u.jsx)("div",{...l,...a,children:i})},n):(0,u.jsx)("td",{className:"cell-".concat(r),children:i},n)})})},h9=e=>{let{children:t,className:n,rowId:l}=e;return typeof l>"u"?null:(0,u.jsx)("div",{className:n,children:(0,u.jsx)("table",{cellPadding:0,cellSpacing:0,children:(0,u.jsx)("tbody",{children:t})})})},h7="table",fe=e=>{let{appearance:t="default",BeforeTable:n,collection:l,columns:a,data:r}
1=e,{config:s}=(0,i.c)(),{data:c,orderableFieldName:d,query:p}=cn(),h=(null==c?void 0:c.docs)||r,[f,m]=(0,o.useState)(h),[v,b]=(0,o.useState)({}),[y,x]=(0,o.useState)();(0,o.useEffect)(()=>{m(h),b(Object.fromEntries(h.map((e,t)=>{var n;return[String(null!=(n=e.id)?n:e._id),t]})))},[h]);let w=null==a?void 0:a.filter(e=>null==e?void 0:e.active);if(!w||0===w.filter(e=>!["_dragHandle","_select"].includes(e.accessor)).length)return(0,u.jsx)("div",{children:"No columns selected"});let j=async e=>{var t,n,a;let{moveFromIndex:o,moveToIndex:r}=e;if(p.sort!==d&&p.sort!=="-".concat(d)){eJ.warning('To reorder the rows you must first sort them by the "Order" column'),x(void 0);return}if(o===r)return void x(void 0);let i=null!=(t=f[o].id)?t:f[o]._id,c=r>o?f[r]:f[r-1],u=r>o?f[r+1]:f[r],h=[...f];m(e=>{let t=[...e];return t[o][d]="pending",t.splice(r,0,t.splice(o,1)[0]),t});try{let e=c?{id:null!=(n=c.id)?n:c._id,key:c[d]}:{id:null!=(a=u.id)?a:u._id,key:u[d]},t=c&&p.sort===d||!c&&p.sort==="-".concat(d)?"greater":"less",o={collectionSlug:l.slug,docsToMove:[i],newKeyWillBe:t,orderableFieldName:d,target:e},r=await fetch("".concat(s.serverURL).concat(s.routes.api,"/reorder"),{body:JSON.stringify(o),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(403===r.status)throw Error("You do not have permission to reorder these rows");if(!r.ok)throw Error("Failed to reorder. This can happen if you reorder several rows too quickly. Please try again.");if(200===r.status&&"initial migration"===(await r.json()).message)throw 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(t){let e=t instanceof Error?t.message:String(t);m(h),eJ.error(e)}finally{x(void 0)}},C=f.map(e=>{var t;return null!=(t=e.id)?t:e._id});return(0,u.jsxs)("div",{className:[h7,t&&"".concat(h7,"--appearance-").concat(t)].filter(Boolean).join(" "),children:[n,(0,u.jsxs)(ne,{ids:C,onDragEnd:j,onDragStart:e=>{let{id:t}=e;x(t)},children:[(0,u.jsxs)("table",{cellPadding:"0",cellSpacing:"0",children:[(0,u.jsx)("thead",{children:(0,u.jsx)("tr",{children:w.map((e,t)=>(0,u.jsx)("th",{id:"heading-".concat(e.accessor),children:e.Heading},t))})}),(0,u.jsx)("tbody",{children:f.map((e,t)=>(0,u.jsx)(t7,{id:C[t],children:n=>{var l;let{attributes:a,isDragging:o,listeners:r,setNodeRef:i,transform:s,transition:c}=n;return(0,u.jsx)(h8,{cellMap:v,className:"row-".concat(t+1),columns:w,dragAttributes:a,dragListeners:r,ref:i,rowId:null!=(l=e.id)?l:e._id,style:{opacity:+!o,transform:s,transition:c}})}},C[t]))})]}),(0,u.jsx)(g.Hd,{children:(0,u.jsx)(h9,{className:[h7,"".concat(h7,"--drag-preview")].join(" "),rowId:y,children:(0,u.jsx)(h8,{cellMap:v,columns:w,rowId:y})})})]})]})},ft=e=>{let{cellData:t}=e;return(0,u.jsx)("div",{className:"query-preset-columns-cell",children:t?(0,_.F)(t).map((e,t)=>{let n=!e.startsWith("-");return n?(0,u.jsx)(ol,{pillStyle:n?"always-white":"light",size:"small",children:(0,G.x4)(e)},t):null}):"No columns selected"})},fn=e=>{let{cellData:t}=e;return(0,u.jsx)("div",{children:t?(e=>{if(e.or&&e.or.length>0&&e.or[0].and&&e.or[0].and.length>0){var t,n;let l=null==(n=e.or[0])||null==(t=n.and)?void 0:t[0];if(!l||"object"!=typeof l)return"No where query";let a=Object.keys(l)[0];if(!a||!l[a]||"object"!=typeof l[a])return"No where query";let o=Object.keys(l[a])[0],r=l[a][o];if("string"==typeof r)return"".concat((0,G.x4)(a)," ").concat(o," ").concat((0,G.x4)(r));if(Array.isArray(r))return"".concat((0,G.x4)(a)," ").concat(o," ").concat(r.map(e=>(0,G.x4)(e)).join(" or "))}return""})(t):"No where query"})},fl=e=>{let{cellData:t}=e,n=["read","update","delete"];return(0,u.jsx)("p",{children:n.reduce((e,l,a)=>{let r=null==t?void 0:t[l];return r&&r.constraint&&e.push((0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("span",{children:[(0,u.jsx)("strong",{children:(0,G.x4)(l)}),": ",(0,G.x4)(r.constraint)]}),a!==n.length-1&&", "]},l)),e},[])})},fa=[{label:"equals",value:"equals"},{label:"isNotEqualTo",value:"not_equals"}],fo={label:"exists",value:"exists"},fr=[...fa,{label:"isIn",value:"in"},{label:"isNotIn",value:"not_in"},fo],fi=[...fr,{label:"isGreaterThan",value:"greater_than"},{label:"isLessThan",value:"less_than"},{label:"isLessThanOrEqualTo",value:"less_than_equal"},{label:"isGreaterThanOrEqualTo",value:"greater_than_equal"}],fs=[...fa,{label:"near",value:"near"}],fc={label:"within",value:"within"},fu={label:"intersects",value:"intersects"},fd={label:"isLike",value:"like"},fp={label:"isNotLike",value:"not_like"},fh={label:"contains",value:"contains"},ff={checkbox:{component:"Text",operators:[...fa,fo]},code:{component:"Text",operators:[...fr,fd,fp,fh]},date:{component:"Date",operators:[...fi,fo]},email:{component:"Text",operators:[...fr,fh]},json:{component:"Text",operators:[...fr,fd,fh,fp,fc,fu]},number:{component:"Number",operators:[...fi,fo]},point:{component:"Point",operators:[...fs,fo,fc,fu]},radio:{component:"Select",operators:[...fr]},relationship:{component:"Relationship",operators:[...fr]},richText:{component:"Text",operators:[...fr,fd,fp,fh]},select:{component:"Select",operators:[...fr]},text:{component:"Text",operators:[...fr,fd,fp,fh]},textarea:{component:"Text",operators:[...fr,fd,fp,fh]},upload:{component:"Relationship",operators:[...fr]}},fm=e=>{let{field:t,operator:n}=e,l=[];return l="relationship"===t.type&&Array.isArray(t.relationTo)?"hasMany"in t&&t.hasMany?[...fa,fo]:[...fr]:[...ff[t.type].operators],{validOperator:n&&l.find(e=>{let{value:t}=e;return t===n})?n:l[0].value,validOperators:l}},fg=e=>{let{fieldPermissions:t,fields:n,i18n:l,labelPrefix:a,pathPrefix:o}=e;return n.reduce((e,n)=>{var r,i,s;let c=o;if((0,m.I2)(n)&&!(0,m.uT)(n)||"virtual"in n&&!0===n.virtual)return e;let u=!1;if("virtual"in n&&"string"==typeof n.virtual&&(c=c?c+"."+n.virtual:n.virtual,(0,m.Z7)(n)&&(u=!0)),"tabs"===n.type&&"tabs"in n)return n.tabs.forEac
1h(n=>{if("boolean"!=typeof n.label){var o;let r=(0,d.s)(n.label,l),i=(0,m.pz)(n)&&n.name?c?c+"."+n.name:n.name:c;"string"==typeof r&&e.push(...fg({fieldPermissions:"boolean"==typeof t?t:(0,m.pz)(n)&&n.name?(null==t||null==(o=t[n.name])?void 0:o.fields)||(null==t?void 0:t[n.name]):t,fields:n.fields,i18n:l,labelPrefix:a?a+" > "+r:r,pathPrefix:i}))}}),e;if("row"===n.type&&"fields"in n)return e.push(...fg({fieldPermissions:t,fields:n.fields,i18n:l,labelPrefix:a,pathPrefix:c})),e;if("collapsible"===n.type&&"fields"in n){let o=(0,d.s)(n.label||"",l);return e.push(...fg({fieldPermissions:t,fields:n.fields,i18n:l,labelPrefix:a?a+" > "+o:o,pathPrefix:c})),e}if("group"===n.type&&"fields"in n){let o=(0,d.s)(n.label||"",l),r=a?o?a+" > "+o:a:o;if((0,m.Z7)(n)){let a=n.name?c?c+"."+n.name:n.name:c;e.push(...fg({fieldPermissions:"boolean"==typeof t?t:(null==t||null==(i=t[n.name])?void 0:i.fields)||(null==t?void 0:t[n.name]),fields:n.fields,i18n:l,labelPrefix:r,pathPrefix:a}))}else e.push(...fg({fieldPermissions:t,fields:n.fields,i18n:l,labelPrefix:r,pathPrefix:c}));return e}if("array"===n.type&&"fields"in n){let o=(0,d.s)(n.label||"",l),r=n.name?c?c+"."+n.name:n.name:c;return e.push(...fg({fieldPermissions:"boolean"==typeof t?t:(null==t||null==(s=t[n.name])?void 0:s.fields)||(null==t?void 0:t[n.name]),fields:n.fields,i18n:l,labelPrefix:a?o?a+" > "+o:a:o,pathPrefix:r})),e}if("object"==typeof ff[n.type]&&((0,m.uT)(n)||!0===t||(null==t?void 0:t[n.name])===!0||(null==t||null==(r=t[n.name])?void 0:r.read)===!0)){let t=new Set,{validOperators:o}=fm({field:n}),r=o.reduce((e,n)=>{if(!t.has(n.value)){t.add(n.value);let a="operators:".concat(n.label);e.push({...n,label:l.t(a)})}return e},[]),i=(0,d.s)(n.label||"",l),s=a?dz({field:n,prefix:a}):i,p;p=u?c:c?dU(c,n):n.name;let h={label:s,plainTextLabel:"".concat(a?a+" > ":"").concat(i),value:p,...ff[n.type],field:n,operators:r};return e.push(h),e}return e},[])},fv=e=>{var t;let{cellData:n,rowData:l}=e,{i18n:a}=(0,s.d)(),{permissions:r}=lw(),{config:c}=(0,i.c)(),d=null==l?void 0:l.relatedCollection,p=(0,o.useMemo)(()=>{var e;return d?null==(e=c.collections)?void 0:e.find(e=>e.slug===d):null},[d,c.collections]),h=(0,o.useMemo)(()=>{var e,t;return p?fg({fieldPermissions:null==r||null==(t=r.collections)||null==(e=t[d])?void 0:e.fields,fields:p.fields,i18n:a}):[]},[p,r,d,a]);if(!n||"string"!=typeof n)return(0,u.jsx)("div",{children:"No group by selected"});let f=n.startsWith("-"),m=f?n.slice(1):n,g=(null==(t=h.find(e=>e.value===m))?void 0:t.label)||(0,G.x4)(m);return(0,u.jsxs)("div",{children:[g," (",f?"descending":"ascending",")"]})},fb=e=>{let t=(0,f.c)(5),{field:n}=e,{label:l,required:a}=n,{path:o,value:r}=aB(),i;return t[0]!==l||t[1]!==o||t[2]!==a||t[3]!==r?(i=(0,u.jsxs)("div",{className:"field-type query-preset-columns-field",children:[(0,u.jsx)(lD,{as:"h3",label:l,path:o,required:a}),(0,u.jsx)("div",{className:"value-wrapper",children:r?(0,_.F)(r).map(fy):"No columns selected"})]}),t[0]=l,t[1]=o,t[2]=a,t[3]=r,t[4]=i):i=t[4],i};function fy(e,t){let n=!e.startsWith("-");return(0,u.jsx)(ol,{pillStyle:n?"always-white":"light-gray",size:"small",children:(0,G.x4)(e)},t)}var fx=e=>{var t;let{field:n}=e,{label:l,required:a}=n,{path:r,value:c}=aB(),{collectionSlug:p}=cn(),{getEntityConfig:h}=(0,i.c)(),f=h({collectionSlug:p}),{i18n:m}=(0,s.d)();return(0,u.jsxs)("div",{className:"field-type query-preset-where-field",children:[(0,u.jsx)(lD,{as:"h3",label:l,path:r,required:a}),(0,u.jsx)("div",{className:"value-wrapper",children:c?((e,t)=>{if(!e)return null;let n=e=>{if(!e||"object"!=typeof e)return"No where query";let t=Object.keys(e)[0];if(!t||!e[t]||"object"!=typeof e[t])return"No where query";let n=Object.keys(e[t])[0],l=e[t][n],a=e=>{var t;if("object"==typeof e&&null!=e)try{return new Date(e).toLocaleDateString()}catch(e){return"Unknown error has occurred"}return null!=(t=null==e?void 0:e.toString())?t:""},o=Array.isArray(l)?l.map(a).join(", "):a(l);return(0,u.jsxs)(ol,{pillStyle:"always-white",size:"small",children:[(0,u.jsx)("b",{children:(0,G.x4)(t)})," ",n," ",(0,u.jsx)("b",{children:(0,G.x4)(o)})]})};return((e,t)=>e.or&&e.or.length>0?(0,u.jsx)("div",{className:"or-condition",children:e.or.map((e,l)=>(0,u.jsx)(o.Fragment,{children:e.and&&e.and.length>0?(0,u.jsxs)("div",{className:"and-condition",children:[0===l&&(0,u.jsx)("span",{className:"label",children:"Filter ".concat(t," where ")}),l>0&&(0,u.jsx)("span",{className:"label",children:" or "}),e.and.map((t,l)=>(0,u.jsxs)(o.Fragment,{children:[n(t),l<e.and.length-1&&(0,u.jsx)("span",{className:"label",children:" and "})]},l))]}):n(e)},l))}):n(e))(e,t)})(c,(0,d.s)(null==f||null==(t=f.labels)?void 0:t.plural,m)):"No where query"})]})},fw=e=>{let{field:{label:t,required:n}}=e,{path:l,value:a}=aB(),{i18n:r}=(0,s.d)(),{permissions:c}=lw(),{config:d}=(0,i.c)(),p=aB({path:"relatedCollection"}).value,h=(0,o.useMemo)(()=>{var e;
1return p?null==(e=d.collections)?void 0:e.find(e=>e.slug===p):null},[p,d.collections]),f=(0,o.useMemo)(()=>{var e,t;return h?fg({fieldPermissions:null==c||null==(t=c.collections)||null==(e=t[p])?void 0:e.fields,fields:h.fields,i18n:r}):[]},[h,c,p,r]);return(0,u.jsxs)("div",{className:"field-type query-preset-group-by-field",children:[(0,u.jsx)(lD,{as:"h3",label:t,path:l,required:n}),(0,u.jsx)("div",{className:"value-wrapper",children:(e=>{var t;if(!e)return"No group by selected";let n=e.startsWith("-"),l=n?e.slice(1):e,a=(null==(t=f.find(e=>e.value===l))?void 0:t.label)||(0,G.x4)(l);return(0,u.jsxs)(ol,{pillStyle:"always-white",size:"small",children:[(0,u.jsx)("b",{children:a})," (",n?"descending":"ascending",")"]})})(a)})]})},fj="leave-without-saving",fC=e=>{let t,n=(0,f.c)(17),{disablePreventLeave:l,onConfirm:a,onPrevent:r}=e,{closeModal:i,openModal:s}=nE(),c=eO(),{isValid:d}=eP(),{user:p}=lw(),[m,g]=o.useState(!1),v=!(void 0!==l&&l)&&!!((c||!d)&&p),b;n[0]!==r||n[1]!==s?(b=()=>{var e;let t=(null==(e=document.activeElement)?void 0:e.href)||null;r&&r(t),s(fj)},n[0]=r,n[1]=s,n[2]=b):b=n[2];let y=b,x;n[3]!==i?(x=()=>{i(fj)},n[3]=i,n[4]=x):x=n[4];let w=x,j;n[5]!==w||n[6]!==y||n[7]!==m||n[8]!==v?(j={hasAccepted:m,onAccept:w,onPrevent:y,prevent:v},n[5]=w,n[6]=y,n[7]=m,n[8]=v,n[9]=j):j=n[9],(e=>{let{hasAccepted:t=!1,message:n="Are you sure want to leave this page?",onAccept:l,onPrevent:a,prevent:r=!0}=e;((e,t)=>{let n=(0,f.c)(7),l=void 0===e||e,a;n[0]!==l||n[1]!==t?(a=e=>{if("function"!=typeof l||l())return e.preventDefault(),t&&(e.returnValue=t),t},n[0]=l,n[1]=t,n[2]=a):a=n[2];let r=a,i,s;n[3]!==l||n[4]!==r?(i=()=>{if(l)return function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];e&&e.addEventListener&&e.addEventListener(...n)}(window,"beforeunload",r),()=>(function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];e&&e.removeEventListener&&e.removeEventListener(...n)})(window,"beforeunload",r)},s=[l,r],n[3]=l,n[4]=r,n[5]=i,n[6]=s):(i=n[5],s=n[6]),(0,o.useEffect)(i,s)})(r,n);let{startRouteTransition:i}=e8(),s=(0,h.useRouter)(),c=(0,o.useRef)("");(0,o.useEffect)(()=>{function e(e){try{let t=e.target,l=function(e){for(;e&&"a"!==e.tagName.toLowerCase();)e=e.parentElement;return e}(t);if(l){let t=window.location.href,o=l.href,i=function(e,t){try{let n=new URL(e),l=new URL(t);if(n.hostname===l.hostname&&n.pathname===l.pathname&&n.search===l.search){let e=n.hash,t=l.hash;return e!==t&&n.href.replace(e,"")===l.href.replace(t,"")}}catch(e){console.log("Unexpected exception thrown in LeaveWithoutSaving:isAnchorOfCurrentUrl",e)}return!1}(t,o),s=""!==l.download,u="_blank"===l.target||e.metaKey||e.ctrlKey;!(o===t||i||s||u)&&r&&(a||!window.confirm(n))&&(c.current=o,e.preventDefault(),e.stopPropagation(),"function"==typeof a&&a())}}catch(e){console.log("Unexpected exception thrown in LeaveWithoutSaving:usePreventLeave",e)}}return r&&document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}},[a,r,n]),(0,o.useEffect)(()=>{t&&c.current&&(l&&l(),i(()=>s.push(c.current)))},[t,l,s,i])})(j),n[10]!==i?(t=()=>{i(fj)},n[10]=i,n[11]=t):t=n[11];let C=t,S;n[12]!==a?(S=async()=>{if(a)try{await a()}catch(e){console.error("Error in LeaveWithoutSaving onConfirm:",e)}g(!0)},n[12]=a,n[13]=S):S=n[13];let k=S,_;return n[14]!==k||n[15]!==C?(_=(0,u.jsx)(fS,{modalSlug:fj,onCancel:C,onConfirm:k}),n[14]=k,n[15]=C,n[16]=_):_=n[16],_},fS=e=>{let t=(0,f.c)(5),{modalSlug:n,onCancel:l,onConfirm:a}=e,{t:o}=(0,s.d)(),r;return t[0]!==n||t[1]!==l||t[2]!==a||t[3]!==o?(r=(0,u.jsx)(lf,{body:o("general:changesNotSaved"),cancelLabel:o("general:stayOnThisPage"),confirmLabel:o("general:leaveAnyway"),heading:o("general:leaveWithoutSaving"),modalSlug:n,onCancel:l,onConfirm:a}),t[0]=n,t[1]=l,t[2]=a,t[3]=o,t[4]=r):r=t[4],r},fk="document-take-over",f_="document-take-over",fN=e=>{let t,n=(0,f.c)(19),{handleBackToDashboard:l,isActive:a,onReadOnly:r}=e,{closeModal:i,openModal:c}=nE(),{t:d}=(0,s.d)(),{startRouteTransition:p}=e8(),{clearRouteCache:h}=d7(),m,g;if(n[0]!==i||n[1]!==a||n[2]!==c?(m=()=>{a?c(fk):i(fk)},g=[a,c,i],n[0]=i,n[1]=a,n[2]=c,n[3]=m,n[4]=g):(m=n[3],g=n[4]),(0,o.useEffect)(m,g),n[5]!==h||n[6]!==i||n[7]!==l||n[8]!==r||n[9]!==p||n[10]!==d){let e,a;n[12]!==l||n[13]!==p?(e=()=>{p(()=>l())},n[12]=l,n[13]=p,n[14]=e):e=n[14],n[15]!==h||n[16]!==i||n[17]!==r?(a=()=>{r(),i(fk),h()},n[15]=h,n[16]=i,n[17]=r,n[18]=a):a=n[18],t=(0,u.jsx)(nq,{className:f_,closeOnBlur:!1,slug:fk,children:(0,u.jsxs)("div",{className:"".concat(f_,"__wrapper"),children:[(0,u.jsxs)("div",{className:"".concat(f_,"__c
1ontent"),children:[(0,u.jsx)("h1",{children:d("general:editingTakenOver")}),(0,u.jsx)("p",{children:d("general:anotherUserTakenOver")})]}),(0,u.jsxs)("div",{className:"".concat(f_,"__controls"),children:[(0,u.jsx)(tD,{buttonStyle:"primary",id:"".concat(fk,"-back-to-dashboard"),onClick:e,size:"large",children:d("general:backToDashboard")}),(0,u.jsx)(tD,{buttonStyle:"secondary",id:"".concat(fk,"-view-read-only"),onClick:a,size:"large",children:d("general:viewReadOnly")})]})]})}),n[5]=h,n[6]=i,n[7]=l,n[8]=r,n[9]=p,n[10]=d,n[11]=t}else t=n[11];return t},fE="document-locked",fP="document-locked",fD=e=>{let t,n,l=(0,f.c)(33),{handleGoBack:a,isActive:r,onReadOnly:i,onTakeOver:c,updatedAt:d,user:p}=e,{closeModal:h,openModal:m}=nE(),{t:g}=(0,s.d)(),{clearRouteCache:v}=d7(),{startRouteTransition:b}=e8(),y,x;if(l[0]!==h||l[1]!==r||l[2]!==m?(y=()=>{r?m(fE):h(fE)},x=[r,m,h],l[0]=h,l[1]=r,l[2]=m,l[3]=y,l[4]=x):(y=l[3],x=l[4]),(0,o.useEffect)(y,x),l[5]!==a||l[6]!==b?(t=()=>{b(()=>a())},l[5]=a,l[6]=b,l[7]=t):t=l[7],l[8]!==v||l[9]!==h||l[10]!==a||l[11]!==i||l[12]!==c||l[13]!==b||l[14]!==g||l[15]!==t||l[16]!==d||l[17]!==p){var w;let e,o,r,s;l[19]!==g||l[20]!==p?(e=(e=>e&&"object"==typeof e)(p)?null!=(w=p.email)?w:p.id:"".concat(g("general:user"),": ").concat(p),l[19]=g,l[20]=p,l[21]=e):e=l[21],l[22]!==h||l[23]!==a||l[24]!==b?(o=()=>{h(fE),b(()=>a())},l[22]=h,l[23]=a,l[24]=b,l[25]=o):o=l[25],l[26]!==v||l[27]!==h||l[28]!==i?(r=()=>{i(),h(fE),v()},l[26]=v,l[27]=h,l[28]=i,l[29]=r):r=l[29],l[30]!==h||l[31]!==c?(s=()=>{c(),h(fE)},l[30]=h,l[31]=c,l[32]=s):s=l[32],n=(0,u.jsx)(nq,{className:fP,closeOnBlur:!1,onClose:t,slug:fE,children:(0,u.jsxs)("div",{className:"".concat(fP,"__wrapper"),children:[(0,u.jsxs)("div",{className:"".concat(fP,"__content"),children:[(0,u.jsx)("h1",{children:g("general:documentLocked")}),(0,u.jsxs)("p",{children:[(0,u.jsx)("strong",{children:e})," ",g("general:currentlyEditing")]}),(0,u.jsxs)("p",{children:[g("general:editedSince")," ",(0,u.jsx)("strong",{children:(e=>e?new Intl.DateTimeFormat("en-US",{day:"numeric",hour:"numeric",hour12:!0,minute:"numeric",month:"short",year:"numeric"}).format(new Date(e)):"")(d)})]})]}),(0,u.jsxs)("div",{className:"".concat(fP,"__controls"),children:[(0,u.jsx)(tD,{buttonStyle:"secondary",id:"".concat(fE,"-go-back"),onClick:o,size:"large",children:g("general:goBack")}),(0,u.jsx)(tD,{buttonStyle:"secondary",id:"".concat(fE,"-view-read-only"),onClick:r,size:"large",children:g("general:viewReadOnly")}),(0,u.jsx)(tD,{buttonStyle:"primary",id:"".concat(fE,"-take-over"),onClick:s,size:"large",children:g("general:takeOver")})]})]})}),l[8]=v,l[9]=h,l[10]=a,l[11]=i,l[12]=c,l[13]=b,l[14]=g,l[15]=t,l[16]=d,l[17]=p,l[18]=n}else n=l[18];return n};function fT(e){let t=(0,f.c)(3),{i18n:n}=(0,s.d)(),{description:l}=e;if(l){let e;return t[0]!==l||t[1]!==n?(e=(0,u.jsx)("div",{className:"custom-view-description",children:(0,d.s)(l,n)}),t[0]=l,t[1]=n,t[2]=e):e=t[2],e}return null}var fR="graphic-account",fA=e=>(0,u.jsxs)("svg",{className:[fR,(null==e?void 0:e.active)&&"".concat(fR,"--active")].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("circle",{className:"".concat(fR,"__bg"),cx:"12.5",cy:"12.5",r:"11.5"}),(0,u.jsx)("circle",{className:"".concat(fR,"__head"),cx:"12.5",cy:"10.73",r:"3.98"}),(0,u.jsx)("path",{className:"".concat(fR,"__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"})]}),fL=(0,c.e)(ed(),1),fO=()=>{let e=(0,f.c)(2),{user:t}=lw(),n=(0,fL.default)(t.email.trim().toLowerCase()),l="?".concat(new URLSearchParams({default:"mp",r:"g",s:"50"}).toString()),a="https://www.gravatar.com/avatar/".concat(n).concat(l),o;return e[0]!==a?(o=(0,u.jsx)("img",{alt:"yas",className:"gravatar-account",height:25,src:a,style:{borderRadius:"50%"},width:25}),e[0]=a,e[1]=o):o=e[1],o},fF=()=>{let e=(0,f.c)(3),{config:t}=(0,i.c)(),{admin:n,routes:l,serverURL:a}=t,{avatar:o,routes:r}=n,{account:s}=r,{admin:c}=l,{user:d}=lw(),p=(0,h.usePathname)()===(0,v.Q)({adminRoute:c,path:s,serverURL:a});if(!(null==d?void 0:d.email)||"default"===o){let t;return e[0]!==p?(t=(0,u.jsx)(fA,{active:p}),e[0]=p,e[1]=t):t=e[1],t}if("gravatar"===o){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=(0,u.jsx)(fO,{}),e[2]=t):t=e[2],t}},fM=(0,o.createContext)({Actions:{},setViewActions:()=>{}}),fI=()=>(0,o.use)(fM),fB=e=>{let t=(0,f.c)(4),{Actions:n,children:l}=e,[a,r]=(0,o.useState)(n),i;return t[0]!==n||t[1]!==l||t[2]!==a?(i=(0,u.jsx)(fM,{value:{Actions:{...a,...n}
1,setViewActions:r},children:l}),t[0]=n,t[1]=l,t[2]=a,t[3]=i):i=t[3],i},fU=()=>(0,u.jsx)("svg",{className:"icon icon--close-menu",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M14 6L6 14M6 6L14 14",strokeLinecap:"square"})}),fz=()=>(0,u.jsx)("svg",{className:"icon icon--menu",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M4.66667 10H15.3333M4.66667 6H15.3333M4.66667 14H15.3333",strokeLinecap:"square"})}),fV="hamburger",fH=e=>{let t=(0,f.c)(4),{t:n}=(0,s.d)(),{closeIcon:l,isActive:a}=e,o=void 0===l?"x":l,r=void 0!==a&&a,i;return t[0]!==o||t[1]!==r||t[2]!==n?(i=(0,u.jsxs)("div",{className:fV,children:[!r&&(0,u.jsx)("div",{"aria-label":n("general:open"),className:"".concat(fV,"__open-icon"),title:n("general:open"),children:(0,u.jsx)(fz,{})}),r&&(0,u.jsxs)("div",{"aria-label":n("collapse"===o?"general:collapse":"general:close"),className:"".concat(fV,"__close-icon"),title:n("collapse"===o?"general:collapse":"general:close"),children:["x"===o&&(0,u.jsx)(fU,{}),"collapse"===o&&(0,u.jsx)(ta,{direction:"left"})]})]}),t[0]=o,t[1]=r,t[2]=n,t[3]=i):i=t[3],i},fq="localizer-button",fW=e=>{let t=(0,f.c)(8),{ariaLabel:n,className:l}=e,a=lN(),{i18n:o,t:r}=(0,s.d)(),i;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==a||t[4]!==r){let e;
1t[6]!==l?(e=[fq,l].filter(Boolean),t[6]=l,t[7]=e):e=t[7],i=(0,u.jsxs)("div",{"aria-label":n||r("general:locale"),className:e.join(" "),"data-locale":a?a.code:void 0,children:[(0,u.jsxs)("div",{className:"".concat(fq,"__label"),children:["".concat(r("general:locale"),":"),"\xa0"]}),(0,u.jsxs)("div",{className:"".concat(fq,"__current"),children:[(0,u.jsx)("span",{className:"".concat(fq,"__current-label"),children:"".concat((0,d.s)(a.label,o))}),(0,u.jsx)(ta,{className:"".concat(fq,"__chevron")})]})]}),t[0]=n,t[1]=l,t[2]=o,t[3]=a,t[4]=r,t[5]=i}else i=t[5];return i},fK="localizer",fY=e=>{let t=(0,f.c)(17),{className:n}=e,{config:l}=(0,i.c)(),{localization:a}=l,r=(0,h.useRouter)(),{startRouteTransition:c}=e8(),{setLocaleIsLoading:p}=l_(),{i18n:m}=(0,s.d)(),g=lN();if(a){let{locales:e}=a,l;t[0]!==n?(l=[fK,n].filter(Boolean),t[0]=n,t[1]=l):l=t[1];let i=l.join(" "),s;if(t[2]!==m||t[3]!==g||t[4]!==e||t[5]!==r||t[6]!==p||t[7]!==c||t[8]!==i){let n;t[10]!==m||t[11]!==g||t[12]!==e||t[13]!==r||t[14]!==p||t[15]!==c?(n=t=>{let{close:n}=t;return(0,u.jsx)(tc.ButtonGroup,{children:e.map(e=>{let t=(0,d.s)(e.label,m);return(0,u.jsx)(tc.Button,{active:g.code===e.code,disabled:g.code===e.code,onClick:()=>{p(!0),n();let t=new URLSearchParams(window.location.search),l=y.A({...N.q(t.toString(),{depth:10,ignoreQueryPrefix:!0}),locale:e.code},{addQueryPrefix:!0});c(()=>{r.push(l)})},children:t!==e.code?(0,u.jsxs)(o.Fragment,{children:[t,"\xa0",(0,u.jsx)("span",{className:"".concat(fK,"__locale-code"),"data-locale":e.code,children:"(".concat(e.code,")")})]}):(0,u.jsx)("span",{className:"".concat(fK,"__locale-code"),"data-locale":e.code,children:t})},e.code)})})},t[10]=m,t[11]=g,t[12]=e,t[13]=r,t[14]=p,t[15]=c,t[16]=n):n=t[16],s=(0,u.jsx)("div",{className:i,children:(0,u.jsx)(t_,{button:(0,u.jsx)(fW,{}),horizontalAlign:"right",render:n,showScrollbar:!0,size:"large"})}),t[2]=m,t[3]=g,t[4]=e,t[5]=r,t[6]=p,t[7]=c,t[8]=i,t[9]=s}else s=t[9];return s}return null},fG=o.createContext({hydrated:!1,navOpen:!0,navRef:null,setNavOpen:()=>{},shouldAnimate:!1}),fQ=()=>o.use(fG),fX=async e=>{var t;let n=null==(t=await e("nav"))?void 0:t.open;return"boolean"!=typeof n||n},f$=e=>{let{children:t,initialIsOpen:n}=e,{breakpoints:{l:l,m:a,s:r}}=tv(),i=(0,h.usePathname)(),{getPreference:s}=aS(),c=(0,o.useRef)(null),[d,p]=o.useState(n),[f,m]=o.useState(!1),[g,v]=o.useState(!1);return(0,o.useEffect)(()=>{!1===l&&(async()=>{p(await fX(s))})()},[l,s,p]),(0,o.useEffect)(()=>{!0===r&&p(!1)},[i]),(0,o.useEffect)(()=>{c.current&&(d&&a?c.current.style.overscrollBehavior="contain":c.current.style.overscrollBehavior="auto")},[d,a]),(0,o.useEffect)(()=>{(!0===l||!0===a||!0===r)&&p(!1),v(!0);let e=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(e)}},[l,a,r]),(0,o.useEffect)(()=>()=>{c.current&&(c.current.style.overscrollBehavior="auto")},[]),(0,u.jsx)(fG,{value:{hydrated:g,navOpen:d,navRef:c,setNavOpen:p,shouldAnimate:f},children:t})},fZ="nav-toggler",fJ=e=>{let t,n=(0,f.c)(15),{id:l,children:a,className:o,tabIndex:r}=e,i=void 0===r?0:r,{t:c}=(0,s.d)(),{setPreference:d}=aS(),{navOpen:p,setNavOpen:h}=fQ(),{breakpoints:m}=tv(),{l:g}=m,v="".concat(c(p?"general:close":"general:open")," ").concat(c("general:menu")),b=p&&"".concat(fZ,"--is-open"),y;n[0]!==o||n[1]!==b?(y=[fZ,b,o].filter(Boolean),n[0]=o,n[1]=b,n[2]=y):y=n[2];let x=y.join(" "),w;return n[3]!==g||n[4]!==p||n[5]!==h||n[6]!==d?(w=async()=>{h(!p),g||await d("nav",{open:!p},!0)},n[3]=g,n[4]=p,n[5]=h,n[6]=d,n[7]=w):w=n[7],n[8]!==a||n[9]!==l||n[10]!==v||n[11]!==x||n[12]!==w||n[13]!==i?(t=(0,u.jsx)("button",{"aria-label":v,className:x,id:l,onClick:w,tabIndex:i,type:"button",children:a}),n[8]=a,n[9]=l,n[10]=v,n[11]=x,n[12]=w,n[13]=i,n[14]=t):t=n[14],t},f0=e=>{let{fill:t}=e,n=t||"var(--theme-elevation-1000)";return(0,u.jsxs)("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("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:n}),(0,u.jsx)("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:n})]})},f1=()=>(0,o.use)(f3),f3=(0,o.createContext)({}),f2=e=>{let t=(0,f.c)(4),{children:n}=e,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];let[a,r]=(0,o.useState)(l),i;return t[1]!==n||t[2]!==a?(i=(0,u.jsx)(f3,{value:{setStepNav:r,stepNav:a},children:n}),t[1]=n,t[2]=a,t[3]=i):i=t[3],i},f6=e=>{let t=(0,f.c)(4),{nav:n}=e,{setStepNav:l}=f1(),a,r;return t[0]!==n||t[1]!==l?(a=()=>
1{l(n)},r=[l,n],t[0]=n,t[1]=l,t[2]=a,t[3]=r):(a=t[2],r=t[3]),(0,o.useEffect)(a,r),null},f5="step-nav",f4=e=>{let t=(0,f.c)(7),{className:n,CustomIcon:l}=e,{i18n:a}=(0,s.d)(),{stepNav:r}=f1(),{config:c}=(0,i.c)(),{routes:p}=c,{admin:h}=p,{t:m}=(0,s.d)(),g;return t[0]!==l||t[1]!==h||t[2]!==n||t[3]!==a||t[4]!==r||t[5]!==m?(g=(0,u.jsx)(o.Fragment,{children:r.length>0?(0,u.jsxs)("nav",{className:[f5,n].filter(Boolean).join(" "),children:[(0,u.jsx)(tt,{className:"".concat(f5,"__home"),href:h,prefetch:!1,tabIndex:0,children:(0,u.jsx)("span",{title:m("general:dashboard"),children:(0,u.jsx)(ep,{CustomComponent:l,Fallback:(0,u.jsx)(f0,{})})})}),(0,u.jsx)("span",{children:"/"}),r.map((e,t)=>{let n=(0,d.s)(e.label,a);return r.length===t+1?(0,u.jsx)("span",{className:"".concat(f5,"__last"),children:n},t):(0,u.jsxs)(o.Fragment,{children:[e.url?(0,u.jsx)(tt,{href:e.url,prefetch:!1,children:(0,u.jsx)("span",{children:n},t)}):(0,u.jsx)("span",{children:n},t),(0,u.jsx)("span",{children:"/"})]},t)})]}):(0,u.jsx)("div",{className:[f5,n].filter(Boolean).join(" "),children:(0,u.jsx)("div",{className:"".concat(f5,"__home"),children:(0,u.jsx)("span",{title:m("general:dashboard"),children:(0,u.jsx)(ep,{CustomComponent:l,Fallback:(0,u.jsx)(f0,{})})})})})}),t[0]=l,t[1]=h,t[2]=n,t[3]=a,t[4]=r,t[5]=m,t[6]=g):g=t[6],g},f8="app-header";function f9(e){let{CustomAvatar:t,CustomIcon:n}=e,{t:l}=(0,s.d)(),{Actions:a}=fI(),{config:{admin:{routes:{account:r}},localization:c,routes:{admin:d},serverURL:p}}=(0,i.c)(),{navOpen:h}=fQ(),f=(0,o.useRef)(null),[m,g]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=()=>{let e=f.current;e&&g(e.scrollWidth>e.clientWidth)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[a]);let b=a?Object.values(a):[];return(0,u.jsxs)("header",{className:[f8,h&&"".concat(f8,"--nav-open")].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{className:"".concat(f8,"__bg")}),(0,u.jsx)("div",{className:"".concat(f8,"__content"),children:(0,u.jsxs)("div",{className:"".concat(f8,"__wrapper"),children:[(0,u.jsx)(fJ,{className:"".concat(f8,"__mobile-nav-toggler"),tabIndex:-1,children:(0,u.jsx)(fH,{})}),(0,u.jsxs)("div",{className:"".concat(f8,"__controls-wrapper"),children:[(0,u.jsx)("div",{className:"".concat(f8,"__step-nav-wrapper"),children:(0,u.jsx)(f4,{className:"".concat(f8,"__step-nav"),CustomIcon:n})}),(0,u.jsxs)("div",{className:"".concat(f8,"__actions-wrapper"),children:[(0,u.jsx)("div",{className:"".concat(f8,"__actions"),ref:f,children:b.map((e,t)=>(0,u.jsx)("div",{className:m&&t===b.length-1?"".concat(f8,"__last-action"):"",children:e},t))}),m&&(0,u.jsx)("div",{className:"".concat(f8,"__gradient-placeholder")})]}),c&&(0,u.jsx)(fW,{ariaLabel:"invisible",className:"".concat(f8,"__localizer-spacing")}),(0,u.jsx)(tt,{"aria-label":l("authentication:account"),className:"".concat(f8,"__account"),href:(0,v.Q)({adminRoute:d,path:r,serverURL:p}),prefetch:!1,tabIndex:0,children:(0,u.jsx)(ep,{CustomComponent:t,Fallback:(0,u.jsx)(fF,{})})})]})]})}),(0,u.jsx)(fY,{className:"".concat(f8,"__localizer")})]})}var f7="card",me=e=>{let{id:t,actions:n,buttonAriaLabel:l,href:a,onClick:o,title:r,titleAs:i}=e,s=[f7,t,(o||a)&&"".concat(f7,"--has-onclick")].filter(Boolean).join(" ");return(0,u.jsxs)("div",{className:s,id:t,children:[(0,u.jsx)(null!=i?i:"div",{className:"".concat(f7,"__title"),children:r}),n&&(0,u.jsx)("div",{className:"".concat(f7,"__actions"),children:n}),(o||a)&&(0,u.jsx)(tD,{"aria-label":l,buttonStyle:"none",className:"".concat(f7,"__click"),el:"link",onClick:o,to:a})]})},mt="copy-locale-data",mn="copy-locale",ml=()=>{let e,t,n,l,a,r,c,p=(0,f.c)(36),{config:m}=(0,i.c)(),{localization:g,routes:b,serverURL:y}=m,{admin:x}=b,{code:w}=lN(),{id:j,collectionSlug:C,globalSlug:S}=aD(),{i18n:k,t:_}=(0,s.d)(),N=eO(),{toggleModal:E}=nE(),{copyDataFromLocale:P}=ci(),D=(0,h.useRouter)(),{startRouteTransition:T}=e8(),R=g&&g.locales.map(ma)||[],A;p[0]!==w?(A=e=>e.value!==w,p[0]=w,p[1]=A):A=p[1];let L=R.filter(A),O;p[2]!==k||p[3]!==g?(O=e=>{let t=g&&g.locales.find(t=>t.code===e);return t&&t.label?(0,d.s)(t.label,k):e},p[2]=k,p[3]=g,p[4]=O):O=p[4];
1let F=O,[M,I]=o.useState(!1),[B,U]=o.useState(null),[z,V]=o.useState(w),[H,q]=o.useState(!1),W,K;p[5]!==w||p[6]!==z?(W=()=>{z!==w&&V(w)},K=[w,z],p[5]=w,p[6]=z,p[7]=W,p[8]=K):(W=p[7],K=p[8]),o.useEffect(W,K),p[9]!==x||p[10]!==C||p[11]!==P||p[12]!==S||p[13]!==j||p[14]!==H||p[15]!==D||p[16]!==y||p[17]!==T||p[18]!==E?(e=async e=>{let{from:t,to:n}=e;I(!0);try{await P({collectionSlug:C,docID:j,fromLocale:t,globalSlug:S,overrideData:H,toLocale:n}),I(!1),T(()=>D.push((0,v.Q)({adminRoute:x,path:"/".concat(C?"collections/".concat(C,"/").concat(j):"globals/".concat(S)),serverURL:y})+"?locale=".concat(n))),E(mn)}catch(e){eJ.error(e.message)}},p[9]=x,p[10]=C,p[11]=P,p[12]=S,p[13]=j,p[14]=H,p[15]=D,p[16]=y,p[17]=T,p[18]=E,p[19]=e):e=p[19];let Y=e;return j||S?(p[20]!==N||p[21]!==_||p[22]!==E?(t=()=>{N?eJ.info(_("general:unsavedChanges")):E(mn)},p[20]=N,p[21]=_,p[22]=E,p[23]=t):t=p[23],p[24]!==E?(n=()=>{E(mn)},p[24]=E,p[25]=n):n=p[25],p[26]!==Y||p[27]!==M||p[28]!==z||p[29]!==_||p[30]!==B?(l=async()=>{if(z===B)return void eJ.error(_("localization:cannotCopySameLocale"));M||await Y({from:z,to:B})},p[26]=Y,p[27]=M,p[28]=z,p[29]=_,p[30]=B,p[31]=l):l=p[31],p[32]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{(null==e?void 0:e.value)&&V(e.value)},p[32]=a):a=p[32],p[33]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{(null==e?void 0:e.value)&&U(e.value)},p[33]=r):r=p[33],p[34]!==H?(c=()=>q(!H),p[34]=H,p[35]=c):c=p[35],(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tc.Button,{id:"".concat(mt,"__button"),onClick:t,children:_("localization:copyToLocale")}),(0,u.jsxs)(lc,{className:mt,gutter:!1,Header:(0,u.jsx)(dD,{onClose:n,title:_("localization:copyToLocale")}),slug:mn,children:[(0,u.jsxs)("div",{className:"".concat(mt,"__sub-header"),children:[(0,u.jsx)("span",{children:z&&B?(0,u.jsx)("div",{children:_("localization:copyFromTo",{from:F(z),to:F(B)})}):_("localization:selectLocaleToCopy")}),(0,u.jsx)(tD,{buttonStyle:"primary",disabled:!z||!B,iconPosition:"left",onClick:l,size:"medium",children:M?_("general:copying")+"...":_("general:copy")})]}),(0,u.jsxs)("div",{className:"".concat(mt,"__content"),children:[(0,u.jsx)(uZ,{label:_("localization:copyFrom"),name:"fromLocale",onChange:a,options:R,path:"fromLocale",readOnly:!0,value:z}),(0,u.jsx)(uZ,{label:_("localization:copyTo"),name:"toLocale",onChange:r,options:L,path:"toLocale",value:B}),(0,u.jsx)(a$,{checked:H,field:{name:"overwriteExisting",label:_("general:overwriteExistingData")},onChange:c,path:"overwriteExisting"})]})]})]})):null};function ma(e){return{label:e.label,value:e.code}}var mo=function(e){return e.AllAvailable="allAvailable",e.AllInPage="allInPage",e.None="none",e.Some="some",e}({}),mr=(0,o.createContext)({count:void 0,getQueryParams:e=>"",getSelectedIds:()=>[],selectAll:void 0,selected:new Map,selectedIDs:[],setSelection:e=>{},toggleAll:e=>{},totalDocs:void 0}),mi=e=>{let t=[];for(let[n,l]of e)l&&t.push(n);return t},ms=e=>{let{children:t,docs:n=[],totalDocs:l}=e,a=(0,o.useRef)({}),{user:r}=lw(),{code:i}=lN(),[s,c]=(0,o.useState)(()=>{let e=new Map;return n.forEach(t=>{let{id:n}=t;e.set(n,!1)}),e}),[d,p]=(0,o.useState)("none"),[f,m]=(0,o.useState)(0),g=(0,h.useSearchParams)(),{query:v}=cn(),b=(0,o.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=new Map;e?(p("allAvailable"),n.forEach(e=>{let{id:n,_isLocked:l,_userEditing:a}=e;l&&(null==a?void 0:a.id)!==(null==r?void 0:r.id)||t.set(n,!0)})):"allAvailable"===d||"allInPage"===d?p("none"):n.forEach(e=>{let{id:n,_isLocked:l,_userEditing:a}=e;l&&(null==a?void 0:a.id)!==(null==r?void 0:r.id)||t.set(n,"some"!==d)}),c(t)},[n,d,null==r?void 0:r.id]),x=(0,o.useCallback)(e=>{let t=n.find(t=>t.id===e);if((null==t?void 0:t._isLocked)&&(null==r?void 0:r.id)!==(null==t?void 0:t._userEditing.id))return;let l=s.get(e),a="boolean"!=typeof l||!l,o=new Map(s.set(e,a));"allAvailable"!==d||a||p("some"),c(o)},[s,n,d,null==r?void 0:r.id]),w=(0,o.useCallback)(e=>{var t;let n;if("allAvailable"===d)n=(null==(t=ce(g))?void 0:t.where)||{id:{not_equals:""}};else{let e=[];for(let[t,n]of s)n&&e.push(t);n={id:{in:e}}}return e&&(n={and:[{...e},n]}),y.A({locale:i,where:n},{addQueryPrefix:!0})},[d,s,i,g]),j=(0,o.useCallback)(()=>mi(s),[s]);(0,o.useEffect)(()=>
1{if("allAvailable"===d)return;let e=!1,t=!0;if(s.size)for(let[n,l]of s)t=t&&l,e=e||l;else t=!1,e=!1;t&&s.size===n.length?p("allInPage"):p(e?"some":"none")},[d,s,l,n]),(0,o.useEffect)(()=>{let e=0;if("allAvailable"===d)e=l;else for(let[t,n]of s)n&&e++;m(e)},[d,s,l]),(0,o.useEffect)(()=>{p("none"),c(new Map)},[v]);let C=(0,o.useMemo)(()=>mi(s),[s]);return a.current={count:f,getQueryParams:w,getSelectedIds:j,selectAll:d,selected:s,selectedIDs:C,setSelection:x,toggleAll:b,totalDocs:l},(0,u.jsx)(mr,{value:a.current,children:t})},mc=()=>(0,o.use)(mr),mu="list-selection";function md(e){let t=(0,f.c)(5),{count:n,ListActions:l,SelectionActions:a}=e,{t:r}=(0,s.d)(),i;return t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==r?(i=(0,u.jsxs)("div",{className:mu,children:[(0,u.jsx)("span",{children:r("general:selectedCount",{count:n,label:""})}),l&&l.length>0&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("span",{children:"â"}),(0,u.jsx)("div",{className:"".concat(mu,"__actions"),children:l})]}),a&&a.length>0&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("span",{children:"â"}),(0,u.jsx)("div",{className:"".concat(mu,"__actions"),children:a})]})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function mp(e){let{children:t,className:n,...l}=e;return(0,u.jsx)(tD,{...l,buttonStyle:"none",className:["".concat(mu,"__button"),n].filter(Boolean).join(" "),children:t})}var mh=e=>{var t,n,l,a;let r=(0,f.c)(6),{viewType:i}=e,{collection:s,modalPrefix:c}=e,{slug:d,trash:p}=void 0===s?{}:s,{permissions:m}=lw(),{count:g,selectAll:v,selectedIDs:b,toggleAll:x}=mc(),w=(0,h.useRouter)(),j=(0,h.useSearchParams)(),{clearRouteCache:C}=d7(),S=null==m||null==(n=m.collections)||null==(t=n[d])?void 0:t.delete,k=v===mo.AllAvailable,_=k?[]:b;if(v===mo.None||!S)return null;let N=null==(l=ce(j))?void 0:l.where,E="trash"===i?{and:[...Array.isArray(null==N?void 0:N.and)?N.and:N?[N]:[],{deletedAt:{exists:!0}}]}:N,P;return r[0]!==C||r[1]!==w||r[2]!==j||r[3]!==v||r[4]!==x?(P=()=>{x(),w.replace(y.A({...ce(j),page:v?"1":void 0},{addQueryPrefix:!0})),C()},r[0]=C,r[1]=w,r[2]=j,r[3]=v,r[4]=x,r[5]=P):P=r[5],(0,u.jsx)(o.Fragment,{children:(0,u.jsx)(mf,{afterDelete:P,modalPrefix:c,search:null==(a=ce(j))?void 0:a.search,selections:{[d]:{all:v===mo.AllAvailable,ids:_,totalCount:k?g:_.length}},trash:p,viewType:i,where:E})})};function mf(e){let{afterDelete:t,modalPrefix:n,search:l,selections:a,trash:r,viewType:c,where:p}=e,{t:h}=(0,s.d)(),{config:{collections:f,routes:{api:m},serverURL:g}}=(0,i.c)(),{code:v}=lN(),{i18n:b}=(0,s.d)(),{openModal:x}=nE(),[w,j]=o.useState(!1),C="".concat(n?"".concat(n,"-"):"","confirm-delete-many-docs"),S=o.useCallback(async()=>{let e=1===Object.keys(a).length,n={};for(let[t,{all:o,ids:r=[]}]of Object.entries(a)){let a=f.find(e=>{let{slug:n}=e;return n===t});if(a){let i;i=o?e&&p?"trash"===c?{and:[...Array.isArray(p.and)?p.and:[p],{deletedAt:{exists:!0}}]}:p:"trash"===c?{and:[{id:{not_equals:""}},{deletedAt:{exists:!0}}]}:{id:{not_equals:""}}:{and:[{id:{in:r}},..."trash"===c?[{deletedAt:{exists:!0}}]:[]]};let s="".concat(g).concat(m,"/").concat(t).concat(y.A({limit:0,locale:v,select:{},where:(0,k.d)({collectionConfig:a,search:l,where:i}),..."trash"===c?{trash:!0}:{}},{addQueryPrefix:!0})),u="trash"===c||w||!a.trash?await lb.delete(s,{headers:{"Accept-Language":b.language,"Content-Type":"application/json"}}):await lb.patch(s,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":b.language,"Content-Type":"application/json"}});try{let{plural:e,singular:l}=a.labels,o=await u.json(),r=(null==o?void 0:o.docs.length)||0,i=r>1?e:l;if(u.status<400||r>0){let e;e=a.trash&&!w&&"trash"!==c?"general:trashedCountSuccessfully":"trash"===c||w?"general:permanentlyDeletedCountSuccessfully":"general:deletedCountSuccessfully",eJ.success(h(e,{count:r,label:(0,d.s)(i,b)}))}(null==o?void 0:o.errors.length)>0&&eJ.error(o.message,{description:o.errors.map(e=>e.message).join("\n")}),n[t]={deletedCount:r,errors:(null==o?void 0:o.errors)||null,ids:(null==o?void 0:o.docs.map(e=>e.id))||[],totalCount:o.totalDocs},u.status>400&&(null==o?void 0:o.errors.length)===0&&(eJ.error(h("error:unknown")),n[t].errors=[h("error:unknown")]);continue}catch(e){eJ.error(h("error:unknown")),n[t]={deletedCount:0,errors:[e],ids:[],totalCount:0};continue}}}"function"==typeof t&&t(n)},[a,t,f,w,v,l,g,m,b,c,p,h]),{label:_,labelCount:N}=Object.entries(a).reduce((e,t,n,l)=>{let[a,o]=t,r=f.find(e=>{let{slug:t}=e;return t===a});if(r){let t=void 0===e.labelCount?o.totalCount:e.labelCount,a="".concat(void 0!==e.labelCount?"".concat(o.totalCount," "):"").concat((0,d.s)(o.totalCount>1?r.labels.plural:r.labels.singular,b));return{label:n===l.length-1&&0!==n?"".concat(e.label," and ").concat(a):n>0?"".concat(e.label,", ").concat(a):a,labelCount:t}}return e},{label:"",labelCount:void 0});return(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(mp,{"aria-label":h("general:delete"),className:"delete-documents__toggle",onClick:()=>{x(C)},children:h("general:delete")}),(0,u.jsx)(lf,{body:(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("p",{children:r?"trash"===c?(0,u.jsx)(pc,{elements:{0:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})},1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:h,variables:{count:null!=N?N:0,label:_}}):h("general:aboutToTrashCount",{count:N,label:_}):h("general:aboutToDeleteCount",{count:N,label:_})}),r&&"trash"!==c&&(0,u.jsx)("div",{className:"delete-documents__checkbox",children:(0,u.jsx)(aQ,{checked:w,id:"delete-forever",label:h("general:deletePermanently"),name:"delete-forever",onToggle:e=>j(e.target.checked)})})]}),confirmingLabel:h("general:deleting"),heading:h("general:confirmDeletion"),modalSlug:C,onConfirm:S})]})}var mm=(0,o.createContext)({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}),mg=()=>(0,o.use)(mm),mv=()=>{let{isPreviewEnabled:e,previewURL:t,setPreviewURL:n}=(0,o.use)(mm);return{isPreviewEnabled:e,previewURL:t,setPreviewURL:n}},mb=e=>{let{id:t,collection:n,global:l}=e,{config:{routes:{api:a},serverURL:r}}=(0,i.c)(),{docConfig:c,lastUpdateTime:d,mostRecentVersionIsAutosaved:p,setMostRecentVersionIsAutosaved:h,setUnpublishedVersionCount:f}
1=aD(),{isValid:m,setBackgroundProcessing:g,submit:v}=eP(),[b]=eI(),y=eO(),x=eR(),{code:j}=lN(),{i18n:C,t:S}=(0,s.d)(),k=(0,L.ag)(c),_=(0,L.wA)(c),[N,E]=(0,o.useState)(!1),P=(0,o.useDeferredValue)(N),D=cF(b,k),{queueTask:T}=uE(),R=(0,o.useRef)(null),A=lv(()=>{let e,o;R.current=void 0,T(async()=>{if(y){let s,c,u;e=new Date().getTime(),E(!0),n&&t&&(u=n.slug,s="".concat(r).concat(a,"/").concat(u,"/").concat(t,"?depth=0&draft=true&autosave=true&locale=").concat(j,"&fallback-locale=null"),c="PATCH"),l&&(u=l.slug,s="".concat(r).concat(a,"/globals/").concat(u,"?depth=0&draft=true&autosave=true&locale=").concat(j,"&fallback-locale=null"),c="POST");let{valid:d}=((e,t,n)=>{let l={data:{},valid:!0};return e&&(Object.keys(e).forEach(t=>{var a,o;!0!==n&&(null==(a=e[t])?void 0:a.disableFormData)||(l.data[t]=null==(o=e[t])?void 0:o.value,e[t].valid||(l.valid=!1))}),t&&(l.data=(0,V.s)(l.data))),l})(b,!0);if(!(x&&!d&&_)&&y&&s){var i;let t=await v({acceptValues:{overrideLocalChanges:!1},action:s,context:{getDocPermissions:!1,incrementVersionCount:!p},disableFormWhileProcessing:!1,disableSuccessStatus:!0,method:c,overrides:{_status:"draft"},skipValidation:!_});t&&(null==t||null==(i=t.res)?void 0:i.ok)&&!p&&(h(!0),f(e=>e+1)),(o=new Date().getTime())-e<1e3?R.current=setTimeout(()=>{E(!1)},1e3-(o-e)):I()}}},{afterProcess:()=>{g(!1)},beforeProcess:()=>{g(!0)}})}),O=(0,o.useRef)(!1),F=(0,o.useRef)((0,M.r)(D));(0,o.useEffect)(()=>{if(!O.current){O.current=!0;return}let{updatedAt:e,...t}=(0,M.r)(D),{updatedAt:n,...l}=F.current;(0,w.j)(t,l)||(F.current=t,A())},[D]),(0,o.useEffect)(()=>()=>{I()},[]);let I=lv(()=>{R.current&&clearTimeout(R.current),E(!1)});return(0,u.jsxs)("div",{className:"autosave",children:[_&&!m&&(0,u.jsx)(fC,{}),P&&S("general:saving"),!P&&!!d&&(0,u.jsx)(o.Fragment,{children:S("version:lastSavedAgo",{distance:af({date:d,i18n:C})})})]})},my="delete-document",mx=e=>{let{id:t,buttonId:n,collectionSlug:l,onDelete:a,redirectAfterDelete:r=!0,singularLabel:c,title:p}=e,{config:{routes:{admin:f,api:m},serverURL:g},getEntityConfig:b}=(0,i.c)(),y=b({collectionSlug:l}),{setModified:x}=eP(),w=(0,h.useRouter)(),{i18n:j,t:C}=(0,s.d)(),{title:S}=ay(),{startRouteTransition:k}=e8(),{openModal:_}=nE(),N="delete-".concat(t),[E,P]=(0,o.useState)(!1),D=(0,o.useCallback)(()=>{eJ.error(C("error:deletingTitle",{title:S}))},[C,S]),T=(0,o.useCallback)(async()=>{x(!1);try{let e=E||!y.trash?await lb.delete("".concat(g).concat(m,"/").concat(l,"/").concat(t),{headers:{"Accept-Language":j.language,"Content-Type":"application/json"}}):await lb.patch("".concat(g).concat(m,"/").concat(l,"/").concat(t),{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":j.language,"Content-Type":"application/json"}}),n=await e.json();if(e.status<400){if(eJ.success(C(E||!y.trash?"general:titleDeleted":"general:titleTrashed",{label:(0,d.s)(c,j),title:S})||n.message),r)return k(()=>w.push((0,v.Q)({adminRoute:f,path:"/collections/".concat(l),serverURL:g}
1)));"function"==typeof a&&await a({id:t,collectionConfig:y});return}n.errors?n.errors.forEach(e=>eJ.error(e.message)):D();return}catch(e){return D()}},[E,x,g,m,l,t,C,c,D,j,S,w,f,r,a,y,k]);return t?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tc.Button,{id:n,onClick:()=>{_(N)},children:C("general:delete")}),(0,u.jsx)(lf,{body:(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(pc,{elements:{1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:y.trash?"general:aboutToTrash":"general:aboutToDelete",t:C,variables:{label:(0,d.s)(c,j),title:p||S||t}}),y.trash&&(0,u.jsx)("div",{className:"".concat(my,"__checkbox"),children:(0,u.jsx)(aQ,{checked:E,id:"delete-forever",label:C("general:deletePermanently"),name:"delete-forever",onToggle:e=>P(e.target.checked)})})]}),className:my,confirmingLabel:C("general:deleting"),heading:C("general:confirmDeletion"),modalSlug:N,onConfirm:T})]}):null},mw=e=>{for(let t of e){if("localized"in t&&t.localized)return!0;switch(t.type){case"array":case"collapsible":case"group":case"row":if(t.fields&&mw(t.fields))return!0;break;case"blocks":if(t.blocks){for(let e of t.blocks)if(e.fields&&mw(e.fields))return!0}break;case"tabs":if(t.tabs){for(let e of t.tabs)if("localized"in e&&e.localized||"fields"in e&&e.fields&&mw(e.fields))return!0}}}return!1},mj="select-locales-drawer",mC=e=>{let{slug:t,localization:n,onConfirm:l}=e,{i18n:a,t:r}=(0,s.d)(),{toggleModal:i}=nE(),[c,p]=(0,o.useState)([]),h=(0,o.useMemo)(()=>(e=>{let{i18n:t,localization:n}=e;return n.locales.map(e=>({label:(0,d.s)(e.label,t),value:e.code}))})({i18n:a,localization:n}),[n,a]),f=(0,o.useMemo)(()=>h.map(e=>e.value),[h]),m=(0,o.useMemo)(()=>(0,Y._)(new Set(c),new Set(f)),[c,f]),g=(0,o.useCallback)(()=>{p(m?[]:[...f])},[m,f]),v=(0,o.useCallback)(e=>{p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),b=(0,o.useCallback)(async()=>{await l({selectedLocales:c}),i(t)},[l,c,t,i]);return(0,u.jsxs)(lc,{className:mj,gutter:!1,Header:(0,u.jsx)(dD,{onClose:()=>{i(t)},title:"".concat(r("general:duplicate")," ").concat(r("localization:selectedLocales"))}),slug:t,children:[(0,u.jsxs)("div",{className:"".concat(mj,"__sub-header"),children:[(0,u.jsx)("span",{children:r("localization:selectLocaleToDuplicate")}),(0,u.jsx)(tD,{buttonStyle:"primary",disabled:0===c.length,iconPosition:"left",id:"#action-duplicate-confirm",onClick:b,size:"medium",children:r("general:duplicate")})]}),(0,u.jsxs)("div",{className:"".concat(mj,"__content"),children:[(0,u.jsx)("div",{className:"".concat(mj,"__item"),children:(0,u.jsx)(aQ,{checked:m,id:"select-locale-all",label:r("general:selectAll",{count:f.length,label:r("general:locales")}),onToggle:g})}),h.map(e=>(0,u.jsx)("div",{className:"".concat(mj,"__item"),children:(0,u.jsx)(aQ,{checked:c.includes(e.value),id:"select-locale-".concat(e.value),label:e.label,onToggle:()=>v(e.value)})},e.value))]})]})},mS=e=>{let{id:t,slug:n,onDuplicate:l,redirectAfterDuplicate:a=!0,selectLocales:r,singularLabel:c}=e,p=(0,h.useRouter)(),f=eO(),{openModal:m}=nE(),{code:g}=lN(),{setModified:x}=eP(),{startRouteTransition:w}=e8(),{config:{localization:j,routes:{admin:C,api:S},serverURL:k},getEntityConfig:_}=(0,i.c)(),N=_({collectionSlug:n}),{i18n:E,t:P}=(0,s.d)(),D="duplicate-".concat(t),T="duplicate-locales-".concat(t),R=(0,o.useMemo)(()=>!!r&&!!N&&mw(N.fields),[N,r]),A=(0,o.useCallback)(async e=>{let{selectedLocales:o}=e||{},r=o&&o.length>0,i={};g&&(i.locale=g),r&&(i.selectedLocales=o);let s={"Accept-Language":E.language,"Content-Type":"application/json",credentials:"include"};try{let e=await lb.post((0,b.n)({apiRoute:S,path:"/".concat(n,"/").concat(t,"/duplicate").concat(y.A(i,{addQueryPrefix:!0})),serverURL:k}),{body:JSON.stringify((0,L.gD)(N)?{_status:"draft"}:{}),headers:s}),{doc:o,errors:r,message:u}=await e.json();if(e.status<400){if(eJ.success(u||P("general:successfullyDuplicated",{label:(0,d.s)(c,E)})),x(!1),a)return w(()=>p.push((0,v.Q)({adminRoute:C,path:"/collections/".concat(n,"/").concat(o.id).concat(g?"?locale=".concat(g):""),serverURL:k})));"function"==typeof l&&l({collectionConfig:N,doc:o})}else eJ.error((null==r?void 0:r[0].message)||u||P("error:unspecific",{label:(0,d.s)(c,E)}))}catch(e){eJ.error(P("error:unspecific",{label:(0,d.s)(c,E)}))}},[C,S,N,E,t,g,l,a,p,k,x,c,n,w,P]),O=(0,o.useCallback)(async()=>{r?m(T):await A()},[A,T,r,m]),F=r?"".concat(P("general:duplicate")," ").concat(P("localization:selectedLocales")):P("general:duplicate");return!r||R?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tc.Button,{id:"action-duplicate".concat(R?"-locales":""),onClick:()=>{f?m(D):r?m(T):A()},children:F}),(0,u.jsx)(lf,{body:P("general:unsavedChangesDuplicate"),confirmLabel:P("general:duplicateWithoutSaving"),heading:P("general:unsavedChanges"),modalSlug:D,onConfirm:O}),r&&j&&(0,u.jsx)(mC,{localization:j,onConfirm:A,slug:T})]}):null},mk=e=>
1{let{active:t=!0,className:n}=e;return(0,u.jsx)("svg",{className:[n,"icon icon--eye"].filter(Boolean).join(" "),viewBox:"0 0 16 12",xmlns:"http://www.w3.org/2000/svg",children:t?(0,u.jsx)(o.Fragment,{children:(0,u.jsx)("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"})}):(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("circle",{className:"stroke",cx:"8.5",cy:"6",r:"2.5"}),(0,u.jsx)("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"})]})})},m_="live-preview-toggler",mN=()=>{let{isLivePreviewing:e,setIsLivePreviewing:t,url:n}=mg(),{t:l}=(0,s.d)();return n?(0,u.jsx)("button",{"aria-label":l(e?"general:exitLivePreview":"general:livePreview"),className:[m_,e&&"".concat(m_,"--active")].filter(Boolean).join(" "),id:"live-preview-toggler",onClick:()=>{t(!e)},title:l(e?"general:exitLivePreview":"general:livePreview"),type:"button",children:(0,u.jsx)(mk,{active:e})}):null},mE=e=>{let{className:t}=e;return(0,u.jsxs)("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:[(0,u.jsx)("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"}),(0,u.jsx)("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"})]})},mP="locked",mD=e=>{var t;let n=(0,f.c)(8),{className:l,user:a}=e,[r,i]=(0,o.useState)(!1),{t:c}=(0,s.d)(),d=(e=>e&&"object"==typeof e)(a)?null!=(t=a.email)?t:a.id:c("general:anotherUser"),p;n[0]!==l?(p=[mP,l].filter(Boolean),n[0]=l,n[1]=p):p=n[1];let h=p.join(" "),m,g;n[2]===Symbol.for("react.memo_cache_sentinel")?(m=()=>i(!0),g=()=>i(!1),n[2]=m,n[3]=g):(m=n[2],g=n[3]);let v="".concat(d," ").concat(c("general:isEditing")),b;return n[4]!==r||n[5]!==h||n[6]!==v?(b=(0,u.jsxs)("div",{className:h,onMouseEnter:m,onMouseLeave:g,role:"button",tabIndex:0,children:[(0,u.jsx)(tN,{alignCaret:"left",className:"".concat(mP,"__tooltip"),position:"top",show:r,children:v}),(0,u.jsx)(mE,{})]}),n[4]=r,n[5]=h,n[6]=v,n[7]=b):b=n[7],b},mT=e=>{let{id:t,buttonId:n,collectionSlug:l,onDelete:a,redirectAfterDelete:r=!0,singularLabel:c,title:p}=e,{config:{routes:{admin:f,api:m},serverURL:g},getEntityConfig:b}=(0,i.c)(),x=b({collectionSlug:l}),w=(0,h.useRouter)(),{i18n:j,t:C}=(0,s.d)(),{title:S}=ay(),{startRouteTransition:k}=e8(),{openModal:_}=nE(),N="perma-delete-".concat(t),E=(0,o.useCallback)(()=>{eJ.error(C("error:deletingTitle",{title:S}))},[C,S]),P=(0,o.useCallback)(async()=>{try{let e="".concat(g).concat(m,"/").concat(l,"?").concat(y.A({trash:!0,where:{and:[{id:{equals:t}},{deletedAt:{exists:!0}}]}})),n=await lb.delete(e,{headers:{"Accept-Language":j.language,"Content-Type":"application/json"}}),o=await n.json();if(n.status<400){if(eJ.success(C("general:titleDeleted",{label:(0,d.s)(c,j),title:S})||o.message),r)return k(()=>w.push((0,v.Q)({adminRoute:f,path:"/collections/".concat(l,"/trash"),serverURL:g}
1)));"function"==typeof a&&await a({id:t,collectionConfig:x});return}o.errors?o.errors.forEach(e=>eJ.error(e.message)):E()}catch(e){E()}},[g,m,l,t,C,c,E,j,S,w,f,r,a,x,k]);return t?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"secondary",id:n,onClick:()=>{_(N)},children:C("general:permanentlyDelete")}),(0,u.jsx)(lf,{body:(0,u.jsx)(pc,{elements:{1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:"general:aboutToPermanentlyDelete",t:C,variables:{label:(0,d.s)(c,j),title:p||S||t}}),confirmingLabel:C("general:deleting"),heading:C("general:confirmDeletion"),modalSlug:N,onConfirm:P})]}):null},mR=e=>{let{className:t}=e;return(0,u.jsx)("svg",{className:[t,"icon icon--externalLink"].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("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"})})};function mA(e){let t,n=(0,f.c)(3),{previewURL:l}=mv(),{t:a}=(0,s.d)();return l?(n[0]!==l||n[1]!==a?(t=(0,u.jsx)("a",{"aria-label":a("version:preview"),className:"preview-btn",href:l,id:"preview-button",target:"_blank",title:a("version:preview"),children:(0,u.jsx)(mR,{})}),n[0]=l,n[1]=a,n[2]=t):t=n[2],t):null}var mL="table",mO=e=>{let{appearance:t,BeforeTable:n,columns:l,data:a}=e,o=null==l?void 0:l.filter(e=>null==e?void 0:e.active);return o&&0!==o.length?(0,u.jsxs)("div",{className:[mL,t&&"".concat(mL,"--appearance-").concat(t)].filter(Boolean).join(" "),children:[n,(0,u.jsxs)("table",{cellPadding:"0",cellSpacing:"0",children:[(0,u.jsx)("thead",{children:(0,u.jsx)("tr",{children:o.map((e,t)=>(0,u.jsx)("th",{id:"heading-".concat(e.accessor.replace(/\./g,"__")),children:e.Heading},t))})}),(0,u.jsx)("tbody",{children:a&&(null==a?void 0:a.map((e,t)=>(0,u.jsx)("tr",{className:"row-".concat(t+1),"data-id":e.id,children:o.map((e,n)=>{let{accessor:l}=e;return(0,u.jsx)("td",{className:"cell-".concat(l.replace(/\./g,"__")),children:e.renderedCells[t]},n)})},"string"==typeof e.id||"number"==typeof e.id?String(e.id):t)))})]})]}):(0,u.jsx)("div",{children:"No columns selected"})},mF="schedule-publish",mM={label:"All",value:"all"},mI=e=>{var t;let{slug:n,defaultType:l,schedulePublishConfig:a}=e,{toggleModal:r}=nE(),{config:{admin:{dateFormat:c,timezones:{defaultTimezone:p,supportedTimezones:h}},localization:f,routes:{api:m},serverURL:g}}=(0,i.c)(),{id:v,collectionSlug:b,globalSlug:x}=aD(),{title:w}=ay(),{i18n:j,t:C}=(0,s.d)(),{schedulePublish:S}=ci(),[k,_]=o.useState(l||"publish"),[N,E]=o.useState(),[P,D]=o.useState(p),[T,R]=o.useState(mM),[A,L]=o.useState(!1),O=C("general:schedulePublishFor",{title:w}
1),[F,M]=o.useState(),[I,B]=o.useState(),U=o.useRef(()=>null),z=Intl.DateTimeFormat().resolvedOptions().timeZone,V=o.useMemo(()=>{if(f){let e=f.locales.map(e=>{let{code:t,label:n}=e;return{label:(0,d.s)(n,j),value:t}});return e.unshift(mM),e}return[]},[f,j]),H=o.useCallback(async()=>{let e={sort:"waitUntil",where:{and:[{taskSlug:{equals:"schedulePublish"}},{waitUntil:{greater_than:new Date}}]}};b&&(e.where.and.push({"input.doc.value":{equals:String(v)}}),e.where.and.push({"input.doc.relationTo":{equals:b}})),x&&e.where.and.push({"input.global":{equals:x}});let{docs:t}=await lb.post("".concat(g).concat(m,"/payload-jobs"),{body:y.A(e),headers:{"Accept-Language":j.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"}}).then(e=>e.json());B((e=>{let{dateFormat:t,deleteHandler:n,docs:l,i18n:a,localization:o,supportedTimezones:r,t:i}=e,s=[{accessor:"input.type",active:!0,field:{name:"",type:"text"},Heading:(0,u.jsx)("span",{children:i("version:type")}),renderedCells:l.map(e=>{var t;let n=null==(t=e.input)?void 0:t.type;return(0,u.jsxs)(ol,{pillStyle:"publish"===n?"success":"warning",size:"small",children:["publish"===n&&i("version:publish"),"unpublish"===n&&i("version:unpublish")]},e.id)})},{accessor:"waitUntil",active:!0,field:{name:"",type:"date"},Heading:(0,u.jsx)("span",{children:i("general:time")}),renderedCells:l.map(e=>(0,u.jsx)("span",{children:ah({date:e.waitUntil,i18n:a,pattern:t,timezone:e.input.timezone})},e.id))},{accessor:"input.timezone",active:!0,field:{name:"",type:"text"},Heading:(0,u.jsx)("span",{children:i("general:timezone")}),renderedCells:l.map(e=>{var t;let n=(null==(t=r.find(t=>t.value===e.input.timezone))?void 0:t.label)||e.input.timezone;return(0,u.jsx)("span",{children:n||i("general:noValue")},e.id)})}];return o&&s.push({accessor:"input.locale",active:!0,field:{name:"",type:"text"},Heading:(0,u.jsx)("span",{children:i("general:locale")}
1),renderedCells:l.map(e=>{if(e.input.locale){let t=o.locales.find(t=>t.code===e.input.locale);if(t)return(0,u.jsx)("span",{children:(0,d.s)(t.label,a)},e.id)}return(0,u.jsx)("span",{children:i("general:all")},e.id)})}),s.push({accessor:"delete",active:!0,field:{name:"delete",type:"text"},Heading:(0,u.jsx)("span",{children:i("general:delete")}),renderedCells:l.map(e=>(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"schedule-publish__delete",icon:"x",onClick:t=>{t.preventDefault(),n(e.id)},tooltip:i("general:delete")},e.id))}),s})({dateFormat:c,deleteHandler:U.current,docs:t,i18n:j,localization:f,supportedTimezones:h,t:C})),M(t)},[b,x,g,m,j,c,f,h,C,v]),q=o.useCallback(async e=>{try{await S({deleteID:e}),await H(),eJ.success(C("general:deletedSuccessfully"))}catch(e){console.error(e),eJ.error(e.message)}},[H,S,C]);o.useEffect(()=>{U.current=q},[q]);let W=o.useCallback(async()=>{let e;if(!N)return eJ.error(C("general:noDateSelected"));L(!0),"object"==typeof T&&"all"!==T.value&&"publish"===k&&(e=T.value);try{await S({type:k,date:N,doc:b?{relationTo:b,value:String(v)}:void 0,global:x||void 0,locale:e,timezone:P}),E(void 0),eJ.success(C("version:scheduledSuccessfully")),H()}catch(e){console.error(e),eJ.error(e.message)}L(!1)},[N,T,k,C,S,b,v,x,P,H]),K=(0,o.useMemo)(()=>{if(P&&z&&N){let e=lB.tz(P),t=lB.tz(z),n=ap(new lB(N).withTimeZone(P),e);return ap(n,t).toISOString()}return N},[P,N,z]),Y=(0,o.useCallback)(e=>{if(P&&e){let t=lB.tz(P);E(ap(new lB(e),t)||null)}else E(e||null)},[E,P]);o.useEffect(()=>{F||(async()=>await H())()},[F,H]);let G=(0,o.useMemo)(()=>N&&function(e,t){return function(e,t,n){let[l,a]=l$(void 0,e,t);return+lZ(l)==+lZ(a)}(lq(e,e),l0(e))}(N)?new Date:lZ(new Date),[N]);return(0,u.jsxs)(lc,{className:mF,gutter:!1,Header:(0,u.jsxs)("div",{className:"".concat(mF,"__drawer-header"),children:[(0,u.jsx)("h2",{title:O,children:O}),(0,u.jsx)(dP,{onClick:()=>r(n)})]}),slug:n,children:[(0,u.jsxs)(la,{className:"".concat(mF,"__scheduler"),children:[(0,u.jsx)(lD,{label:C("version:type"),required:!0}),(0,u.jsxs)("ul",{className:"".concat(mF,"__type"),children:[(0,u.jsx)("li",{children:(0,u.jsx)(ug,{id:"".concat(n,"-type"),isSelected:"publish"===k,onChange:()=>_("publish"),option:{label:C("version:publish"),value:"publish"},path:"".concat(n,"-type"),readOnly:A})}),(0,u.jsx)("li",{children:(0,u.jsx)(ug,{id:"".concat(n,"-type"),isSelected:"unpublish"===k,onChange:()=>_("unpublish"),option:{label:C("version:unpublish"),value:"unpublish"},path:"".concat(n,"-type"),readOnly:A})})]}),(0,u.jsx)("br",{}),(0,u.jsx)(lD,{label:C("general:time"),path:"time",required:!0}),(0,u.jsx)(oF,{id:"time",maxTime:l1(Date.now(),void 0),minDate:new Date,minTime:G,onChange:e=>Y(e),pickerAppearance:"dayAndTime",readOnly:A,timeFormat:null==a?void 0:a.timeFormat,timeIntervals:null!=(t=null==a?void 0:a.timeIntervals)?t:5,value:K}),h.length>0&&(0,u.jsx)(sY,{id:"timezone-picker",onChange:D,options:h,selectedTimezone:P}),(0,u.jsx)("br",{}),V.length>0&&"publish"===k&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(lD,{label:C("localization:localeToPublish")}),(0,u.jsx)(sW,{onChange:e=>R(e),options:V,value:T}),(0,u.jsx)("br",{})]}),(0,u.jsxs)("div",{className:"".concat(mF,"__actions"),children:[(0,u.jsx)(tD,{buttonStyle:"primary",disabled:A,id:"scheduled-publish-save",onClick:W,type:"button",children:C("general:save")}),A?(0,u.jsx)("span",{children:C("general:saving")}):null]})]}),(0,u.jsxs)(la,{className:"".concat(mF,"__upcoming"),children:[(0,u.jsx)("h4",{children:C("general:upcomingEvents")}),!F&&(0,u.jsx)(i.f,{}),(null==F?void 0:F.length)===0&&(0,u.jsx)(tl,{type:"info",children:C("general:noUpcomingEventsScheduled")}),(null==F?void 0:F.length)>0&&(0,u.jsx)(mO,{appearance:"condensed",columns:I,data:F})]})]})};function mB(e){let{label:t}=e,{id:n,collectionSlug:l,globalSlug:a,hasPublishedDoc:r,hasPublishPermission:c,setHasPublishedDoc:p,setMostRecentVersionIsAutosaved:h,setUnpublishedVersionCount:f,unpublishedVersionCount:m,uploadStatus:g}=aD(),{config:v,getEntityConfig:b}=(0,i.c)(),{submit:x}=eP(),w=eO(),j=ns(),{code:C}=lN(),{isModalOpen:S,toggleModal:k}=nE(),_="schedule-publish-".concat(n),{localization:N,routes:{api:E},serverURL:P}=v,{i18n:D,t:T}=(0,s.d)(),R=t||T("version:publishChanges"),A=o.useMemo(()=>l?b({collectionSlug:l}):a?b({globalSlug:a}):void 0,[l,a,b]),O=m>0,F=c&&(w||O||!r)&&"uploading"!==g,M=(0,L._N)(A),I=(0,L.s8)(A),B=!!(M&&c&&(a||l&&n)&&(I||!w)),[U,z]=(0,o.useState)(!1);(0,o.useEffect)(()=>{z(mw(null==A?void 0:A.fields))},[null==A?void 0:A.fields]);let V=N&&U&&c,H="update"===aO()&&!w,q=(0,o.useCallback)(async()=>
1{if(H)return;let e="?locale=".concat(C,"&depth=0&fallback-locale=null&draft=true"),t,o="POST";l&&(t="".concat(P).concat(E,"/").concat(l).concat(n?"/".concat(n):"").concat(e),n&&(o="PATCH")),a&&(t="".concat(P).concat(E,"/globals/").concat(a).concat(e)),await x({action:t,method:o,overrides:{_status:"draft"},skipValidation:!0})},[x,l,a,P,E,C,n,H]);hG({cmdCtrlKey:!0,editDepth:j,keyCodes:["s"]},e=>{e.preventDefault(),e.stopPropagation(),q&&I&&q()});let W=(0,o.useCallback)(async()=>{"uploading"!==g&&await x({overrides:{_status:"published"}})&&(f(0),h(!1),p(!0))},[p,x,f,g,h]),K=(0,o.useCallback)(async e=>{if("uploading"===g)return;let t=y.A({depth:0,publishSpecificLocale:e}),o="".concat(P).concat(E).concat(a?"/globals/".concat(a):"/".concat(l).concat(n?"/".concat(n):"")).concat(t?"?"+t:"");await x({action:o,overrides:{_status:"published"}})&&p(!0)},[E,l,a,n,P,p,x,g]),Y=!V||N&&(null==N?void 0:N.defaultLocalePublishOption)!=="active",G=N&&(null==N?void 0:N.locales.find(e=>"string"==typeof e?e===C:e.code===C)),Q=G&&(0,d.s)(G.label,D);return c?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(pe,{buttonId:"action-save",disabled:!F,enableSubMenu:B,onClick:Y?W:()=>K(G.code),size:"medium",SubMenuPopupContent:V||B?e=>{let{close:t}=e;return(0,u.jsxs)(o.Fragment,{children:[B&&(0,u.jsx)(tc.ButtonGroup,{children:(0,u.jsx)(tc.Button,{id:"schedule-publish",onClick:()=>[k(_),t()],children:T("version:schedulePublish")})},"schedule-publish"),V&&(0,u.jsx)(tc.ButtonGroup,{children:(0,u.jsx)(tc.Button,{id:"publish-locale",onClick:Y?()=>K(G.code):W,children:Y?T("version:publishIn",{locale:Q}):T("version:publishAllLocales")})})]})}:void 0,type:"button",children:Y?R:T("version:publishIn",{locale:Q})}),B&&S(_)&&(0,u.jsx)(mI,{defaultType:O?"publish":"unpublish",schedulePublishConfig:M&&"object"==typeof A.versions.drafts.schedulePublish?A.versions.drafts.schedulePublish:void 0,slug:_})]}):null}var mU="restore-button",mz=e=>{var t,n;let{id:l,buttonId:a,collectionSlug:r,onRestore:c,redirectAfterRestore:p=!0,singularLabel:f,title:m}=e,{config:{routes:{admin:g,api:b},serverURL:x},getEntityConfig:w}=(0,i.c)(),j=w({collectionSlug:r}),C=(0,h.useRouter)(),{i18n:S,t:k}=(0,s.d)(),{title:_}=ay(),{startRouteTransition:N}=e8(),{openModal:E}=nE(),P="restore-".concat(l),[D,T]=(0,o.useState)(!1),R=(0,o.useCallback)(()=>{eJ.error(k("error:restoringTitle",{title:_}))},[k,_]),A=(0,o.useCallback)(async()=>{try{var e;let t="".concat(x).concat(b,"/").concat(r,"?").concat(y.A({trash:!0,where:{and:[{id:{equals:l}},{deletedAt:{exists:!0}}]}})),n={deletedAt:null};(null==j||null==(e=j.versions)?void 0:e.drafts)&&(n._status=D?"published":"draft");let a=await lb.patch(t,{body:JSON.stringify(n),headers:{"Accept-Language":S.language,"Content-Type":"application/json"}}),o=await a.json();if(a.status<400){if(eJ.success(k("general:titleRestored",{label:(0,d.s)(f,S),title:_})||o.message),p)return N(()=>C.push((0,v.Q)({adminRoute:g,path:"/collections/".concat(r,"/").concat(l),serverURL:x})));"function"==typeof c&&await c({id:l,collectionConfig:j});return}o.errors?o.errors.forEach(e=>eJ.error(e.message)):R()}catch(e){R()}},[x,b,r,l,k,f,R,S,_,C,g,p,c,j,N,D]);return l?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"primary",id:a,onClick:()=>{E(P)},children:k("general:restore")},a),(0,u.jsx)(lf,{body:(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(pc,{elements:{1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:(null==j||null==(t=j.versions)?void 0:t.drafts)?"general:aboutToRestoreAsDraft":"general:aboutToRestore",t:k,variables:{label:(0,d.s)(f,S),title:m||_||l}}),(null==j||null==(n=j.versions)?void 0:n.drafts)&&(0,u.jsx)("div",{className:"".concat(mU,"__checkbox"),children:(0,u.jsx)(aQ,{checked:D,id:"restore-as-published",label:k("general:restoreAsPublished"),name:"restore-as-published",onToggle:e=>T(e.target.checked)})})]}),className:mU,confirmingLabel:k("general:restoring"),heading:k("general:confirmRestoration"),modalSlug:P,onConfirm:A})]}):null};function mV(e){let{label:t}=e,{uploadStatus:n}=aD(),{t:l}=(0,s.d)(),{submit:a}=eP(),r=eO(),i=t||l("general:save"),c=(0,o.useRef)(null),d=ns(),p="update"===aO()&&!r||"uploading"===n;
1return hG({cmdCtrlKey:!0,editDepth:d,keyCodes:["s"]},e=>{e.preventDefault(),e.stopPropagation(),(null==c?void 0:c.current)&&c.current.click()}),(0,u.jsx)(pe,{buttonId:"action-save",disabled:p,onClick:()=>{if("uploading"!==n)return void a()},ref:c,size:"medium",type:"button",children:i})}function mH(e){let{config:{routes:{api:t},serverURL:n}}=(0,i.c)(),{id:l,collectionSlug:a,globalSlug:r,setUnpublishedVersionCount:c,uploadStatus:d}=aD(),p=eO(),{code:h}=lN(),f=(0,o.useRef)(null),m=ns(),{t:g}=(0,s.d)(),{submit:v}=eP(),b="update"===aO()&&!p||"uploading"===d,y=(0,o.useCallback)(async()=>{if(b)return;let e="?locale=".concat(h,"&depth=0&fallback-locale=null&draft=true"),o,i="POST";a&&(o="".concat(n).concat(t,"/").concat(a).concat(l?"/".concat(l):"").concat(e),l&&(i="PATCH")),r&&(o="".concat(n).concat(t,"/globals/").concat(r).concat(e)),await v({action:o,method:i,overrides:{_status:"draft"},skipValidation:!0}),c(e=>e+1)},[v,a,r,n,t,h,l,b,c]);return hG({cmdCtrlKey:!0,editDepth:m,keyCodes:["s"]},e=>{e.preventDefault(),e.stopPropagation(),(null==f?void 0:f.current)&&f.current.click()}),(0,u.jsx)(pe,{buttonId:"action-save-draft",buttonStyle:"secondary",className:"save-draft",disabled:b,onClick:()=>void y(),ref:f,size:"medium",type:"button",children:g("version:saveDraft")})}var mq="status",mW=()=>{let{id:e,collectionSlug:t,docPermissions:n,globalSlug:l,hasPublishedDoc:a,incrementVersionCount:r,isTrashed:c,setHasPublishedDoc:d,setMostRecentVersionIsAutosaved:p,setUnpublishedVersionCount:h,unpublishedVersionCount:f}=aD(),{toggleModal:m}=nE(),{config:{routes:{api:g},serverURL:v}}=(0,i.c)(),{reset:b}=eP(),{code:y}=lN(),{i18n:x,t:w}=(0,s.d)(),j="confirm-un-publish-".concat(e),C="confirm-revert-".concat(e),S;f>0&&a?S="changed":a?a&&f<=0&&(S="published"):S="draft";let k=c?a?"previouslyPublished":"previouslyDraft":S,_=(0,o.useCallback)(async n=>{let a,o,i;"unpublish"===n&&(i={_status:"draft"}),t&&(a="".concat(v).concat(g,"/").concat(t,"/").concat(e,"?locale=").concat(y,"&fallback-locale=null&depth=0"),o="patch"),l&&(a="".concat(v).concat(g,"/globals/").concat(l,"?locale=").concat(y,"&fallback-locale=null&depth=0"),o="post"),"revert"===n&&(i=await lb.get(a,{headers:{"Accept-Language":x.language,"Content-Type":"application/json"}}).then(e=>e.json()));let s=await lb[o](a,{body:JSON.stringify(i),headers:{"Accept-Language":x.language,"Content-Type":"application/json"}});if(200===s.status){let e,a=await s.json();l?e=a.result:t&&(e=a.doc),b(e),eJ.success(a.message),r(),p(!1),"unpublish"===n?d(!1):"revert"===n&&h(0)}else try{var c,u;let e=await s.json();(null==(u=e.errors)||null==(c=u[0])?void 0:c.message)?eJ.error(e.errors[0].message):e.error?eJ.error(e.error):eJ.error(w("error:unPublishingDocument"))}catch(e){eJ.error(w("error:unPublishingDocument"))}},[g,t,l,e,x.language,r,y,b,v,h,p,w,d]),N=null==n?void 0:n.update;return S?(0,u.jsx)("div",{className:mq,title:"".concat(w("version:status"),": ").concat(w("version:".concat(k))),children:(0,u.jsxs)("div",{className:"".concat(mq,"__value-wrap"),children:[(0,u.jsxs)("span",{className:"".concat(mq,"__label"),children:[w("version:status"),":\xa0"]}),(0,u.jsx)("span",{className:"".concat(mq,"__value"),children:w("version:".concat(k))}),!c&&N&&"published"===S&&(0,u.jsxs)(o.Fragment,{children:["\xa0â\xa0",(0,u.jsx)(tD,{buttonStyle:"none",className:"".concat(mq,"__action"),id:"action-unpublish",onClick:()=>m(j),children:w("version:unpublish")}),(0,u.jsx)(lf,{body:w("version:aboutToUnpublish"),confirmingLabel:w("version:unpublishing"),heading:w("version:confirmUnpublish"),modalSlug:j,onConfirm:()=>_("unpublish")})]}),!c&&N&&a&&"changed"===S&&(0,u.jsxs)(o.Fragment,{children:["\xa0â\xa0",(0,u.jsx)(tD,{buttonStyle:"none",className:"".concat(mq,"__action"),id:"action-revert-to-published",onClick:()=>m(C),children:w("version:revertToPublished")}),(0,u.jsx)(lf,{body:w("version:aboutToRevertToPublished"),confirmingLabel:w("version:reverting"),heading:w("version:confirmRevertToSaved"),modalSlug:C,onConfirm:()=>_("revert")})]})]})}):null},mK="doc-controls",mY=e=>{var t,n,l,a,r,c,p,h,m,g,b;let y=(0,f.c)(5),{id:x,slug:w,BeforeDocumentControls:j,customComponents:C,data:S,disableActions:k,disableCreate:_,EditMenuItems:N,hasSavePermission:E,isAccountView:P,isEditing:D,isInDrawer:T,isTrashed:R,onDelete:A,onDrawerCreateNew:O,onDuplicate:F,onRestore:M,onTakeOver:I,permissions:B,readOnlyForIncomingUser:U,redirectAfterDelete:z,redirectAfterDuplicate:V,redirectAfterRestore:H,user:q}
1=e,{PreviewButton:W,PublishButton:K,SaveButton:Y,SaveDraftButton:G}=void 0===C?{}:C,{i18n:Q,t:X}=(0,s.d)(),$=ns(),{config:Z,getEntityConfig:J}=(0,i.c)(),ee=J({collectionSlug:w}),et=J({globalSlug:w}),{isLivePreviewEnabled:en}=mg(),{admin:el,localization:ea,routes:eo,serverURL:er}=Z,{dateFormat:ei}=el,{admin:es}=eo,[ec,eu]=o.useState(""),[ed,eh]=o.useState(""),ef=eA(),em=eF(),eg,ev;y[0]!==S||y[1]!==ei||y[2]!==Q?(eg=()=>{(null==S?void 0:S.updatedAt)&&eu(ah({date:S.updatedAt,i18n:Q,pattern:ei})),(null==S?void 0:S.createdAt)&&eh(ah({date:S.createdAt,i18n:Q,pattern:ei}))},ev=[S,Q,ei],y[0]=S,y[1]=ei,y[2]=Q,y[3]=eg,y[4]=ev):(eg=y[3],ev=y[4]),(0,o.useEffect)(eg,ev);let eb=B&&"create"in B&&B.create,ey=B&&"delete"in B&&B.delete,ex=!!(ee&&x&&!k&&(eb||ey)),ew=!x&&(null==ee||null==(t=ee.versions)?void 0:t.drafts)&&(null==(n=ee.versions)?void 0:n.drafts.validate),ej=(0,L.gD)(et),eC=(0,L.gD)(ee),eS=(0,L.s8)(ee),ek=(0,L.s8)(et),e_=eS||ek,eN=eS&&!1!==ee.versions.drafts.autosave&&!0===ee.versions.drafts.autosave.showSaveDraftButton||ek&&!1!==et.versions.drafts.autosave&&!0===et.versions.drafts.autosave.showSaveDraftButton,eE=ea&&!(null==ee||null==(l=ee.admin)?void 0:l.disableCopyToLocale),eP=ee&&ee.folders,eD=q&&U;return(0,u.jsxs)(la,{className:mK,children:[(0,u.jsxs)("div",{className:"".concat(mK,"__wrapper"),children:[(0,u.jsxs)("div",{className:"".concat(mK,"__content"),children:[eD||eP?(0,u.jsxs)("div",{className:"".concat(mK,"__meta-icons"),children:[eD&&(0,u.jsx)(mD,{className:"".concat(mK,"__locked-controls"),user:q}),eP&&Z.folders&&!R&&(0,u.jsx)(pN,{folderCollectionSlug:Z.folders.slug,folderFieldName:Z.folders.fieldName})]}):null,(0,u.jsxs)("ul",{className:"".concat(mK,"__meta"),children:[ee&&!D&&!P&&(0,u.jsx)("li",{className:"".concat(mK,"__list-item"),children:(0,u.jsx)("p",{className:"".concat(mK,"__value"),children:Q.t("general:creatingNewLabel",{label:(0,d.s)(null!=(b=null==ee||null==(a=ee.labels)?void 0:a.singular)?b:Q.t("general:document"),Q)})})}),(eC||ej)&&(0,u.jsxs)(o.Fragment,{children:[(et||ee&&D)&&(0,u.jsx)("li",{className:["".concat(mK,"__status"),"".concat(mK,"__list-item")].filter(Boolean).join(" "),children:(0,u.jsx)(mW,{})}),E&&e_&&!ew&&!R&&(0,u.jsx)("li",{className:"".concat(mK,"__list-item"),children:(0,u.jsx)(mb,{collection:ee,global:et,id:x,publishedDocUpdatedAt:null==S?void 0:S.createdAt})})]}),(null==ee?void 0:ee.timestamps)&&(D||P)&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("li",{className:["".concat(mK,"__list-item"),"".concat(mK,"__value-wrap")].filter(Boolean).join(" "),title:(null==S?void 0:S.updatedAt)?ec:"",children:[(0,u.jsxs)("p",{className:"".concat(mK,"__label"),children:[Q.t(R?"general:deleted":"general:lastModified"),":\xa0"]}),(null==S?void 0:S.updatedAt)&&(0,u.jsx)("p",{className:"".concat(mK,"__value"),children:ec})]}),(0,u.jsxs)("li",{className:["".concat(mK,"__list-item"),"".concat(mK,"__value-wrap")].filter(Boolean).join(" "),title:(null==S?void 0:S.createdAt)?ed:"",children:[(0,u.jsxs)("p",{className:"".concat(mK,"__label"),children:[Q.t("general:created"),":\xa0"]}),(null==S?void 0:S.createdAt)&&(0,u.jsx)("p",{className:"".concat(mK,"__value"),children:ed})]})]})]})]}),(0,u.jsxs)("div",{className:"".concat(mK,"__controls-wrapper"),children:[(0,u.jsxs)("div",{className:"".concat(mK,"__controls"),children:[j,en&&!T&&(0,u.jsx)(mN,{}),((null==ee?void 0:ee.admin.preview)||(null==et?void 0:et.admin.preview))&&(0,u.jsx)(ep,{CustomComponent:W,Fallback:(0,u.jsx)(mA,{})}),E&&!R&&(0,u.jsx)(o.Fragment,{children:eC||ej?(0,u.jsxs)(o.Fragment,{children:[(ew||!e_||e_&&eN)&&(0,u.jsx)(ep,{CustomComponent:G,Fallback:(0,u.jsx)(mH,{})}),(0,u.jsx)(ep,{CustomComponent:K,Fallback:(0,u.jsx)(mB,{})})]}):(0,u.jsx)(ep,{CustomComponent:Y,Fallback:(0,u.jsx)(mV,{})})}),ey&&R&&(0,u.jsx)(mT,{buttonId:"action-permanently-delete",collectionSlug:null==ee?void 0:ee.slug,id:x.toString(),onDelete:A,redirectAfterDelete:z,singularLabel:null==ee||null==(r=ee.labels)?void 0:r.singular}),E&&R&&(0,u.jsx)(mz,{buttonId:"action-restore",collectionSlug:null==ee?void 0:ee.slug,id:x.toString(),onRestore:M,redirectAfterRestore:H,singularLabel:null==ee||null==(c=ee.labels)?void 0:c.singular}),q&&U&&(0,u.jsx)(tD,{buttonStyle:"secondary",id:"take-over",onClick:I,size:"medium",type:"button",children:X("general:takeOver")})]}),ex&&!U&&(0,u.jsx)(t_,{button:(0,u.jsxs)("div",{className:"".concat(mK,"__dots"),children:[(0,u.jsx)("div",{}),(0,u.jsx)("div",{}),(0,u.jsx)("div",{})]}),className:"".concat(mK,"__popup"),disabled:em||ef,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:(0,u.jsxs)(tc.ButtonGroup,{children:[eE&&(0,u.jsx)(ml,{}),eb&&(0,u.jsxs)(o.Fragment,{children:[!_&&(0,u.jsx)(o.Fragment,{children:$>1?(0,u.jsx)(tc.Button,{id:"action-create",onClick:O,children:Q.t("general:createNew")}):(0,u.jsx)(tc.Button,{href:(0,v.Q)({adminRoute:es,path:"/collections/".concat(null==ee?void 0:ee.slug,"/create"),serverURL:er}),id:"action-create",children:Q.t("general:createNew")})}),!0!==ee.disableDuplicate&&D&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(mS,{id:x,onDuplicate:F,redirectAfterDuplicate:V,singularLabel:null==ee||null==(p=ee.labels)?void 0:p.singular,slug:null==ee?void 0:ee.slug}),ea&&(0,u.jsx)(mS,{id:x,onDuplicate:F,redirectAfterDuplicate:V,selectLocales:!0,singularLabel:null==ee||null==(h=ee.labels)?void 0:h.singular,slug:null==ee?void 0:ee.slug})]})]}),ey&&(0,u.jsx)(mx,{buttonId:"action-delete",collectionSlug:null==ee?void 0:ee.slug,id:x.toString(),onDelete:A,redirectAfterDelete:z,singularLabel:null==ee||null==(m
1=ee.labels)?void 0:m.singular,useAsTitle:null==ee||null==(g=ee.admin)?void 0:g.useAsTitle}),N]})})]})]}),(0,u.jsx)("div",{className:"".concat(mK,"__divider")})]})},mG=RegExp("^<(?<name>[^\\s/>]+)[^>]*>$"),mQ=RegExp("^<(?<isEnd>\\/)?(?<name>[^\\s>]+)[^>]*>$"),mX=/^<[^>]+>/,m$=/^<img[^>]*>$/,mZ=RegExp("^<video[^>]*>.*?<\\/video>$","ms"),mJ=class{computeBestMatchedBlock(e,t,n,l){let a=null;for(let o=e;o<t;o++){let e=Math.min(t-o,l-n),r=this.slideBestMatchedBlock(o,n,e);if(r&&(!a||r.size>a.size)&&(a=r,r.size>this.leastCommonLength))return a}for(let o=n;o<l;o++){let n=Math.min(t-e,l-o),r=this.slideBestMatchedBlock(e,o,n);if(r&&(!a||r.size>a.size)&&(a=r,r.size>this.leastCommonLength))break}return a}computeMatchedBlockList(e,t,n,l){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=this.computeBestMatchedBlock(e,t,n,l);return o?(e<o.oldStart&&n<o.newStart&&this.computeMatchedBlockList(e,o.oldStart,n,o.newStart,a),a.push(o),t>o.oldEnd&&l>o.newEnd&&this.computeMatchedBlockList(o.oldEnd,t,o.newEnd,l,a),a):[]}dressUpBlockTag(e,t){return"create"===e?'<div class="'.concat(this.config.classNames.createBlock,'">').concat(t,"</div>"):"delete"===e?'<div class="'.concat(this.config.classNames.deleteBlock,'">').concat(t,"</div>"):""}dressUpDiffContent(e,t){let n=t.length;if(!n)return"";let l="",a=0,o=-1;for(let n of t){var r;o++;let i=n.includes('data-enable-match="true"'),s=n.includes('data-enable-match="false"'),c=!!(null==(r=n.match(mX))?void 0:r.length);s?(a=o+1,l+=n):!i&&c?(o>a&&(l+=this.dressUpText(e,t.slice(a,o))),a=o+1,n.match(mZ)?l+=this.dressUpBlockTag(e,n):l+=n):i&&c&&(o>a&&(l+=this.dressUpText(e,t.slice(a,o))),a=o+1,l+=this.dressupMatchEnabledHtmlTag(e,n))}return a<n&&(l+=this.dressUpText(e,t.slice(a))),l}dressUpInlineTag(e,t){return"create"===e?'<span class="'.concat(this.config.classNames.createInline,'">').concat(t,"</span>"):"delete"===e?'<span class="'.concat(this.config.classNames.deleteInline,'">').concat(t,"</span>"):""}dressupMatchEnabledHtmlTag(e,t){var n,l;let a=null==(l=t.match(mG))||null==(n=l.groups)?void 0:n.name;if(!a)return t;let o=a.length+1;return"".concat(t.slice(0,o),' data-match-type="').concat("create"===e?"create":"delete",'"').concat(t.slice(o,t.length))}dressUpText(e,t){let n=t.join("");return n.trim()?"create"===e?'<span data-match-type="create">'.concat(n,"</span>"):"delete"===e?'<span data-match-type="delete">'.concat(n,"</span>"):"":""}getMatchedBlockList(){let e=this.oldTokens.length,t=this.newTokens.length,n=null,l=0;for(;l<e&&l<t&&this.oldTokens[l]===this.newTokens[l];)l++;l>=this.config.minMatchedSize&&(n={newEnd:l,newStart:0,oldEnd:l,oldStart:0,size:l});let a=null,o=e-1,r=t-1;for(;l<=o&&l<=r&&this.oldTokens[o]===this.newTokens[r];)o--,r--;let i=e-1-o;i>=this.config.minMatchedSize&&(a={newEnd:t,newStart:r+1,oldEnd:e,oldStart:o+1,size:i});let s=n?l:0,c=a?o+1:e,u=n?l:0,d=a?r+1:t;if(this.config.greedyMatch){let e=Math.min(c-s,d-u);e>this.config.greedyBoundary&&(this.leastCommonLength=Math.floor(e/3))}let p=this.computeMatchedBlockList(s,c,u,d);return n&&p.unshift(n),a&&p.push(a),p}getOperationList(){let e=[],t=0,n=0;for(let l of this.matchedBlockList){let a=t===l.oldStart,o=n===l.newStart,r={newEnd:l.newStart,newStart:n,oldEnd:l.oldStart,oldStart:t};a||o?a&&!o?e.push(Object.assign(r,{type:"create"})):!a&&o&&e.push(Object.assign(r,{type:"delete"})):e.push(Object.assign(r,{type:"replace"})),e.push({type:"equal",newEnd:l.newEnd,newStart:l.newStart,oldEnd:l.oldEnd,oldStart:l.oldStart}),t=l.oldEnd,n=l.newEnd}let l=this.oldTokens.length,a=this.newTokens.length,o={newEnd:a,newStart:n,oldEnd:l,oldStart:t},r=t===l,i=n===a;return r||i?r&&!i?e.push(Object.assign(o,{type:"create"})):!r&&i&&e.push(Object.assign(o,{type:"delete"})):e.push(Object.assign(o,{type:"replace"})),e}slideBestMatchedBlock(e,t,n){let l=0,a=null,o=0;for(let r=0;r<n;r++)this.oldTokens[e+r]===this.newTokens[t+r]?o++:o=0,o>l&&(l=o,a={newEnd:t+r+1,newStart:t+r-o+1,oldEnd:e+r+1,oldStart:e+r-o+1,size:o});return l>=this.config.minMatchedSize?a:null}tokenizeByCharacter(e){let t=[],n=0,l=RegExp("<picture[^>]*>.*?<\\/picture>|<video[^>]*>.*?<\\/video>|<[^>]+>","gs"),a;for(;null!==(a=l.exec(e));){let l=e.substring(n,a.index);if(l)for(let e of l)t.push(e);t.push(a[0]),n=a.index+a[0].length}for(let l of e.substring(n))t.push(l);return t}tokenizeByWord(e){return e.match(RegExp("<picture[^>]*>.*?<\\/picture>|<video[^>]*>.*?<\\/video>|<[^>]+>|\\w+\\b|\\s+|[^<>\\w]","gs"))||[]}getSideBySideContents(){if(void 0!==this.sideBySideContents)return this.sideBySideContents;let e="",t="",n=0;this.operationList.forEach(l=>{switch(l.type){case"create":t+=this.dressUpDiffContent("create",this.newTokens.slice(l.newStart,l.newEnd));break;case"delete":{let t=this.oldTokens.slice(l.oldStart,l.oldEnd);e+=this.dressUpDiffContent("delete",t);break}case"equal":{let i=this.newTokens.slice(l.newStart,l.newEnd),s="";for(let e of i){let t=e.match(mG);if(t){var a,o,r;n+=1;let l=(null!=(r=null==t||null==(o=t.groups)||null==(a=o.name)?void 0:a.length)?r:0)+1;s+="".concat(e.slice(0,l),' data-seq="').concat(n,'"').concat(e.slice(l))}else s+=e}e+=s,t+=s;break}case"replace":e+=this.dressUpDiffContent("delete",this.oldTokens.slice(l.oldStart,l.oldEnd)),t+=this.dressUpDiffContent("create",this.newTokens.slice(l.newStart,l.newEnd));break;default:console.error("Richtext diff error - invalid operation: "+String(l.type))}});let l=[e,t];return this.sideBySideContents=l,l}getUnifiedContent(){if(void 0!==this.unifiedContent)return this.unifiedContent;let e="";return this.operationList.forEach(t=>{switch(t.type){case"create":e+=this.dressUpDiffContent("create",this.newTokens.slice(t.newStart,t.newEnd));break;case"delete":e+=this.dressUpDiffContent("delete",this.oldTokens.slice(t.oldStart,t.oldEnd));break;case"equal":for(let n of this.newTokens.slice(t.newStart,t.newEnd))e+=n;break;case"replace":{var n,l,a,o,r,i;let s=this.oldTokens.slice(t.oldStart,t.oldEnd),c=this.newTokens.slice(t.newStart,t.newEnd);if(1===s.length&&1===c.length&&(null==(n=s[0])?void 0:n.match(mX))&&(null==(l=c[0])?void 0:l.match(mX))){e+=c[0];break}let u=[],d=[],p=t.newStart;for(let n=t.oldStart;n<t.oldEnd;n++){let l=this.oldTokens[n];if(!l)continue;let s=null==l?void 0:l.match(mQ);if(s){if([m$,mZ].some(e=>null==l?void 0:l.match(e))){u.push(l);continue}e+=this.dressUpDiffContent("delete",u),u.splice(0);let n=!1;for(let l=p;l<t.newEnd;l++){let t=this.newTokens[l];if(!t)continue;let c=null==t?void 0:t.match(mQ);if(c&&(null==(a=c.groups)?void 0:a.name)===(null==(o=s.groups)?void 0:o.name)&&(null==(r=c.groups)?void 0:r.isEnd)===(null==(i=s.groups)?void 0:i.isEnd)){n=!0,e+=this.dressUpDiffContent("create",d),e+=t,d.splice(0),p=l+1;break}d.push(t)}n||(e+=l,d.splice(0))}else u.push(l)}p<t.newEnd&&d.push(...this.newTokens.slice(p,t.newEnd)),e+=this.dressUpDiffContent("delete",u),e+=this.dressUpDiffContent("create",d);break}default:console.error("Richtext diff error - invalid operation: "+String(t.type))}}),this.unifiedContent=e,e}constructor(e,t,{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:l=1e3,greedyMatch:a=!0,minMatchedSize:o=2,tokenizeByCh
1aracter:r=!1}={}){if(this.leastCommonLength=1/0,this.matchedBlockList=[],this.newTokens=[],this.oldTokens=[],this.operationList=[],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:l,greedyMatch:a,minMatchedSize:o},(e=e.trim())===(t=t.trim())){this.unifiedContent=e;let t=0,n=e.replace(/<([^\s/>]+)[^>]*>/g,(e,n)=>{let l=n.length+1;return"".concat(e.slice(0,l),' data-seq="').concat(++t,'"').concat(e.slice(l))});this.sideBySideContents=[n,n];return}let i=r?this.tokenizeByCharacter:this.tokenizeByWord;this.oldTokens=i(e),this.newTokens=i(t),this.matchedBlockList=this.getMatchedBlockList(),this.operationList=this.getOperationList()}},m0="html-diff",m1=e=>{let{fromHTML:t,toHTML:n,tokenizeByCharacter:l}=e,[a,o]=new mJ(t,n,{tokenizeByCharacter:l}).getSideBySideContents();return{From:a?(0,u.jsx)("div",{className:"".concat(m0,"__diff-old html-diff"),dangerouslySetInnerHTML:{__html:a}}):null,To:o?(0,u.jsx)("div",{className:"".concat(m0,"__diff-new html-diff"),dangerouslySetInnerHTML:{__html:o}}):null}},m3=(0,o.createContext)(null),m2=e=>{let{children:t}=e,n=(0,o.useRef)(new Set);return(0,o.useEffect)(()=>{let e=e=>{n.current.forEach(t=>{let{handler:n,ref:l}=t;l.current&&!l.current.contains(e.target)&&n()})};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,u.jsx)(m3,{value:{register:e=>n.current.add(e),unregister:e=>n.current.delete(e)},children:t})},m6=()=>{let e=(0,o.use)(m3);if(!e)throw Error("useClickOutside must be used within a ClickOutsideProvider");return e};function m5(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],{register:l,unregister:a}=m6();(0,o.useEffect)(()=>{if(!n||!e.current)return;let o={handler:t,ref:e};return l(o),()=>a(o)},[e,t,n,l,a])}var m4=e=>{let t=(0,f.c)(7),{action:n,disabled:l}=e,{submit:a}=eP(),{t:o}=(0,s.d)(),r;t[0]!==n||t[1]!==a?(r=()=>{a({action:n,method:"PATCH",skipValidation:!0})},t[0]=n,t[1]=a,t[2]=r):r=t[2];let i=r,c;return t[3]!==l||t[4]!==i||t[5]!==o?(c=(0,u.jsx)(pe,{className:"".concat(ge,"__save"),disabled:l,onClick:i,children:o("general:save")}),t[3]=l,t[4]=i,t[5]=o,t[6]=c):c=t[6],c},m8=e=>{let t=(0,f.c)(7),{action:n,disabled:l}=e,{submit:a}=eP(),{t:o}=(0,s.d)(),r;t[0]!==n||t[1]!==a?(r=()=>{a({action:n,method:"PATCH",overrides:{_status:"published"},skipValidation:!0})},t[0]=n,t[1]=a,t[2]=r):r=t[2];let i=r,c;return t[3]!==l||t[4]!==i||t[5]!==o?(c=(0,u.jsx)(pe,{className:"".concat(ge,"__publish"),disabled:l,onClick:i,children:o("version:publishChanges")}),t[3]=l,t[4]=i,t[5]=o,t[6]=c):c=t[6],c},m9=e=>{let t=(0,f.c)(7),{action:n,disabled:l}=e,{submit:a}=eP(),{t:o}=(0,s.d)(),r;t[0]!==n||t[1]!==a?(r=()=>{a({action:n,method:"PATCH",overrides:{_status:"draft"},skipValidation:!0})},t[0]=n,t[1]=a,t[2]=r):r=t[2];let i=r,c;return t[3]!==l||t[4]!==i||t[5]!==o?(c=(0,u.jsx)(pe,{buttonStyle:"secondary",className:"".concat(ge,"__draft"),disabled:l,onClick:i,children:o("version:saveDraft")}),t[3]=l,t[4]=i,t[5]=o,t[6]=c):c=t[6],c},m7=e=>{var t,n;let{collection:l,collection:{fields:a,labels:{plural:r,singular:c}}={},count:p,drawerSlug:f,ids:m,onSuccess:g,selectAll:v,selectedFields:x,setSelectedFields:w,where:j}=e,{permissions:C,user:S}=lw(),{code:_}=lN(),{closeModal:N}=nE(),{config:{routes:{api:E},serverURL:P}}=(0,i.c)(),{getFormState:D}=ci(),{i18n:T,t:R}=(0,s.d)(),[A,L]=(0,o.useState)(!1),O=(0,h.useRouter)(),F=o.useRef(null),{clearRouteCache:M}=d7(),I=null==C||null==(t=C.collections)?void 0:t[l.slug],B=(0,h.useSearchParams)(),U=(0,o.useMemo)(()=>(0,V.s)(x.reduce((e,t)=>(e[t.value.path]=!0,e),{})),[x]),z=(0,o.useCallback)(async e=>{let{formState:t,submitted:n}=e,a=cN(F),{state:o}=await D({collectionSlug:l.slug,docPermissions:I,docPreferences:null,formState:t,operation:"update",schemaPath:l.slug,select:U,signal:a.signal,skipValidation:!n});return F.current=null,o},[D,l,I,U]);(0,o.useEffect)(()=>{let e=F.current;return()=>{c_(e)}},[]);let H=(0,o.useMemo)(()=>{var e;let t=[];
1j&&t.push(j);let n=(0,k.d)({collectionConfig:l,search:B.get("search")});return n&&t.push(n),v?t.push((null==(e=ce(B))?void 0:e.where)||{id:{not_equals:""}}):t.push({id:{in:m||[]}}),y.A({locale:_,select:{},where:(0,Q.h)(t)},{addQueryPrefix:!0})},[l,B,v,m,_,j]),q=(0,o.useCallback)(async e=>{let{dispatchFields:t,formState:n,selected:a}=e;L(!0),w(a||[]);let{state:o}=await D({collectionSlug:l.slug,docPermissions:I,docPreferences:null,formState:n,operation:"update",schemaPath:l.slug,select:(0,V.s)(a.reduce((e,t)=>(e[t.value.path]=!0,e),{})),skipValidation:!0});t({type:"UPDATE_MANY",formState:o}),L(!1)},[D,l.slug,I,w]);return(0,u.jsx)(aR,{collectionSlug:l.slug,currentEditor:S,hasPublishedDoc:!1,id:null,initialData:{},isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,versionCount:0,children:(0,u.jsx)(aA,{value:"update",children:(0,u.jsxs)("div",{className:"".concat(ge,"__main"),children:[(0,u.jsxs)("div",{className:"".concat(ge,"__header"),children:[(0,u.jsx)("h2",{className:"".concat(ge,"__header__title"),children:R("general:editingLabel",{count:p,label:(0,d.s)(p>1?r:c,T)})}),(0,u.jsx)("button",{"aria-label":R("general:close"),className:"".concat(ge,"__header__close"),id:"close-drawer__".concat(f),onClick:()=>N(f),type:"button",children:(0,u.jsx)(s.a,{})})]}),(0,u.jsxs)(di,{className:"".concat(ge,"__form"),isInitializing:A,onChange:[z],onSuccess:()=>{O.replace(y.A({...ce(B),page:v?"1":void 0},{addQueryPrefix:!0})),M(),N(f),"function"==typeof g&&g()},children:[(0,u.jsx)(dH,{fields:a,onChange:q,permissions:I.fields}),0===x.length?null:(0,u.jsx)("div",{className:"render-fields",children:x.map((e,t)=>{let{value:{field:n,fieldPermissions:l,path:a}}=e;return(0,u.jsx)(hR,{clientFieldConfig:n,indexPath:"",parentPath:"",parentSchemaPath:"",path:a,permissions:l},"".concat(a,"-").concat(t))})}),(0,u.jsx)("div",{className:"".concat(ge,"__sidebar-wrap"),children:(0,u.jsx)("div",{className:"".concat(ge,"__sidebar"),children:(0,u.jsx)("div",{className:"".concat(ge,"__sidebar-sticky-wrap"),children:(0,u.jsx)("div",{className:"".concat(ge,"__document-actions"),children:(null==l||null==(n=l.versions)?void 0:n.drafts)?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(m9,{action:(0,b.n)({apiRoute:E,path:"/".concat(l.slug).concat(H,"&draft=true"),serverURL:P}),disabled:0===x.length}),(0,u.jsx)(m8,{action:(0,b.n)({apiRoute:E,path:"/".concat(l.slug).concat(H,"&draft=true"),serverURL:P}),disabled:0===x.length})]}):(0,u.jsx)(m4,{action:(0,b.n)({apiRoute:E,path:"/".concat(l.slug).concat(H),serverURL:P}),disabled:0===x.length})})})})})]})]})})})},ge="edit-many",gt=e=>{let t=(0,f.c)(8),{count:n,selectAll:l,selectedIDs:a,toggleAll:o}=mc(),r;t[0]!==o?(r=()=>o(),t[0]=o,t[1]=r):r=t[1];let i=l===mo.AllAvailable,s;return t[2]!==n||t[3]!==e||t[4]!==a||t[5]!==r||t[6]!==i?(s=(0,u.jsx)(gn,{...e,count:n,ids:a,onSuccess:r,selectAll:i}),t[2]=n,t[3]=e,t[4]=a,t[5]=r,t[6]=i,t[7]=s):s=t[7],s},gn=e=>{var t;let n,l,a=(0,f.c)(16),{collection:r,count:i,ids:c,modalPrefix:d,onSuccess:p,selectAll:h,where:m}=e,{permissions:g}=lw(),{openModal:v}=nE(),{t:b}=(0,s.d)(),y;a[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],a[0]=y):y=a[0];let[x,w]=(0,o.useState)(y),j=null==g||null==(t=g.collections)?void 0:t[r.slug],C="".concat(d?"".concat(d,"-"):"","edit-").concat(r.slug);if(0===i||!(null==j?void 0:j.update))return null;if(a[1]===Symbol.for("react.memo_cache_sentinel")?(n=[ge,"".concat(ge,"__toggle")].filter(Boolean),a[1]=n):n=a[1],a[2]!==r||a[3]!==i||a[4]!==C||a[5]!==c||a[6]!==p||a[7]!==v||a[8]!==h||a[9]!==x||a[10]!==b||a[11]!==m){let e;a[13]!==C||a[14]!==v?(e=()=>{v(C),w([])},a[13]=C,a[14]=v,a[15]=e):e=a[15],l=(0,u.jsxs)("div",{className:n.join(" "),children:[(0,u.jsx)(mp,{"aria-label":b("general:edit"),onClick:e,children:b("general:edit")}),(0,u.jsx)(ni,{children:(0,u.jsx)(lc,{Header:null,slug:C,children:(0,u.jsx)(m7,{collection:r,count:i,drawerSlug:C,ids:c,onSuccess:p,selectAll:h,selectedFields:x,setSelectedFields:w,where:m})})})]}),a[2]=r,a[3]=i,a[4]=C,a[5]=c,a[6]=p,a[7]=v,a[8]=h,a[9]=x,a[10]=b,a[11]=m,a[12]=l}else l=a[12];return l};function gl(e){let t=(0,f.c)(3),n=ns(),l;return t[0]!==n||t[1]!==e?(l=(0,u.jsx)(nq,{closeOnBlur:!1,...e,style:{...e.style||{},zIndex:"calc(100 + ".concat(n||0," + 1)")}}),t[0]=n,t[1]=e,t[2]=l):l=t[2],l}function ga(e){let t,n=(0,f.c)(12),{highlightField:l,setKey:a}=e,{id:r}=aD(),{toggleModal:i}=nE(),{t:c}=(0,s.d)(),d="generate-confirmation-".concat(r),p;n[0]!==l||n[1]!==a||n[2]!==c?(p=()=>{a(),eJ.success(c("authentication:newAPIKeyGenerated")),l(!0)},n[0]=l,n[1]=a,n[2]=c,n[3]=p):p=n[3];let h=p,m;return n[4]!==d||n[5]!==i?(m=()=>{i(d)},n[4]=d,n[5]=i,n[6]=m):m=n[6],n[7]!==h||n[8]!==d||n[9]!==c||n[10]!==m?(t=(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"secondary",onClick:m,size:"small",children:c("authentication:generateNewAPIKey")}),(0,u.jsx)(lf,{body:(0,u.jsx)(pc,{elements:{1:go},i18nKey:"authentication:generatingNewAPIKeyWillInvalidate",t:c}),confirmLabel:c("authentication:generate"),heading:c("authentication:confirmGeneration"),modalSlug:d,onConfirm:h})]}),n[7]=h,n[8]=d,n[9]=c,n[10]=m,n[11]=t):t=n[11],t}function go(e){let{children:t}=e;return(0,u.jsx)("strong",{children:t})}function gr(e){let t=(0,f.c)(4),{permissions:n}=e,{setPermissions:l}=lw(),a,r;return t[0]!==n||t[1]!==l?(a=()=>
1{l(n)},r=[n,l],t[0]=n,t[1]=l,t[2]=a,t[3]=r):(a=t[2],r=t[3]),(0,o.useEffect)(a,r),null}var gi="dots",gs=e=>{let{ariaLabel:t,className:n,noBackground:l,orientation:a="vertical"}=e;return(0,u.jsxs)("div",{"aria-label":t,className:[n,gi,l&&"".concat(gi,"--no-background"),a&&"".concat(gi,"--").concat(a)].filter(Boolean).join(" "),children:[(0,u.jsx)("div",{}),(0,u.jsx)("div",{}),(0,u.jsx)("div",{})]})},gc="group-by-builder",gu=["text","textarea","number","select","relationship","date","checkbox","radio","email","number","upload"],gd=e=>{var t,n,l;let{collectionSlug:a,fields:r}=e,{i18n:i,t:c}=(0,s.d)(),{permissions:d}=lw(),p=null==d||null==(n=d.collections)||null==(t=n[a])?void 0:t.fields,h=(0,o.useMemo)(()=>fg({fieldPermissions:p,fields:r,i18n:i}),[r,p,i]),{query:f,refineListData:m}=cn(),g=null==(l=f.groupBy)?void 0:l.replace(/^-/,""),v=h.find(e=>e.value===g);return(0,u.jsxs)("div",{className:gc,children:[(0,u.jsxs)("div",{className:"".concat(gc,"__header"),children:[(0,u.jsx)("p",{children:c("general:groupByLabel",{label:""})}),f.groupBy&&(0,u.jsx)("button",{className:"".concat(gc,"__clear-button"),id:"group-by--reset",onClick:async()=>{await m({groupBy:""})},type:"button",children:c("general:clear")})]}),(0,u.jsxs)("div",{className:"".concat(gc,"__inputs"),children:[(0,u.jsx)(sW,{filterOption:(e,t)=>{var n;return((null==e||null==(n=e.data)?void 0:n.plainTextLabel)||e.label).toLowerCase().includes(t.toLowerCase())},id:"group-by--field-select",isClearable:!0,isMulti:!1,onChange:async e=>{var t;let n=null===e?void 0:e.value;null===e&&await m({groupBy:"",page:1}),await m({groupBy:n?(null==(t=f.groupBy)?void 0:t.startsWith("-"))?"-".concat(n):n:void 0,page:1})},options:h.filter(e=>!e.field.admin.disableGroupBy&&"id"!==e.value&&gu.includes(e.field.type)),value:{label:(null==v?void 0:v.label)||c("general:selectValue"),value:g||""}}),(0,u.jsx)(uZ,{id:"group-by--sort",isClearable:!1,name:"direction",onChange:async e=>{let{value:t}=e;g&&await m({groupBy:"asc"===t?g:"-".concat(g),page:1})},options:[{label:c("general:ascending"),value:"asc"},{label:c("general:descending"),value:"desc"}],path:"direction",readOnly:!g,value:f.groupBy?"string"==typeof f.groupBy?"".concat(f.groupBy.startsWith("-")?"desc":"asc"):"":"asc"})]})]})},gp=e=>{let{className:t}=e;return(0,u.jsx)("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:(0,u.jsx)("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"})})},gh="active-query-preset";function gf(e){let t=(0,f.c)(11),{activePreset:n,openPresetListDrawer:l,resetPreset:a}=e,{i18n:o,t:r}=(0,s.d)(),{getEntityConfig:c}=(0,i.c)(),p;if(t[0]!==n||t[1]!==c||t[2]!==o||t[3]!==l||t[4]!==a||t[5]!==r){let e,i=c({collectionSlug:"payload-query-presets"}),h=n&&"".concat(gh,"--active"),f;t[7]!==h?(f=[gh,h].filter(Boolean),t[7]=h,t[8]=f):f=t[8],t[9]!==l?(e=()=>{l()},t[9]=l,t[10]=e):e=t[10],p=(0,u.jsx)(ol,{className:f.join(" "),id:"select-preset",onClick:e,pillStyle:"light",size:"small",children:(0,u.jsxs)("div",{className:"".concat(gh,"__label"),children:[(null==n?void 0:n.isShared)&&(0,u.jsx)(gp,{className:"".concat(gh,"__shared")}),(0,u.jsx)("div",{className:"".concat(gh,"__label-text-max-width"),children:(0,u.jsx)("div",{className:"".concat(gh,"__label-text"),children:(null==n?void 0:n.title)||r("general:selectLabel",{label:(0,d.s)(i.labels.singular,o)})})}),n?(0,u.jsx)("div",{className:"".concat(gh,"__clear"),id:"clear-preset",onClick:async e=>{e.stopPropagation(),await a()},onKeyDown:async e=>
1{("Enter"===e.key||" "===e.key)&&(e.stopPropagation(),await a())},role:"button",tabIndex:0,children:(0,u.jsx)(s.a,{})}):null]})}),t[0]=n,t[1]=c,t[2]=o,t[3]=l,t[4]=a,t[5]=r,t[6]=p}else p=t[6];return p}var gm="confirm-delete-preset",gg="payload-query-presets",gv="query-preset-bar",gb=e=>{var t,n,l,a,r;let{activePreset:c,collectionSlug:p,queryPresetPermissions:h}=e,{modified:f,query:m,refineListData:g,setModified:v}=cn(),{i18n:y,t:x}=(0,s.d)(),{openModal:w}=nE(),{config:{routes:{api:j},serverURL:C},getEntityConfig:S}=(0,i.c)(),k=S({collectionSlug:gg}),[N,,{openDrawer:E}]=cO({id:null==c?void 0:c.id,collectionSlug:gg}),[P,,{closeDrawer:D,openDrawer:T}]=cO({collectionSlug:gg}),[R,,{closeDrawer:A,openDrawer:L}]=uk({collectionSlugs:[gg],filterOptions:(0,o.useMemo)(()=>({"payload-query-presets":{isTemp:{not_equals:!0},relatedCollection:{equals:p}}}),[p]),selectedCollection:gg}),O=(0,o.useCallback)(async e=>{await g({columns:e.columns?(0,_.F)(e.columns):void 0,groupBy:e.groupBy||"",preset:e.id,where:e.where},!1)},[g]),F=(0,o.useCallback)(async()=>{await g({columns:[],groupBy:"",preset:"",where:{}},!1)},[g]),M=(0,o.useCallback)(async()=>{try{await fetch((0,b.n)({apiRoute:j,path:"/".concat(gg,"/").concat(c.id),serverURL:C}),{method:"DELETE"}).then(async e=>{try{var t;let n=await e.json();e.status<400?(eJ.success(x("general:titleDeleted",{label:(0,d.s)(null==k||null==(t=k.labels)?void 0:t.singular,y),title:c.title})),await F()):n.errors?n.errors.forEach(e=>eJ.error(e.message)):eJ.error(x("error:deletingTitle",{title:c.title}))}catch(e){eJ.error(x("error:deletingTitle",{title:c.title}))}})}catch(e){eJ.error(x("error:deletingTitle",{title:c.title}))}},[j,null==c?void 0:c.id,null==c?void 0:c.title,x,k,y,F,C]),I=(0,o.useCallback)(async()=>{try{await fetch((0,b.n)({apiRoute:j,path:"/".concat(gg,"/").concat(c.id),serverURL:C}),{body:JSON.stringify({columns:(0,_.l)(m.columns),groupBy:m.groupBy,where:m.where}),credentials:"include",headers:{"Content-Type":"application/json"},method:"PATCH"}).then(async e=>{try{var t;let n=await e.json();e.status<400?(eJ.success(x("general:updatedLabelSuccessfully",{label:(0,d.s)(null==k||null==(t=k.labels)?void 0:t.singular,y)})),v(!1)):n.errors?n.errors.forEach(e=>eJ.error(e.message)):eJ.error(x("error:unknown"))}catch(e){eJ.error(x("error:unknown"))}})}catch(e){eJ.error(x("error:unknown"))}},[j,null==c?void 0:c.id,m.columns,m.groupBy,m.where,x,null==k||null==(t=k.labels)?void 0:t.singular,y,v,C]),B=c&&f;return(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("div",{className:gv,children:[(0,u.jsxs)("div",{className:"".concat(gv,"__menu"),children:[(0,u.jsx)(gf,{activePreset:c,openPresetListDrawer:L,resetPreset:F}),(0,u.jsx)(ol,{"aria-label":x("general:newLabel",{label:null==k||null==(n=k.labels)?void 0:n.singular}),className:"".concat(gv,"__create-new-preset"),icon:(0,u.jsx)(ti,{}),id:"create-new-preset",onClick:()=>{T()},size:"small"})]}),(0,u.jsxs)("div",{className:"".concat(gv,"__menu-items"),children:[B&&(0,u.jsx)(mp,{id:"reset-preset",onClick:async()=>{await g({columns:(0,_.F)(c.columns),groupBy:c.groupBy||"",where:c.where},!1)},type:"button",children:x("general:reset")},"reset"),B&&h.update&&(0,u.jsx)(mp,{id:"save-preset",onClick:async()=>{await I()},type:"button",children:(null==c?void 0:c.isShared)?x("general:updateForEveryone"):x("fields:saveChanges")},"save"),c&&(null==h?void 0:h.delete)&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(mp,{id:"delete-preset",onClick:()=>w(gm),type:"button",children:x("general:deleteLabel",{label:null==k||null==(l=k.labels)?void 0:l.singular})}),(0,u.jsx)(mp,{id:"edit-preset",onClick:()=>{E()},type:"button",children:x("general:editLabel",{label:null==k||null==(a=k.labels)?void 0:a.singular})})]})]})]}),(0,u.jsx)(P,{initialData:{columns:(0,_.l)(m.columns),groupBy:m.groupBy,relatedCollection:p,where:m.where},onSave:async e=>{let{doc:t}=e;D(),await O(t)},redirectAfterCreate:!1}),(0,u.jsx)(lf,{body:(0,u.jsx)(pc,{elements:{1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:"general:aboutToDelete",t:x,variables:{label:null==k||null==(r=k.labels)?void 0:r.singular,title:null==c?void 0:c.title}}),confirmingLabel:x("general:deleting"),heading:x("general:confirmDeletion"),modalSlug:gm,onConfirm:M}),(0,u.jsx)(N,{onDelete:()=>{},onDuplicate:async e=>{let{doc:t}=e;await O(t)},onSave:async e=>{let{doc:t}=e;await O(t)}}),(0,u.jsx)(R,{allowCreate:!1,disableQueryPresets:!0,onSelect:async e=>{let{doc:t}=e;A(),await O(t)}})]})},gy="search-filter";function gx(e){let{handleChange:t,initialParams:n,label:l,searchQueryParam:a}=e,r=(null==n?void 0:n.search)||a,[i,s]=(0,o.useState)("string"==typeof r?r:void 0),c=(0,o.useRef)(!0),d=(0,o.useRef)("string"==typeof r?r:void 0),p=cF(i,300);return(0,o.useEffect)(()=>(r!==d.current&&(c.current=!1,s(r),d.current=r),()=>{c.current=!0,d.current=void 0}),[r]),(0,o.useEffect)(()=>{p!==d.current&&c.current&&(t&&t(p),d.current=p)},[p,t]),(0,u.jsx)("div",{className:gy,children:(0,u.jsx)("input",{"aria-label":l,className:"".concat(gy,"__input"),id:"search-filter-input",onChange:e=>{c.current=!0,s(e.target.value)},placeholder:l,type:"text",value:i||""})})}var gw="search-bar";function gj(e){let{Actions:t,className:n,label:l="Search...",onSearchChange:a,searchQueryParam:o}=e;
1return(0,u.jsxs)("div",{className:[gw,n].filter(Boolean).join(" "),children:[(0,u.jsx)(of,{}),(0,u.jsx)(gx,{handleChange:a,label:l,searchQueryParam:o}),t&&t.length>0?(0,u.jsx)("div",{className:"".concat(gw,"__actions"),children:t}):null]})}var gC=e=>{let{disabled:t,field:n,onChange:l,value:a}=e,{admin:o}=n,{date:r}=o||{},{i18n:i,t:c}=(0,s.d)();return(0,u.jsx)("div",{className:"condition-value-date",children:(0,u.jsx)(oF,{...r,onChange:l,placeholder:(0,d.s)(o.placeholder,i)||c("general:enterAValue"),readOnly:t,value:a})})},gS=e=>{let t,n=(0,f.c)(20),{disabled:l,field:a,onChange:r,operator:i,value:c}=e,{admin:p,hasMany:h}=a,{i18n:m,t:g}=(0,s.d)(),v;n[0]!==h||n[1]!==i?(v=["in","not_in"].includes(i)||h,n[0]=h,n[1]=i,n[2]=v):v=n[2];let b=v,y;n[3]===Symbol.for("react.memo_cache_sentinel")?(y=[],n[3]=y):y=n[3];let[x,w]=o.useState(y),j;n[4]!==b||n[5]!==r?(j=e=>{var t;let n;e?b&&(n=Array.isArray(e)?e.map(gk):[Number((null==(t=e.value)?void 0:t.value)||e.value)]):n=[],r(n)},n[4]=b,n[5]=r,n[6]=j):j=n[6];let C=j,S,k;if(n[7]!==c?(S=()=>{Array.isArray(c)?w(c.map(g_)):w([])},k=[c],n[7]=c,n[8]=S,n[9]=k):(S=n[8],k=n[9]),o.useEffect(S,k),n[10]!==(null==p?void 0:p.placeholder)||n[11]!==l||n[12]!==m||n[13]!==b||n[14]!==r||n[15]!==C||n[16]!==g||n[17]!==c||n[18]!==x){let e=(0,d.s)(null==p?void 0:p.placeholder,m)||g("general:enterAValue");t=b?(0,u.jsx)(sW,{disabled:l,isClearable:!0,isCreatable:!0,isMulti:b,isSortable:!0,numberOnly:!0,onChange:C,options:[],placeholder:e,value:x||[]}):(0,u.jsx)("input",{className:"condition-value-number",disabled:l,onChange:e=>r(e.target.value),placeholder:e,type:"number",value:c}),n[10]=null==p?void 0:p.placeholder,n[11]=l,n[12]=m,n[13]=b,n[14]=r,n[15]=C,n[16]=g,n[17]=c,n[18]=x,n[19]=t}else t=n[19];return t};function gk(e){var t;return Number((null==(t=e.value)?void 0:t.value)||e.value)}function g_(e,t){return{id:"".concat(e).concat(t),label:"".concat(e),value:{toString:()=>"".concat(e).concat(t),value:(null==e?void 0:e.value)||e}}}var gN=e=>e.reduce((e,t)=>t.options?[...e,...gN(t.options)]:[...e,t.id],[]),gE=(e,t)=>{switch(t.type){case"ADD":{let{collection:n,data:l,hasMultipleRelations:a,i18n:o,relation:r}=t,i=n.admin.useAsTitle||"id",s=gN(e);if(!a)return[...e,...l.docs.reduce((e,t)=>-1===s.indexOf(t.id)?(s.push(t.id),[...e,{label:t[i],value:t.id}]):e,[])];let c=[...e],u=c.find(e=>e.label===(0,d.s)(n.labels.plural,o)),p=l.docs.reduce((e,t)=>-1===s.indexOf(t.id)?(s.push(t.id),[...e,{label:t[i],relationTo:r,value:t.id}]):e,[]);return u?u.options=[...u.options,...p]:c.push({label:(0,d.s)(n.labels.plural,o),options:p,value:void 0}),c}case"CLEAR":return t.required?[]:[{label:t.i18n.t("general:none"),value:"null"}];default:return e}},gP="condition-value-relationship",gD=e=>{let{disabled:t,field:{admin:n={},hasMany:l,relationTo:a},filterOptions:r,onChange:c,value:d}=e,p="placeholder"in n?null==n?void 0:n.placeholder:void 0,h=null==n?void 0:n.isSortable,{config:{routes:{api:f},serverURL:m},getEntityConfig:g}=(0,i.c)(),v=Array.isArray(a),[b,x]=(0,o.useReducer)(gE,[]),[w,j]=(0,o.useState)(""),C=cF(w,300),[S,k]=(0,o.useState)(""),[_,N]=(0,o.useState)(!1),{i18n:E,t:P}=(0,s.d)(),D=lN(),T=v?a:[a],R=o.useRef(new Map(T.map(e=>[e,{hasLoadedAll:!1,nextPage:1}]))),A=(0,o.useCallback)((e,t)=>{x({type:"ADD",collection:g({collectionSlug:t}),data:e,hasMultipleRelations:v,i18n:E,relation:t})},[v,E,g]),L=lv(async e=>{let{abortController:t,relationSlug:n}=e,l=R.current.get(n);if(n&&!l.hasLoadedAll){var a,o;let e=(null==(o=g({collectionSlug:n}))||null==(a=o.admin)?void 0:a.useAsTitle)||"id",i={depth:0,limit:10,locale:D.code,page:l.nextPage,select:{[e]:!0},where:{and:[]}};r&&(null==r?void 0:r[n])&&i.where.and.push(r[n]),C&&i.where.and.push({[e]:{like:C}});try{let e=await fetch("".concat(m).concat(f,"/").concat(n).concat(y.A(i,{addQueryPrefix:!0})),{credentials:"include",headers:{"Accept-Language":E.language},signal:t.signal});if(e.ok){let t=await e.json();t.docs.length>0&&(A(t,n),t.nextPage?R.current.set(n,{hasLoadedAll:!1,nextPage:t.nextPage}):R.current.set(n,{hasLoadedAll:!0,nextPage:null}))}else k(P("error:unspecific"))}catch(e){t.signal.aborted||console.error(e)}}N(!0)}),O=o.useCallback(()=>{let e=R.current.entries().next().value;e[0]&&!e[1].hasLoadedAll&&L({abortController:new AbortController,relationSlug:e[0]})},[]),F=(0,o.useCallback)(()=>
1{if(d){if(l)return Array.isArray(d)?d.map(e=>{if(v){let t;return b.forEach(n=>{n.options&&n.options.some(n=>(null==n?void 0:n.value)==e.value&&(t=n,!0))}),t}return b.find(t=>t.value==e)}):void 0;if(v){let e;return b.forEach(t=>{(null==t?void 0:t.options)&&t.options.some(t=>(null==t?void 0:t.value)==d.value&&(e=t,!0))}),e}return b.find(e=>e.value==d)}},[l,v,d,b]),M=(0,o.useCallback)(e=>{e!==w&&(x({type:"CLEAR",i18n:E,required:!1}),R.current=new Map((Array.isArray(a)?a:[a]).map(e=>[e,{hasLoadedAll:!1,nextPage:1}])),j(e))},[E,a,w]),I=(0,o.useCallback)(async(e,t)=>{if(!S&&"null"!==e&&e&&t){let n=await fetch("".concat(m).concat(f,"/").concat(t,"/").concat(e,"?depth=0"),{credentials:"include",headers:{"Accept-Language":E.language}});n.ok?A({docs:[await n.json()]},t):console.error(P("error:loadingDocument",{id:e}))}},[E,A,f,S,m,P]);(0,o.useEffect)(()=>{let e=Array.isArray(a)?a:[a];R.current=new Map(e.map(e=>[e,{hasLoadedAll:!1,nextPage:1}])),x({type:"CLEAR",i18n:E,required:!1}),N(!1);let t=[];return e.forEach(e=>{let n=new AbortController;L({abortController:n,relationSlug:e}),t.push(n)}),()=>{t.forEach(e=>{if(e.signal)try{e.abort()}catch(e){}})}},[E,a,C,r]),(0,o.useEffect)(()=>{d&&_&&(l?(F()||[]).forEach((e,t)=>{e||(v?I(d[t].value,d[t].relationTo):I(d[t],a))}):F()||(v?I(d.value,d.relationTo):I(d,a)))},[I,F,l,v,a,d,_]);let B=["field-type",gP,S&&"error-loading"].filter(Boolean).join(" "),U=F()||d;return(0,u.jsx)("div",{className:B,children:S?(0,u.jsx)("div",{className:"".concat(gP,"__error-loading"),children:S}):(0,u.jsx)(sW,{disabled:t,isMulti:l,isSortable:h,onChange:e=>{if(!e)return void c(null);l&&Array.isArray(e)?c(e?e.map(e=>v?{relationTo:null==e?void 0:e.relationTo,value:null==e?void 0:e.value}:null==e?void 0:e.value):null):v&&!Array.isArray(e)?c({relationTo:null==e?void 0:e.relationTo,value:null==e?void 0:e.value}):Array.isArray(e)||c(null==e?void 0:e.value)},onInputChange:M,onMenuScrollToBottom:O,options:b,placeholder:p,value:U})})},gT=e=>{let t,n,l,a,r=(0,f.c)(21),{disabled:i,field:c,isClearable:p,onChange:h,operator:m,options:g,value:v}=e,{admin:b}=c,{placeholder:y}=b,{i18n:x}=(0,s.d)(),w;r[0]!==g?(w=sK(g),r[0]=g,r[1]=w):w=r[1];let[j,C]=o.useState(w),S;r[2]===Symbol.for("react.memo_cache_sentinel")?(S=["in","not_in"],r[2]=S):S=r[2];let k=S.includes(m),_;if(k&&Array.isArray(v)){let e;r[3]!==x||r[4]!==j?(e=e=>{var t;let n=j.find(t=>t.value===e);return{label:n?(0,d.s)(n.label,x):e,value:null!=(t=null==n?void 0:n.value)?t:e}},r[3]=x,r[4]=j,r[5]=e):e=r[5],_=v.map(e)}else if(v){var N;let e;r[6]!==v?(e=e=>e.value===v,r[6]=v,r[7]=e):e=r[7];let t=j.find(e);_={label:t?(0,d.s)(t.label,x):v,value:null!=(N=null==t?void 0:t.value)?N:v}}r[8]!==k||r[9]!==h?(t=e=>{h(e?k?Array.isArray(e)?e.map(gR):[]:e.value:null)},r[8]=k,r[9]=h,r[10]=t):t=r[10];let E=t,P,D;return r[11]!==g?(P=()=>{C(sK(g))},D=[g],r[11]=g,r[12]=P,r[13]=D):(P=r[12],D=r[13]),o.useEffect(P,D),r[14]!==k||r[15]!==h||r[16]!==v?(n=()=>{!k&&Array.isArray(v)&&h(v[0])},l=[k,h,v],r[14]=k,r[15]=h,r[16]=v,r[17]=n,r[18]=l):(n=r[17],l=r[18]),o.useEffect(n,l),r[19]!==x?(a=e=>({...e,label:(0,d.s)(e.label,x)}),r[19]=x,r[20]=a):a=r[20],(0,u.jsx)(sW,{disabled:i,isClearable:p,isMulti:k,onChange:E,options:j.map(a),placeholder:y,value:_})};function gR(e){return e.value}var gA=e=>{let t,n=(0,f.c)(18),{disabled:l,field:a,onChange:r,operator:i,value:c}=e,{hasMany:d}=a,{t:p}=(0,s.d)(),h;n[0]!==d||n[1]!==i?(h=["in","not_in"].includes(i)||d,n[0]=d,n[1]=i,n[2]=h):h=n[2];let m=h,g;n[3]===Symbol.for("react.memo_cache_sentinel")?(g=[],n[3]=g):g=n[3];let[v,b]=o.useState(g),y;n[4]!==m||n[5]!==r?(y=e=>{var t;let n;e?m&&(n=Array.isArray(e)?e.map(gL):[(null==(t=e.value)?void 0:t.value)||e.value]):n=[],r(n)},n[4]=m,n[5]=r,n[6]=y):y=n[6];let x=y,w,j;return n[7]!==c?(w=()=>{Array.isArray(c)?b(c.map(gO)):b([])},j=[c],n[7]=c,n[8]=w,n[9]=j):(w=n[8],j=n[9]),o.useEffect(w,j),n[10]!==l||n[11]!==m||n[12]!==r||n[13]!==x||n[14]!==p||n[15]!==c||n[16]!==v?(t=m?(0,u.jsx)(sW,{disabled:l,isClearable:!0,isCreatable:!0,isMulti:m,isSortable:!0,onChange:x,options:[],placeholder:p("general:enterAValue"),value:v||[]}):(0,u.jsx)("input",{className:"condition-value-text",disabled:l,onChange:e=>r(e.target.value),placeholder:p("general:enterAValue"),type:"text",value:c||""}),n[10]=l,n[11]=m,n[12]=r,n[13]=x,n[14]=p,n[15]=c,n[16]=v,n[17]=t):t=n[17],t};function gL(e){var t;return(null==(t=e.value)?void 0:t.value)||e.value}function gO(e,t){return{id:"".concat(e).concat(t),label:"".concat(e),value:{toString:()=>"".concat(e).concat(t),value:(null==e?void 0:e.value)||e}}}var gF=e=>{var t,n;let{booleanSelect:l,disabled:a,filterOptions:o,internalField:r,onChange:i,operator:s,options:c,value:d}=e;if(l||["radio","select"].includes(null==r||null==(t=r.field)?void 0:t.type))return(0,u.jsx)(gT,{disabled:a,field:r.field,isClearable:!l,onChange:i,operator:s,options:c,value:d});switch(null==r||null==(n=r.field)?void 0:n.type){case"date":return(0,u.jsx)(gC,{disabled:a,field:r.field,onChange:i,operator:s,value:d});case"number":return(0,u.jsx)(gS,{disabled:a,field:r.field,onChange:i,operator:s,value:d});case"relationship":case"upload":return(0,u.jsx)(gD,{disabled:a,field:r.field,filterOptions:o,onChange:i,operator:s,value:d});default:return(0,u.jsx)(gA,{disabled:a,field:null==r?void 0:r.field,onChange:i,operator:s,value:d})}},gM="condition",gI=e=>{var t,n,l,a,r;let{addCondition:i,andIndex:c,fieldPath:d,filterOptions:p,operator:h,orIndex:f,reducedFields:m,removeCondition:g,RenderedFilter:v,updateCondition:b,value:y}=e,{t:x}=(0,s.d)(),w=m.find(e=>e.value===d),[j,C]=(0,o.useState)(y),S=cF(j,300),k=["exists"].includes(h)||(null==w||null==(t=w.field)?void 0:t.type)==="checkbox",_=[];
1k?_=[{label:x("general:true"),value:"true"},{label:x("general:false"),value:"false"}]:(null==w?void 0:w.field)&&"options"in w.field&&(_=w.field.options);let N=lv(async e=>{h&&await b({type:"value",andIndex:c,field:w,operator:h,orIndex:f,value:null===e||""===e?void 0:e})});(0,o.useEffect)(()=>{N(S)},[S]);let E=!(null==w?void 0:w.value)&&"number"!=typeof(null==w?void 0:w.value)||(null==w||null==(l=w.field)||null==(n=l.admin)?void 0:n.disableListFilter),P=(0,o.useCallback)(async e=>{C(void 0),await b({type:"field",andIndex:c,field:m.find(t=>t.value===e.value),operator:h,orIndex:f,value:void 0})},[c,h,f,m,b]),D=(0,o.useCallback)(async e=>{let t=(e=>({all:"any",contains:"string",equals:"any",exists:"boolean",greater_than:"date"===e?"object":"string",greater_than_equal:"date"===e?"object":"string",in:"any",intersects:"any",less_than:"date"===e?"object":"string",less_than_equal:"date"===e?"object":"string",like:"string",near:"any",not_equals:"any",not_in:"any",not_like:"string",within:"any"}))(w.field.type)[e.value]||"any",n="any"===t||typeof y===t||"boolean"===t&&("true"===y||"false"===y);n||C(void 0),await b({type:"operator",andIndex:c,field:w,operator:e.value,orIndex:f,value:n?y:void 0})},[c,w,f,b,y]);return(0,u.jsx)("div",{className:gM,children:(0,u.jsxs)("div",{className:"".concat(gM,"__wrap"),children:[(0,u.jsxs)("div",{className:"".concat(gM,"__inputs"),children:[(0,u.jsx)("div",{className:"".concat(gM,"__field"),children:(0,u.jsx)(sW,{disabled:E,filterOption:(e,t)=>{var n;return((null==e||null==(n=e.data)?void 0:n.plainTextLabel)||e.label).toLowerCase().includes(t.toLowerCase())},isClearable:!1,onChange:P,options:m.filter(e=>!e.field.admin.disableListFilter),value:w||{value:null==w?void 0:w.value}})}),(0,u.jsx)("div",{className:"".concat(gM,"__operator"),children:(0,u.jsx)(sW,{disabled:E,isClearable:!1,onChange:D,options:null==w?void 0:w.operators,value:(null==w?void 0:w.operators.find(e=>h===e.value))||null})}),(0,u.jsx)("div",{className:"".concat(gM,"__value"),children:v||(0,u.jsx)(gF,{booleanSelect:k,disabled:!h||!w||(null==w||null==(r=w.field)||null==(a=r.admin)?void 0:a.disableListFilter),filterOptions:p,internalField:w,onChange:C,operator:h,options:_,value:null!=j?j:""})})]}),(0,u.jsxs)("div",{className:"".concat(gM,"__actions"),children:[(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(gM,"__actions-remove"),icon:"x",iconStyle:"with-border",onClick:()=>g({andIndex:c,orIndex:f}),round:!0}),(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(gM,"__actions-add"),icon:"plus",iconStyle:"with-border",onClick:()=>i({andIndex:c+1,field:m.find(e=>{var t;return!(null==(t=e.field.admin)?void 0:t.disableListFilter)}),orIndex:f,relation:"and"}),round:!0})]})]})})},gB="where-builder",gU=e=>{var t,n;let{collectionPluralLabel:l,collectionSlug:a,fields:r,renderedFilters:i,resolvedFilterOptions:c}=e,{i18n:p,t:h}=(0,s.d)(),{permissions:f}=lw(),m=null==f||null==(n=f.collections)||null==(t=n[a])?void 0:t.fields,g=(0,o.useMemo)(()=>fg({fieldPermissions:m,fields:r,i18n:p}),[m,r,p]),{handleWhereChange:v,query:b}=cn(),y=(0,o.useMemo)(()=>{let e=b.where;if(e){if((0,X.Q)(e))return e.or;let t=(0,$.a)(e);if((0,X.Q)(t))return t.or;console.warn("Invalid where query in URL: ".concat(JSON.stringify(e)))}return[]},[b.where]),x=o.useCallback(async e=>{let{andIndex:t,field:n,orIndex:l,relation:a}=e,o=[...y],r=ff[n.field.type].operators[0].value;"and"===a?o[l].and.splice(t,0,{[String(n.value)]:{[r]:void 0}}):o.push({and:[{[String(n.value)]:{[r]:void 0}}]}),await v({or:o})},[y,v]),w=o.useCallback(async e=>{let{andIndex:t,field:n,operator:l,orIndex:a,value:o}=e;if("object"==typeof y[a].and[t]&&n.value){let{validOperator:e}=fm({field:n.field,operator:l}),r={[String(n.value)]:{[e]:o}},i=[...y];i[a].and[t]=r,await v({or:i})}},[y,v]),j=o.useCallback(async e=>{let{andIndex:t,orIndex:n}=e,l=[...y];l[n].and.splice(t,1),0===l[n].and.length&&l.splice(n,1),await v({or:l})},[y,v]);return(0,u.jsxs)("div",{className:gB,children:[y.length>0&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("p",{className:"".concat(gB,"__label"),children:h("general:filterWhere",{label:(0,d.s)(l,p)})}),(0,u.jsx)("ul",{className:"".concat(gB,"__or-filters"),children:y.map((e,t)=>{let n="".concat(t,"_").concat(Array.isArray(null==e?void 0:e.and)?e.and.length:"");return(0,u.jsxs)("li",{children:[0!==t&&(0,u.jsx)("div",{className:"".concat(gB,"__label"),children:h("general:or")}),(0,u.jsx)("ul",{className:"".concat(gB,"__and-filters"),children:Array.isArray(null==e?void 0:e.and)&&e.and.map((e,n)=>{var l,a;let o=y[t].and[n],r=Object.keys(o)[0],s=(null==(l=Object.keys((null==o?void 0:o[r])||{}))?void 0:l[0])||void 0,d=(null==o||null==(a=o[r])?void 0:a[s])||void 0;return(0,u.jsxs)("li",{children:[0!==n&&(0,u.jsx)("div",{className:"".concat(gB,"__label"),children:h("general:and")}),(0,u.jsx)(gI,{addCondition:x,andIndex:n,fieldPath:r,filterOptions:null==c?void 0:c.get(r),operator:s,orIndex:t,reducedFields:g,removeCondition:j,RenderedFilter:null==i?void 0:i.get(r),updateCondition:w,value:d})]},n)})})]},n)})}),(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(gB,"__add-or"),icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:async()=>{await x({andIndex:0,field:g.find(e=>{var t;return!(null==(t=e.field.admin)?void 0:t.disableListFilter)}),orIndex:y.length,relation:"or"})},children:h("general:or")})]}),0===y.length&&(0,u.jsxs)("div",{className:"".concat(gB,"__no-filters"),children:[(0,u.jsx)("div",{className:"".concat(gB,"__label"),children:h("general:noFiltersSet")}),(0,u.jsx)(tD,{buttonStyle:"icon-label",className:"".concat(gB,"__add-first-filter"),icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:async()=>{g.length>0&&await x({andIndex:0,field:g.find(e=>{var t;return!(null==(t=e.field.admin)?void 0:t.disableListFilter)}),orIndex:y.length,relation:"or"})},children:h("general:addFilter")})]})]})}
1,gz="list-controls",gV=e=>{var t,n;let{beforeActions:l,collectionConfig:a,collectionSlug:r,disableQueryPresets:i,enableColumns:c=!0,enableFilters:p=!0,enableSort:h=!1,listMenuItems:f,queryPreset:g,queryPresetPermissions:v,renderedFilters:b,resolvedFilterOptions:y}=e,{handleSearchChange:x,query:w}=cn(),j=h0(a),{i18n:C,t:k}=(0,s.d)(),{breakpoints:{s:_}}=tv(),N=null!=(n=j&&(0,d.s)("label"in j&&("string"==typeof j.label||"object"==typeof j.label)?j.label:"name"in j?j.name:null,C))?n:"ID",E=((e,t,n)=>{if(e){let l=(0,S.L)(t,{i18n:n,moveSubFieldsToTop:!0}),a=new Set(e),o=[];for(let e of l)(0,m.Z7)(e)&&a.has(e.name)&&(o.push(e),a.delete(e.name));return o}return null})(a.admin.listSearchableFields,a.fields,C),P=(0,o.useRef)(k("general:searchBy",{label:(0,d.s)(N,C)})),D=(0,o.useRef)(!!(null==w?void 0:w.where)),T=(0,X.Q)(null==w?void 0:w.where),[R,A]=(0,o.useState)(T?"where":void 0);return(0,o.useEffect)(()=>{!D.current||(null==w?void 0:w.where)?(null==w?void 0:w.where)&&(D.current=!0):D.current=!1},[A,null==w?void 0:w.where]),(0,o.useEffect)(()=>{(null==E?void 0:E.length)>0?P.current=E.reduce((e,t,n)=>{let l="label"in t&&t.label?t.label:"name"in t?t.name:null;return 0===n?"".concat(k("general:searchBy",{label:(0,d.s)(l,C)})):n===E.length-1?"".concat(e," ").concat(k("general:or")," ").concat((0,d.s)(l,C)):"".concat(e,", ").concat((0,d.s)(l,C))},""):P.current=k("general:searchBy",{label:(0,d.s)(N,C)})},[k,E,C,N]),(0,u.jsxs)("div",{className:gz,children:[(null==a?void 0:a.enableQueryPresets)&&!i&&(0,u.jsx)(gb,{activePreset:g,collectionSlug:r,queryPresetPermissions:v}),(0,u.jsx)(gj,{Actions:[!_&&(0,u.jsx)(o.Fragment,{children:l&&l},"before-actions"),c&&(0,u.jsx)(ol,{"aria-controls":"".concat(gz,"-columns"),"aria-expanded":"columns"===R,className:"".concat(gz,"__toggle-columns"),icon:(0,u.jsx)(ta,{direction:"columns"===R?"up":"down"}),id:"toggle-list-columns",onClick:()=>A("columns"!==R?"columns":void 0),pillStyle:"light",size:"small",children:k("general:columns")},"toggle-list-columns"),p&&(0,u.jsx)(ol,{"aria-controls":"".concat(gz,"-where"),"aria-expanded":"where"===R,className:"".concat(gz,"__toggle-where"),icon:(0,u.jsx)(ta,{direction:"where"===R?"up":"down"}),id:"toggle-list-filters",onClick:()=>A("where"!==R?"where":void 0),pillStyle:"light",size:"small",children:k("general:filters")},"toggle-list-filters"),h&&(0,u.jsx)(ol,{"aria-controls":"".concat(gz,"-sort"),"aria-expanded":"sort"===R,className:"".concat(gz,"__toggle-sort"),icon:(0,u.jsx)(ta,{}),id:"toggle-list-sort",onClick:()=>A("sort"!==R?"sort":void 0),pillStyle:"light",size:"small",children:k("general:sort")},"toggle-list-sort"),a.admin.groupBy&&(0,u.jsx)(ol,{"aria-controls":"".concat(gz,"-group-by"),"aria-expanded":"group-by"===R,className:"".concat(gz,"__toggle-group-by"),icon:(0,u.jsx)(ta,{direction:"group-by"===R?"up":"down"}),id:"toggle-group-by",onClick:()=>A("group-by"!==R?"group-by":void 0),pillStyle:"light",size:"small",children:k("general:groupByLabel",{label:""})},"toggle-group-by"),f&&Array.isArray(f)&&f.length>0&&(0,u.jsx)(t_,{button:(0,u.jsx)(gs,{ariaLabel:k("general:moreOptions")}),className:"".concat(gz,"__popup"),horizontalAlign:"right",id:"list-menu",size:"small",verticalAlign:"bottom",children:f.map((e,t)=>(0,u.jsx)(o.Fragment,{children:e},"list-menu-item-".concat(t)))},"list-menu")].filter(Boolean),label:P.current,onSearchChange:x,searchQueryParam:null==w?void 0:w.search},r),c&&(0,u.jsx)(a2,{className:"".concat(gz,"__columns"),height:"columns"===R?"auto":0,id:"".concat(gz,"-columns"),children:(0,u.jsx)(cf,{collectionSlug:a.slug})}),(0,u.jsx)(a2,{className:"".concat(gz,"__where"),height:"where"===R?"auto":0,id:"".concat(gz,"-where"),children:(0,u.jsx)(gU,{collectionPluralLabel:null==a||null==(t=a.labels)?void 0:t.plural,collectionSlug:a.slug,fields:null==a?void 0:a.fields,renderedFilters:b,resolvedFilterOptions:y})}),a.admin.groupBy&&(0,u.jsx)(a2,{className:"".concat(gz,"__group-by"),height:"group-by"===R?"auto":0,id:"".concat(gz,"-group-by"),children:(0,u.jsx)(gd,{collectionSlug:a.slug,fields:a.fields})})]})};function gH(e){let{collection:t,collection:{slug:n,labels:{plural:l,singular:a}}={},drawerSlug:r,ids:c,onSuccess:p,selectAll:f,where:m}=e,{clearRouteCache:g}=d7(),{config:{routes:{api:v},serverURL:b}}
1=(0,i.c)(),{code:x}=lN(),w=(0,h.useRouter)(),j=(0,h.useSearchParams)(),{i18n:C,t:S}=(0,s.d)(),_=(0,o.useCallback)(()=>{eJ.error(S("error:unknown"))},[S]),N=o.useMemo(()=>{var e;let n=[{_status:{not_equals:"published"}}];m&&n.push(m);let l=(0,k.d)({collectionConfig:t,search:j.get("search")});return l&&n.push(l),f?n.push((null==(e=ce(j))?void 0:e.where)||{id:{not_equals:""}}):n.push({id:{in:c||[]}}),y.A({locale:x,select:{},where:(0,Q.h)(n)},{addQueryPrefix:!0})},[t,j,f,c,x,m]),E=(0,o.useCallback)(async()=>{await lb.patch("".concat(b).concat(v,"/").concat(n).concat(N,"&draft=true"),{body:JSON.stringify({_status:"published"}),headers:{"Accept-Language":C.language,"Content-Type":"application/json"}}).then(async e=>{try{let t=await e.json(),n=(null==t?void 0:t.docs.length)||0,o=n>1?l:a;return e.status<400||n>0?(eJ.success(S("general:updatedCountSuccessfully",{count:n,label:(0,d.s)(o,C)})),(null==t?void 0:t.errors.length)>0&&eJ.error(t.message,{description:t.errors.map(e=>e.message).join("\n")}),w.replace(y.A({...ce(j),page:f?"1":void 0},{addQueryPrefix:!0})),g(),"function"==typeof p&&p(),null):(t.errors?t.errors.forEach(e=>eJ.error(e.message)):_(),!1)}catch(e){return _()}})},[b,v,n,N,C,l,a,S,w,j,f,g,_,p]);return(0,u.jsx)(lf,{body:S("version:aboutToPublishSelection",{label:(0,d.s)(l,C)}),cancelLabel:S("general:cancel"),confirmingLabel:S("version:publishing"),confirmLabel:S("general:confirm"),heading:S("version:confirmPublish"),modalSlug:r,onConfirm:E})}var gq=e=>{let t=(0,f.c)(8),{count:n,selectAll:l,selectedIDs:a,toggleAll:o}=mc(),r;t[0]!==o?(r=()=>o(),t[0]=o,t[1]=r):r=t[1];let i=l===mo.AllAvailable,s;return t[2]!==n||t[3]!==e||t[4]!==a||t[5]!==r||t[6]!==i?(s=(0,u.jsx)(gW,{...e,count:n,ids:a,onSuccess:r,selectAll:i}),t[2]=n,t[3]=e,t[4]=a,t[5]=r,t[6]=i,t[7]=s):s=t[7],s},gW=e=>{var t,n;let l,a=(0,f.c)(12),{collection:r,collection:i,count:c,ids:d,modalPrefix:p,onSuccess:h,selectAll:m,where:g}=e,{slug:v,versions:b}=void 0===i?{}:i,{permissions:y}=lw(),{t:x}=(0,s.d)(),{openModal:w}=nE(),j=null==y||null==(n=y.collections)||null==(t=n[v])?void 0:t.update,C="".concat(p?"".concat(p,"-"):"","publish-").concat(v);if(!(null==b?void 0:b.drafts)||0===c||!j)return null;if(a[0]!==r||a[1]!==C||a[2]!==d||a[3]!==h||a[4]!==w||a[5]!==m||a[6]!==x||a[7]!==g){let e;a[9]!==C||a[10]!==w?(e=()=>{w(C)},a[9]=C,a[10]=w,a[11]=e):e=a[11],l=(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(mp,{"aria-label":x("version:publish"),onClick:e,children:x("version:publish")}),(0,u.jsx)(gH,{collection:r,drawerSlug:C,ids:d,onSuccess:h,selectAll:m,where:g})]}),a[0]=r,a[1]=C,a[2]=d,a[3]=h,a[4]=w,a[5]=m,a[6]=x,a[7]=g,a[8]=l}else l=a[8];return l},gK="confirm-restore-many-docs",gY="restore-many",gG=e=>{var t,n,l,a,r;let{collection:{slug:c}={},viewType:p}=e,{permissions:f}=lw(),{config:{collections:m,routes:g,serverURL:v}}=(0,i.c)(),{code:b}=lN(),x=(0,h.useRouter)(),{clearRouteCache:w}=d7(),j=(0,h.useSearchParams)(),{count:C,getSelectedIds:S,selectAll:_,toggleAll:N}=mc(),{openModal:E}=nE(),{i18n:P,t:D}=(0,s.d)(),[T,R]=o.useState(!1),A=null==f||null==(n=f.collections)||null==(t=n[c])?void 0:t.update;if(_===mo.None||!A||"trash"!==p)return null;let L=_===mo.AllAvailable,O=L?[]:S(),F=null==(l=ce(j))?void 0:l.where,M={and:[...Array.isArray(null==F?void 0:F.and)?F.and:F?[F]:[],{deletedAt:{exists:!0}}]},I=async()=>{var e,t,n,l;let a,o=m.find(e=>e.slug===c);if(!o)return;a=L?M:{and:[{id:{in:O}},{deletedAt:{exists:!0}}]};let r="".concat(v).concat(g.api,"/").concat(c).concat(y.A({limit:0,locale:b,select:{},trash:!0,where:(0,k.d)({collectionConfig:o,search:null==(e=ce(j))?void 0:e.search,where:a})},{addQueryPrefix:!0})),i={deletedAt:null};(null==o||null==(t=o.versions)?void 0:t.drafts)&&(i._status=T?"published":"draft");let s=await lb.patch(r,{body:JSON.stringify(i),headers:{"Accept-Language":P.language,"Content-Type":"application/json"}});try{let{plural:e,singular:t}=o.labels,a=await s.json(),r=(null==a||null==(n=a.docs)?void 0:n.length)||0;(s.status<400||r>0)&&eJ.success(D("general:restoredCountSuccessfully",{count:r,label:(0,d.s)(r>1?e:t,P)})),(null==a||null==(l=a.errors)?void 0:l.length)>0&&eJ.error(a.message,{description:a.errors.map(e=>e.message).join("\n")})}catch(e){eJ.error(D("error:unknown"))}N(),x.replace(y.A({...ce(j),page:L?"1":void 0},{addQueryPrefix:!0})),w()}
1,B=m.find(e=>{let{slug:t}=e;return t===c}),U=(0,d.s)(1===C?B.labels.singular:B.labels.plural,P);return(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(mp,{"aria-label":D("general:restore"),className:"restore-documents__toggle",onClick:()=>{E(gK)},children:D("general:restore")}),(0,u.jsx)(lf,{body:(0,u.jsxs)(o.Fragment,{children:[D((null==B||null==(a=B.versions)?void 0:a.drafts)?"general:aboutToRestoreAsDraftCount":"general:aboutToRestoreCount",{count:C,label:U}),(null==B||null==(r=B.versions)?void 0:r.drafts)&&(0,u.jsx)("div",{className:"".concat(gY,"__checkbox"),children:(0,u.jsx)(aQ,{checked:T,id:"restore-as-published-many",label:D("general:restoreAsPublished"),name:"restore-as-published-many",onToggle:e=>R(e.target.checked)})})]}),className:gY,confirmingLabel:D("general:restoring"),heading:D("general:confirmRestoration"),modalSlug:gK,onConfirm:I})]})};function gQ(e){let{collection:t,collection:{slug:n,labels:{plural:l,singular:a}}={},drawerSlug:r,ids:c,onSuccess:p,selectAll:f,where:m}=e,{config:{routes:{api:g},serverURL:v}}=(0,i.c)(),{code:b}=lN(),{i18n:x,t:w}=(0,s.d)(),j=(0,h.useSearchParams)(),C=(0,h.useRouter)(),{clearRouteCache:S}=d7(),_=(0,o.useCallback)(()=>{eJ.error(w("error:unknown"))},[w]),N=o.useMemo(()=>{let e=[{_status:{not_equals:"draft"}}];m&&e.push(m);let n=(0,k.d)({collectionConfig:t,search:j.get("search")});return n&&e.push(n),f||e.push({id:{in:c||[]}}),y.A({locale:b,select:{},where:(0,Q.h)(e)},{addQueryPrefix:!0})},[t,j,f,c,b,m]),E=(0,o.useCallback)(async()=>{await lb.patch("".concat(v).concat(g,"/").concat(n).concat(N),{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":x.language,"Content-Type":"application/json"}}).then(async e=>{try{let t=await e.json(),n=(null==t?void 0:t.docs.length)||0,o=n>1?l:a;return e.status<400||n>0?(eJ.success(w("general:updatedCountSuccessfully",{count:n,label:(0,d.s)(o,x)})),(null==t?void 0:t.errors.length)>0&&eJ.error(t.message,{description:t.errors.map(e=>e.message).join("\n")}),C.replace(y.A({...ce(j),page:f?"1":void 0},{addQueryPrefix:!0})),S(),"function"==typeof p&&p(),null):(t.errors?t.errors.forEach(e=>eJ.error(e.message)):_(),!1)}catch(e){return _()}})},[v,g,n,N,x,l,a,w,C,j,f,S,_,p]);return(0,u.jsx)(lf,{body:w("version:aboutToUnpublishSelection",{label:(0,d.s)(l,x)}),confirmingLabel:w("version:unpublishing"),heading:w("version:confirmUnpublish"),modalSlug:r,onConfirm:E})}var gX=e=>{let t=(0,f.c)(8),{count:n,selectAll:l,selectedIDs:a,toggleAll:o}=mc(),r;t[0]!==o?(r=()=>o(),t[0]=o,t[1]=r):r=t[1];let i=l===mo.AllAvailable,s;return t[2]!==n||t[3]!==e||t[4]!==a||t[5]!==r||t[6]!==i?(s=(0,u.jsx)(g$,{...e,count:n,ids:a,onSuccess:r,selectAll:i}),t[2]=n,t[3]=e,t[4]=a,t[5]=r,t[6]=i,t[7]=s):s=t[7],s},g$=e=>{var t,n;let l,a=(0,f.c)(12),{collection:r,collection:i,count:c,ids:d,modalPrefix:p,onSuccess:h,selectAll:m,where:g}=e,{slug:v,versions:b}=void 0===i?{}:i,{t:y}=(0,s.d)(),{permissions:x}=lw(),{toggleModal:w}=nE(),j=null==x||null==(n=x.collections)||null==(t=n[v])?void 0:t.update,C="".concat(p?"".concat(p,"-"):"","unpublish-").concat(v);if(!(null==b?void 0:b.drafts)||0===c||!j)return null;if(a[0]!==r||a[1]!==C||a[2]!==d||a[3]!==h||a[4]!==m||a[5]!==y||a[6]!==w||a[7]!==g){let e;a[9]!==C||a[10]!==w?(e=()=>{w(C)},a[9]=C,a[10]=w,a[11]=e):e=a[11],l=(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(mp,{"aria-label":y("version:unpublish"),onClick:e,children:y("version:unpublish")}),(0,u.jsx)(gQ,{collection:r,drawerSlug:C,ids:d,onSuccess:h,selectAll:m,where:g})]}),a[0]=r,a[1]=C,a[2]=d,a[3]=h,a[4]=m,a[5]=y,a[6]=w,a[7]=g,a[8]=l}else l=a[8];return l},gZ=e=>{let t=(0,f.c)(19),{collectionConfig:n,disableBulkDelete:l,disableBulkEdit:a,label:r,modalPrefix:i,showSelectAllAcrossPages:c,viewT
1ype:d,where:p}=e,h=void 0===c||c,{count:m,selectAll:g,selectedIDs:v,toggleAll:b,totalDocs:y}=mc(),{t:x}=(0,s.d)(),w;t[0]!==b?(w=()=>b(),t[0]=b,t[1]=w):w=t[1];let j=w;if(0===m)return null;let C=(null==n?void 0:n.trash)&&"trash"===d,S;return t[2]!==n||t[3]!==m||t[4]!==l||t[5]!==a||t[6]!==C||t[7]!==r||t[8]!==i||t[9]!==j||t[10]!==g||t[11]!==v||t[12]!==h||t[13]!==x||t[14]!==b||t[15]!==y||t[16]!==d||t[17]!==p?(S=(0,u.jsx)(md,{count:m,ListActions:[g!==mo.AllAvailable&&m<y&&!1!==h?(0,u.jsx)(mp,{"aria-label":x("general:selectAll",{count:"(".concat(y,")"),label:r}),id:"select-all-across-pages",onClick:()=>b(!0),children:x("general:selectAll",{count:"(".concat(y,")"),label:""})},"select-all"):null].filter(Boolean),SelectionActions:[!a&&!C&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(gn,{collection:n,count:m,ids:v,modalPrefix:i,onSuccess:j,selectAll:g===mo.AllAvailable,where:p}),(0,u.jsx)(gW,{collection:n,count:m,ids:v,modalPrefix:i,onSuccess:j,selectAll:g===mo.AllAvailable,where:p}),(0,u.jsx)(g$,{collection:n,count:m,ids:v,modalPrefix:i,onSuccess:j,selectAll:g===mo.AllAvailable,where:p})]},"bulk-actions"),C&&(0,u.jsx)(gG,{collection:n,viewType:d},"bulk-restore"),!l&&(0,u.jsx)(mh,{collection:n,modalPrefix:i,viewType:d},"bulk-delete")].filter(Boolean)}),t[2]=n,t[3]=m,t[4]=l,t[5]=a,t[6]=C,t[7]=r,t[8]=i,t[9]=j,t[10]=g,t[11]=v,t[12]=h,t[13]=x,t[14]=b,t[15]=y,t[16]=d,t[17]=p,t[18]=S):S=t[18],S};function gJ(e){let{slug:t,className:n}=e,{closeModal:l}=nE(),{t:a}=(0,s.d)();return(0,u.jsx)("button",{"aria-label":a("general:close"),className:["close-modal-button",n].filter(Boolean).join(" "),onClick:()=>{l(t)},type:"button",children:(0,u.jsx)(s.a,{})},"close-button")}var g0="default-list-view-tabs",g1=e=>{var t,n,l,a;let o,r=(0,f.c)(20),{collectionConfig:i,config:c,onChange:p,viewType:m}=e,{i18n:g,t:b}=(0,s.d)(),{setPreference:y}=aS(),x=(0,h.useRouter)(),w=i.trash,j=i.folders&&c.folders;if(!w&&!j)return null;r[0]!==i.slug||r[1]!==c||r[2]!==p||r[3]!==x||r[4]!==y?(o=async e=>{p&&p(e),("list"===e||"folders"===e)&&await y("collection-".concat(i.slug),{listViewType:e});let t="/collections/".concat(i.slug);switch(e){case"folders":c.folders&&(t="/collections/".concat(i.slug,"/").concat(c.folders.slug));break;case"trash":t="/collections/".concat(i.slug,"/trash")}let n=(0,v.Q)({adminRoute:c.routes.admin,path:t,serverURL:c.serverURL});x.push(n)},r[0]=i.slug,r[1]=c,r[2]=p,r[3]=x,r[4]=y,r[5]=o):o=r[5];let C=o,S="".concat(b("general:all")," ").concat((0,d.s)(null==i||null==(t=i.labels)?void 0:t.plural,g)),k;if(r[6]!==S||r[7]!==(null==(n=i.labels)?void 0:n.plural)||r[8]!==C||r[9]!==g||r[10]!==j||r[11]!==w||r[12]!==b||r[13]!==m){let e,t;r[15]===Symbol.for("react.memo_cache_sentinel")?(e=/\s+/g,r[15]=e):e=r[15];let n=S.toLowerCase().replace(e,"-"),o="list"===m&&"".concat(g0,"__button--active"),s;r[16]!==o?(s=["".concat(g0,"__button"),o].filter(Boolean),r[16]=o,r[17]=s):s=r[17],r[18]!==C?(t=()=>C("list"),r[18]=C,r[19]=t):t=r[19],k=(0,u.jsxs)("div",{className:g0,children:[(0,u.jsxs)(tD,{buttonStyle:"tab",className:s.join(" "),disabled:"list"===m,el:"button",id:n,onClick:t,children:[b("general:all")," ",(0,d.s)(null==i||null==(l=i.labels)?void 0:l.plural,g)]}),j&&(0,u.jsx)(tD,{buttonStyle:"tab",className:["".concat(g0,"__button"),"folders"===m&&"".concat(g0,"__button--active")].filter(Boolean).join(" "),disabled:"folders"===m,el:"button",onClick:()=>C("folders"),children:b("folder:byFolder")}),w&&(0,u.jsx)(tD,{buttonStyle:"tab",className:["".concat(g0,"__button"),"trash"===m&&"".concat(g0,"__button--active")].filter(Boolean).join(" "),disabled:"trash"===m,el:"button",id:"trash-view-pill",onClick:()=>C("trash"),children:b("general:trash")})]}),r[6]=S,r[7]=null==(a=i.labels)?void 0:a.plural,r[8]=C,r[9]=g,r[10]=j,r[11]=w,r[12]=b,r[13]=m,r[14]=k}else k=r[14];return k},g3="list-header",g2=e=>(0,u.jsxs)("header",{className:[g3,e.className].filter(Boolean).join(" "),children:[(0,u.jsxs)("div",{className:"".concat(g3,"__content"),children:[(0,u.jsxs)("div",{className:"".concat(g3,"__title-and-actions"),children:[(0,u.jsx)("h1",{className:"".concat(g3,"__title"),children:e.title}),e.TitleActions.length?(0,u.jsx)("div",{className:"".concat(g3,"__title-actions"),children:e.TitleActions}):null]}),e.Actions.length?(0,u.jsx)("div",{className:"".concat(g3,"__actions"),children:e.Actions}):null]}),e.AfterListHeaderContent?(0,u.jsx)("div",{className:"".concat(g3,"__after-header-content"),children:e.AfterListHeaderContent}):null]}),g6=()=>{let e=(0,f.c)(12),{i18n:t,t:n}=(0,s.d)(),{config:l,getEntityConfig:a}=(0,i.c)(),{collections:o}=l,{enabledCollections:r,selectedOption:c,setSelectedOption:p}=s7(),h;if(e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==t||e[4]!==c||e[5]!==p||e[6]!==n){h=Symbol.for("react.early_return_sentinel");e:{let l;e[8]!==r?(l=e=>{let{slug:t}=e;return r.includes(t)},e[8]=r,e[9]=l):l=e[9];let i=o.filter(l);if(i.length>1){let l=a({collectionSlug:c.value}),o;e[10]!==t?(o=e=>({label:(0,d.s)(e.labels.singular,t),value:e.slug}),e[10]=t,e[11]=o):o=e[11],h=(0,u.jsxs)("div",{className:"".concat("list-drawer","__select-collection-wrap"),children:[(0,u.jsx)(lD,{label:n("upload:selectCollectionToBrowse")}),(0,u.jsx)(sW,{className:"".concat(g3,"__select-collection"),isClearable:!1,onChange:p,options:i.map(o),value:{label:(0,d.s)(null==l?void 0:l.labels.singular,t),value:null==l?void 0:l.slug}})]});break e}}e[0]=o,e[1]=r,e[2]=a,e[3]=t,e[4]=c,e[5]=p,e[6]=n,e[7]=h}else h=e[7];return h!==Symbol.for("react.early_return_sentinel")?h:null};function g5(e){let t,n=(0,f.c)(3),{hasCreatePermission:l}=e,{DocumentDrawerToggler:a}=s7(),{t:o}=(0,s.d)();return l?(n[0]!==a||n[1]!==o?(t=(0,u.jsx)(a,{className:"".concat("list-header","__create-new-button"),children:(0,u.jsx)(ol,{size:"small",children:o("general:createNew")})},"create-new-button-toggler"),n[0]=a,n[1]=o,n[2]=t):t=n[2],t):null}function g4(e){let t,n=(0,f.c)(12),{collectionSlug:l,hasCreatePermission:a,isBulkUploadEnabled:o,onBulkUploadSuccess:r,openBulkUpload:i}=e,{drawerSlug:c,setCollectionSlug:d,setOnSuccess:p}=hy(),{t:m}=(0,s.d)(),{openModal:g}=nE(),v=(0,h.useRouter)(),b;n[0]!==c||n[1]!==l||n[2]!==r||n[3]!==i||n[4]!==g||n[5]!==v||n[6]!==d||n[7]!==p?(b=()=>{"function"==typeof i?i():(d(l),g(c),p(()=>{"function"==typeof r?r():v.refresh()}))},n[0]=c,n[1]=l,n[2]=r,n[3]=i,n[4]=g,n[5]=v,n[6]=d,n[7]=p,n[8]=b):b=n[8];let y=b;return a&&o?(n[9]!==y||n[10]!==m?(t=(0,u.jsx)(tD,{"aria-label":m("upload:bulkUpload"),buttonStyle:"pill",onClick:y,size:"small",children:m("upload:bulkUpload")},"bulk-upload-button"),n[9]=y,n[10]=m,n[11]=t):t=n[11],t):null}function g8(e){var t;let n=(0,f.c)(5),{collectionConfig:l,hasCreatePermission:a,newDocumentURL:o}=e,{i18n:r,t:i}=(0,s.d)();if(!a)return null;
1let c=null==l||null==(t=l.labels)?void 0:t.singular,p;return n[0]!==r||n[1]!==o||n[2]!==i||n[3]!==c?(p=(0,u.jsx)(tD,{"aria-label":i("general:createNewLabel",{label:(0,d.s)(c,r)}),buttonStyle:"pill",className:"".concat("list-create-new-doc","__create-new-button"),el:"link",size:"small",to:o,children:i("general:createNew")},"create-new-button"),n[0]=r,n[1]=o,n[2]=i,n[3]=c,n[4]=p):p=n[4],p}var g9="confirm-empty-trash";function g7(e){var t,n,l;let{collectionConfig:a,hasDeletePermission:r}=e,{i18n:c,t:p}=(0,s.d)(),{code:f}=lN(),{config:m}=(0,i.c)(),{openModal:g}=nE(),v=(0,h.useRouter)(),b=(0,h.useSearchParams)(),{clearRouteCache:x}=d7(),[w,j]=o.useState(null);o.useEffect(()=>{(async()=>{let e=y.A({depth:0,limit:0,locale:f,trash:!0,where:{deletedAt:{exists:!0}}},{addQueryPrefix:!0});try{var t;let n=await (await lb.get("".concat(m.serverURL).concat(m.routes.api,"/").concat(a.slug).concat(e),{headers:{"Accept-Language":c.language,"Content-Type":"application/json"}})).json();j(null!=(t=null==n?void 0:n.totalDocs)?t:0)}catch(e){j(0)}})()},[a.slug,m,c.language,f]);let C=o.useCallback(async()=>{if(!r)return;let{slug:e,labels:t}=a,n=y.A({limit:0,locale:f,trash:!0,where:{deletedAt:{exists:!0}}},{addQueryPrefix:!0}),l=await lb.delete("".concat(m.serverURL).concat(m.routes.api,"/").concat(e).concat(n),{headers:{"Accept-Language":c.language,"Content-Type":"application/json"}});try{var o,i;let e=await l.json(),n=(null==e||null==(o=e.docs)?void 0:o.length)||0;l.status<400&&eJ.success(p("general:permanentlyDeletedCountSuccessfully",{count:n,label:(0,d.s)(null==t?void 0:t.plural,c)})),(null==e||null==(i=e.errors)?void 0:i.length)>0&&eJ.error(e.message,{description:e.errors.map(e=>e.message).join("\n")}),v.replace(y.A({...Object.fromEntries(b.entries()),page:"1"},{addQueryPrefix:!0})),x()}catch(e){eJ.error(p("error:unknown"))}},[a,m,r,c,p,f,b,v,x]);return(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(tD,{"aria-label":p("general:emptyTrashLabel",{label:(0,d.s)(null==a||null==(t=a.labels)?void 0:t.plural,c)}),buttonStyle:"pill",disabled:0===w,id:"empty-trash-button",onClick:()=>{g(g9)},size:"small",children:p("general:emptyTrash")},"empty-trash-button"),(0,u.jsx)(lf,{body:(0,u.jsx)(pc,{elements:{0:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})},1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:p,variables:{count:null!=w?w:0,label:(0,d.s)(1===w?null==(n=a.labels)?void 0:n.singular:null==(l=a.labels)?void 0:l.plural,c)}}),confirmingLabel:p("general:deleting"),heading:p("general:confirmDeletion"),modalSlug:g9,onConfirm:C})]})}var ve="list-drawer",vt=e=>{var t,n,l,a;let{className:o,collectionConfig:r,Description:s,disableBulkDelete:c,disableBulkEdit:p,hasCreatePermission:h,hasDeletePermission:f,i18n:m,isBulkUploadEnabled:g,isTrashEnabled:v,newDocumentURL:b,onBulkUploadSuccess:y,openBulkUpload:x,smallBreak:w,viewType:j}=e,{config:C,getEntityConfig:S}=(0,i.c)(),{drawerSlug:k,isInDrawer:_,selectedOption:N}=s7(),E="trash"===j,{isGroupingBy:P}=cn();return _?(0,u.jsx)(g2,{Actions:[(0,u.jsx)(gJ,{className:"".concat(ve,"__header-close"),slug:k},"close-button")],AfterListHeaderContent:(0,u.jsxs)(u.Fragment,{children:[s,(0,u.jsx)(g6,{})]}),className:"".concat(ve,"__header"),title:(0,d.s)(null==(n=S({collectionSlug:N.value}))||null==(t=n.labels)?void 0:t.plural,m),TitleActions:[(0,u.jsx)(g5,{hasCreatePermission:h},"list-drawer-create-new-doc")].filter(Boolean)}):(0,u.jsx)(g2,{Actions:[!w&&!P&&(0,u.jsx)(gZ,{collectionConfig:r,disableBulkDelete:c,disableBulkEdit:p,label:(0,d.s)(null==r||null==(l=r.labels)?void 0:l.plural,m),showSelectAllAcrossPages:!P,viewType:j},"list-selection"),(0,u.jsx)(g1,{collectionConfig:r,config:C,viewType:j},"default-list-actions")].filter(Boolean),AfterListHeaderContent:s,className:o,title:(0,d.s)(null==r||null==(a=r.labels)?void 0:a.plural,m),TitleActions:[h&&!E&&(0,u.jsx)(g8,{collectionConfig:r,hasCreatePermission:h,newDocumentURL:b},"list-header-create-new-doc"),h&&g&&!E&&(0,u.jsx)(g4,{collectionSlug:r.slug,hasCreatePermission:h,isBulkUploadEnabled:g,onBulkUploadSuccess:y,openBulkUpload:x},"list-header-bulk-upload"),f&&v&&"trash"===j&&(0,u.jsx)(g7,{collectionConfig:r,hasDeletePermission:f}
1,"list-header-empty-trash")].filter(Boolean)})},vn="group-by-header",vl=e=>{let{collectionConfig:t,groupByFieldPath:n,groupByValue:l,heading:a}=e;return(0,u.jsxs)("header",{className:vn,children:[(0,u.jsx)("h4",{className:"".concat(vn,"__heading"),"data-group-id":l,children:a}),(0,u.jsx)(gZ,{collectionConfig:t,label:a,modalPrefix:l,where:{[n]:{equals:l}}})]})},va="per-page",vo=Z.NT.admin.pagination.limits,vr=e=>{let t=(0,f.c)(9),{defaultLimit:n,handleChange:l,limit:a,limits:o}=e,r=void 0===o?vo:o,{t:i}=(0,s.d)(),c=(0,R.E)(a)?a:void 0===n?10:n,d;if(t[0]!==l||t[1]!==c||t[2]!==r||t[3]!==i){let e;t[5]!==l||t[6]!==c||t[7]!==r?(e=e=>{let{close:t}=e;return(0,u.jsx)(tc.ButtonGroup,{children:r.map((e,n)=>(0,u.jsxs)(tc.Button,{className:["".concat(va,"__button"),e===c&&"".concat(va,"__button-active")].filter(Boolean).join(" "),onClick:()=>{t(),l&&l(e)},children:[e===c&&(0,u.jsx)("div",{className:"".concat(va,"__chevron"),children:(0,u.jsx)(ta,{direction:"right",size:"small"})}),"\xa0",(0,u.jsx)("span",{children:e})]},n))})},t[5]=l,t[6]=c,t[7]=r,t[8]=e):e=t[8],d=(0,u.jsx)("div",{className:va,children:(0,u.jsx)(t_,{button:(0,u.jsxs)("div",{className:"".concat(va,"__base-button"),children:[(0,u.jsx)("span",{children:i("general:perPage",{limit:c})}),"\xa0",(0,u.jsx)(ta,{className:"".concat(va,"__icon")})]}),horizontalAlign:"right",render:e,size:"small"})}),t[0]=l,t[1]=c,t[2]=r,t[3]=i,t[4]=d}else d=t[4];return d},vi="page-controls",vs=e=>{var t,n,l,a,r,i;let c=(0,f.c)(16),{AfterPageControls:d,collectionConfig:p,data:h,handlePageChange:m,handlePerPageChange:g,limit:v}=e,{i18n:b}=(0,s.d)(),y;return c[0]!==d||c[1]!==(null==p||null==(n=p.admin)||null==(t=n.pagination)?void 0:t.limits)||c[2]!==h.hasNextPage||c[3]!==h.hasPrevPage||c[4]!==h.limit||c[5]!==h.nextPage||c[6]!==h.page||c[7]!==h.pagingCounter||c[8]!==h.prevPage||c[9]!==h.totalDocs||c[10]!==h.totalPages||c[11]!==m||c[12]!==g||c[13]!==b||c[14]!==v?(y=(0,u.jsxs)("div",{className:vi,children:[(0,u.jsx)(ua,{hasNextPage:h.hasNextPage,hasPrevPage:h.hasPrevPage,limit:h.limit,nextPage:h.nextPage,numberOfNeighbors:1,onChange:m,page:h.page,prevPage:h.prevPage,totalPages:h.totalPages}),h.totalDocs>0&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("div",{className:"".concat(vi,"__page-info"),children:[h.page*h.limit-(h.limit-1),"-",h.totalPages>1&&h.totalPages!==h.page?h.limit*h.page:h.totalDocs," ",b.t("general:of")," ",h.totalDocs]}),(0,u.jsx)(vr,{handleChange:g,limit:v,limits:null==p||null==(a=p.admin)||null==(l=a.pagination)?void 0:l.limits,resetPage:h.totalDocs<=h.pagingCounter}),d]})]}),c[0]=d,c[1]=null==p||null==(i=p.admin)||null==(r=i.pagination)?void 0:r.limits,c[2]=h.hasNextPage,c[3]=h.hasPrevPage,c[4]=h.limit,c[5]=h.nextPage,c[6]=h.page,c[7]=h.pagingCounter,c[8]=h.prevPage,c[9]=h.totalDocs,c[10]=h.totalPages,c[11]=m,c[12]=g,c[13]=b,c[14]=v,c[15]=y):y=c[15],y},vc=e=>{let t,n=(0,f.c)(10),{AfterPageControls:l,collectionConfig:a}=e,{data:o,defaultLimit:r,handlePageChange:i,handlePerPageChange:s,query:c}=cn(),d;return n[0]!==r||n[1]!==c.limit?(d=(0,R.E)(c.limit)?c.limit:r,n[0]=r,n[1]=c.limit,n[2]=d):d=n[2],n[3]!==l||n[4]!==a||n[5]!==o||n[6]!==i||n[7]!==s||n[8]!==d?(t=(0,u.jsx)(vs,{AfterPageControls:l,collectionConfig:a,data:o,handlePageChange:i,handlePerPageChange:s,limit:d}),n[3]=l,n[4]=a,n[5]=o,n[6]=i,n[7]=s,n[8]=d,n[9]=t):t=n[9],t},vu=e=>{let{children:t}=e;return(0,u.jsx)("div",{className:"sticky-toolbar",children:t})},vd=e=>{let t=(0,f.c)(12),{AfterPageControls:n,collectionConfig:l,data:a,groupByValue:o}=e,{refineListData:r}=cn(),i;t[0]!==o||t[1]!==r?(i=async e=>{await r({queryByGroup:{[o]:{page:e}}})},t[0]=o,t[1]=r,t[2]=i):i=t[2];let s=i,c;t[3]!==o||t[4]!==r?(c=async e=>{await r({queryByGroup:{[o]:{limit:e,page:1}}})},t[3]=o,t[4]=r,t[5]=c):c=t[5];let d=c,p;return t[6]!==n||t[7]!==l||t[8]!==a||t[9]!==s||t[10]!==d?(p=(0,u.jsx)(vs,{AfterPageControls:n,collectionConfig:l,data:a,handlePageChange:s,handlePerPageChange:d}),t[6]=n,t[7]=l,t[8]=a,t[9]=s,t[10]=d,t[11]=p):p=t[11],p},vp=()=>(0,u.jsx)("svg",{className:"icon icon--logout",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M12 16H14.6667C15.0203 16 15.3594 15.8595 15.6095 15.6095C15.8595 15.3594 16 15.0203 16 14.6667V5.33333C16 4.97971 15.8595 4.64057 15.6095 4.39052C15.3594 4.14048 15.0203 4 14.6667 4H12M7.33333 13.3333L4 10M4 10L
17.33333 6.66667M4 10H12",strokeLinecap:"square"})}),vh=e=>{let t=(0,f.c)(6),{tabIndex:n}=e,l=void 0===n?0:n,{t:a}=(0,s.d)(),{config:o}=(0,i.c)(),{admin:r,routes:c,serverURL:d}=o,{routes:p}=r,{logout:h}=p,{admin:m}=c,g;return t[0]!==m||t[1]!==h||t[2]!==d||t[3]!==a||t[4]!==l?(g=(0,u.jsx)(tt,{"aria-label":a("authentication:logOut"),className:"".concat("nav","__log-out"),href:(0,v.Q)({adminRoute:m,path:h,serverURL:d}),prefetch:!1,tabIndex:l,title:a("authentication:logOut"),children:(0,u.jsx)(vp,{})}),t[0]=m,t[1]=h,t[2]=d,t[3]=a,t[4]=l,t[5]=g):g=t[5],g},vf="nav-group",vm=e=>{let t,n=(0,f.c)(21),{children:l,isOpen:a,label:r}=e,[i,s]=(0,o.useState)("u">typeof a&&!a),[c,d]=(0,o.useState)(!1),{setPreference:p}=aS(),{navOpen:h}=fQ();if(r){let e;n[0]!==i||n[1]!==r||n[2]!==p?(e=()=>{d(!0);let e={};(null==e?void 0:e[r])?e[r].open=!!i:e[r]={open:!!i},p("nav",{groups:e},!0),s(!i)},n[0]=i,n[1]=r,n[2]=p,n[3]=e):e=n[3];let t=e,a="".concat(r),o=i&&"".concat(vf,"--collapsed"),f;n[4]!==a||n[5]!==o?(f=["".concat(vf),a,o].filter(Boolean),n[4]=a,n[5]=o,n[6]=f):f=n[6];let m=f.join(" "),g="nav-group-".concat(r),v="".concat(vf,"__toggle--").concat(i?"collapsed":"open"),b;n[7]!==v?(b=["".concat(vf,"__toggle"),v].filter(Boolean),n[7]=v,n[8]=b):b=n[8];let y=b.join(" "),x=h?0:-1,w;return n[9]!==c||n[10]!==l||n[11]!==i||n[12]!==r||n[13]!==x||n[14]!==m||n[15]!==g||n[16]!==y||n[17]!==t?(w=(0,u.jsxs)("div",{className:m,id:g,children:[(0,u.jsxs)("button",{className:y,onClick:t,tabIndex:x,type:"button",children:[(0,u.jsx)("div",{className:"".concat(vf,"__label"),children:r}),(0,u.jsx)("div",{className:"".concat(vf,"__indicator"),children:(0,u.jsx)(ta,{className:"".concat(vf,"__indicator"),direction:i?void 0:"up"})})]}),(0,u.jsx)(a2,{duration:200*!!c,height:i?0:"auto",children:(0,u.jsx)("div",{className:"".concat(vf,"__content"),children:l})})]}),n[9]=c,n[10]=l,n[11]=i,n[12]=r,n[13]=x,n[14]=m,n[15]=g,n[16]=y,n[17]=t,n[18]=w):w=n[18],w}return n[19]!==l?(t=(0,u.jsx)(o.Fragment,{children:l}),n[19]=l,n[20]=t):t=n[20],t},vg="combobox",vv=e=>{let{entries:t,minEntriesForSearch:n=8,onSelect:l,onToggleClose:a,onToggleOpen:r,searchPlaceholder:i="Search...",...s}=e,[c,d]=(0,o.useState)(""),p=(0,o.useRef)(!1),h=(0,o.useRef)(null),f=(0,o.useMemo)(()=>{if(!c)return t;let e=c.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e))},[t,c]),m=t.length>=n,g=f.length>0,v=o.useCallback(e=>{p.current=e,e&&m&&setTimeout(()=>{var e;null==(e=h.current)||e.focus()},100),null==r||r(e)},[m,r]),b=o.useCallback(()=>{p.current=!1,d(""),null==a||a()},[a]);return(0,u.jsx)(t_,{...s,className:"".concat(vg," ").concat(s.className||""),onToggleClose:b,onToggleOpen:v,render:e=>{let{close:t}=e;return(0,u.jsxs)("div",{className:"".concat(vg,"__content"),children:[m&&(0,u.jsx)("div",{className:"".concat(vg,"__search-wrapper").concat(g?"":" ".concat(vg,"__search-wrapper--no-results")),children:(0,u.jsx)("input",{"aria-label":i,className:"".concat(vg,"__search-input"),onChange:e=>d(e.target.value),placeholder:i,ref:h,type:"text",value:c})}),(0,u.jsx)(tc.ButtonGroup,{children:f.map((e,n)=>{let a=()=>{l&&l(e),t()};return(0,u.jsx)("div",{className:"".concat(vg,"__entry"),onClick:a,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),a())},role:"menuitem",tabIndex:0,children:e.Component},"".concat(e.name,"-").concat(n))})})]})}})};function vb(e){let{active:t}=e,{t:n}=(0,s.d)(),{config:l}=(0,i.c)(),{admin:{routes:{browseByFolder:a}},routes:{admin:o},serverURL:r}=l;return(0,u.jsxs)(tt,{className:["browse-by-folder-button",t&&"active"].filter(Boolean).join(" "),href:(0,v.Q)({adminRoute:o,path:a,serverURL:r}),id:"browse-by-folder",prefetch:!1,children:[(0,u.jsx)(ph,{}),n("folder:browseByFolder")]})}var vy=e=>{let{options:t,...n}=e,{field:l,field:{name:a,admin:{className:r,isClearable:i=!0,isSortable:c=!0,placeholder:d}={},hasMany:p=!1,label:h,localized:f,required:m},onChange:g,path:v,readOnly:b,validate:y}=n,{t:x}=(0,s.d)(),{folderType:w}=d4(),j=o.useMemo(()=>w&&0!==w.length?uJ(t.filter(e=>"object"!=typeof e||!e.value||w.includes(e.value))):uJ(t),[t,w]),{customComponents:{AfterInput:C,BeforeInput:S,Description:k,Error:_,Label:N}={},disabled:E,path:P,selectFilterOptions:D,setValue:T,showError:R,value:A}=aB({potentiallyStalePath:v,validate:o.useCallback((e,t)=>{if("function"==typeof y)return y(e,{...t,hasMany:p,options:j,required:m})},[y,m,p,j])}),L=o.useCallback(e=>{if(!b||E){let t=null;e&&p?t=Array.isArray(e)&&e.length>0?e.map(e=>e.value):null:e&&!Array.isArray(e)&&(t=e.value),"function"==typeof g&&g(t),T(t)}},[b,E,p,T,g]),O=o.useMemo(()=>aH(l),[l]);return(0,u.jsx)(uZ,{AfterInput:C,BeforeInput:S,className:r,Description:k,description:x("folder:folderTypeDescription"),Error:_,filterOption:D?e=>{let{value:t}=e;return null==D?void 0:D.some(e=>("string"==typeof e?e:e.value)===t)}:void 0,hasMany:p,isClearable:i,isSortable:c,Label:N,label:h,localized:f,name:a,onChange:L,options:j,path:P,placeholder:d,readOnly:b||E,required:m||Array.isArray(w)&&w.length>0,showError:R,style:O,value:A})},vx=()=>(0,u.jsx)("svg",{className:"icon icon--document",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{clipRule:"evenodd",d:"M3.5 1C2.94772 1 2.5 1.44772 2.5 2V14C2.5 14.5523 2.94771 15 3.5 15H12.5C13.0523 15 13.5 14.5523 13.5 14V4.41421C13.5 4.149 13.3946 3.89464 13.2071 3.70711L10.7929 1.29289C10.6054 1.10536 10.351 1 10.0858 1H3.5ZM5 5.5C5 5.22386 5.22386 5 5.5 5H10.5C10.7761 5 11 5.22386 11 5.5C11 5.77614 10.7761 6 10.5 6H5.5C5.22386 6 5 5.77614 5 5.5ZM5 8.5C5 8.22386 5.22386 8 5.5 8H10.5C10.7761 8 11 8.22386 11 8.5C11 8.77614 10.7761 9 10.5 9H5.5C5.22386 9 5 8.77614 5 8.5ZM5 11.5C5 11.2239 5.22386 11 5.5 11H10.5C10.7761 11 11 11.2239 11 11.5C11 11.7761 10.7761 12 10.5 12H5.5C5.22386 12 5 11.7761 5 11.5Z",fill:"currentColor",fillRule:"evenodd"})}),vw="draggable-with-click",vj=e=>{let{as:t="div",children:n,className:l,disabled:a=!1,onClick:r,onKeyDown:i,ref:s,thresholdPixels:c=3}=e,d=(0,o.useId)(),{attributes:p,listeners:h,setNodeRef:f}=(0,g.PM)({id:d,disabled:a}),m=(0,o.useRef)({x:0,y:0}),v=(0,o.useRef)(!1);return(0,u.jsx)(t||"div",{role:"button",tabIndex:0,...p,className:[vw,l,a?"".concat(vw,"--disabled"):""].filter(
1Boolean).join(" "),onKeyDown:a?void 0:i,onPointerDown:a?void 0:r?e=>{m.current={x:e.clientX,y:e.clientY},v.current=!1;let t=n=>{let l=Math.abs(n.clientX-m.current.x),a=Math.abs(n.clientY-m.current.y);(l>c||a>c)&&(v.current=!0,(null==h?void 0:h.onPointerDown)&&(h.onPointerDown(e),r(n)),window.removeEventListener("pointermove",t))},n=e=>{window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n),v.current||r(e)};window.addEventListener("pointermove",t),window.addEventListener("pointerup",n)}:void 0,ref:e=>{a||(f(e),s&&(s.current=e))},children:n})},vC="simple-table",vS=e=>{let{appearance:t,className:n,headerCells:l,tableRows:a}=e;return(0,u.jsx)("div",{className:[n,vC,t&&"".concat(vC,"--appearance-").concat(t)].filter(Boolean).join(" "),children:(0,u.jsxs)("table",{cellPadding:0,cellSpacing:0,className:"".concat(vC,"__table"),children:[(0,u.jsx)(vk,{children:(0,u.jsx)(vN,{children:l})}),(0,u.jsx)(v_,{children:a})]})})},vk=e=>{let{children:t,className:n,...l}=e;return(0,u.jsx)("thead",{className:"".concat(vC,"__thead ").concat(n||"").trim(),...l,children:t})},v_=e=>{let{children:t,className:n,...l}=e;return(0,u.jsx)("tbody",{className:"".concat(vC,"__tbody ").concat(n||"").trim(),...l,children:t})},vN=e=>{let{children:t,className:n,...l}=e;return(0,u.jsx)("tr",{className:"".concat(vC,"__tr ").concat(n||"").trim(),...l,children:t})},vE=e=>{let{children:t,className:n,...l}=e;return(0,u.jsx)("td",{className:"".concat(vC,"__td ").concat(n||"").trim(),...l,children:t})},vP=e=>{let{children:t,className:n,...l}=e;return(0,u.jsx)("th",{className:"".concat(vC,"__th ").concat(n||"").trim(),...l,children:t})},vD=e=>{let{children:t,className:n,...l}=e;return(0,u.jsx)("td",{className:"".concat(vC,"__hidden-cell ").concat(n||"").trim(),...l,children:t})},vT="draggable-table-row";function vR(e){let{id:t,columns:n,disabled:l=!1,dragData:a,isDroppable:r,isFocused:i,isSelected:s,isSelecting:c,itemKey:d,onClick:p,onKeyDown:h}=e,f=!l&&r&&!s,{isOver:m,setNodeRef:v}=(0,g.zM)({id:t,data:a,disabled:!f}),b=o.useRef(null);return o.useEffect(()=>{let e=b.current;return i&&b.current?b.current.focus():!i&&b.current&&b.current.blur(),()=>{e&&e.blur()}},[i]),(0,u.jsxs)(vj,{as:"tr",className:[vT,s&&"".concat(vT,"--selected"),c&&"".concat(vT,"--selecting"),l&&"".concat(vT,"--disabled"),i&&"".concat(vT,"--focused"),m&&"".concat(vT,"--over")].filter(Boolean).join(" "),onClick:p,onKeyDown:h,ref:b,children:[n.map((e,t)=>(0,u.jsx)(vE,{className:["".concat(vT,"__cell-content"),0===t&&"".concat(vT,"__first-td"),t===n.length-1&&"".concat(vT,"__last-td")].filter(Boolean).join(" "),children:e},"".concat(d,"-").concat(t))),f?(0,u.jsx)(vD,{children:(0,u.jsx)("div",{className:"".concat(vT,"__drop-area"),ref:v})}):null]},d)}var vA="folder-file-table";function vL(e){let t=(0,f.c)(39),{showRelationCell:n}=e,l=void 0===n||n,{checkIfItemIsDisabled:a,documents:r,focusedRowIndex:c,onItemClick:p,onItemKeyPress:h,selectedItemKeys:m,subfolders:g}=d4(),{config:v}=(0,i.c)(),{i18n:b,t:y}=(0,s.d)(),x;t[0]!==v||t[1]!==b?(x=()=>{let e={};return v.collections.forEach(t=>{var n,l;e[t.slug]={plural:(0,d.s)(null==(n=t.labels)?void 0:n.plural,b),singular:(0,d.s)(null==(l=t.labels)?void 0:l.singular,b)}}),e},t[0]=v,t[1]=b,t[2]=x):x=t[2];let[w]=o.useState(x),j;t[3]!==l||t[4]!==y?(j=()=>{let e=[{name:"name",label:y("general:name")},{name:"createdAt",label:y("general:createdAt")},{name:"updatedAt",label:y("general:updatedAt")}];return l&&e.push({name:"type",label:y("version:type")}),e},t[3]=l,t[4]=y,t[5]=j):j=t[5];let[C]=o.useState(j),S;if(t[6]!==a||t[7]!==C||t[8]!==v||t[9]!==r||t[10]!==c||t[11]!==b||t[12]!==p||t[13]!==h||t[14]!==w||t[15]!==m||t[16]!==g){let e,n;t[18]!==a||t[19]!==C||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==p||t[24]!==h||t[25]!==w||t[26]!==m?(e=(e,t)=>{let{itemKey:n,relationTo:l,value:o}=e,r=(0,H.r)(o);return(0,u.jsx)(vR,{columns:C.map((t,a)=>{var r,i,s;let{name:c}=t,d="â";return"name"===c&&void 0!==o._folderOrDocumentTitle&&(d=o._folderOrDocumentTitle),("createdAt"===c||"updatedAt"===c)&&o[c]&&(d=ah({date:o[c],i18n:b,pattern:v.admin.dateFormat})),"type"===c&&(d=(0,u.jsxs)(u.Fragment,{children:[(null==(r=w[l])?void 0:r.singular)||l,Array.isArray(null==(i=e.value)?void 0:i.folderType)?null==(s=e.value)?void 0:s.folderType.reduce((e,t,n
1)=>{var l,a;return 0===n?" â ".concat((null==(l=w[t])?void 0:l.plural)||t):n>0?"".concat(e,", ").concat((null==(a=w[t])?void 0:a.plural)||t):e},""):""]})),0===a?(0,u.jsxs)("span",{className:"".concat(vA,"__cell-with-icon"),children:[(0,u.jsx)(ph,{}),d]},"".concat(n,"-").concat(c)):d}),disabled:a(e),dragData:{id:r,type:"folder"},id:r,isDroppable:!0,isFocused:c===t,isSelected:m.has(n),isSelecting:m.size>0,itemKey:n,onClick:n=>{p({event:n,index:t,item:e})},onKeyDown:n=>{h({event:n,index:t,item:e})}},"".concat(t,"-").concat(n))},t[18]=a,t[19]=C,t[20]=v,t[21]=c,t[22]=b,t[23]=p,t[24]=h,t[25]=w,t[26]=m,t[27]=e):e=t[27],t[28]!==a||t[29]!==C||t[30]!==v||t[31]!==c||t[32]!==b||t[33]!==p||t[34]!==h||t[35]!==w||t[36]!==m||t[37]!==g.length?(n=(e,t)=>{let{itemKey:n,relationTo:l,value:o}=e,r=(0,H.r)(o),i=t+g.length;return(0,u.jsx)(vR,{columns:C.map((e,t)=>{var a;let{name:r}=e,i="â";return"name"===r&&void 0!==o._folderOrDocumentTitle&&(i=o._folderOrDocumentTitle),("createdAt"===r||"updatedAt"===r)&&o[r]&&(i=ah({date:o[r],i18n:b,pattern:v.admin.dateFormat})),"type"===r&&(i=(null==(a=w[l])?void 0:a.singular)||l),0===t?(0,u.jsxs)("span",{className:"".concat(vA,"__cell-with-icon"),children:[(0,u.jsx)(vx,{}),i]},"".concat(n,"-").concat(r)):i}),disabled:a(e),dragData:{id:r,type:"document"},id:r,isFocused:c===i,isSelected:m.has(n),isSelecting:m.size>0,itemKey:n,onClick:t=>{p({event:t,index:i,item:e})},onKeyDown:t=>{h({event:t,index:i,item:e})}},"".concat(i,"-").concat(n))},t[28]=a,t[29]=C,t[30]=v,t[31]=c,t[32]=b,t[33]=p,t[34]=h,t[35]=w,t[36]=m,t[37]=g.length,t[38]=n):n=t[38],S=(0,u.jsx)(vS,{headerCells:C.map(vO),tableRows:[...g.map(e),...r.map(n)]}),t[6]=a,t[7]=C,t[8]=v,t[9]=r,t[10]=c,t[11]=b,t[12]=p,t[13]=h,t[14]=w,t[15]=m,t[16]=g,t[17]=S}else S=t[17];return S}function vO(e){let{name:t,label:n}=e;return(0,u.jsx)(vP,{children:n},t)}function vF(e){let{className:t=""}=e;return(0,u.jsxs)("div",{className:"icon icon--dots ".concat(t).trim(),children:[(0,u.jsx)("div",{}),(0,u.jsx)("div",{}),(0,u.jsx)("div",{})]})}var vM="folder-file-card";function vI(e){let{id:t,type:n,className:l="",disabled:a=!1,folderType:r,isDeleting:i=!1,isFocused:s=!1,isSelected:c=!1,itemKey:d,onClick:p,onKeyDown:h,PopupActions:f,previewUrl:m,selectedCount:v=0,title:b}=e,y=!t||a||"folder"!==n,{isOver:x,setNodeRef:w}=(0,g.zM)({id:d,data:{id:t,type:n,folderType:r},disabled:y}),j=o.useRef(null);return o.useEffect(()=>{let e=j.current;return s&&j.current?j.current.focus():!s&&j.current&&j.current.blur(),()=>{e&&e.blur()}},[s]),(0,u.jsxs)(vj,{className:[vM,l,c&&"".concat(vM,"--selected"),a&&"".concat(vM,"--disabled"),i&&"".concat(vM,"--deleting"),s&&"".concat(vM,"--focused"),x&&"".concat(vM,"--over"),"".concat(vM,"--").concat(n)].filter(Boolean).join(" "),disabled:a||!p&&!h,onClick:p,onKeyDown:h,ref:j,children:[y?null:(0,u.jsx)("div",{className:"".concat(vM,"__drop-area"),ref:w}),"file"===n?(0,u.jsx)("div",{className:"".concat(vM,"__preview-area"),children:m?(0,u.jsx)(cX,{fileSrc:m}):(0,u.jsx)(vx,{})}):null,(0,u.jsxs)("div",{className:"".concat(vM,"__titlebar-area"),children:[(0,u.jsx)("div",{className:"".concat(vM,"__icon-wrap"),children:"file"===n?(0,u.jsx)(vx,{}):(0,u.jsx)(ph,{})}),(0,u.jsxs)("div",{className:"".concat(vM,"__titlebar-labels"),children:[(0,u.jsx)("p",{className:"".concat(vM,"__name"),title:b,children:(0,u.jsx)("span",{children:b})}),r&&r.length>0?(0,u.jsx)(vB,{folderType:r}):null]}),f?(0,u.jsx)(t_,{button:(0,u.jsx)(vF,{}),disabled:v>1||1===v&&!c,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:f}):null]})]},d)}function vB(e){let{folderType:t}=e,{config:n}=(0,i.c)(),{i18n:l}=(0,s.d)(),a=o.useMemo(()=>t.reduce((e,t)=>{var a;let o=null==(a=n.collections)?void 0:a.find(e=>e.slug===t);return o?[...e,(0,d.s)(o.labels.plural,l)]:e},[]),[t,n.collections,l]);return(0,u.jsx)("p",{className:"".concat(vM,"__assigned-collections"),children:a.map((e,n)=>(0,u.jsxs)("span",{children:[e,n<t.length-1?", ":""]},e))})}function vU(e){let t=(0,f.c)(18),{type:n,className:l,index:a,item:o}=e,{checkIfItemIsDisabled:r,focusedRowIndex:i,onItemClick:s,onItemKeyPress:c,selectedItemKeys:d}=d4(),p;if(t[0]!==r||t[1]!==l||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==d||t[8]!==n){let e,h=d.has(o.itemKey),f=r(o),m;t[10]!==a||t[11]!==o||t[12]!==s?(m=e=>{s({event:e,index:a,item:o})},t[10]=a,t[11]=o,t[12]=s,t[13]=m):m=t[13],t[14]!==a||t[15]!==o||t[16]!==c?(e=e=>{c({event:e,index:a,item:o})},t[14]=a,t[15]=o,t[16]=c,t[17]=e):e=t[17],p=(0,u.jsx)(vI,{className:l,disabled:f,folderType:o.value.folderType||[],id:o.value.id,isFocused:i===a,isSelected:h,itemKey:o.itemKey,onClick:m,onKeyDown:e,previewUrl:o.value.url,title:o.value._folderOrDocumentTitle,type:n}),t[0]=r,t[1]=l,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=d,t[8]=n,t[9]=
1p}else p=t[9];return p}var vz="item-card-grid";function vV(e){let{type:t,items:n,subfolderCount:l,title:a}=e;return(0,u.jsxs)(u.Fragment,{children:[a&&(0,u.jsx)("p",{className:"".concat(vz,"__title"),children:a}),(0,u.jsx)("div",{className:vz,children:n&&(null==n?void 0:n.length)!==0?n.map((e,n)=>{let{itemKey:a}=e;return(0,u.jsx)(vU,{index:n+(l||0),item:e,type:t},a)}):null})]})}function vH(e){return void 0===e||"number"==typeof e?e:decodeURIComponent(e)}var vq=e=>{let t=(0,f.c)(10),{id:n,className:l,prefix:a}=e,o=void 0===a?"ID:":a,{config:r}=(0,i.c)(),{routes:s,serverURL:c}=r,{admin:d}=s,{collectionSlug:p,globalSlug:h}=aD(),m=lp(),g="/".concat(p?"collections/".concat(p):"globals/".concat(h),"/").concat(n),b;if(t[0]!==d||t[1]!==l||t[2]!==m||t[3]!==n||t[4]!==o||t[5]!==c||t[6]!==g){let e=(0,v.Q)({adminRoute:d,path:g,serverURL:c}),a;t[8]!==l?(a=["id-label",l].filter(Boolean),t[8]=l,t[9]=a):a=t[9],b=(0,u.jsxs)("div",{className:a.join(" "),title:n,children:[o,"\xa0",m>1?(0,u.jsx)(tt,{href:e,children:vH(n)}):vH(n)]}),t[0]=d,t[1]=l,t[2]=m,t[3]=n,t[4]=o,t[5]=c,t[6]=g,t[7]=b}else b=t[7];return b},vW="render-title",vK=e=>{let t=(0,f.c)(10),{className:n,element:l,fallback:a,title:r}=e,{id:i,isInitializing:s}=aD(),{title:c}=ay(),d=r||c||a,p=d===i,h=void 0===l?"h1":l,m;if(t[0]!==h||t[1]!==n||t[2]!==i||t[3]!==p||t[4]!==s||t[5]!==d){let e=(0,u.jsx)(o.Fragment,{children:"\xa0"}),l=p&&"".concat(vW,"--has-id"),a;t[7]!==n||t[8]!==l?(a=[n,vW,l].filter(Boolean),t[7]=n,t[8]=l,t[9]=a):a=t[9],m=(0,u.jsx)(h,{className:a.join(" "),"data-doc-id":i,title:d,children:s?e:(0,u.jsx)(o.Fragment,{children:p?(0,u.jsx)(vq,{className:"".concat(vW,"__id"),id:i}):d||e})}),t[0]=h,t[1]=n,t[2]=i,t[3]=p,t[4]=s,t[5]=d,t[6]=m}else m=t[6];return m},vY="sort-column",vG=e=>{let t,n=(0,f.c)(19),{name:l,appearance:a,disable:o,Label:r,label:i}=e,c=void 0!==o&&o,{handleSortChange:d,query:p}=cn(),{t:h}=(0,s.d)(),{sort:m}=p,g="-".concat(l),v;n[0]!==l||n[1]!==m?(v=["".concat(vY,"__asc")],m===l&&v.push("".concat(vY,"--active")),n[0]=l,n[1]=m,n[2]=v):v=n[2],n[3]!==g||n[4]!==m?(t=["".concat(vY,"__desc")],m===g&&t.push("".concat(vY,"--active")),n[3]=g,n[4]=m,n[5]=t):t=n[5];let b=a&&"".concat(vY,"--appearance-").concat(a),y;n[6]!==b?(y=[vY,b].filter(Boolean),n[6]=b,n[7]=y):y=n[7];let x=y.join(" "),w;return n[8]!==r||n[9]!==l||n[10]!==v||n[11]!==g||n[12]!==t||n[13]!==c||n[14]!==d||n[15]!==i||n[16]!==h||n[17]!==x?(w=(0,u.jsxs)("div",{className:x,children:[(0,u.jsx)("span",{className:"".concat(vY,"__label"),children:null!=r?r:(0,u.jsx)(lD,{hideLocale:!0,label:i,unstyled:!0})}),!c&&(0,u.jsxs)("div",{className:"".concat(vY,"__buttons"),children:[(0,u.jsx)("button",{"aria-label":h("general:sortByLabelDirection",{direction:h("general:ascending"),label:i}),className:[...v,"".concat(vY,"__button")].filter(Boolean).join(" "),onClick:()=>void d(l),type:"button",children:(0,u.jsx)(ta,{direction:"up"})}),(0,u.jsx)("button",{"aria-label":h("general:sortByLabelDirection",{direction:h("general:descending"),label:i}),className:[...t,"".concat(vY,"__button")].filter(Boolean).join(" "),onClick:()=>void d(g),type:"button",children:(0,u.jsx)(ta,{})})]})]}),n[8]=r,n[9]=l,n[10]=v,n[11]=g,n[12]=t,n[13]=c,n[14]=d,n[15]=i,n[16]=h,n[17]=x,n[18]=w):w=n[18],w},vQ=e=>{let t=(0,f.c)(24),{field:n,path:l,readOnly:a,useAsSlug:r}=e,{label:i}=n,{t:c}=(0,s.d)(),{collectionSlug:d,globalSlug:p}=aD(),{slugify:h}=ci(),m=l||n.name,g;t[0]!==m?(g={path:m},t[0]=m,t[1]=g):g=t[1];let{setValue:v,value:b}=aB(g),{getData:y,getDataByPath:x}=eP(),[w,j]=(0,o.useState)(!0),C;t[2]!==d||t[3]!==y||t[4]!==x||t[5]!==p||t[6]!==l||t[7]!==v||t[8]!==h||t[9]!==r||t[10]!==b?(C=async e=>{e.preventDefault();let t=x(r),n=await h({collectionSlug:d,data:y(),globalSlug:p,path:l,valueToSlugify:t});if(null==n)return void v("");b!==n&&v(n)},t[2]=d,t[3]=y,t[4]=x,t[5]=p,t[6]=l,t[7]=v,t[8]=h,t[9]=r,t[10]=b,t[11]=C):C=t[11];let S=C,k;t[12]===Symbol.for("react.memo_cache_sentinel")?(k=e=>{e.preventDefault(),j(vX)},t[12]=k):k=t[12];let _=k,N="field-".concat(l),E;return t[13]!==n.name||t[14]!==S||t[15]!==w||t[16]!==i||t[17]!==l||t[18]!==a||t[19]!==v||t[20]!==c||t[21]!==N||t[22]!==b?(E=(0,u.jsxs)("div",{className:"field-type slug-field-component",children:[(0,u.jsxs)("div",{className:"label-wrapper",children:[(0,u.jsx)(lD,{htmlFor:N,label:i}),!w&&(0,u.jsx)(tD,{buttonStyle:"none",className:"lock-button",onClick:S,children:c("authentication:generate")}),(0,u.jsx)(tD,{buttonStyle:"none",className:"lock-button",onClick:_,children:c(w?"general:unlock":"general:lock")})]}),(0,u.jsx)(dv,{onChange:v,path:l||n.name,readOnly:!!(a||w),value:b})]}),t[13]=n.name,t[14]=S,t[15]=w,t[16]=i,t[17]=l,t[18]=a,t[19]=v,t[20]=c,t[21]=N,t[22]=b,t[23]=E):E=t[23],E};function vX(e){return!e}var v$=()=>(0,u.jsx)("svg",{"aria-hidden":"true",className:"graphic code-block-icon",focusable:"false",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{className:"stroke",d:"M14 12.6667L16.6667 9.99999L14 7.33332M5.99999 7.33332L3.33333 9.99999L5.99999 12.6667M11.6667 4.66666L8.33333 15.3333",strokeLinecap:"square"})}),vZ="minimize-maximize",vJ=e=>{let{className:t,isMinimized:n}=e,l=[vZ,n?"".concat(vZ,"--minimized"):"".concat(vZ,"--maximized"),t].filter(
1Boolean).join(" ");return(0,u.jsx)("svg",{className:l,height:"20",stroke:"currentColor",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:n?(0,u.jsx)("path",{d:"M7.33333 4H5.33333C4.97971 4 4.64057 4.14048 4.39052 4.39052C4.14048 4.64057 4 4.97971 4 5.33333V7.33333M16 7.33333V5.33333C16 4.97971 15.8595 4.64057 15.6095 4.39052C15.3594 4.14048 15.0203 4 14.6667 4H12.6667M4 12.6667V14.6667C4 15.0203 4.14048 15.3594 4.39052 15.6095C4.64057 15.8595 4.97971 16 5.33333 16H7.33333M12.6667 16H14.6667C15.0203 16 15.3594 15.8595 15.6095 15.6095C15.8595 15.3594 16 15.0203 16 14.6667V12.6667"}):(0,u.jsx)("path",{d:"M7.33333 4V6C7.33333 6.35362 7.19286 6.69276 6.94281 6.94281C6.69276 7.19286 6.35362 7.33333 6 7.33333H4M16 7.33333H14C13.6464 7.33333 13.3072 7.19286 13.0572 6.94281C12.8071 6.69276 12.6667 6.35362 12.6667 6V4M4 12.6667H6C6.35362 12.6667 6.69276 12.8071 6.94281 13.0572C7.19286 13.3072 7.33333 13.6464 7.33333 14V16M12.6667 16V14C12.6667 13.6464 12.8071 13.3072 13.0572 13.0572C13.3072 12.8071 13.6464 12.6667 14 12.6667H16"})})},v0=e=>{let{ariaLabel:t,className:n}=e;return(0,u.jsx)("div",{"aria-label":t,className:[n,"gear"].filter(Boolean).join(" "),children:(0,u.jsx)("svg",{className:"icon icon--gear",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{d:"M9.33337 8.84671L6.66671 4.22671M9.33337 11.1534L6.66671 15.7734M10 16.6667V15.3334M10 15.3334C12.9456 15.3334 15.3334 12.9456 15.3334 10C15.3334 7.05452 12.9456 4.66671 10 4.66671M10 15.3334C7.05452 15.3334 4.66671 12.9456 4.66671 10M10 3.33337V4.66671M10 4.66671C7.05452 4.66671 4.66671 7.05452 4.66671 10M11.3334 10H16.6667M11.3334 10C11.3334 10.7364 10.7364 11.3334 10 11.3334C9.26366 11.3334 8.66671 10.7364 8.66671 10C8.66671 9.26366 9.26366 8.66671 10 8.66671C10.7364 8.66671 11.3334 9.26366 11.3334 10ZM13.3334 15.7734L12.6667 14.62M13.3334 4.22671L12.6667 5.38004M3.33337 10H4.66671M15.7734 13.3334L14.62 12.6667M15.7734 6.66671L14.62 7.33337M4.22671 13.3334L5.38004 12.6667M4.22671 6.66671L5.38004 7.33337",strokeLinecap:"round",strokeLinejoin:"round"})})})};function v1(){return(0,u.jsxs)("svg",{className:"icon icon--move-folder",fill:"none",height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("g",{filter:"url(#filter0_d_278_1086)",children:(0,u.jsx)("path",{d:"M5.33334 10V7.33334C5.33334 6.97971 5.47382 6.64058 5.72387 6.39053C5.97392 6.14048 6.31305 6 6.66668 6H9.26668C9.48967 5.99782 9.70965 6.0516 9.90648 6.15642C10.1033 6.26124 10.2707 6.41375 10.3933 6.6L10.9333 7.4C11.0547 7.58436 11.22 7.73568 11.4143 7.84041C11.6087 7.94513 11.8259 7.99997 12.0467 8H17.3333C17.687 8 18.0261 8.14048 18.2762 8.39053C18.5262 8.64058 18.6667 8.97971 18.6667 9.33334V16C18.6667 16.3536 18.5262 16.6928 18.2762 16.9428C18.0261 17.1929 17.687 17.3333 17.3333 17.3333H6.66668C6.31305 17.3333 5.97392 17.1929 5.72387 16.9428C5.47382 16.6928 5.33334 16.3536 5.33334 16V15.3333M5.33334 12.6667H12M12 12.6667L10 14.6667M12 12.6667L10 10.6667",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,u.jsx)("defs",{children:(0,u.jsx)("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"26",id:"filter0_d_278_1086",width:"26",x:"-1",y:"-1",children:(0,u.jsx)("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_278_1086",mode:"normal",result:"shape"})})})]})}var v3=()=>(0,u.jsxs)("svg",{className:"icon icon--grid-view",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{d:"M8 4H4.66667C4.29848 4 4 4.29848 4 4.66667V8C4 8.36819 4.29848 8.66667 4.66667 8.66667H8C8.36819 8.66667 8.66667 8.36819 8.66667 8V4.66667C8.66667 4.29848 8.36819 4 8 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M15.3333 4H12C11.6318 4 11.3333 4.29848 11.3333 4.66667V8C11.3333 8.36819 11.6318 8.66667 12 8.66667H15.3333C15.7015 8.66667 16 8.36819 16 8V4.66667C16 4.29848 15.7015 4 15.3333 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M15.3333 11.3333H12C11.6318 11.3333 11.3333 11.6318 11.3333 12V15.3333C11.3333 15.7015 11.6318 16 12 16H15.3333C15.7015 16 16 15.7015 16 15.3333V12
1C16 11.6318 15.7015 11.3333 15.3333 11.3333Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,u.jsx)("path",{d:"M8 11.3333H4.66667C4.29848 11.3333 4 11.6318 4 12V15.3333C4 15.7015 4.29848 16 4.66667 16H8C8.36819 16 8.66667 15.7015 8.66667 15.3333V12C8.66667 11.6318 8.36819 11.3333 8 11.3333Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]}),v2=()=>(0,u.jsx)("svg",{className:"icon icon--list-view",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,u.jsx)("path",{d:"M4 10H16M4 14H16M4 6H16",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),v6=()=>(0,u.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-error-500)"}),(0,u.jsx)("path",{d:"M15.4001 10.5996L10.6001 15.3996M10.6001 10.5996L15.4001 15.3996",stroke:"var(--theme-error-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),v5=()=>(0,u.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-elevation-500)"}),(0,u.jsx)("path",{d:"M13 16.1998V12.9998M13 9.7998H13.0077",stroke:"var(--theme-elevation-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),v4=()=>(0,u.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-success-500)"}),(0,u.jsx)("path",{d:"M10.6001 13.0004L12.2001 14.6004L15.4001 11.4004",stroke:"var(--theme-success-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),v8=()=>(0,u.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,u.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-warning-500)"}),(0,u.jsx)("path",{d:"M13 10V13.2M13 16.4H13.008",stroke:"var(--theme-warning-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),v9=o.createContext({addClientFunction:()=>null,removeClientFunction:()=>null}),v7=o.createContext({}),be=e=>{let t=(0,f.c)(6),{children:n}=e,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];let[a,r]=o.useState(l),i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=e=>{r(t=>{let n={...t};return n[e.key]=e.func,n})},t[1]=i):i=t[1];let s=i,c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{r(t=>{let n={...t};return delete n[e.key],n})},t[2]=c):c=t[2];let d=c,p;return t[3]!==n||t[4]!==a?(p=(0,u.jsx)(v9,{value:{addClientFunction:s,removeClientFunction:d},children:(0,u.jsx)(v7,{value:a,children:n})}),t[3]=n,t[4]=a,t[5]=p):p=t[5],p},bt=(e,t)=>{let n=(0,f.c)(6),{addClientFunction:l,removeClientFunction:a}=o.use(v9),r,i;n[0]!==l||n[1]!==t||n[2]!==e||n[3]!==a?(r=()=>(l({func:t,key:e}),()=>{a({func:t,key:e})}),i=[t,e,l,a],n[0]=l,n[1]=t,n[2]=e,n[3]=a,n[4]=r,n[5]=i):(r=n[4],i=n[5]),o.useEffect(r,i)},bn=()=>o.use(v7),bl=e=>(null==e?void 0:e.startsWith("http://"))||(null==e?void 0:e.startsWith("https://"))?e:(e=>{try{return new URL(e,window.location.origin).href}catch(t){return e}})(e),ba=e=>{var t;let{collisionRect:n,droppableContainers:l,...a}=e,o=l.find(e=>{let{id:t}=e;return"live-preview-area"===t}),r=(0,g.Qo)({...a,collisionRect:n,droppableContainers:[o]});if(0===r.length)return r;let i=null==o||null==(t=o.rect)?void 0:t.current;if(n.top>=i.top&&n.left>=i.left&&n.bottom<=i.bottom&&n.right<=i.right)return r},bo=(e,t)=>{switch(t.type){case"height":return{...e,height:t.value};case"width":return{...e,width:t.value};default:return{...e,...(null==t?void 0:t.value)||{}}}},br=e=>{let{breakpoints:t,children:n,isLivePreviewEnabled:l,isLivePreviewing:a,isPreviewEnabled:r,previewURL:s,typeofLivePreviewURL:c,url:d}=e,[p,h]=(0,o.useState)("iframe"),[m,v]=(0,o.useState)(a),b=(0,o.useMemo)(()=>[...t||[],{name:"responsive",height:"100%",label:"Responsive",width:"100%"}],[t]),[y,x]=(0,o.useState)(""),[w,j]=(0,o.useState)(s),{isPopupOpen:C,openPopupWindow:S,popupRef:k}=(e=>{let t,n,l=(0,f.c)(15),{eventType:a,onMessage:r,url:s}=e,c=(0,o.useRef)(!1),[u,d]=(0,o.useState)(!1),{config:p}=(0,i.c)(),{serverURL:h}=p,m=(0,o.useRef)(null),g,v;l[0]!==a||l[1]!==u||l[2]!==r||l[3]!==h||l[4]!==s?(g=()=>{let e=async e=>{var t,n;e.origin!==window.location.origin||e.origin!==s||e.origin!==h||"function"!=typeof r||(null==(t=e.data)?void 0:t.type)!==a||c.current||(c.current=!0,await r(null==(n=e.data)?void 0:n.searchParams),c.current=!1)};return u&&m.current&&window.addEventListener("message",e,!1),()=>{window.removeEventListener("message",e)}},v=[r,a,s,h,u],l[0]=a,l[1]=u,l[2]=r,l[3]=h,l[4]=s,l[5]=g,l[6]=v):(g=l[5],v=l[6]),(0,o.useEffect)(g,v),l[7]!==s?(t=e=>{e&&e.preventDefault();let t={height:700,left:"auto",menubar:"no",popup:"yes",toolbar:"no",top:"auto",width:800},n=Object.entries(t).reduce((e,n)=>{let[l,a]=n,o=e;if("auto"===a){if("top"===l){let e=Math.round(window.innerHeight/2-t.height/2);o+="top=".concat(e,",")}else if("left"===l){let e=Math.round(window.innerWidth/2-t.width/2);o+="left=".concat(e,",")}return o}return o+"".concat(l,"=").concat(a,",")},"").slice(0,-1);m.current=window.open(s,"_blank",n),d(!0)},l[7]=s,l[8]=t):t=l[8];let b=t,y,x;return l[9]!==u?(y=()=>{let e;return u?e=setInterval(function(){m.current.closed&&(clearInterval(e),d(!1))},1e3):clearInterval(e),()=>{e&&clearInterval(e)}},x=[u,m],l[9]=u,l[10]=y,l[11]=x):(y=l[10],x=l[11]),(0,o.useEffect)(y,x),l[12]!==u||l[13]!==b?(n={isPopupOpen:u,openPopupWindow:b,popupRef:m},l[12]=u,l[13]=b,l[14]=n):n=l[14],n})({eventType:"payload-live-preview",url:y}),[_,N]=(0,o.useState)(!1),[E,P]=(0,o.useState)(!1),{collectionSlug:D,globalSlug:T}=aD(),R=(0,o.useRef)(!0),{setPreference:A}=aS(),L=o.useRef(null),[O,F]=(0,o.useState)(),[M,I]=(0,o.useState)(1),[B,U]=(0,o.useState)({x:0,y:0}),[z,V]=o.useReducer(bo,{height:0,width:0}),[H,q]=(0,o.useState)({height:0,width:0}),[W,K]=o.useState("responsive"),Y=(0,o.useCallback)(e=>{let t;"string"==typeof e&&(t=bl(e)),t||v(!1),t!==y&&(N(!1),x(t))},[y]);(0,o.useEffect)(()=>{"string"==typeof d&&x(bl(d))},[d]);let G=(0,o.useCallback)(e=>{V({type:"width",value:e})},[V]),Q=(0,o.useCallback)(e=>{V({type:"height",value:e})},[V]);(0,o.useEffect)(()=>{let e=null==b?void 0:b.find(e=>e.name===W);e&&"responsive"!==W&&"custom"!==W&&"number"==typeof(null==e?void 0:e.width)&&"number"==typeof(null==e?void 0:e.he
1ight)&&V({type:"reset",value:{height:e.height,width:e.width}})},[W,b]),(0,o.useEffect)(()=>{let e=e=>{(null==y?void 0:y.startsWith(e.origin))&&e.data&&"object"==typeof e.data&&"payload-live-preview"===e.data.type&&e.data.ready&&N(!0)};return window.addEventListener("message",e),P(!0),()=>{window.removeEventListener("message",e)}},[y,E]);let X=(0,o.useCallback)(e=>{N(!1),h(e),"popup"===e&&S()},[S]);return(0,o.useEffect)(()=>{(C?"popup":"iframe")!==p&&X("iframe")},[p,C,X]),(0,o.useEffect)(()=>{if(R.current){R.current=!1;return}A(D?"collection-".concat(D):"global-".concat(T),{editViewType:m?"live-preview":"default"},!0)},[m,A,D,T]),(0,u.jsx)(mm,{value:{appIsReady:_,breakpoint:W,breakpoints:b,iframeRef:L,isLivePreviewEnabled:l,isLivePreviewing:m,isPopupOpen:C,isPreviewEnabled:r,listeningForMessages:E,loadedURL:O,measuredDeviceSize:H,openPopupWindow:S,popupRef:k,previewURL:w,previewWindowType:p,setAppIsReady:N,setBreakpoint:K,setHeight:Q,setIsLivePreviewing:v,setLoadedURL:F,setMeasuredDeviceSize:q,setPreviewURL:j,setPreviewWindowType:X,setSize:V,setToolbarPosition:U,setURL:Y,setWidth:G,setZoom:I,size:z,toolbarPosition:B,typeofLivePreviewURL:c,url:y,zoom:M},children:(0,u.jsx)(g.Mp,{collisionDetection:ba,onDragEnd:e=>{e.over&&"live-preview-area"===e.over.id&&U({x:B.x+e.delta.x,y:B.y+e.delta.y})},children:n})})},bi="progress-bar",bs=()=>{let e=(0,f.c)(9),{isTransitioning:t,transitionProgress:n}=e8(),[l,a]=o.useState(null),r=(0,o.useRef)(!0),i,s;if(e[0]!==t||e[1]!==n?(i=()=>{let e,l;return t?r.current?l=setTimeout(()=>{a(n),r.current=!1},150):a(n):(r.current=!0,a(1),e=setTimeout(()=>{a(null)},400)),()=>{clearTimeout(e),clearTimeout(l)}},s=[t,n],e[0]=t,e[1]=n,e[2]=i,e[3]=s):(i=e[2],s=e[3]),(0,o.useEffect)(i,s),"number"==typeof l){let t=1===l&&"".concat(bi,"--fade-out"),n;e[4]!==t?(n=[bi,t].filter(Boolean),e[4]=t,e[5]=n):n=e[5];let a=n.join(" "),o;return e[6]!==l||e[7]!==a?(o=(0,u.jsx)("div",{className:a,style:{"--transition-duration":"".concat(200,"ms")},children:(0,u.jsx)("div",{className:"".concat(bi,"__progress"),style:{width:"".concat(100*(l||0),"%")}})}),e[6]=l,e[7]=a,e[8]=o):o=e[8],o}return null},bc=(0,o.createContext)({}),bu=e=>{let t=(0,f.c)(6),{children:n,visibleEntities:l}=e,a;t[0]!==l?(a=e=>{let{collectionSlug:t,globalSlug:n}=e;return t?l.collections.includes(t):!!n&&l.globals.includes(n)},t[0]=l,t[1]=a):a=t[1];let o=a,r;return t[2]!==n||t[3]!==o||t[4]!==l?(r=(0,u.jsx)(bc,{value:{isEntityVisible:o,visibleEntities:l},children:n}),t[2]=n,t[3]=o,t[4]=l,t[5]=r):r=t[5],r},bd=()=>(0,o.use)(bc),bp=(0,o.createContext)({}),bh=e=>{let t=(0,f.c)(3),{children:n}=e,l=(0,h.useParams)(),a;return t[0]!==n||t[1]!==l?(a=(0,u.jsx)(bp,{value:l,children:n}),t[0]=n,t[1]=l,t[2]=a):a=t[2],a},bf=()=>(0,o.use)(bp),bm=(0,o.createContext)({}),bg=()=>(0,o.useContext)(bm),bv=(e,t)=>{let{timestamp:n,animationRef:l}=t;l.current=null;let{x:a,y:o,xDirection:r,yDirection:i,eventsFired:s,hasScrolled:c}=e,u=c||!!n,d=u?window.pageXOffset:0,p=u?window.pageYOffset:0,h=d-a,f=p-o,m=d/(document.body.scrollWidth-window.innerWidth)*100,g=p/(document.body.scrollHeight-window.innerHeight)*100;return{x:d,y:p,xDifference:h,yDifference:f,xDirection:h>0?"right":h<0?"left":r,yDirection:f>0?"down":f<0?"up":i,xPercentage:m,yPercentage:g,totalPercentage:(m+g)/2,eventsFired:u?s+1:s,hasScrolled:u}},bb=e=>{let{children:t}=e,n=(0,o.useRef)(null),[l,a]=(0,o.useReducer)(bv,{x:0,y:0,xDifference:0,yDifference:0,xDirection:void 0,yDirection:void 0,xPercentage:0,yPercentage:0,totalPercentage:0,eventsFired:0,hasScrolled:!1}),r=(0,o.useCallback)(e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(t=>{a({e:e,timestamp:t,animationRef:n})})},[]);return(0,o.useEffect)(()=>(window.addEventListener("scroll",r),()=>{window.removeEventListener("scroll",r)}),[r]),o.createElement(bm.Provider,{value:Object.assign({},l)},t&&t)};function by(){let e,t=(0,f.c)(6),{closeAllModals:n}=nE(),l=(0,h.usePathname)(),a;t[0]!==n?(a=()=>{n()},t[0]=n,t[1]=a):a=t[1];let r=lv(a),i=(0,o.useRef)(!0),s;return t[2]!==r?(s=()=>{if(i.current){i.current=!1;return}r()}
1,t[2]=r,t[3]=s):s=t[3],t[4]!==l?(e=[l],t[4]=l,t[5]=e):e=t[5],(0,o.useEffect)(s,e),null}var{WindowInfoProvider:bx}=tm&&"WindowInfoProvider"in tm?tm:{WindowInfoProvider:void 0},{useWindowInfo:bw}=tm&&"useWindowInfo"in tm?tm:{useWindowInfo:void 0},bj=(0,o.createContext)({searchParams:{},stringifyParams:()=>""}),bC=e=>{let{children:t}=e,n=(0,h.useSearchParams)().toString(),l=o.useMemo(()=>N.q(n,{depth:10,ignoreQueryPrefix:!0}),[n]),a=o.useCallback(e=>{let{params:t,replace:n=!1}=e;return y.A({...n?{}:l,...t},{addQueryPrefix:!0})},[l]);return(0,u.jsx)(bj,{value:{searchParams:l,stringifyParams:a},children:t})},bS=()=>(0,o.use)(bj),bk=e=>{let{config:t}=e,{admin:{toast:{duration:n,expand:l,limit:a,position:o}={}}={}}=t;return(0,u.jsx)(e6,{className:"payload-toast-container",closeButton:!0,dir:"undefined",duration:null!=n?n:4e3,expand:null!=l&&l,gap:8,icons:{error:(0,u.jsx)(v6,{}),info:(0,u.jsx)(v5,{}),success:(0,u.jsx)(v4,{}),warning:(0,u.jsx)(v8,{})},offset:"calc(var(--gutter-h) / 2)",position:null!=o?o:"bottom-right",toastOptions:{classNames:{closeButton:"payload-toast-close-button",content:"toast-content",error:"toast-error",icon:"toast-icon",info:"toast-info",success:"toast-success",title:"toast-title",toast:"payload-toast-item",warning:"toast-warning"},unstyled:!0},visibleToasts:null!=a?a:5})},b_=e=>{let t=(0,f.c)(16),{children:n,config:l,dateFNSKey:a,fallbackLang:r,isNavOpen:c,languageCode:d,languageOptions:p,locale:h,permissions:m,serverFunction:v,switchLanguageServerAction:b,theme:y,translations:x,user:w}=e,j=o.useId(),C;return t[0]!==n||t[1]!==l||t[2]!==a||t[3]!==j||t[4]!==r||t[5]!==c||t[6]!==d||t[7]!==p||t[8]!==h||t[9]!==m||t[10]!==v||t[11]!==b||t[12]!==y||t[13]!==x||t[14]!==w?(C=(0,u.jsxs)(m2,{children:[(0,u.jsx)(cs,{serverFunction:v,children:(0,u.jsx)(e5,{children:(0,u.jsx)(d9,{cachingEnabled:"true"===J.env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH,children:(0,u.jsx)(i.b,{config:l,children:(0,u.jsx)(be,{children:(0,u.jsx)(s.c,{dateFNSKey:a,fallbackLang:r,language:d,languageOptions:p,switchLanguageServerAction:b,translations:x,children:(0,u.jsx)(bx,{breakpoints:{l:"(max-width: 1440px)",m:"(max-width: 1024px)",s:"(max-width: 768px)",xs:"(max-width: 400px)"},children:(0,u.jsx)(bb,{children:(0,u.jsx)(bC,{children:(0,u.jsxs)(ln,{classPrefix:"payload",transTime:0,zIndex:"var(--z-modal)",children:[(0,u.jsx)(by,{}),(0,u.jsxs)(lx,{permissions:m,user:w,children:[(0,u.jsx)(aC,{children:(0,u.jsx)(i.i,{theme:y,children:(0,u.jsx)(bh,{children:(0,u.jsx)(lk,{locale:h,children:(0,u.jsx)(f2,{children:(0,u.jsx)(cx,{children:(0,u.jsx)(uD,{children:(0,u.jsx)(f$,{initialIsOpen:c,children:(0,u.jsx)(u4,{children:(0,u.jsx)(g.Mp,{collisionDetection:g.TT,id:j,children:n})})})})})})})})})}),(0,u.jsx)(nY,{}),(0,u.jsx)(lg,{})]})]})})})})})})})})})}),(0,u.jsx)(bk,{config:l})]}),t[0]=n,t[1]=l,t[2]=a,t[3]=j,t[4]=r,t[5]=c,t[6]=d,t[7]=p,t[8]=h,t[9]=m,t[10]=v,t[11]=b,t[12]=y,t[13]=x,t[14]=w,t[15]=C):C=t[15],C};function bN(e){let{className:t,loginWithUsername:n,operation:l,permissions:a,readOnly:o,t:r}=e;function i(e,t){return(0,j.P)({field:{name:e,type:"text"},operation:"create"===l?"create":t,parentName:"",permissions:a}).operation}let s="object"==typeof a&&"email"in a&&a.email,c="object"==typeof a&&"username"in a&&a.username,d=s?{read:i("email","read"),update:i("email","update")}:{read:!0,update:!0},p=c?{read:i("username","read"),update:i("username","update")}:{read:!0,update:!0},h=(!n||(null==n?void 0:n.requireEmail)||(null==n?void 0:n.allowEmailLogin))&&d.read,f=!!n&&p.read;if(h||f)return(0,u.jsxs)("div",{className:["login-fields",t&&t].filter(Boolean).join(" "),children:[h?(0,u.jsx)(aF,{value:"email",children:(0,u.jsx)(sX,{field:{name:"email",admin:{autoComplete:"off"},label:r("general:email"),required:!n||n&&n.requireEmail},path:"email",readOnly:o||!d.update,schemaPath:"email",validate:K.Rp})}):null,f&&(0,u.jsx)(aF,{value:"username",children:(0,u.jsx)(dx,{field:{name:"username",admin:{autoComplete:"off"},label:r("authentication:username"),required:n&&n.requireUsername},path:"username",readOnly:o||!p.update,schemaPath:"username",validate:K.Xh})})]})}var bE="select-all",bP=()=>{let e=(0,f.c)(7),{selectAll:t,toggleAll:n}=mc(),{i18n:l}=(0,s.d)(),a;if(e[0]!==l||e[1]!==t||e[2]!==n){let o,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=[bE,"".concat(bE,"__checkbox")],e[4]=o):o=e[4],e[5]!==n?(r=()=>n(),e[5]=n,e[6]=r):r=e[6],a=(0,u.jsx)(aQ,{"aria-label":t===mo.None?l.t("general:selectAllRows"):l.t("general:deselectAllRows"),checked:t===mo.AllInPage||t===mo.AllAvailable,className:o.join(" "),id:"select-all",name:"select-all",onToggle:r,partialChecked:t===mo.Some}),e[0]=l,e[1]=t,e[2]=n,e[3]=a}else a=e[3];return a},bD="select-row",bT=e=>{let t,n,l,a=(0,f.c)(13),{rowData:o}=e,{user:r}=lw(),{selected:i,setSelection:s}=mc(),c;if(a[0]!==o||a[1]!==(null==r?void 0:r.id)){c=Symbol.for("react.early_return_sentinel");e:{let{_isLocked:e,_userEditing:t}=o||{};if(e&&t&&t.id!==(null==r?void 0:r.id)){c=(0,u.jsx)(mD,{user:t});break e}}a[0]=o,a[1]=null==r?void 0:r.id,a[2]=c}else c=a[2];
1if(c!==Symbol.for("react.early_return_sentinel"))return c;a[3]!==o.id||a[4]!==i?(t=i.get(o.id),a[3]=o.id,a[4]=i,a[5]=t):t=a[5];let d=!!t,p;return a[6]===Symbol.for("react.memo_cache_sentinel")?(p=[bD,"".concat(bD,"__checkbox")],a[6]=p):p=a[6],a[7]!==o.id||a[8]!==s?(n=()=>s(o.id),a[7]=o.id,a[8]=s,a[9]=n):n=a[9],a[10]!==d||a[11]!==n?(l=(0,u.jsx)(aQ,{checked:d,className:p.join(" "),onToggle:n}),a[10]=d,a[11]=n,a[12]=l):l=a[12],l},bR=e=>{let{onClick:t}=e,{count:n,selected:l}=mc(),{t:a}=(0,s.d)();return l&&n?(0,u.jsxs)(ol,{onClick:()=>{"function"==typeof t&&t(l)},pillStyle:"white",size:"small",children:[a("general:select")," ",n]}):null},bA="collection-list";function bL(e){var t;let{AfterList:n,AfterListTable:l,beforeActions:a,BeforeList:r,BeforeListTable:c,collectionSlug:p,columnState:f,Description:m,disableBulkDelete:g,disableBulkEdit:b,disableQueryPresets:y,enableRowSelections:x,hasCreatePermission:w,hasDeletePermission:j,listMenuItems:C,newDocumentURL:S,queryPreset:k,queryPresetPermissions:_,renderedFilters:N,resolvedFilterOptions:E,Table:P,viewType:D}=e,[T]=(0,i.a)(P),{allowCreate:R,createNewDrawerSlug:A,isInDrawer:L,onBulkSelect:O}=s7(),F=void 0!==R?R&&w:w,{config:{routes:{admin:M},serverURL:I},getEntityConfig:B}=(0,i.c)(),U=(0,h.useRouter)(),{data:z,isGroupingBy:V}=cn(),{openModal:H}=nE(),{drawerSlug:q,setCollectionSlug:K,setOnSuccess:Y}=hy(),G=B({collectionSlug:p}),{labels:Q,upload:X}=G,$=!!X,Z=$&&G.upload.bulkUpload,J=!!G.trash,{i18n:ee}=(0,s.d)(),{setStepNav:et}=f1(),{breakpoints:{s:en}}=bw(),el=o.useMemo(()=>$?z.docs.map(e=>({...e,filesize:(0,W.B)(e.filesize)})):null==z?void 0:z.docs,[null==z?void 0:z.docs,$]),ea=o.useCallback(()=>{K(p),H(q),Y(()=>U.refresh())},[U,p,q,H,K,Y]);return(0,o.useEffect)(()=>{if(!L){let e={label:(0,d.s)(null==Q?void 0:Q.plural,ee),url:J&&"trash"===D?(0,v.Q)({adminRoute:M,path:"/collections/".concat(p),serverURL:I}):void 0},t={label:ee.t("general:trash")};et(J&&"trash"===D?[e,t]:[e])}},[M,et,I,Q,L,J,D,ee,p]),(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(cd,{collectionSlug:p,columnState:f,children:(0,u.jsx)("div",{className:"".concat(bA," ").concat(bA,"--").concat(p),children:(0,u.jsxs)(ms,{docs:el,totalDocs:null==z?void 0:z.totalDocs,children:[r,(0,u.jsxs)(la,{className:"".concat(bA,"__wrap"),children:[(0,u.jsx)(vt,{collectionConfig:G,Description:(0,u.jsx)("div",{className:"".concat(bA,"__sub-header"),children:(0,u.jsx)(ep,{CustomComponent:m,Fallback:(0,u.jsx)(fT,{collectionSlug:p,description:null==G||null==(t=G.admin)?void 0:t.description})})}),disableBulkDelete:g,disableBulkEdit:b,hasCreatePermission:F,hasDeletePermission:j,i18n:ee,isBulkUploadEnabled:Z&&!X.hideFileInputOnCreate,isTrashEnabled:J,newDocumentURL:S,openBulkUpload:ea,smallBreak:en,viewType:D}),(0,u.jsx)(gV,{beforeActions:x&&"function"==typeof O?a?[...a,(0,u.jsx)(bR,{onClick:O},"select-many")]:[(0,u.jsx)(bR,{onClick:O},"select-many")]:a,collectionConfig:G,collectionSlug:p,disableQueryPresets:(null==G?void 0:G.enableQueryPresets)!==!0||y,listMenuItems:C,queryPreset:k,queryPresetPermissions:_,renderedFilters:N,resolvedFilterOptions:E}),c,(null==el?void 0:el.length)>0&&(0,u.jsx)("div",{className:"".concat(bA,"__tables"),children:(0,u.jsx)(cB,{children:T})}),(null==el?void 0:el.length)===0&&(0,u.jsxs)("div",{className:"".concat(bA,"__no-results"),children:[(0,u.jsx)("p",{children:ee.t("trash"===D?"general:noTrashResults":"general:noResults",{label:(0,d.s)(null==Q?void 0:Q.plural,ee)})}),F&&S&&"trash"!==D&&(0,u.jsx)(o.Fragment,{children:L?(0,u.jsx)(tD,{el:"button",onClick:()=>H(A),children:ee.t("general:createNewLabel",{label:(0,d.s)(null==Q?void 0:Q.singular,ee)})}):(0,u.jsx)(tD,{el:"link",to:S,children:ee.t("general:createNewLabel",{label:(0,d.s)(null==Q?void 0:Q.singular,ee)})})})]}),l,(null==el?void 0:el.length)>0&&!V&&(0,u.jsx)(vc,{AfterPageControls:en?(0,u.jsxs)("div",{className:"".concat(bA,"__list-selection"),children:[(0,u.jsx)(gZ,{collectionConfig:G,disableBulkDelete:g,disableBulkEdit:b,label:(0,d.s)(G.labels.plural,ee),showSelectAllAcrossPages:!V}),(0,u.jsx)("div",{className:"".concat(bA,"__list-selection-actions"),children:x&&"function"==typeof O?a?[...a,(0,u.jsx)(bR,{onClick:O},"select-many")]:[(0,u.jsx)(bR,{onClick:O},"select-many")]:a})]}):null,collectionConfig:G})]}),n]})})}),(null==el?void 0:el.length)>0&&V&&z.totalPages>1&&(0,u.jsx)(vu,{children:(0,u.jsx)(vc,{collectionConfig:G})})]})}var bO="move-to-folder--current-folder",bF="confirm-many-delete";function bM(e){let{className:t}=e,n=(0,h.useRouter)(),{startRouteTransition:l}=e8(),{breadcrumbs:a,currentFolder:r,folderCollectionConfig:c,folderCollectionSlug:p,folderFieldName:f,folderID:m,getFolderRoute:g,moveToFolder:v}=d4(),[b,,{closeDrawer:y,openDrawer:x}]=cO({id:m,collectionSlug:p}),{clearRouteCache:w}=d7(),{config:j}=(0,i.c)(),{routes:C,serverURL:S}
1=j,{closeModal:k,openModal:_}=nE(),{i18n:N,t:E}=(0,s.d)(),P=o.useCallback(async()=>{await fetch("".concat(S).concat(C.api,"/").concat(p,"/").concat(m,"?depth=0"),{credentials:"include",method:"DELETE"}),l(()=>{var e;n.push(g((null==(e=a[a.length-2])?void 0:e.id)||null))})},[a,p,m,g,n,S,C.api,l]);return m?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(t_,{button:(0,u.jsx)(gs,{}),className:["current-folder-actions",t].filter(Boolean).join(" "),render:()=>(0,u.jsxs)(tc.ButtonGroup,{children:[(0,u.jsx)(tc.Button,{onClick:()=>{x()},children:E("general:editLabel",{label:(0,d.s)(c.labels.singular,N)})}),(0,u.jsx)(tc.Button,{onClick:()=>{_(bO)},children:E("folder:moveFolder")}),(0,u.jsx)(tc.Button,{onClick:()=>{_(bF)},children:E("folder:deleteFolder")})]})}),(0,u.jsx)(pg,{action:"moveItemToFolder",drawerSlug:bO,folderAssignedCollections:null==r?void 0:r.value.folderType,folderCollectionSlug:p,folderFieldName:f,fromFolderID:null==r?void 0:r.value.id,fromFolderName:null==r?void 0:r.value._folderOrDocumentTitle,itemsToMove:[r],onConfirm:async e=>{let{id:t,name:n}=e;await v({itemsToMove:[r],toFolderID:t}),t?eJ.success(E("folder:itemHasBeenMoved",{folderName:'"'.concat(n,'"'),title:r.value._folderOrDocumentTitle})):eJ.success(E("folder:itemHasBeenMovedToRoot",{title:r.value._folderOrDocumentTitle})),k(bO)},title:r.value._folderOrDocumentTitle}),(0,u.jsx)(lf,{body:(0,u.jsx)(pc,{elements:{1:e=>{let{children:t}=e;return(0,u.jsx)("strong",{children:t})}},i18nKey:"general:aboutToDelete",t:E,variables:{label:(0,d.s)(c.labels.singular,N),title:r.value._folderOrDocumentTitle}}),confirmingLabel:E("general:deleting"),heading:E("general:confirmDeletion"),modalSlug:bF,onConfirm:P}),(0,u.jsx)(b,{onSave:()=>{y(),w()}})]}):null}var bI="drag-overlay-selection";function bB(e){let{item:t,selectedCount:n}=e;return(0,u.jsx)(g.Hd,{dropAnimation:null,modifiers:[bU],style:{height:"unset",maxWidth:"220px"},children:(0,u.jsxs)("div",{className:"".concat(bI,"__cards"),children:[Array.from({length:n>1?2:1}).map((e,n)=>(0,u.jsx)("div",{className:"".concat(bI,"__card"),style:{right:"".concat(3*n,"px"),top:"-".concat(3*n,"px")},children:(0,u.jsx)(vI,{id:null,isSelected:!0,itemKey:"overlay-card",title:t.value._folderOrDocumentTitle,type:"folder"})},n)),n>1?(0,u.jsx)("span",{className:"".concat(bI,"__card-count"),children:n}):null]})})}var bU=e=>{let{activatorEvent:t,draggingNodeRect:n,transform:l}=e;if(n&&t){let e=function(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=tz(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}(t);if(!e)return l;let a=e.x-n.left,o=e.y-n.top;return{...l,x:l.x+a+5,y:l.y+o+5}}return l},bz="sort-by-pill",bV=[{label:e=>e("general:name"),value:"name"},{label:e=>e("general:createdAt"),value:"createdAt"},{label:e=>e("general:updatedAt"),value:"updatedAt"}],bH=[{label:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(h3,{}),e("general:ascending")]}),value:"asc"},{label:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(h1,{}),e("general:descending")]}),value:"desc"}];function bq(){let{refineFolderData:e,sort:t}=d4(),{t:n}=(0,s.d)(),l=t.startsWith("-")?"desc":"asc",[a]=bV.filter(e=>{let{value:n}=e;return n===(t.startsWith("-")?t.slice(1):t)})||bV,[o]=bH.filter(e=>{let{value:t}=e;return t===l});return(0,u.jsx)(t_,{button:(0,u.jsxs)(ol,{className:"".concat(bz,"__trigger"),icon:(0,u.jsx)(ta,{}),size:"small",children:["asc"===l?(0,u.jsx)(h3,{className:"".concat(bz,"__sort-icon")}):(0,u.jsx)(h1,{className:"".concat(bz,"__sort-icon")}),null==a?void 0:a.label(n)]}),className:bz,horizontalAlign:"right",render:t=>{let{close:r}=t;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(tc.GroupLabel,{label:"Sort by"}),(0,u.jsx)(tc.ButtonGroup,{children:bV.map(t=>{let{label:o,value:i}=t;return(0,u.jsx)(tc.Button,{active:(null==a?void 0:a.value)===i,onClick:()=>{e({query:{page:"1",sort:"desc"===l?"-".concat(i):i},updateURL:!0}),r()},children:o(n)},i)})}),(0,u.jsx)(tc.Divider,{}),(0,u.jsx)(tc.GroupLabel,{label:"Order"}),(0,u.jsx)(tc.ButtonGroup,{children:bH.map(t=>{let{label:i,value:s}=t;return(0,u.jsx)(tc.Button,{active:(null==o?void 0:o.value)===s,className:"".concat(bz,"__order-option"),onClick:()=>{l!==s&&(e({query:{page:"1",sort:"desc"===s?"-".concat(null==a?void 0:a.value):null==a?void 0:a.value},updateURL:!0}),r())},children:i(n)},s)})})]})},showScrollbar:!0,verticalAlign:"bottom"})}var bW="folder-view-toggle-button";function bK(e){let{activeView:t,setActiveView:n}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(tD,{buttonStyle:"pill",className:[bW,"grid"===t&&"".concat(bW,"--active")].filter(
1Boolean).join(" "),icon:(0,u.jsx)(v3,{}),margin:!1,onClick:()=>{n("grid")}}),(0,u.jsx)(tD,{buttonStyle:"pill",className:[bW,"list"===t&&"".concat(bW,"--active")].filter(Boolean).join(" "),icon:(0,u.jsx)(v2,{}),margin:!1,onClick:()=>{n("list")}})]})}var bY=e=>{let{id:t,folderCollectionSlug:n}=e,{clearRouteCache:l}=d7(),{t:a}=(0,s.d)(),[o,,{closeDrawer:r,openDrawer:i}]=cO({id:t,collectionSlug:n});return t?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(mp,{onClick:i,type:"button",children:a("general:edit")}),(0,u.jsx)(o,{onSave:()=>{r(),l()}})]}):null},bG="move-to-folder--list",bQ=e=>{var t,n,l,a;let r=(0,f.c)(17),{disableBulkDelete:c,disableBulkEdit:d,folderAssignedCollections:p}=e,{clearSelections:h,currentFolder:m,folderCollectionSlug:g,folderFieldName:v,folderID:b,getSelectedItems:y,moveToFolder:x}=d4(),{clearRouteCache:w}=d7(),{config:j}=(0,i.c)(),{t:C}=(0,s.d)(),{closeModal:S,openModal:k}=nE(),_,N;if(r[0]!==w||r[1]!==h||r[2]!==S||r[3]!==j||r[4]!==(null==m||null==(t=m.value)?void 0:t._folderOrDocumentTitle)||r[5]!==c||r[6]!==d||r[7]!==p||r[8]!==g||r[9]!==v||r[10]!==b||r[11]!==y||r[12]!==x||r[13]!==k||r[14]!==C){N=Symbol.for("react.early_return_sentinel");e:{let e=y(),t=e.reduce(bX,{}),n=e.length,r=1===Object.keys(t).length&&Object.keys(t)[0]!==g,i=r?j.collections.find(e=>e.slug===Object.keys(t)[0]):null;if(0===n){N=null;break e}let s=r&&(null==(l=t[Object.keys(t)[0]])?void 0:l.ids)||[];_=(0,u.jsx)(md,{count:n,ListActions:[n>0&&(0,u.jsx)(mp,{onClick:()=>h(),children:C("general:clearAll")},"clear-all")].filter(Boolean),SelectionActions:[!d&&s.length&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(gn,{collection:i,count:n,ids:s,selectAll:!1}),(0,u.jsx)(gW,{collection:i,count:n,ids:s,selectAll:!1}),(0,u.jsx)(g$,{collection:i,count:n,ids:s,selectAll:!1})]},"bulk-actions"),1===n&&!r&&(0,u.jsx)(bY,{folderCollectionSlug:g,id:t[g].ids[0]},"edit-folder-action"),n>0?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(mp,{onClick:()=>{k(bG)},type:"button",children:C("general:move")}),(0,u.jsx)(pg,{action:"moveItemsToFolder",drawerSlug:bG,folderAssignedCollections:p,folderCollectionSlug:g,folderFieldName:v,fromFolderID:b,fromFolderName:null==m||null==(a=m.value)?void 0:a._folderOrDocumentTitle,itemsToMove:y(),onConfirm:async e=>{let{id:t,name:l}=e;await x({itemsToMove:y(),toFolderID:t}),t?eJ.success(C("folder:itemsMovedToFolder",{folderName:'"'.concat(l,'"'),title:"".concat(n," ").concat(n>1?C("general:items"):C("general:item"))})):eJ.success(C("folder:itemsMovedToRoot",{title:"".concat(n," ").concat(n>1?C("general:items"):C("general:item"))})),w(),S(bG)}})]},bG):null,!c&&(0,u.jsx)(mf,{afterDelete:()=>{w(),h()},selections:t},"bulk-delete")].filter(Boolean)})}r[0]=w,r[1]=h,r[2]=S,r[3]=j,r[4]=null==m||null==(n=m.value)?void 0:n._folderOrDocumentTitle,r[5]=c,r[6]=d,r[7]=p,r[8]=g,r[9]=v,r[10]=b,r[11]=y,r[12]=x,r[13]=k,r[14]=C,r[15]=_,r[16]=N}else _=r[15],N=r[16];return N!==Symbol.for("react.early_return_sentinel")?N:_};function bX(e,t){return t&&(e[t.relationTo]?(e[t.relationTo].ids.push((0,H.r)(t.value)),e[t.relationTo].totalCount=e[t.relationTo].totalCount+1):e[t.relationTo]={ids:[(0,H.r)(t.value)],totalCount:1}),e}var b$="collection-folder-list";function bZ(e){let{allCollectionFolderSlugs:t,allowCreateCollectionSlugs:n,baseFolderPath:l,breadcrumbs:a,documents:o,folderFieldName:r,folderID:i,FolderResultsComponent:s,search:c,sort:d,subfolders:p,...h}=e;return(0,u.jsx)(d5,{allCollectionFolderSlugs:t,allowCreateCollectionSlugs:n,baseFolderPath:l,breadcrumbs:a,documents:o,folderFieldName:r,folderID:i,FolderResultsComponent:s,search:c,sort:d,subfolders:p,children:(0,u.jsx)(bJ,{...h})})}function bJ(e){var t,n,l,a;let r=(0,f.c)(6),{AfterFolderList:c,AfterFolderListTable:p,BeforeFolderList:m,BeforeFolderListTable:g,collectionSlug:b,Description:y,disableBulkDelete:x,disableBulkEdit:w,search:j,viewPreference:C}=e,{config:S,getEntityConfig:k}=(0,i.c)(),{i18n:_,t:N}=(0,s.d)(),E=ns(),{setStepNav:P}=f1(),{setPreference:D}=aS(),{allowCreateCollectionSlugs:T,breadcrumbs:R,documents:A,dragOverlayItem:L,folderCollectionConfig:O,folderCollectionSlug:F,FolderResultsComponent:M,folderType:I,getSelectedItems:B,moveToFolder:U,refineFolderData:z,selectedItemKeys:V,setIsDragging:H,subfolders:q}=d4(),W=(0,h.useRouter)(),{startRouteTransition:K}=e8(),{clearRouteCache:Y}=d7(),G=k({collectionSlug:b}),{labels:Q,upload:X}=G,$=!!X&&G.upload.bulkUpload,{breakpoints:Z}=bw(),{s:J}=Z,ee;r[0]!==Y||r[1]!==B||r[2]!==U?(ee=async e=>{if(e.over&&"folder"===e.over.data.current.type&&"id"in e.over.data.current){try{await U({itemsToMove:B(),toFolderID:e.over.data.current.id})}catch(e){console.error("Error moving items:",e)}Y()}},r[0]=Y,r[1]=B,r[2]=U,r[3]=ee):ee=r[3];let et=ee,en=async e=>{await D("".concat(b,"-collection-folder"),{viewPreference:e}),Y()};o.useEffect(()=>{E||P([R.length?{label:(0,u.jsxs)(pp,{className:["".concat(b$,"__step-nav-droppable"),"".concat(b$,"__step-nav-icon-label")].filter(
1Boolean).join(" "),id:null,onClick:()=>{K(()=>{S.folders&&W.push((0,v.Q)({adminRoute:S.routes.admin,path:"/collections/".concat(b,"/").concat(S.folders.slug),serverURL:S.serverURL}))})},children:[(0,u.jsx)(ph,{}),(0,d.s)(null==Q?void 0:Q.plural,_)]},"root")}:{label:(0,u.jsxs)("div",{className:"".concat(b$,"__step-nav-icon-label"),children:[(0,u.jsx)(ph,{}),(0,d.s)(null==Q?void 0:Q.plural,_)]},"root")},...R.map((e,t)=>({label:t===R.length-1?e.name:(0,u.jsx)(pp,{className:"".concat(b$,"__step-nav-droppable"),id:e.id,onClick:()=>{K(()=>{S.folders&&W.push((0,v.Q)({adminRoute:S.routes.admin,path:"/collections/".concat(b,"/").concat(S.folders.slug,"/").concat(e.id),serverURL:S.serverURL}))})},children:e.name},e.id)}))])},[R,b,S.folders,S.routes.admin,S.serverURL,E,_,null==Q?void 0:Q.plural,W,P,K]);let el=A.length+q.length,ea;return r[4]!==z?(ea=e=>z({query:{search:e},updateURL:!0}),r[4]=z,r[5]=ea):ea=r[5],(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(b0,{onDragEnd:et,setIsDragging:H}),(0,u.jsxs)("div",{className:"".concat(b$," ").concat(b$,"--").concat(b),children:[m,(0,u.jsxs)(la,{className:"".concat(b$,"__wrap"),children:[(0,u.jsx)(g2,{Actions:[!J&&(0,u.jsx)(bQ,{disableBulkDelete:x,disableBulkEdit:null!=(a=G.disableBulkEdit)?a:w,folderAssignedCollections:Array.isArray(I)?I:[b]},"list-selection"),(0,u.jsx)(g1,{collectionConfig:G,config:S,viewType:"folders"},"default-list-actions")].filter(Boolean),AfterListHeaderContent:y,title:(0,d.s)(null==Q?void 0:Q.plural,_),TitleActions:[T.length&&(0,u.jsx)(po,{buttonLabel:T.length>1?N("general:createNew"):"".concat(N("general:create")," ").concat((0,d.s)(null==(t=O.labels)?void 0:t.singular,_).toLowerCase()),collectionSlugs:T,folderAssignedCollections:Array.isArray(I)?I:[b],onCreateSuccess:Y,slugPrefix:"create-document--header-pill"},"create-new-button"),(0,u.jsx)(g4,{collectionSlug:b,hasCreatePermission:T.includes(b),isBulkUploadEnabled:$},"bulk-upload-button")].filter(Boolean)}),(0,u.jsx)(gj,{Actions:[(0,u.jsx)(bq,{},"sort-by-pill"),(0,u.jsx)(bK,{activeView:C,setActiveView:en},"toggle-view-buttons"),(0,u.jsx)(bM,{},"current-folder-actions")].filter(Boolean),label:N("general:searchBy",{label:N("general:name")}),onSearchChange:ea,searchQueryParam:j}),g,el>0&&M,0===el&&(0,u.jsx)(pi,{Actions:[T.includes(F)&&(0,u.jsx)(po,{buttonLabel:"".concat(N("general:create")," ").concat((0,d.s)(null==(n=O.labels)?void 0:n.singular,_).toLowerCase()),collectionSlugs:[O.slug],folderAssignedCollections:Array.isArray(I)?I:[b],onCreateSuccess:Y,slugPrefix:"create-folder--no-results"},"create-folder"),T.includes(b)&&(0,u.jsx)(po,{buttonLabel:"".concat(N("general:create")," ").concat(N("general:document").toLowerCase()),collectionSlugs:[b],folderAssignedCollections:Array.isArray(I)?I:[b],onCreateSuccess:Y,slugPrefix:"create-document--no-results"},"create-document")].filter(Boolean),Message:(0,u.jsx)("p",{children:_.t("general:noResults",{label:"".concat((0,d.s)(null==Q?void 0:Q.plural,_)," ").concat(N("general:or").toLowerCase()," ").concat((0,d.s)(null==(l=O.labels)?void 0:l.plural,_))})})}),p]}),c]}),V.size>0&&L&&(0,u.jsx)(bB,{item:L,selectedCount:V.size})]})}function b0(e){let t=(0,f.c)(3),{onDragEnd:n,setIsDragging:l}=e,a;return t[0]!==n||t[1]!==l?(a={onDragCancel(){l(!1)},onDragEnd(e){l(!1),n(e)},onDragStart(){l(!0)}},t[0]=n,t[1]=l,t[2]=a):a=t[2],(0,g.E5)(a),null}var b1="checkbox-popup";function b3(e){let{Button:t,className:n,onChange:l,options:a,selectedValues:o,...r}=e;return(0,u.jsx)(t_,{button:t,className:[b1,n].filter(Boolean).join(" "),horizontalAlign:"right",render:e=>{let{close:t}=e;return(0,u.jsx)("div",{className:"".concat(b1,"__options"),children:a.map(e=>{let{label:n,value:a}=e;return(0,u.jsx)(aQ,{checked:null==o?void 0:o.includes(a),label:n,onToggle:()=>{l({close:t,selectedValues:(null==o?void 0:o.includes(a))?o.filter(e=>e!==a):[...o,a]})}},a)})})},showScrollbar:!0,verticalAlign:"bottom",...r})}function b2(){let e=(0,f.c)(13),{activeCollectionFolderSlugs:t,allCollectionFolderSlugs:n,folderCollectionSlug:l,refineFolderData:a}=d4(),{i18n:r,t:c}=(0,s.d)(),{config:p,getEntityConfig:h}=(0,i.c)(),m;e[0]!==p||e[1]!==l||e[2]!==n||e[3]!==h||e[4]!==r?(m=()=>{var e;return p.collections.reduce((e,t)=>
1{var l;return t.folders&&n.includes(t.slug)&&e.push({label:(0,d.s)(null==(l=t.labels)?void 0:l.plural,r),value:t.slug}),e},[{label:(0,d.s)(null==(e=h({collectionSlug:l}).labels)?void 0:e.plural,r),value:l}])},e[0]=p,e[1]=l,e[2]=n,e[3]=h,e[4]=r,e[5]=m):m=e[5];let[g]=o.useState(m),v;if(e[6]!==g||e[7]!==a||e[8]!==c||e[9]!==t){let n;e[11]!==a?(n=e=>{let{selectedValues:t}=e;a({query:{relationTo:t},updateURL:!0})},e[11]=a,e[12]=n):n=e[12],v=(0,u.jsx)(b3,{Button:(0,u.jsxs)(tD,{buttonStyle:"pill",el:"div",icon:"chevron",margin:!1,size:"small",children:[t.length?(0,u.jsx)("span",{className:"".concat("collection-type","__count"),children:t.length}):null,c("version:type")]}),onChange:n,options:g,selectedValues:t},"relation-to-selection-popup"),e[6]=g,e[7]=a,e[8]=c,e[9]=t,e[10]=v}else v=e[10];return v}var b6="folder-list";function b5(e){let{activeCollectionFolderSlugs:t,allCollectionFolderSlugs:n,allowCreateCollectionSlugs:l,baseFolderPath:a,breadcrumbs:o,documents:r,folderFieldName:i,folderID:s,FolderResultsComponent:c,search:d,subfolders:p,...h}=e;return(0,u.jsx)(d5,{activeCollectionFolderSlugs:t,allCollectionFolderSlugs:n,allowCreateCollectionSlugs:l,baseFolderPath:a,breadcrumbs:o,documents:r,folderFieldName:i,folderID:s,FolderResultsComponent:c,search:d,subfolders:p,children:(0,u.jsx)(b4,{...h})})}function b4(e){var t,n;let l=(0,f.c)(24),{AfterFolderList:a,AfterFolderListTable:r,BeforeFolderList:c,BeforeFolderListTable:p,Description:m,disableBulkDelete:g,disableBulkEdit:v,folderAssignedCollections:b,viewPreference:y}=e,x=(0,h.useRouter)(),{getEntityConfig:w}=(0,i.c)(),{i18n:j,t:C}=(0,s.d)(),S=ns(),{setStepNav:k}=f1(),{startRouteTransition:_}=e8(),{clearRouteCache:N}=d7(),{breakpoints:E}=bw(),{s:P}=E,{setPreference:D}=aS(),{activeCollectionFolderSlugs:T,allowCreateCollectionSlugs:R,breadcrumbs:A,documents:L,dragOverlayItem:O,folderCollectionConfig:F,folderID:M,folderType:I,getFolderRoute:B,getSelectedItems:U,moveToFolder:z,refineFolderData:V,search:H,selectedItemKeys:q,setIsDragging:W,subfolders:K}=d4(),[Y,G]=o.useState(y||"grid"),Q;l[0]!==A||l[1]!==F||l[2]!==j||l[3]!==C?(Q=()=>{var e;return C("folder:searchByNameInFolder",{folderName:0===A.length?(0,d.s)(null==(e=F.labels)?void 0:e.plural,j):A[A.length-1].name})},l[0]=A,l[1]=F,l[2]=j,l[3]=C,l[4]=Q):Q=l[4];let[X]=o.useState(Q),$;l[5]!==N||l[6]!==U||l[7]!==z?($=async e=>{e.over&&"folder"===e.over.data.current.type&&"id"in e.over.data.current&&(await z({itemsToMove:U(),toFolderID:e.over.data.current.id||null}),N())},l[5]=N,l[6]=U,l[7]=z,l[8]=$):$=l[8];let Z=$,J=L.length+K.length,ee=A.length?A[A.length-1].name:C("folder:browseByFolder"),et;l[9]!==w||l[10]!==j||l[11]!==C?(et=(e,t,n,l)=>{var a,o,r;let i=w({collectionSlug:t});return 0===n?(0,d.s)(null==(a=i.labels)?void 0:a.plural,j):n===l.length-1?"".concat(e," ").concat(C("general:or").toLowerCase()," ").concat((0,d.s)(null==(o=i.labels)?void 0:o.plural,j)):"".concat(e,", ").concat((0,d.s)(null==(r=i.labels)?void 0:r.plural,j))},l[9]=w,l[10]=j,l[11]=C,l[12]=et):et=l[12];let en=T.reduce(et,""),el,ea;l[13]!==A||l[14]!==S||l[15]!==B||l[16]!==x||l[17]!==k||l[18]!==_||l[19]!==C?(el=()=>{S||k([A.length?{label:(0,u.jsxs)(pp,{className:["".concat(b6,"__step-nav-droppable"),"".concat(b6,"__step-nav-icon-label")].filter(Boolean).join(" "),id:null,onClick:()=>{_(()=>{x.push(B(null))})},children:[(0,u.jsx)(ph,{}),C("folder:browseByFolder")]},"root")}:{label:(0,u.jsxs)("div",{className:"".concat(b6,"__step-nav-icon-label"),children:[(0,u.jsx)(ph,{}),C("folder:browseByFolder")]},"root")},...A.map((e,t)=>({label:t===A.length-1?e.name:(0,u.jsx)(pp,{className:"".concat(b6,"__step-nav-droppable"),id:e.id,onClick:()=>{_(()=>{x.push(B(e.id))})},children:e.name},e.id)}))])},ea=[A,S,B,x,k,_,C],l[13]=A,l[14]=S,l[15]=B,l[16]=x,l[17]=k,l[18]=_,l[19]=C,l[20]=el,l[21]=ea):(el=l[20],ea=l[21]),o.useEffect(el,ea);let eo=R.filter(e=>e!==F.slug),er;return l[22]!==V?(er=e=>V({query:{search:e},updateURL:!0}),l[22]=V,l[23]=er):er=l[23],(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(b8,{onDragEnd:Z,setIsDragging:W}),(0,u.jsxs)("div",{className:"".concat(b6," ").concat(b6,"--folders"),children:[c,(0,u.jsxs)(la,{className:"".concat(b6,"__wrap"),children:[(0,u.jsx)(g2,{Actions:[!P&&(0,u.jsx)(bQ,{disableBulkDelete:g,disableBulkEdit:v,folderAssignedCollections:b}
1,"list-selection")].filter(Boolean),AfterListHeaderContent:m,title:ee,TitleActions:[R.length&&(0,u.jsx)(po,{buttonLabel:R.length>1?C("general:createNew"):"".concat(C("general:create")," ").concat((0,d.s)(null==(t=F.labels)?void 0:t.singular,j).toLowerCase()),collectionSlugs:R,folderAssignedCollections:Array.isArray(I)?I:[],onCreateSuccess:N,slugPrefix:"create-document--header-pill"},"create-new-button")].filter(Boolean)}),(0,u.jsx)(gj,{Actions:[(0,u.jsx)(bq,{},"sort-by-pill"),M&&(0,u.jsx)(b2,{},"collection-type"),(0,u.jsx)(bK,{activeView:Y,setActiveView:e=>{D("browse-by-folder",{viewPreference:e}),G(e)}},"toggle-view-buttons"),(0,u.jsx)(bM,{},"current-folder-actions")].filter(Boolean),label:X,onSearchChange:er,searchQueryParam:H}),p,J>0&&(0,u.jsx)(u.Fragment,{children:"grid"===Y?(0,u.jsxs)("div",{children:[K.length?(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(vV,{items:K,title:"Folders",type:"folder"})}):null,L.length?(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(vV,{items:L,subfolderCount:K.length,title:"Documents",type:"file"})}):null]}):(0,u.jsx)(vL,{})}),0===J&&(0,u.jsx)(pi,{Actions:[R.includes(F.slug)&&(0,u.jsx)(po,{buttonLabel:"".concat(C("general:create")," ").concat((0,d.s)(null==(n=F.labels)?void 0:n.singular,j).toLowerCase()),collectionSlugs:[F.slug],folderAssignedCollections:Array.isArray(I)?I:[],onCreateSuccess:N,slugPrefix:"create-folder--no-results"},"create-folder"),M&&eo.length>0&&(0,u.jsx)(po,{buttonLabel:"".concat(C("general:create")," ").concat(C("general:document").toLowerCase()),collectionSlugs:eo,folderAssignedCollections:Array.isArray(I)?I:[],onCreateSuccess:N,slugPrefix:"create-document--no-results"},"create-document")].filter(Boolean),Message:(0,u.jsx)("p",{children:j.t("general:noResults",{label:en})})}),r]}),a]}),q.size>0&&O&&(0,u.jsx)(bB,{item:O,selectedCount:q.size})]})}function b8(e){let t=(0,f.c)(3),{onDragEnd:n,setIsDragging:l}=e,a;return t[0]!==n||t[1]!==l?(a={onDragCancel(){l(!1)},onDragEnd(e){l(!1),n(e)},onDragStart(){l(!0)}},t[0]=n,t[1]=l,t[2]=a):a=t[2],(0,g.E5)(a),null}var b9="leave-without-saving-doc-drawer",b7=e=>{let t=(0,f.c)(15),{AfterHeader:n,drawerSlug:l,showDocumentID:a}=e,o=void 0===a||a,{closeModal:r,openModal:i}=nE(),{t:c}=(0,s.d)(),d=eO(),p;t[0]!==r||t[1]!==l||t[2]!==d||t[3]!==i?(p=()=>{d?i(b9):r(l)},t[0]=r,t[1]=l,t[2]=d,t[3]=i,t[4]=p):p=t[4];let h=p,m;if(t[5]!==n||t[6]!==r||t[7]!==l||t[8]!==h||t[9]!==o||t[10]!==c){let e;t[12]!==r||t[13]!==l?(e=()=>r(l),t[12]=r,t[13]=l,t[14]=e):e=t[14],m=(0,u.jsxs)(la,{className:"".concat(cR,"__header"),children:[(0,u.jsxs)("div",{className:"".concat(cR,"__header-content"),children:[(0,u.jsx)("h2",{className:"".concat(cR,"__header-text"),children:(0,u.jsx)(vK,{element:"span"})}),(0,u.jsx)("button",{"aria-label":c("general:close"),className:"".concat(cR,"__header-close"),onClick:h,type:"button",children:(0,u.jsx)(s.a,{})})]}),o&&(0,u.jsx)(ye,{}),n?(0,u.jsx)("div",{className:"".concat(cR,"__after-header"),children:n}):null,(0,u.jsx)(fS,{modalSlug:b9,onConfirm:e})]}),t[5]=n,t[6]=r,t[7]=l,t[8]=h,t[9]=o,t[10]=c,t[11]=m}else m=t[11];return m},ye=()=>{let e=(0,f.c)(3),{id:t}=aD(),{title:n}=ay(),l;return e[0]!==t||e[1]!==n?(l=t&&t!==n?(0,u.jsx)(vq,{id:t.toString()}):null,e[0]=t,e[1]=n,e[2]=l):l=e[2],l},yt=e=>{let{children:t}=e,n=o.useRef(null),l=o.useRef(null),{breakpoint:a,setMeasuredDeviceSize:r,size:i,zoom:s}=mg(),{size:c}=hJ(n.current),{size:d}=hJ(l.current);(0,o.useEffect)(()=>{c&&r(c)},[c,r]);let p="0",h="0";if(a&&"responsive"!==a&&(p="-50%",i&&c&&"number"==typeof s&&"number"==typeof i.width&&"number"==typeof i.height&&"number"==typeof c.width&&"number"==typeof c.height)){h="0 auto";let e=i.width/s,t=c.width*s,n=e-i.width;if(t>d.width)if(s>1){let e=c.width-d.width;p=e<0?"".concat(e/2,"px"):"0"}else p="0";else s>=1?p="".concat(n/2,"px"):(p="".concat((d.width-t)/2,"px"),h="0")}let f=s?"".concat(100/s,"%"):"100%",m=s?"".concat(100/s,"%"):"100%";return"responsive"!==a&&(f="".concat((null==i?void 0:i.width)/("number"==typeof s?s:1),"px"),m="".concat((null==i?void 0:i.height)/("number"==typeof s?s:1),"px")),(0,u.jsx)("div",{ref:l,style:{height:"100%",width:"100%"},children:(0,u.jsx)("div",{ref:n,style:{height:m,margin:h,transform:"translate3d(".concat(p,", 0, 0)"),width:f},children:t})})},yn=()=>{let e=(0,f.c)(8),{iframeRef:t,setLoadedURL:n,url:l,zoom:a}=mg(),o;e[0]!==n||e[1]!==l?(o=()=>{n(l)},e[0]=n,e[1]=l,e[2]=o):o=e[2];let r="number"==typeof a?"scale(".concat(a,") "):void 0,i;return e[3]!==t||e[4]!==o||e[5]!==r||e[6]!==l?(i=(0,u.jsx)("iframe",{className:"live-preview-iframe",onLoad:o,ref:t,src:l,style:{transform:r},title:l},l),e[3]=t,e[4]=o,e[5]=r,e[6]=l,e[7]=i):i=e[7],i},yl=e=>{let t=(0,f.c)(18),{axis:n}=e,{breakpoint:l,measuredDeviceSize:a,setBreakpoint:r,setSize:i,size:s,zoom:c}
1=mg(),[d,p]=o.useState(("x"===n?null==a?void 0:a.width:null==a?void 0:a.height)||0),h;t[0]!==n||t[1]!==(null==a?void 0:a.height)||t[2]!==(null==a?void 0:a.width)||t[3]!==r||t[4]!==i||t[5]!==c?(h=e=>{let t=Number(e.target.value);t<0&&(t=0),p(t),r("custom"),i({type:"reset",value:{height:"y"===n?t:Number(null==a?void 0:a.height.toFixed(0))*c,width:"x"===n?t:Number(null==a?void 0:a.width.toFixed(0))*c}})},t[0]=n,t[1]=null==a?void 0:a.height,t[2]=null==a?void 0:a.width,t[3]=r,t[4]=i,t[5]=c,t[6]=h):h=t[6];let m=h,g,v;t[7]!==n||t[8]!==l||t[9]!==a||t[10]!==s||t[11]!==c?(g=()=>{"responsive"===l&&a&&p("x"===n?Number(a.width.toFixed(0))*c:Number(a.height.toFixed(0))*c),"responsive"!==l&&s&&p("x"===n?s.width:s.height)},v=[l,n,a,s,c],t[7]=n,t[8]=l,t[9]=a,t[10]=s,t[11]=c,t[12]=g,t[13]=v):(g=t[12],v=t[13]),(0,o.useEffect)(g,v);let b="x"===n?"live-preview-width":"live-preview-height",y=d||0,x;return t[14]!==m||t[15]!==b||t[16]!==y?(x=(0,u.jsx)("input",{className:"toolbar-input",min:0,name:b,onChange:m,step:1,type:"number",value:y}),t[14]=m,t[15]=b,t[16]=y,t[17]=x):x=t[17],x},ya="live-preview-toolbar-controls",yo=[50,75,100,125,150,200],yr=()=>{let e=(0,f.c)(14),{breakpoint:t,breakpoints:n,setBreakpoint:l,setPreviewWindowType:a,setZoom:r,url:i,zoom:c}=mg(),{t:d}=(0,s.d)(),p;if(e[0]!==t||e[1]!==n||e[2]!==l||e[3]!==a||e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c){var h,m;let f,g={label:d("general:custom"),value:"custom"},v;e[9]!==r||e[10]!==c?(v=e=>{let{close:t}=e;return(0,u.jsx)(tc.ButtonGroup,{children:(0,u.jsx)(o.Fragment,{children:yo.map(e=>(0,u.jsxs)(tc.Button,{active:100*c==e,onClick:()=>{r(e/100),t()},children:[e,"%"]},e))})})},e[9]=r,e[10]=c,e[11]=v):v=e[11],e[12]!==a?(f=e=>{e.preventDefault(),a("popup")},e[12]=a,e[13]=f):f=e[13],p=(0,u.jsxs)("div",{className:ya,children:[(null==n?void 0:n.length)>0&&(0,u.jsx)(t_,{button:(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)("span",{children:null!=(m=null==(h=n.find(e=>e.name==t))?void 0:h.label)?m:g.label}),(0,u.jsx)(ta,{className:"".concat(ya,"__chevron")})]}),className:"".concat(ya,"__breakpoint"),horizontalAlign:"right",render:e=>{let{close:a}=e;return(0,u.jsx)(tc.ButtonGroup,{children:(0,u.jsxs)(o.Fragment,{children:[n.map(e=>(0,u.jsx)(tc.Button,{active:e.name==t,onClick:()=>{l(e.name),a()},children:e.label},e.name)),"custom"===t&&(0,u.jsx)(tc.Button,{active:t==g.value,onClick:()=>{l(g.value),a()},children:g.label})]})})},showScrollbar:!0,verticalAlign:"bottom"}),(0,u.jsxs)("div",{className:"".concat(ya,"__device-size"),children:[(0,u.jsx)(yl,{axis:"x"}),(0,u.jsx)("span",{className:"".concat(ya,"__size-divider"),children:(0,u.jsx)(s.a,{})}),(0,u.jsx)(yl,{axis:"y"})]}),(0,u.jsx)(t_,{button:(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("span",{children:[100*c,"%"]}),(0,u.jsx)(ta,{className:"".concat(ya,"__chevron")})]}),className:"".concat(ya,"__zoom"),horizontalAlign:"right",render:v,showScrollbar:!0,verticalAlign:"bottom"}),(0,u.jsx)("a",{className:"".concat(ya,"__external"),href:i,onClick:f,target:"_blank",title:"Open in new window",type:"button",children:(0,u.jsx)(mR,{})})]}),e[0]=t,e[1]=n,e[2]=l,e[3]=a,e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=p}else p=e[8];return p},yi="live-preview-toolbar",ys=e=>{let t=(0,f.c)(10),{toolbarPosition:n}=mg(),l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={id:"live-preview-toolbar"},t[0]=l):l=t[0];let{attributes:a,listeners:o,setNodeRef:r,transform:i}=(0,g.PM)(l),s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=[yi,"".concat(yi,"--draggable")],t[1]=s):s=t[1];let c="".concat(n.x,"px"),d="".concat(n.y,"px"),p;return t[2]!==a||t[3]!==o||t[4]!==e||t[5]!==r||t[6]!==c||t[7]!==d||t[8]!==i?(p=(0,u.jsxs)("div",{className:s.join(" "),style:{left:c,top:d,...i?{transform:i?"translate3d(".concat((null==i?void 0:i.x)||0,"px, ").concat((null==i?void 0:i.y)||0,"px, 0)"):void 0}:{}},children:[(0,u.jsx)("button",{...o,...a,className:"".concat(yi,"__drag-handle"),ref:r,type:"button",children:(0,u.jsx)(a3,{})}),(0,u.jsx)(yr,{...e})]}),t[2]=a,t[3]=o,t[4]=e,t[5]=r,t[6]=c,t[7]=d,t[8]=i,t[9]=p):p=t[9],p},yc=e=>(0,u.jsx)("div",{className:[yi,"".concat(yi,"--static")].join(" "),children:(0,u.jsx)(yr,{...e})}),yu=e=>{let{draggable:t}=e;return t?(0,u.jsx)(ys,{...e}):(0,u.jsx)(yc,{...e})},yd="live-preview-window",yp=e=>{let t,n,l,a=(0,f.c)(49),{appIsReady:r,breakpoint:s,iframeRef:c,isLivePreviewing:d,loadedURL:p,popupRef:h,previewWindowType:m,url:g}=mg(),v=lN(),{mostRecentUpdate:b}=uT(),[y]=eI(),{id:x,collectionSlug:w,globalSlug:j}=aD(),C;if(a[0]!==r||a[1]!==w||a[2]!==y||a[3]!==j||a[4]!==x||a[5]!==c||a[6]!==d||a[7]!==v||a[8]!==b||a[9]!==h||a[10]!==m||a[11]!==g?(C=()=>
1{if(!(!d||!r)&&y){var e;let t=(0,M.r)(y,!0);t.id||(t.id=x);let n={type:"payload-live-preview",collectionSlug:w,data:t,externallyUpdatedRelationship:b,globalSlug:j,locale:v.code};"popup"===m&&h.current&&h.current.postMessage(n,g),"iframe"===m&&c.current&&(null==(e=c.current.contentWindow)||e.postMessage(n,g))}},a[0]=r,a[1]=w,a[2]=y,a[3]=j,a[4]=x,a[5]=c,a[6]=d,a[7]=v,a[8]=b,a[9]=h,a[10]=m,a[11]=g,a[12]=C):C=a[12],a[13]!==r||a[14]!==w||a[15]!==y||a[16]!==j||a[17]!==x||a[18]!==c||a[19]!==d||a[20]!==p||a[21]!==v||a[22]!==b||a[23]!==h||a[24]!==m||a[25]!==g?(t=[y,g,w,j,x,m,h,r,c,b,v,d,p],a[13]=r,a[14]=w,a[15]=y,a[16]=j,a[17]=x,a[18]=c,a[19]=d,a[20]=p,a[21]=v,a[22]=b,a[23]=h,a[24]=m,a[25]=g,a[26]=t):t=a[26],(0,o.useEffect)(C,t),a[27]!==r||a[28]!==c||a[29]!==d||a[30]!==h||a[31]!==m||a[32]!==g?(n=()=>{var e;if(!d||!r)return;let t={type:"payload-document-event"};"popup"===m&&h.current&&h.current.postMessage(t,g),"iframe"===m&&c.current&&(null==(e=c.current.contentWindow)||e.postMessage(t,g))},a[27]=r,a[28]=c,a[29]=d,a[30]=h,a[31]=m,a[32]=g,a[33]=n):n=a[33],a[34]!==r||a[35]!==c||a[36]!==d||a[37]!==b||a[38]!==h||a[39]!==m||a[40]!==g?(l=[b,c,h,m,g,d,r],a[34]=r,a[35]=c,a[36]=d,a[37]=b,a[38]=h,a[39]=m,a[40]=g,a[41]=l):l=a[41],(0,o.useEffect)(n,l),"iframe"!==m)return null;let S=d&&"".concat(yd,"--is-live-previewing"),k=s&&"responsive"!==s&&"".concat(yd,"--has-breakpoint"),_;a[42]!==S||a[43]!==k?(_=[yd,S,k].filter(Boolean),a[42]=S,a[43]=k,a[44]=_):_=a[44];let N=_.join(" "),E;return a[45]!==e||a[46]!==N||a[47]!==g?(E=(0,u.jsx)("div",{className:N,children:(0,u.jsxs)("div",{className:"".concat(yd,"__wrapper"),children:[(0,u.jsx)(yu,{...e}),(0,u.jsx)("div",{className:"".concat(yd,"__main"),children:(0,u.jsx)(yt,{children:g?(0,u.jsx)(yn,{}):(0,u.jsx)(i.f,{height:"100%"})})})]})}),a[45]=e,a[46]=N,a[47]=g,a[48]=E):E=a[48],E},yh=async e=>{let{id:t,clearRouteCache:n,collectionSlug:l,documentLockStateRef:a,globalSlug:o,isLockingEnabled:r,isWithinDoc:i,setCurrentEditor:s,setIsReadOnlyForIncomingUser:c,updateDocumentEditor:u,user:d}=e;if(r)try{var p;await u(t,null!=l?l:o,d),i||(a.current.hasShownLockedModal=!0),a.current={hasShownLockedModal:null==(p=a.current)?void 0:p.hasShownLockedModal,isLocked:!0,user:d},s(d),i&&c&&c(!1),n&&n()}catch(e){console.error("Error during document takeover:",e)}},yf="api-key",ym=e=>{var t,n;let{enabled:l,readOnly:a}=e,[r]=(0,o.useState)(op()),[c,p]=(0,o.useState)(!1),[h,f]=(0,o.useState)(!1),{i18n:m,t:g}=(0,s.d)(),{config:v,getEntityConfig:b}=(0,i.c)(),{collectionSlug:y}=aD(),x=eM(e=>{let[t]=e;return t&&t.apiKey||null}),w=null==(n=b({collectionSlug:y}))||null==(t=n.fields)?void 0:t.find(e=>"name"in e&&"apiKey"===e.name),j=null==x?void 0:x.value,C=(0,o.useMemo)(()=>{let e="API Key";return(null==w?void 0:w.label)&&(e=w.label),(0,d.s)(e,m)},[w,m]),S=(0,o.useMemo)(()=>(0,u.jsxs)("label",{className:"".concat(yf,"__label field-label"),htmlFor:"apiKey",children:[(0,u.jsx)("span",{children:C}),(0,u.jsx)(pK,{value:j})]}),[C,j]),{setValue:k,value:_}=aB({path:"apiKey",validate:e=>(0,K.Qq)(e,{name:"apiKey",type:"text",blockData:{},data:{},event:"onChange",maxLength:48,minLength:24,path:["apiKey"],preferences:{fields:{}},req:{payload:{config:v},t:g},siblingData:{}})});return(0,o.useEffect)(()=>{!j&&l&&k(r),!l&&j&&k(null)},[j,l,k,r]),(0,o.useEffect)(()=>{c&&setTimeout(()=>{p(!1)},1e4)},[c]),l?(0,u.jsxs)(o.Fragment,{children:[(0,u.jsxs)("div",{className:["field-type","api-key","read-only"].filter(
1Boolean).join(" "),children:[S,(0,u.jsxs)("div",{className:"".concat(yf,"__input-wrap"),children:[(0,u.jsx)("input",{"aria-label":C,className:c?"highlight":void 0,disabled:!0,id:"apiKey",name:"apiKey",type:h?"text":"password",value:_||""}),(0,u.jsx)("div",{className:"".concat(yf,"__toggle-button-wrap"),children:(0,u.jsx)(tD,{buttonStyle:"none",className:"".concat(yf,"__toggle-button"),icon:(0,u.jsx)(mk,{active:h}),onClick:()=>f(e=>!e)})})]})]}),!a&&(0,u.jsx)(ga,{highlightField:()=>{c&&p(!1),setTimeout(()=>{p(!0)},1)},setKey:()=>k(op())})]}):null},yg="auth-fields",yv=e=>{var t;let n,l=(0,f.c)(22),{className:a,collectionSlug:r,disableLocalStrategy:c,email:d,loginWithUsername:p,operation:h,readOnly:m,requirePassword:g,setValidateBeforeSubmit:v,useAPIKey:b,username:y,verify:x}=e,[w,C]=(0,o.useState)(g),S=eM(yb),k=eM(yy),_=eO(),{i18n:N,t:E}=(0,s.d)(),{docPermissions:P,isEditing:D,isInitializing:T,isTrashed:R}=aD(),{config:A}=(0,i.c)(),{routes:L,serverURL:O}=A,{api:F}=L,M=!0,I=!0,B="object"==typeof P.fields&&"password"in P.fields,U="object"==typeof P.fields&&("username"in P.fields||"email"in P.fields);if(B){let{permissions:e}=(0,j.P)({field:{name:"password",type:"text"},operation:h,parentName:"",permissions:null==P?void 0:P.fields});M="create"===h?!0===e||"object"==typeof e&&e.create:!0===e||"object"==typeof e&&e.update}if(U){let e=p&&(p.requireEmail||p.allowEmailLogin),t;l[0]!==P.fields?(t=(0,j.P)({field:{name:"email",type:"text"},operation:"read",parentName:"",permissions:null==P?void 0:P.fields}),l[0]=P.fields,l[1]=t):t=l[1];let{operation:n}=t,a;l[2]!==P.fields?(a=(0,j.P)({field:{name:"username",type:"text"},operation:"read",parentName:"",permissions:null==P?void 0:P.fields}),l[2]=P.fields,l[3]=a):a=l[3];let{operation:o}=a;I=e?o||n:p&&!e?o:n}let z=(!c||"object"==typeof c&&!0===c.enableFields)&&(I||M),V=m||T||R,H=(null==P?void 0:P.fields)===!0||(null==P||null==(t=P.fields)?void 0:t.enableAPIKey),q=m||!0===H||H&&"object"==typeof H&&!(null==H?void 0:H.update),W=m||!0!==H&&!(null==H?void 0:H.update),K=!0===H||(null==H?void 0:H.read),Y;e:{if(P){Y=!!("unlock"in P&&P.unlock);break e}Y=!1}let G=Y,Q;l[4]!==k||l[5]!==v||l[6]!==E?(Q=e=>{e?(v(!0),k({type:"UPDATE",errorMessage:E("validation:required"),path:"password",valid:!1}),k({type:"UPDATE",errorMessage:E("validation:required"),path:"confirm-password",valid:!1})):(v(!1),k({type:"REMOVE",path:"password"}),k({type:"REMOVE",path:"confirm-password"})),C(e)},l[4]=k,l[5]=v,l[6]=E,l[7]=Q):Q=l[7];let X=Q,$;l[8]!==F||l[9]!==r||l[10]!==d||l[11]!==N||l[12]!==p||l[13]!==O||l[14]!==E||l[15]!==y?($=async()=>{let e="".concat(O).concat(F,"/").concat(r,"/unlock");200===(await fetch(e,{body:JSON.stringify(p&&y?{username:y}:{email:d}),credentials:"include",headers:{"Accept-Language":N.language,"Content-Type":"application/json"},method:"post"})).status?eJ.success(E("authentication:successfullyUnlocked")):eJ.error(E("authentication:failedToUnlock"))},l[8]=F,l[9]=r,l[10]=d,l[11]=N,l[12]=p,l[13]=O,l[14]=E,l[15]=y,l[16]=$):$=l[16];let Z=$,J,ee;
1return(l[17]!==_?(J=()=>{_||C(!1)},ee=[_],l[17]=_,l[18]=J,l[19]=ee):(J=l[18],ee=l[19]),(0,o.useEffect)(J,ee),z||b&&K||x&&D)?(l[20]!==a?(n=[yg,a].filter(Boolean),l[20]=a,l[21]=n):n=l[21],(0,u.jsxs)("div",{className:n.join(" "),children:[z&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(bN,{loginWithUsername:p,operation:h,permissions:null==P?void 0:P.fields,readOnly:m||R,t:E}),(w||g)&&(!c||!z)&&(0,u.jsxs)("div",{className:"".concat(yg,"__changing-password"),children:[(0,u.jsx)(hV,{autoComplete:"new-password",field:{name:"password",label:E("authentication:newPassword"),required:!0},indexPath:"",parentPath:"",parentSchemaPath:"",path:"password",schemaPath:"password"}),(0,u.jsx)(hB,{disabled:m||R})]}),(0,u.jsxs)("div",{className:"".concat(yg,"__controls"),children:[w&&!g&&(0,u.jsx)(tD,{buttonStyle:"secondary",disabled:V,id:"cancel-change-password",onClick:()=>X(!1),size:"medium",children:E("general:cancel")}),!w&&!g&&!c&&M&&(0,u.jsx)(tD,{buttonStyle:"secondary",disabled:V,id:"change-password",onClick:()=>X(!0),size:"medium",children:E("authentication:changePassword")}),!w&&"update"===h&&G&&(0,u.jsx)(tD,{buttonStyle:"secondary",disabled:V||!I,id:"force-unlock",onClick:()=>void Z(),size:"medium",children:E("authentication:forceUnlock")})]})]}),b&&(0,u.jsx)("div",{className:"".concat(yg,"__api-key"),children:K&&(0,u.jsxs)(o.Fragment,{children:[(0,u.jsx)(a$,{field:{name:"enableAPIKey",admin:{disabled:V,readOnly:W},label:E("authentication:enableAPIKey")},path:"enableAPIKey",schemaPath:"".concat(r,".enableAPIKey")}),(0,u.jsx)(ym,{enabled:!!(null==S?void 0:S.value),readOnly:q})]})}),x&&D&&(0,u.jsx)(a$,{field:{name:"_verified",admin:{disabled:V,readOnly:m},label:E("authentication:verified")},path:"_verified",schemaPath:"".concat(r,"._verified")})]})):null};function yb(e){let[t]=e;return t&&(null==t?void 0:t.enableAPIKey)||null}function yy(e){return e[1]}var yx=e=>{let t=(0,f.c)(22),{id:n,collectionSlug:l,globalSlug:a,isTrashed:r,pluralLabel:c,useAsTitle:u}=e,p=(null==e?void 0:e.view)||void 0,{isEditing:h,isInitializing:m}=aD(),{title:g}=ay(),{isEntityVisible:b}=bd(),y;t[0]!==l||t[1]!==a||t[2]!==b?(y=b({collectionSlug:l,globalSlug:a}),t[0]=l,t[1]=a,t[2]=b,t[3]=y):y=t[3];let x=y,{setStepNav:w}=f1(),{i18n:j,t:C}=(0,s.d)(),{config:S}=(0,i.c)(),{routes:k,serverURL:_}=S,{admin:N}=k,E,P;return t[4]!==N||t[5]!==l||t[6]!==a||t[7]!==j||t[8]!==n||t[9]!==h||t[10]!==m||t[11]!==r||t[12]!==x||t[13]!==c||t[14]!==_||t[15]!==w||t[16]!==C||t[17]!==g||t[18]!==u||t[19]!==p?(E=()=>{let e=[];m||(l?(e.push({label:(0,d.s)(c,j),url:x?(0,v.Q)({adminRoute:N,path:"/collections/".concat(l),serverURL:_}):void 0}),r&&e.push({label:C("general:trash"),url:x?(0,v.Q)({adminRoute:N,path:"/collections/".concat(l,"/trash"),serverURL:_}):void 0}),h?e.push({label:u&&"id"!==u&&g||"".concat(n),url:x?(0,v.Q)({adminRoute:N,path:r?"/collections/".concat(l,"/trash/").concat(n):"/collections/".concat(l,"/").concat(n),serverURL:_}):void 0}):e.push({label:C("general:createNew")})):a&&e.push({label:g,url:x?(0,v.Q)({adminRoute:N,path:"/globals/".concat(a),serverURL:_}):void 0}),p&&e.push({label:p}),w(e))},P=[w,m,h,c,n,r,u,N,C,j,g,l,a,_,p,x],t[4]=N,t[5]=l,t[6]=a,t[7]=j,t[8]=n,t[9]=h,t[10]=m,t[11]=r,t[12]=x,t[13]=c,t[14]=_,t[15]=w,t[16]=C,t[17]=g,t[18]=u,t[19]=p,t[20]=E,t[21]=P):(E=t[20],P=t[21]),(0,o.useEffect)(E,P),null},yw=e=>{var t,n;let l=(0,f.c)(14),{collectionConfig:a,config:r,fallback:i,globalConfig:c}=e,u=null==a||null==(t=a.admin)?void 0:t.useAsTitle,d;l[0]!==u?(d=e=>{let[t]=e;return u&&t&&(null==t?void 0:t[u])||null},l[0]=u,l[1]=d):d=l[1];let p=eM(d),h=(0,o.useRef)(!1),{i18n:m}=(0,s.d)(),{setDocumentTitle:g}=ay(),v=null==r||null==(n=r.admin)?void 0:n.dateFormat,b=(null==p?void 0:p.value)||"",y;l[2]!==a||l[3]!==v||l[4]!==i||l[5]!==c||l[6]!==m||l[7]!==b||l[8]!==u?(y=av({collectionConfig:a,data:{id:"",[u]:b},dateFormat:v,fallback:i,globalConfig:c,i18n:m}),l[2]=a,l[3]=v,l[4]=i,l[5]=c,l[6]=m,l[7]=b,l[8]=u,l[9]=y):y=l[9];let x=y,w,j;return l[10]!==g||l[11]!==x?(w=()=>{if(!h.current){h.current=!0;return}
1g(x)},j=[g,x],l[10]=g,l[11]=x,l[12]=w,l[13]=j):(w=l[12],j=l[13]),(0,o.useEffect)(w,j),null},yj="collection-edit";function yC(e){var t,n,l,a,r;let{BeforeDocumentControls:s,Description:c,EditMenuItems:d,LivePreview:p,PreviewButton:f,PublishButton:m,SaveButton:g,SaveDraftButton:b,Upload:y,UploadControls:x}=e,{id:w,action:j,AfterDocument:C,AfterFields:S,apiURL:k,BeforeFields:_,collectionSlug:N,currentEditor:E,data:P,disableActions:D,disableCreate:T,disableLeaveWithoutSaving:R,docPermissions:A,documentIsLocked:O,documentLockState:F,getDocPermissions:M,getDocPreferences:I,globalSlug:B,hasPublishPermission:U,hasSavePermission:z,incrementVersionCount:V,initialState:H,isEditing:q,isInitializing:W,isLocked:K,isTrashed:Y,lastUpdateTime:G,redirectAfterCreate:Q,redirectAfterDelete:X,redirectAfterDuplicate:$,redirectAfterRestore:Z,setCurrentEditor:J,setData:ee,setDocumentIsLocked:et,setLastUpdateTime:en,unlockDocument:el,updateDocumentEditor:ea}=aD(),{clearDoc:eo,drawerSlug:er,onDelete:ei,onDuplicate:es,onRestore:ec,onSave:eu}=cD(),ed=!!er,{refreshCookieAsync:ep,user:eh}=lw(),{config:ef,config:{admin:{user:em},routes:{admin:eg},serverURL:ev},getEntityConfig:eb}=(0,i.c)(),ey=eb({collectionSlug:N}),ex=eb({globalSlug:B}),ew=ns(),ej=(0,h.useRouter)(),eC=(0,h.useSearchParams)(),{reportUpdate:eS}=uT(),{resetUploadEdits:ek}=aN(),{getFormState:e_}=ci(),{startRouteTransition:eN}=e8(),{clearRouteCache:eE}=d7(),{isLivePreviewEnabled:eP,isLivePreviewing:eD,previewWindowType:eT,setURL:eR,typeofLivePreviewURL:eA,url:eL}=mg(),{isPreviewEnabled:eO,setPreviewURL:eF}=mv(),eM=(0,o.useRef)(null),eI=(0,o.useRef)(null),eB=eC.get("locale"),eU=(null==ey?void 0:ey.slug)||(null==ex?void 0:ex.slug),ez=N&&!w?"create":"update",eV=ey?ey.auth:void 0,eH=ey?ey.upload:void 0,eq=ey||ex,eW=(null==eq?void 0:eq.lockDocuments)===void 0||(null==eq?void 0:eq.lockDocuments),eK=!1!==eW,eY=("object"==typeof eW?eW.duration:300)*1e3,eG=(0,L.s8)(eq),[eQ,eX]=(0,o.useState)(!1),[e$,eZ]=(0,o.useState)(!1),[eJ,e0]=(0,o.useState)(Date.now()),e1=G+eY,e3=Date.now()>e1,e2=!eQ&&("u">typeof R?!R:!eG),e6=(0,o.useMemo)(()=>[eU],[eU]),[e5,e4]=(0,o.useState)(()=>!!("create"===ez&&eV&&!eV.disableLocalStrategy)),e9=o.useRef(null),e7=(0,o.useCallback)(e=>{var t,n,l,a,o;et(!0);let r="object"==typeof(null==(t=F.current)?void 0:t.user)?null==(l=F.current)||null==(n=l.user)?void 0:n.id:null==(a=F.current)?void 0:a.user;if(e){let t="string"==typeof e.user||"number"==typeof e.user?e.user:e.user.id;F.current&&t===r||(r===eh.id&&t!==eh.id&&(eZ(!0),F.current.hasShownLockedModal=!0),F.current={hasShownLockedModal:(null==(o=F.current)?void 0:o.hasShownLockedModal)||!1,isLocked:!0,user:e.user},J(e.user)),e.lastEditedAt&&en(new Date(e.lastEditedAt).getTime())}},[F,J,et,en,null==eh?void 0:eh.id]),te=(0,o.useCallback)(e=>{e9.current=e},[]),tt=(0,o.useCallback)(async()=>{var e;let t=null==(e=F.current)?void 0:e.user,n="object"==typeof t?(null==t?void 0:t.id)===(null==eh?void 0:eh.id):t===(null==eh?void 0:eh.id);if(eK&&O&&(w||B)){let e=e9.current?new URL(e9.current).pathname:"",t=["/preview","/api","/versions"].some(t=>e.includes(t));if(n&&!t)try{await el(w,null!=N?N:B),et(!1),J(null)}catch(e){console.error("Failed to unlock before leave",e)}}},[N,O,F,B,w,eK,J,et,el,null==eh?void 0:eh.id]),tn=(0,o.useCallback)(async(e,t)=>{let{context:n,formState:l}=t||{},a=cN(eI),o=(null==e?void 0:e.doc)||(null==e?void 0:e.result),r=(null==o?void 0:o.updatedAt)||new Date().toISOString();if(eh&&N===em&&w===eh.id&&ep(),en(r),(null==n?void 0:n.incrementVersionCount)!==!1&&V(),"function"==typeof ee&&ee(o||{}),"function"==typeof eu){let t=w?"update":"create";eu({...e,context:n,operation:t,updatedAt:"update"===t?new Date().toISOString():(null==o?void 0:o.updatedAt)||new Date().toISOString()})}if(!q&&ew<2&&!1!==Q){let e=(0,v.Q)({adminRoute:eg,path:"/collections/".concat(N,"/").concat(null==o?void 0:o.id).concat(eB?"?locale=".concat(eB):""),serverURL:ev});eN(()=>ej.push(e))}else ek();if((null==n?void 0:n.getDocPermissions)!==!1&&await M(e),w||B){let e=await I(),{livePreviewURL:t,previewURL:n,state:i}=await e_({id:w,collectionSlug:N,data:o,docPermissions:A,docPreferences:e,formState:l,globalSlug:B,operation:ez,renderAllFields:!1,returnLivePreviewURL:eP&&"function"===eA,returnLockStatus:!1,returnPreviewURL:eO,schemaPath:e6.join("."),signal:a.signal,skipValidation:!0}
1);return eH&&i&&delete i.file,eK&&et(!1),eP&&"function"===eA&&eR(t),eO&&eF(n),eS({id:w,doc:o,drawerSlug:er,entitySlug:eU,operation:"update",updatedAt:r}),eI.current=null,i}eS({id:w,doc:o,drawerSlug:er,entitySlug:eU,operation:"create",updatedAt:r})},[eh,N,em,w,en,ee,eu,q,ew,Q,B,ep,V,eg,eB,ev,eN,ej,ek,M,I,e_,A,ez,eP,eA,eO,e6,eH,eK,eS,er,eU,et,eR,eF]),tl=(0,o.useCallback)(async e=>{let{formState:t,submitted:n}=e,l=cN(eM),a=Date.now(),o=a-eJ,r=eK&&o>=1e4;r&&e0(a);let i=await I(),s=await e_({id:w,collectionSlug:N,docPermissions:A,docPreferences:i,formState:t,globalSlug:B,operation:ez,renderAllFields:!1,returnLockStatus:eK,schemaPath:e6.join("."),signal:l.signal,skipValidation:!n,updateLastEdited:r});if(!s)return;let{lockedState:c,state:u}=s;return eK&&e7(c),eM.current=null,u},[eJ,eK,I,e_,w,N,A,B,ez,e6,e7]);(0,o.useEffect)(()=>()=>{eZ(!1)},[]),(0,o.useEffect)(()=>{let e=eM.current,t=eI.current;return()=>{c_(e),c_(t)}},[]);let ta=O&&E&&("object"==typeof E?E.id!==(null==eh?void 0:eh.id):E!==(null==eh?void 0:eh.id))&&!eQ&&!e$&&!(null==(t=F.current)?void 0:t.hasShownLockedModal)&&!e3,to=ef.folders&&N===(null==(n=ef.folders)?void 0:n.slug);return(0,u.jsx)("main",{className:[yj,(w||B)&&"".concat(yj,"--is-editing"),B&&"global-edit--".concat(B),N&&"collection-edit--".concat(N),eD&&"iframe"===eT&&"".concat(yj,"--is-live-previewing")].filter(Boolean).join(" "),children:(0,u.jsx)(aL,{operation:ez,children:(0,u.jsxs)(di,{action:j,className:"".concat(yj,"__form"),disabled:eQ||W||!z||Y,disableValidationOnSubmit:!e5,initialState:!W&&H,isDocumentForm:!0,isInitializing:W,method:w?"PATCH":"POST",onChange:[tl],onSuccess:tn,children:[ed&&(0,u.jsx)(b7,{AfterHeader:c,drawerSlug:er,showDocumentID:!to}),eK&&ta&&(0,u.jsx)(fD,{handleGoBack:()=>(e=>{let{adminRoute:t,collectionSlug:n,router:l,serverURL:a}=e,o=(0,v.Q)({adminRoute:t,path:n?"/collections/".concat(n):"/",serverURL:a});l.push(o)})({adminRoute:eg,collectionSlug:N,router:ej,serverURL:ev}),isActive:ta,onReadOnly:()=>{eX(!0),eZ(!1)},onTakeOver:()=>yh({id:w,clearRouteCache:eE,collectionSlug:N,documentLockStateRef:F,globalSlug:B,isLockingEnabled:eK,isWithinDoc:!1,setCurrentEditor:J,updateDocumentEditor:ea,user:eh}),updatedAt:G,user:E}),eK&&e$&&(0,u.jsx)(fN,{handleBackToDashboard:()=>(e=>{let{adminRoute:t,router:n,serverURL:l}=e,a=(0,v.Q)({adminRoute:t,path:"/",serverURL:l});n.push(a)})({adminRoute:eg,router:ej,serverURL:ev}),isActive:e$,onReadOnly:()=>{eX(!0),eZ(!1)}}),e2&&(0,u.jsx)(fC,{onConfirm:tt,onPrevent:te}),!ed&&(0,u.jsx)(yx,{collectionSlug:null==ey?void 0:ey.slug,globalSlug:null==ex?void 0:ex.slug,id:w,isTrashed:Y,pluralLabel:null==ey||null==(l=ey.labels)?void 0:l.plural,useAsTitle:null==ey||null==(a=ey.admin)?void 0:a.useAsTitle}),(0,u.jsx)(yw,{collectionConfig:ey,config:ef,fallback:ew<=1?null==w?void 0:w.toString():void 0,globalConfig:ex}),(0,u.jsx)(mY,{apiURL:k,BeforeDocumentControls:s,customComponents:{PreviewButton:f,PublishButton:m,SaveButton:g,S
1aveDraftButton:b},data:P,disableActions:D||to||Y,disableCreate:T,EditMenuItems:d,hasPublishPermission:U,hasSavePermission:z,id:w,isEditing:q,isInDrawer:ed,isTrashed:Y,onDelete:ei,onDrawerCreateNew:eo,onDuplicate:es,onRestore:ec,onSave:tn,onTakeOver:()=>yh({id:w,clearRouteCache:eE,collectionSlug:N,documentLockStateRef:F,globalSlug:B,isLockingEnabled:eK,isWithinDoc:!0,setCurrentEditor:J,setIsReadOnlyForIncomingUser:eX,updateDocumentEditor:ea,user:eh}),permissions:A,readOnlyForIncomingUser:eQ,redirectAfterDelete:X,redirectAfterDuplicate:$,redirectAfterRestore:Z,slug:(null==ey?void 0:ey.slug)||(null==ex?void 0:ex.slug),user:E}),(0,u.jsxs)("div",{className:["".concat(yj,"__main-wrapper"),"popup"===eT&&"".concat(yj,"--detached")].filter(Boolean).join(" "),children:[(0,u.jsxs)("div",{className:["".concat(yj,"__main"),"popup"===eT&&"".concat(yj,"__main--popup-open")].filter(Boolean).join(" "),children:[(0,u.jsx)(d3,{AfterFields:S,BeforeFields:_||(0,u.jsxs)(o.Fragment,{children:[eV&&(0,u.jsx)(yv,{className:"".concat(yj,"__auth"),collectionSlug:ey.slug,disableLocalStrategy:null==(r=ey.auth)?void 0:r.disableLocalStrategy,email:null==P?void 0:P.email,loginWithUsername:null==eV?void 0:eV.loginWithUsername,operation:ez,readOnly:!z,requirePassword:!w,setValidateBeforeSubmit:e4,useAPIKey:eV.useAPIKey,username:null==P?void 0:P.username,verify:eV.verify}),eH&&(0,u.jsx)(o.Fragment,{children:(0,u.jsx)(dk,{children:y||(0,u.jsx)(p8,{collectionSlug:ey.slug,initialState:H,uploadConfig:eH,UploadControls:x})})})]}),Description:c,docPermissions:A,fields:eq.fields,forceSidebarWrap:eD,isTrashed:Y,readOnly:eQ||!z||Y,schemaPathSegments:e6}),C]}),eP&&!ed&&eL&&(0,u.jsx)(u.Fragment,{children:p||(0,u.jsx)(yp,{collectionSlug:N,globalSlug:B})})]})]},"".concat(K))})})}var yS=e=>{let{children:t}=e;return(0,u.jsx)("div",{className:"field-diff-label",children:t})},yk="field-diff",y_=e=>{let{className:t,From:n,i18n:l,label:{label:a,locale:o},nestingLevel:r=0,To:i}=e;return(0,u.jsxs)("div",{className:"".concat(yk,"-container").concat(t?" ".concat(t):""," nested-level-").concat(r),style:r?{"--left-offset":"calc(50% - (".concat(r," * calc( calc(var(--base)* 0.5) - 2.5px )))")}:{"--left-offset":"50%"},children:[(0,u.jsxs)(yS,{children:[o&&(0,u.jsx)("span",{className:"".concat(yk,"__locale-label"),children:o}),"function"!=typeof a&&(0,d.s)(a||"",l)]}),(0,u.jsxs)("div",{className:"".concat(yk,"-content"),style:r?{gridTemplateColumns:"calc(var(--left-offset) - calc(var(--base)*0.5) ) calc(50% - calc(var(--base)*0.5) + calc(50% - var(--left-offset)))"}:void 0,children:[n,i]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.