@payloadcms/next 3.0.0-beta.56 → 3.0.0-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/prod/index.js +2 -2
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.js +8 -12
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/rest/auth/forgotPassword.d.ts.map +1 -1
- package/dist/routes/rest/auth/forgotPassword.js +7 -3
- package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
- package/dist/routes/rest/auth/login.d.ts.map +1 -1
- package/dist/routes/rest/auth/login.js +9 -4
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.d.ts.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.js +9 -2
- package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
- package/dist/routes/rest/auth/verifyEmail.js +1 -1
- package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
- package/dist/routes/rest/buildFormState.d.ts +2 -2
- package/dist/routes/rest/buildFormState.d.ts.map +1 -1
- package/dist/routes/rest/buildFormState.js.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.d.ts +2 -2
- package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
- package/dist/routes/rest/files/getFile.d.ts +2 -2
- package/dist/routes/rest/files/getFile.d.ts.map +1 -1
- package/dist/routes/rest/files/getFile.js.map +1 -1
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +59 -91
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts +2 -2
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/routeError.d.ts +2 -2
- package/dist/routes/rest/routeError.d.ts.map +1 -1
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/routes/rest/types.d.ts +7 -7
- package/dist/routes/rest/types.d.ts.map +1 -1
- package/dist/routes/rest/types.js.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts +3 -6
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +15 -18
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.d.ts +2 -5
- package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
- package/dist/utilities/addLocalesToRequest.js +8 -9
- package/dist/utilities/addLocalesToRequest.js.map +1 -1
- package/dist/utilities/headersWithCors.d.ts +2 -2
- package/dist/utilities/headersWithCors.d.ts.map +1 -1
- package/dist/utilities/headersWithCors.js.map +1 -1
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/views/Document/getDocumentData.d.ts +2 -2
- package/dist/views/Document/getDocumentData.d.ts.map +1 -1
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Default/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/index.js +10 -3
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.d.ts +1 -0
- package/dist/views/Edit/Default/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/types.js.map +1 -1
- package/dist/views/Edit/Default/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/index.js +1 -0
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +34 -6
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +38 -8
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/package.json +7 -7
package/dist/prod/index.js
CHANGED
|
@@ -44,7 +44,7 @@ e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.
|
|
|
44
44
|
*
|
|
45
45
|
* This source code is licensed under the MIT license found in the
|
|
46
46
|
* LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(!(0<o(a,t)))break e;e[r]=t,e[n]=a,n=r}}function r(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length,i=a>>>1;r<i;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>o(l,n))c<a&&0>o(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<a&&0>o(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,p=3,m=!1,h=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var t=r(u);null!==t;){if(null===t.callback)a(u);else{if(!(t.startTime<=e))break;a(u),t.sortIndex=t.expirationTime,n(c,t)}t=r(u)}}function x(e){if(g=!1,w(e),!h)if(null!==r(c))h=!0,D();else{var t=r(u);null!==t&&N(x,t.startTime-e)}}var P,j=!1,k=-1,S=5,C=-1;function M(){return!(t.unstable_now()-C<S)}function _(){if(j){var e=t.unstable_now();C=e;var n=!0;try{e:{h=!1,g&&(g=!1,b(k),k=-1),m=!0;var o=p;try{t:{for(w(e),f=r(c);null!==f&&!(f.expirationTime>e&&M());){var i=f.callback;if("function"==typeof i){f.callback=null,p=f.priorityLevel;var s=i(f.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){f.callback=s,w(e),n=!0;break t}f===r(c)&&a(c),w(e)}else a(c);f=r(c)}if(null!==f)n=!0;else{var l=r(u);null!==l&&N(x,l.startTime-e),n=!1}}break e}finally{f=null,p=o,m=!1}n=void 0}}finally{n?P():j=!1}}}if("function"==typeof y)P=function(){y(_)};else if("undefined"!=typeof MessageChannel){var O=new MessageChannel,E=O.port2;O.port1.onmessage=_,P=function(){E.postMessage(null)}}else P=function(){v(_,0)};function D(){j||(j=!0,P())}function N(e,n){k=v((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){h||m||(h=!0,D())},t.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"):S=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,a,o){var i=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return e={id:d++,callback:a,priorityLevel:e,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>i?(e.sortIndex=o,n(u,e),null===r(c)&&e===r(u)&&(g?(b(k),k=-1):g=!0,N(x,o-i))):(e.sortIndex=s,n(c,e),h||m||(h=!0,D())),e},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},61060:(e,t,n)=>{"use strict";e.exports=n(20919)},37157:(e,t,n)=>{"use strict";var r=n(17663),a=n(73776),o=n(47729)(),i=n(14056),s=n(4100),l=r("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||l(t)!==t)throw new s("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],r=!0,c=!0;if("length"in e&&i){var u=i(e,"length");u&&!u.configurable&&(r=!1),u&&!u.writable&&(c=!1)}return(r||c||!n)&&(o?a(e,"length",t,!0,!0):a(e,"length",t)),e}},57837:(e,t,n)=>{"use strict";var r=n(17663),a=n(5666),o=n(28514),i=n(4100),s=r("%WeakMap%",!0),l=r("%Map%",!0),c=a("WeakMap.prototype.get",!0),u=a("WeakMap.prototype.set",!0),d=a("WeakMap.prototype.has",!0),f=a("Map.prototype.get",!0),p=a("Map.prototype.set",!0),m=a("Map.prototype.has",!0),h=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new i("Side channel does not contain "+o(e))},get:function(r){if(s&&r&&("object"==typeof r||"function"==typeof r)){if(e)return c(e,r)}else if(l){if(t)return f(t,r)}else if(n)return function(e,t){var n=h(e,t);return n&&n.value}(n,r)},has:function(r){if(s&&r&&("object"==typeof r||"function"==typeof r)){if(e)return d(e,r)}else if(l){if(t)return m(t,r)}else if(n)return function(e,t){return!!h(e,t)}(n,r);return!1},set:function(r,a){s&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new s),u(e,r,a)):l?(t||(t=new l),p(t,r,a)):(n||(n={key:{},next:null}),function(e,t,n){var r=h(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,a))}};return r}},22411:e=>{"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},43289:(e,t,n)=>{"use strict";n.d(t,{R8:()=>v,sC:()=>a,pP:()=>r,LE:()=>m,aG:()=>h,t:()=>f});const r=async e=>{let t;switch(e){case"ar":t=(await Promise.resolve().then(n.bind(n,96830))).ar;break;case"az":t=(await Promise.resolve().then(n.bind(n,14330))).az;break;case"bg":t=(await Promise.resolve().then(n.bind(n,31781))).bg;break;case"cs":t=(await Promise.resolve().then(n.bind(n,29603))).cs;break;case"de":t=(await Promise.resolve().then(n.bind(n,52347))).de;break;case"en-US":t=(await Promise.resolve().then(n.bind(n,69441))).enUS;break;case"es":t=(await Promise.resolve().then(n.bind(n,61560))).es;break;case"fa-IR":t=(await Promise.resolve().then(n.bind(n,96433))).faIR;break;case"fr":t=(await Promise.resolve().then(n.bind(n,48976))).fr;break;case"he":t=(await Promise.resolve().then(n.bind(n,32111))).he;break;case"hr":t=(await Promise.resolve().then(n.bind(n,80484))).hr;break;case"hu":t=(await Promise.resolve().then(n.bind(n,50150))).hu;break;case"it":t=(await Promise.resolve().then(n.bind(n,8125))).it;break;case"ja":t=(await Promise.resolve().then(n.bind(n,66964))).ja;break;case"ko":t=(await Promise.resolve().then(n.bind(n,34463))).ko;break;case"nb":t=(await Promise.resolve().then(n.bind(n,6612))).nb;break;case"nl":t=(await Promise.resolve().then(n.bind(n,71816))).nl;break;case"pl":t=(await Promise.resolve().then(n.bind(n,79435))).pl;break;case"pt":t=(await Promise.resolve().then(n.bind(n,42873))).pt;break;case"ro":t=(await Promise.resolve().then(n.bind(n,90947))).ro;break;case"ru":t=(await Promise.resolve().then(n.bind(n,85566))).ru;break;case"sk":t=(await Promise.resolve().then(n.bind(n,95773))).sk;break;case"sv":t=(await Promise.resolve().then(n.bind(n,39734))).sv;break;case"th":t=(await Promise.resolve().then(n.bind(n,61272))).th;break;case"tr":t=(await Promise.resolve().then(n.bind(n,37377))).tr;break;case"uk":t=(await Promise.resolve().then(n.bind(n,98354))).uk;break;case"vi":t=(await Promise.resolve().then(n.bind(n,68121))).vi;break;case"zh-CN":t=(await Promise.resolve().then(n.bind(n,10180))).zhCN;break;case"zh-TW":t=(await Promise.resolve().then(n.bind(n,64609))).zhTW}return t.default?t.default:t},a=(e,t)=>{if("object"==typeof e&&!Object.prototype.hasOwnProperty.call(e,"$$typeof")){if(e[t.language])return e[t.language];let n=[];"string"==typeof t.fallbackLanguage?n=[t.fallbackLanguage]:Array.isArray(t.fallbackLanguage)&&(n=t.fallbackLanguage);const r=n.find((t=>e[t]));return r&&e[r]?r:e[Object.keys(e)[0]]}return"function"==typeof e?e({t:t.t}):e};function o(e,t,n=!0){const r={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n&&(null===t[a]||void 0===t[a])&&null!==e[a]&&void 0!==e[a])continue;"object"==typeof t[a]&&e[a]?r[a]=o(e[a],t[a],n):r[a]=t[a]}return r}const i=["authentication:account","authentication:accountOfCurrentUser","authentication:alreadyActivated","authentication:alreadyLoggedIn","authentication:apiKey","authentication:authenticated","authentication:backToLogin","authentication:beginCreateFirstUser","authentication:changePassword","authentication:checkYourEmailForPasswordReset","authentication:confirmGeneration","authentication:confirmPassword","authentication:createFirstUser","authentication:emailNotValid","authentication:emailSent","authentication:emailVerified","authentication:enableAPIKey","authentication:failedToUnlock","authentication:forceUnlock","authentication:forgotPassword","authentication:forgotPasswordEmailInstructions","authentication:forgotPasswordQuestion","authentication:generate","authentication:generateNewAPIKey","authentication:generatingNewAPIKeyWillInvalidate","authentication:logBackIn","authentication:loggedOutInactivity","authentication:loggedOutSuccessfully","authentication:loggingOut","authentication:login","authentication:logOut","authentication:loggedIn","authentication:loggedInChangePassword","authentication:logout","authentication:logoutUser","authentication:logoutSuccessful","authentication:newAPIKeyGenerated","authentication:newPassword","authentication:passed","authentication:passwordResetSuccessfully","authentication:resetPassword","authentication:stayLoggedIn","authentication:successfullyRegisteredFirstUser","authentication:successfullyUnlocked","authentication:unableToVerify","authentication:tokenRefreshSuccessful","authentication:verified","authentication:verifiedSuccessfully","authentication:verify","authentication:verifyUser","authentication:youAreInactive","error:autosaving","error:correctInvalidFields","error:deletingTitle","error:loadingDocument","error:logoutFailed","error:noMatchedField","error:notAllowedToAccessPage","error:previewing","error:unableToDeleteCount","error:unableToUpdateCount","error:unauthorized","error:unknown","error:unspecific","error:userEmailAlreadyRegistered","error:tokenNotProvided","error:unPublishingDocument","fields:addLabel","fields:addLink","fields:addNew","fields:addNewLabel","fields:addRelationship","fields:addUpload","fields:block","fields:blocks","fields:blockType","fields:chooseBetweenCustomTextOrDocument","fields:customURL","fields:chooseDocumentToLink","fields:openInNewTab","fields:enterURL","fields:internalLink","fields:chooseFromExisting","fields:linkType","fields:textToDisplay","fields:collapseAll","fields:editLink","fields:editRelationship","fields:itemsAndMore","fields:labelRelationship","fields:latitude","fields:linkedTo","fields:longitude","fields:passwordsDoNotMatch","fields:removeRelationship","fields:removeUpload","fields:saveChanges","fields:searchForBlock","fields:selectFieldsToEdit","fields:showAll","fields:swapRelationship","fields:swapUpload","fields:toggleBlock","fields:uploadNewLabel","general:aboutToDeleteCount","general:aboutToDelete","general:addBelow","general:addFilter","general:adminTheme","general:and","general:applyChanges","general:ascending","general:automatic","general:backToDashboard","general:cancel","general:changesNotSaved","general:close","general:collapse","general:collections","general:columns","general:columnToSort","general:confirm","general:confirmDeletion","general:confirmDuplication","general:copied","general:copy","general:create","general:created","general:createdAt","general:createNew","general:createNewLabel","general:creating","general:creatingNewLabel","general:custom","general:dark","general:dashboard","general:delete","general:deletedSuccessfully","general:deletedCountSuccessfully","general:deleting","general:descending","general:depth","general:deselectAllRows","general:document","general:documents","general:duplicate","general:duplicateWithoutSaving","general:edit","general:editing","general:editingLabel","general:editLabel","general:email","general:emailAddress","general:enterAValue","general:error","general:errors","general:fallbackToDefaultLocale","general:false","general:filters","general:filterWhere","general:globals","general:language","general:lastModified","general:leaveAnyway","general:leaveWithoutSaving","general:light","general:livePreview","general:loading","general:locale","general:menu","general:moveDown","general:moveUp","general:noFiltersSet","general:noLabel","general:none","general:noOptions","general:noResults","general:notFound","general:nothingFound","general:noValue","general:of","general:open","general:or","general:order","general:pageNotFound","general:password","general:payloadSettings","general:perPage","general:remove","general:reset","general:row","general:rows","general:save","general:saving","general:searchBy","general:selectAll","general:selectAllRows","general:selectedCount","general:selectValue","general:showAllLabel","general:sorryNotFound","general:sort","general:sortByLabelDirection","general:stayOnThisPage","general:submissionSuccessful","general:submit","general:submitting","general:success","general:successfullyCreated","general:successfullyDuplicated","general:thisLanguage","general:titleDeleted","general:true","general:users","general:user","general:unauthorized","general:unsavedChangesDuplicate","general:untitled","general:updatedAt","general:updatedCountSuccessfully","general:updatedSuccessfully","general:updating","general:welcome","operators:equals","operators:exists","operators:isNotIn","operators:isIn","operators:contains","operators:isLike","operators:isNotEqualTo","operators:near","operators:isGreaterThan","operators:isLessThan","operators:isGreaterThanOrEqualTo","operators:isLessThanOrEqualTo","upload:crop","upload:cropToolDescription","upload:dragAndDrop","upload:editImage","upload:focalPoint","upload:focalPointDescription","upload:height","upload:previewSizes","upload:selectCollectionToBrowse","upload:selectFile","upload:setCropArea","upload:setFocalPoint","upload:sizesFor","upload:sizes","upload:width","upload:fileName","upload:fileSize","validation:emailAddress","validation:fieldHasNo","validation:limitReached","validation:longerThanMin","validation:required","validation:requiresAtLeast","validation:shorterThanMax","version:aboutToPublishSelection","version:aboutToRestore","version:aboutToRestoreGlobal","version:aboutToRevertToPublished","version:aboutToUnpublish","version:aboutToUnpublishSelection","version:autosave","version:autosavedSuccessfully","version:autosavedVersion","version:changed","version:confirmRevertToSaved","version:compareVersion","version:confirmPublish","version:confirmUnpublish","version:confirmVersionRestoration","version:draft","version:draftSavedSuccessfully","version:lastSavedAgo","version:noFurtherVersionsFound","version:noRowsFound","version:preview","version:problemRestoringVersion","version:publish","version:publishChanges","version:published","version:publishing","version:restoredSuccessfully","version:restoreThisVersion","version:restoring","version:reverting","version:revertToPublished","version:saveDraft","version:selectLocales","version:selectVersionToCompare","version:showLocales","version:status","version:type","version:unpublish","version:unpublishing","version:versionCreatedOn","version:versionID","version:version","version:versions","version:viewingVersion","version:viewingVersionGlobal","version:viewingVersions","version:viewingVersionsGlobal"];function s(e,t="",n){const r={};for(const[a,o]of Object.entries(e))if("$schema"!==a)if("object"==typeof o){const e=s(o,a,n);Object.keys(e).length>0&&(r[a]=e)}else for(const e of n){const[n,i]=e.split(":");if(t===n)if(a===i)r[i]=o;else{["zero","one","two","few","many","other"].forEach((e=>{a===`${i}_${e}`&&(r[`${i}_${e}`]=o)}))}}else r[a]=o;return r}function l(e){const t={};return Object.keys(e).sort().forEach((n=>{"object"==typeof e[n]?t[n]=l(e[n]):t[n]=e[n]})),t}const c=(e,t)=>"client"===t?l(s(e.translations,"",i)):e.translations,u=({count:e,key:t,translations:n})=>{const r=t.split(":");let a="";const o=r.reduce(((t,n,o)=>{if("string"==typeof t)return t;"number"==typeof e&&(0===e&&`${n}_zero`in t?a="_zero":1===e&&`${n}_one`in t?a="_one":2===e&&`${n}_two`in t?a="_two":e>5&&`${n}_many`in t?a="_many":e>2&&e<=5&&`${n}_few`in t?a="_few":`${n}_other`in t&&(a="_other"));let i=n;return o===r.length-1&&a&&(i=`${n}${a}`),t&&i in t?t[i]:void 0}),n);return o||console.log("key not found:",t),o||t},d=({translationString:e,vars:t})=>e.split(/(\{\{.*?\}\})/).map((e=>{if(e.startsWith("{{")&&e.endsWith("}}")){const n=e.substring(2,e.length-2).trim(),r=t[n];return null!=r?r:e}return e})).join("");function f({key:e,translations:t,vars:n}){let r=u({count:"number"==typeof n?.count?n.count:void 0,key:e,translations:t});return n&&(r=d({translationString:r,vars:n})),r||(r=e),r}const p=e=>{const{config:t,language:n,translations:r}=e,a=o(r,t?.translations?.[n]??{});return{t:(e,t)=>f({key:e,translations:a,vars:t}),translations:a}};const m=function(e,t){const n=new Map;return async r=>{const a=t.reduce(((e,t)=>e+r[t]),"");if(!n.has(a)){const t=await e(r);n.set(a,t)}return n.get(a)}}((async({config:e,context:t,language:n=e.fallbackLanguage})=>{const a=c(e.supportedLanguages[n],t),{t:o,translations:i}=p({config:e,language:n||e.fallbackLanguage,translations:a}),s=e.supportedLanguages[n]?.dateFNSKey||"en-US";return{dateFNS:await r(s),dateFNSKey:s,fallbackLanguage:e.fallbackLanguage,language:n||e.fallbackLanguage,t:o,translations:i}}),["language","context"]),h=["ar","fa","he"],g=["ar","az","bg","cs","de","en","es","fa","fr","he","hr","hu","it","ja","ko","my","nb","nl","pl","pt","ro","rs","rs-latin","ru","sk","sv","th","tr","uk","vi","zh","zh-TW"];function v(e){const t=function(e){return e.split(",").map((e=>{const[t,n]=e.trim().split(";q=");return{language:t,quality:n?parseFloat(n):1}})).sort(((e,t)=>t.quality-e.quality))}(e);let n;for(const{language:e}of t)!n&&g.includes(e)&&(n=e);return n}},94917:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ue});var r=n(54147);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return t.apply(n,[].concat(a,r))}}}function p(e){return{}.toString.call(e).includes("Object")}function m(e){return"function"==typeof e}var h=f((function(e,t){throw new Error(e[t]||e.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),g={changes:function(e,t){return p(t)||h("changeType"),Object.keys(t).some((function(t){return n=e,r=t,!Object.prototype.hasOwnProperty.call(n,r);var n,r}))&&h("changeField"),t},selector:function(e){m(e)||h("selectorType")},handler:function(e){m(e)||p(e)||h("handlerType"),p(e)&&Object.values(e).some((function(e){return!m(e)}))&&h("handlersType")},initial:function(e){var t;e||h("initialIsRequired"),p(e)||h("initialType"),t=e,Object.keys(t).length||h("initialContent")}};function v(e,t){return m(t)?t(e.current):t}function b(e,t){return e.current=d(d({},e.current),t),t}function y(e,t,n){return m(t)?t(e.current):Object.keys(n).forEach((function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.call(t,e.current[n])})),n}const w={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g.initial(e),g.handler(t);var n={current:e},r=f(y)(n,t),a=f(b)(n),o=f(g.changes)(e),i=f(v)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return g.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(r,a,o,i)(e)}]}};const x={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};const P=function(e){return{}.toString.call(e).includes("Object")};var j={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},k=function(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return t.apply(n,[].concat(a,r))}}}((function(e,t){throw new Error(e[t]||e.default)}))(j),S={config:function(e){return e||k("configIsRequired"),P(e)||k("configType"),e.urls?(console.warn(j.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};const C=S;const M=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}};const _=function e(t,n){return Object.keys(n).forEach((function(r){n[r]instanceof Object&&t[r]&&Object.assign(n[r],e(t[r],n[r]))})),i(i({},t),n)};var O={type:"cancelation",msg:"operation is manually canceled"};const E=function(e){var t=!1,n=new Promise((function(n,r){e.then((function(e){return t?r(O):n(e)})),e.catch(r)}));return n.cancel=function(){return t=!0},n};var D,N,A=w.create({config:x,isInitialized:!1,resolve:null,reject:null,monaco:null}),T=(N=2,function(e){if(Array.isArray(e))return e}(D=A)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}return n}}(D,N)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.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)?l(e,t):void 0}}(D,N)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),R=T[0],I=T[1];function L(e){return document.body.appendChild(e)}function $(e){var t,n,r=R((function(e){return{config:e.config,reject:e.reject}})),a=(t="".concat(r.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return a.onload=function(){return e()},a.onerror=r.reject,a}function W(){var e=R((function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}})),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],(function(t){F(t),e.resolve(t)}),(function(t){e.reject(t)}))}function F(e){R().monaco||I({monaco:e})}var z=new Promise((function(e,t){return I({resolve:e,reject:t})})),B={config:function(e){var t=C.config(e),n=t.monaco,r=s(t,["monaco"]);I((function(e){return{config:_(e.config,r),monaco:n}}))},init:function(){var e=R((function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}}));if(!e.isInitialized){if(I({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),E(z);if(window.monaco&&window.monaco.editor)return F(window.monaco),e.resolve(window.monaco),E(z);M(L,$)(W)}return E(z)},__getMonacoInstance:function(){return R((function(e){return e.monaco}))}};const H=B;var Y=n(54953),V={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},q={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var U=function({children:e}){return Y.createElement("div",{style:q.container},e)};var G=function({width:e,height:t,isEditorReady:n,loading:r,_ref:a,className:o,wrapperProps:i}){return Y.createElement("section",{style:{...V.wrapper,width:e,height:t},...i},!n&&Y.createElement(U,null,r),Y.createElement("div",{ref:a,style:{...V.fullWidth,...!n&&V.hide},className:o}))},K=(0,Y.memo)(G);var X=function(e){(0,Y.useEffect)(e,[])};var Q=function(e,t,n=!0){let r=(0,Y.useRef)(!0);(0,Y.useEffect)(r.current||!n?()=>{r.current=!1}:e,t)};function J(){}function Z(e,t,n,r){return function(e,t){return e.editor.getModel(ee(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?ee(e,r):void 0)}(e,t,n,r)}function ee(e,t){return e.Uri.parse(t)}var te=function({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:a,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:d={},height:f="100%",width:p="100%",className:m,wrapperProps:h={},beforeMount:g=J,onMount:v=J}){let[b,y]=(0,Y.useState)(!1),[w,x]=(0,Y.useState)(!0),P=(0,Y.useRef)(null),j=(0,Y.useRef)(null),k=(0,Y.useRef)(null),S=(0,Y.useRef)(v),C=(0,Y.useRef)(g),M=(0,Y.useRef)(!1);X((()=>{let e=H.init();return e.then((e=>(j.current=e)&&x(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>P.current?function(){let e=P.current?.getModel();s||e?.original?.dispose(),l||e?.modified?.dispose(),P.current?.dispose()}():e.cancel()})),Q((()=>{let e=P.current.getModifiedEditor();e.getOption(j.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())}),[t],b),Q((()=>{P.current?.getModel()?.original.setValue(e||"")}),[e],b),Q((()=>{let{original:e,modified:t}=P.current.getModel();j.current.editor.setModelLanguage(e,r||n||"text"),j.current.editor.setModelLanguage(t,a||n||"text")}),[n,r,a],b),Q((()=>{j.current?.editor.setTheme(c)}),[c],b),Q((()=>{P.current?.updateOptions(d)}),[d],b);let _=(0,Y.useCallback)((()=>{if(!j.current)return;C.current(j.current);let s=Z(j.current,e||"",r||n||"text",o||""),l=Z(j.current,t||"",a||n||"text",i||"");P.current?.setModel({original:s,modified:l})}),[n,t,a,e,r,o,i]),O=(0,Y.useCallback)((()=>{!M.current&&k.current&&(P.current=j.current.editor.createDiffEditor(k.current,{automaticLayout:!0,...d}),_(),j.current?.editor.setTheme(c),y(!0),M.current=!0)}),[d,c,_]);return(0,Y.useEffect)((()=>{b&&S.current(P.current,j.current)}),[b]),(0,Y.useEffect)((()=>{!w&&!b&&O()}),[w,b,O]),Q((()=>{if(P.current&&j.current){let t=P.current.getOriginalEditor(),a=Z(j.current,e||"",r||n||"text",o||"");a!==t.getModel()&&t.setModel(a)}}),[o],b),Q((()=>{if(P.current&&j.current){let e=P.current.getModifiedEditor(),r=Z(j.current,t||"",a||n||"text",i||"");r!==e.getModel()&&e.setModel(r)}}),[i],b),Y.createElement(K,{width:p,height:f,isEditorReady:b,loading:u,_ref:k,className:m,wrapperProps:h})};(0,Y.memo)(te);var ne=function(e){let t=(0,Y.useRef)();return(0,Y.useEffect)((()=>{t.current=e}),[e]),t.current},re=new Map;var ae=function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:a,path:o,theme:i="light",line:s,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p="100%",height:m="100%",className:h,wrapperProps:g={},beforeMount:v=J,onMount:b=J,onChange:y,onValidate:w=J}){let[x,P]=(0,Y.useState)(!1),[j,k]=(0,Y.useState)(!0),S=(0,Y.useRef)(null),C=(0,Y.useRef)(null),M=(0,Y.useRef)(null),_=(0,Y.useRef)(b),O=(0,Y.useRef)(v),E=(0,Y.useRef)(),D=(0,Y.useRef)(r),N=ne(o),A=(0,Y.useRef)(!1),T=(0,Y.useRef)(!1);X((()=>{let e=H.init();return e.then((e=>(S.current=e)&&k(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>C.current?(E.current?.dispose(),f?d&&re.set(o,C.current.saveViewState()):C.current.getModel()?.dispose(),void C.current.dispose()):e.cancel()})),Q((()=>{let i=Z(S.current,e||r||"",t||a||"",o||n||"");i!==C.current?.getModel()&&(d&&re.set(N,C.current?.saveViewState()),C.current?.setModel(i),d&&C.current?.restoreViewState(re.get(o)))}),[o],x),Q((()=>{C.current?.updateOptions(c)}),[c],x),Q((()=>{!C.current||void 0===r||(C.current.getOption(S.current.editor.EditorOption.readOnly)?C.current.setValue(r):r!==C.current.getValue()&&(T.current=!0,C.current.executeEdits("",[{range:C.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),C.current.pushUndoStop(),T.current=!1))}),[r],x),Q((()=>{let e=C.current?.getModel();e&&a&&S.current?.editor.setModelLanguage(e,a)}),[a],x),Q((()=>{void 0!==s&&C.current?.revealLine(s)}),[s],x),Q((()=>{S.current?.editor.setTheme(i)}),[i],x);let R=(0,Y.useCallback)((()=>{if(M.current&&S.current&&!A.current){O.current(S.current);let s=o||n,l=Z(S.current,r||e||"",t||a||"",s||"");C.current=S.current?.editor.create(M.current,{model:l,automaticLayout:!0,...c},u),d&&C.current.restoreViewState(re.get(s)),S.current.editor.setTheme(i),P(!0),A.current=!0}}),[e,t,n,r,a,o,c,u,d,i]);return(0,Y.useEffect)((()=>{x&&_.current(C.current,S.current)}),[x]),(0,Y.useEffect)((()=>{!j&&!x&&R()}),[j,x,R]),D.current=r,(0,Y.useEffect)((()=>{x&&y&&(E.current?.dispose(),E.current=C.current?.onDidChangeModelContent((e=>{T.current||y(C.current.getValue(),e)})))}),[x,y]),(0,Y.useEffect)((()=>{if(x){let e=S.current.editor.onDidChangeMarkers((e=>{let t=C.current.getModel()?.uri;if(t&&e.find((e=>e.path===t.path))){let e=S.current.editor.getModelMarkers({resource:t});w?.(e)}}));return()=>{e?.dispose()}}return()=>{}}),[x,w]),Y.createElement(K,{width:p,height:m,isEditorReady:x,loading:l,_ref:M,className:h,wrapperProps:g})},oe=(0,Y.memo)(ae),ie=n(44666),se=n(32293);const le=oe.default||oe,ce="code-editor",ue=e=>{const{className:t,height:n,options:a,readOnly:o,...i}=e,{theme:s}=(0,ie.DP)(),l=[ce,t,i?.defaultLanguage?`language--${i.defaultLanguage}`:""].filter(Boolean).join(" ");return(0,r.jsx)(le,{className:l,height:n,loading:(0,r.jsx)(se.l,{height:n}),options:{detectIndentation:!0,minimap:{enabled:!1},readOnly:Boolean(o),scrollBeyondLastLine:!1,tabSize:2,wordWrap:"on",...a},theme:"dark"===s?"vs-dark":"vs",...i})}},99304:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(54147),a=(n(54953),n(94467)),o=n.n(a);const i=()=>(0,r.jsxs)("svg",{className:"icon icon--calendar",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("rect",{className:"stroke",height:"14",width:"16",x:"4.5",y:"6.11401"}),(0,r.jsx)("line",{className:"stroke",x1:"8.625",x2:"8.625",y1:"8.02026",y2:"3.70776"}),(0,r.jsx)("line",{className:"stroke",x1:"16.375",x2:"16.375",y1:"8.02026",y2:"3.70776"}),(0,r.jsx)("line",{className:"stroke",x1:"4.5",x2:"20.5",y1:"11.114",y2:"11.114"})]});var s=n(38728),l=n(19236);const c=o().default||o(),u="date-time-picker",d=e=>{const{displayFormat:t,maxDate:n,maxTime:o,minDate:d,minTime:f,monthsToShow:p=1,onChange:m,overrides:h,pickerAppearance:g="default",placeholder:v,readOnly:b,timeFormat:y="h:mm aa",timeIntervals:w=30,value:x}=e,{i18n:P}=(0,l.B)(),j=((e="enUS")=>({en:"enUS",my:"enUS",ua:"uk",zh:"zhCN"}[e]||e))(P.language);try{(0,a.registerLocale)(j,P.dateFNS)}catch(e){console.warn(`Could not find DatePicker locale for ${P.language}`)}let k=t;t||("default"===g?k="MM/dd/yyyy":"dayAndTime"===g?k="MMM d, yyy h:mm a":"timeOnly"===g?k="h:mm a":"dayOnly"===g?k="MMM dd":"monthOnly"===g&&(k="MMMM"));const S=e=>{const t=e;if(t instanceof Date&&["dayOnly","default","monthOnly"].includes(g)){const n=e.getTimezoneOffset()/60;t.setHours(12-n,0)}"function"==typeof m&&m(t)},C={customInputRef:"ref",dateFormat:k,disabled:b,maxDate:n,maxTime:o,minDate:d,minTime:f,monthsShown:Math.min(2,p),onChange:S,placeholderText:v,popperPlacement:"bottom-start",selected:x&&new Date(x),showMonthYearPicker:"monthOnly"===g,showPopperArrow:!1,showTimeSelect:"dayAndTime"===g||"timeOnly"===g,timeFormat:y,timeIntervals:w,...h},M=[u,`${u}__appearance--${g}`].filter(Boolean).join(" ");return(0,r.jsxs)("div",{className:M,children:[(0,r.jsxs)("div",{className:`${u}__icon-wrap`,children:[C.selected&&(0,r.jsx)("button",{className:`${u}__clear-button`,onClick:()=>S(null),type:"button",children:(0,r.jsx)(s.u,{})}),(0,r.jsx)(i,{})]}),(0,r.jsx)("div",{className:`${u}__input-wrapper`,children:(0,r.jsx)(c,{...C,dropdownMode:"select",locale:j,showMonthDropdown:!0,showYearDropdown:!0})})]})}},32293:(e,t,n)=>{"use strict";n.d(t,{l:()=>o,E:()=>i});var r=n(54147),a=(n(54953),n(55674));const o=({animationDelay:e="0ms",height:t="60px",width:n="100%"})=>(0,r.jsx)("div",{className:"shimmer-effect",style:{height:"number"==typeof t?`${t}px`:t,width:"number"==typeof n?`${n}px`:n},children:(0,r.jsx)("div",{className:"shimmer-effect__shine",style:{animationDelay:e}})}),i=({className:e,count:t,height:n,renderDelay:i=500,shimmerDelay:s=25,shimmerItemClassName:l,width:c})=>{const u="number"==typeof s?`${s}ms`:s,[d]=(0,a.Z)(i,!0);return d?(0,r.jsx)("div",{className:e,children:[...Array(t)].map(((e,t)=>(0,r.jsx)("div",{className:l,children:(0,r.jsx)(o,{animationDelay:`calc(${t} * ${u})`,height:n,width:c})},t)))}):null}},55674:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(54953);const a=(e,t=!1)=>{const[n,a]=r.useState(!1),o=r.useRef(void 0),i=r.useCallback((()=>(a(!1),clearTimeout(o.current),o.current=setTimeout((()=>{a(!0)}),e),()=>{clearTimeout(o.current)})),[e]);return r.useEffect((()=>{t&&i()}),[i,t]),[n,i]}},38728:(e,t,n)=>{"use strict";n.d(t,{u:()=>a});var r=n(54147);n(54953);const a=({className:e})=>(0,r.jsxs)("svg",{className:[e,"icon icon--x"].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("line",{className:"stroke",x1:"8.74612",x2:"16.3973",y1:"16.347",y2:"8.69584"}),(0,r.jsx)("line",{className:"stroke",x1:"8.6027",x2:"16.2539",y1:"8.69585",y2:"16.3471"})]})},84348:(e,t,n)=>{"use strict";n.d(t,{P:()=>l,Y:()=>s});var r=n(54147),a=n(72659),o=n(54953);const i=(0,o.createContext)({clearRouteCache:()=>{}}),s=({children:e})=>{const t=(0,a.usePathname)(),n=(0,a.useRouter)(),s=(0,o.useCallback)((()=>{n.refresh()}),[n]);return(0,o.useEffect)((()=>{s()}),[t,s]),(0,r.jsx)(i.Provider,{value:{clearRouteCache:s},children:e})},l=()=>(0,o.useContext)(i)},44666:(e,t,n)=>{"use strict";n.d(t,{DP:()=>u,NP:()=>c,zQ:()=>l});var r=n(54147),a=n(54953);const o={autoMode:!0,setTheme:()=>null,theme:"light"},i=(0,a.createContext)(o);function s(e,t,n){const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);const a="expires="+r.toUTCString();document.cookie=e+"="+t+";"+a+";path=/"}const l="light",c=({children:e,cookiePrefix:t,theme:n})=>{const o=`${t||"payload"}-theme`,[c,u]=(0,a.useState)(n||l),[d,f]=(0,a.useState)();(0,a.useEffect)((()=>{const{theme:e,themeFromCookies:t}=(e=>{let t;const n=window.document.cookie.split("; ").find((t=>t.startsWith(`${e}=`)))?.split("=")[1];return t="light"===n||"dark"===n?n:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t),{theme:t,themeFromCookies:n}})(o);u(e),f(!t)}),[o]);const p=(0,a.useCallback)((e=>{if("light"===e||"dark"===e)u(e),f(!1),s(o,e,365),document.documentElement.setAttribute("data-theme",e);else if("auto"===e){s(o,e,-1);const t=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";document.documentElement.setAttribute("data-theme",t),f(!0),u(t)}}),[o]);return(0,r.jsx)(i.Provider,{value:{autoMode:d,setTheme:p,theme:c},children:e})},u=()=>(0,a.useContext)(i)},19236:(e,t,n)=>{"use strict";n.d(t,{B:()=>d,D:()=>u});var r=n(54147),a=n(43289),o=n(69441),i=n(54953),s=n.n(i),l=n(84348);const c=(0,i.createContext)({i18n:{dateFNS:o.enUS,dateFNSKey:"en-US",fallbackLanguage:"en",language:"en",t:e=>e,translations:{}},languageOptions:void 0,switchLanguage:void 0,t:e=>{}}),u=({children:e,dateFNSKey:t,fallbackLang:n,language:o,languageOptions:u,switchLanguageServerAction:d,translations:f})=>{const{clearRouteCache:p}=(0,l.P)(),[m,h]=(0,i.useState)(),g=(e,t)=>(0,a.t)({key:e,translations:f,vars:t}),v=s().useCallback((async e=>{try{await d(e),p()}catch(t){console.error(`Error loading language: "${e}"`,t)}}),[d,p]);return(0,i.useEffect)((()=>{(async()=>{const e=await(0,a.pP)(t);h(e)})()}),[t]),(0,r.jsx)(c.Provider,{value:{i18n:{dateFNS:m,dateFNSKey:t,fallbackLanguage:n,language:o,t:g,translations:f},languageOptions:u,switchLanguage:v,t:g},children:e})},d=()=>(0,i.useContext)(c)},54953:e=>{"use strict";e.exports=require("react")},20180:e=>{"use strict";e.exports=require("react-dom")},24333:()=>{},64808:(e,t)=>{"use strict";t._=t._interop_require_default=function(e){return e&&e.__esModule?e:{default:e}}},66727:(e,t)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}t._=t._interop_require_wildcard=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var a={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,r&&r.set(e,a);return a}},90435:(e,t)=>{var n;
|
|
47
|
+
*/function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(!(0<o(a,t)))break e;e[r]=t,e[n]=a,n=r}}function r(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length,i=a>>>1;r<i;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>o(l,n))c<a&&0>o(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<a&&0>o(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,p=3,m=!1,h=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var t=r(u);null!==t;){if(null===t.callback)a(u);else{if(!(t.startTime<=e))break;a(u),t.sortIndex=t.expirationTime,n(c,t)}t=r(u)}}function x(e){if(g=!1,w(e),!h)if(null!==r(c))h=!0,D();else{var t=r(u);null!==t&&N(x,t.startTime-e)}}var P,j=!1,k=-1,S=5,C=-1;function M(){return!(t.unstable_now()-C<S)}function _(){if(j){var e=t.unstable_now();C=e;var n=!0;try{e:{h=!1,g&&(g=!1,b(k),k=-1),m=!0;var o=p;try{t:{for(w(e),f=r(c);null!==f&&!(f.expirationTime>e&&M());){var i=f.callback;if("function"==typeof i){f.callback=null,p=f.priorityLevel;var s=i(f.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){f.callback=s,w(e),n=!0;break t}f===r(c)&&a(c),w(e)}else a(c);f=r(c)}if(null!==f)n=!0;else{var l=r(u);null!==l&&N(x,l.startTime-e),n=!1}}break e}finally{f=null,p=o,m=!1}n=void 0}}finally{n?P():j=!1}}}if("function"==typeof y)P=function(){y(_)};else if("undefined"!=typeof MessageChannel){var O=new MessageChannel,E=O.port2;O.port1.onmessage=_,P=function(){E.postMessage(null)}}else P=function(){v(_,0)};function D(){j||(j=!0,P())}function N(e,n){k=v((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){h||m||(h=!0,D())},t.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"):S=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,a,o){var i=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return e={id:d++,callback:a,priorityLevel:e,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>i?(e.sortIndex=o,n(u,e),null===r(c)&&e===r(u)&&(g?(b(k),k=-1):g=!0,N(x,o-i))):(e.sortIndex=s,n(c,e),h||m||(h=!0,D())),e},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},61060:(e,t,n)=>{"use strict";e.exports=n(20919)},37157:(e,t,n)=>{"use strict";var r=n(17663),a=n(73776),o=n(47729)(),i=n(14056),s=n(4100),l=r("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||l(t)!==t)throw new s("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],r=!0,c=!0;if("length"in e&&i){var u=i(e,"length");u&&!u.configurable&&(r=!1),u&&!u.writable&&(c=!1)}return(r||c||!n)&&(o?a(e,"length",t,!0,!0):a(e,"length",t)),e}},57837:(e,t,n)=>{"use strict";var r=n(17663),a=n(5666),o=n(28514),i=n(4100),s=r("%WeakMap%",!0),l=r("%Map%",!0),c=a("WeakMap.prototype.get",!0),u=a("WeakMap.prototype.set",!0),d=a("WeakMap.prototype.has",!0),f=a("Map.prototype.get",!0),p=a("Map.prototype.set",!0),m=a("Map.prototype.has",!0),h=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new i("Side channel does not contain "+o(e))},get:function(r){if(s&&r&&("object"==typeof r||"function"==typeof r)){if(e)return c(e,r)}else if(l){if(t)return f(t,r)}else if(n)return function(e,t){var n=h(e,t);return n&&n.value}(n,r)},has:function(r){if(s&&r&&("object"==typeof r||"function"==typeof r)){if(e)return d(e,r)}else if(l){if(t)return m(t,r)}else if(n)return function(e,t){return!!h(e,t)}(n,r);return!1},set:function(r,a){s&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new s),u(e,r,a)):l?(t||(t=new l),p(t,r,a)):(n||(n={key:{},next:null}),function(e,t,n){var r=h(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,a))}};return r}},22411:e=>{"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},43289:(e,t,n)=>{"use strict";n.d(t,{R8:()=>v,sC:()=>a,pP:()=>r,LE:()=>m,aG:()=>h,t:()=>f});const r=async e=>{let t;switch(e){case"ar":t=(await Promise.resolve().then(n.bind(n,96830))).ar;break;case"az":t=(await Promise.resolve().then(n.bind(n,14330))).az;break;case"bg":t=(await Promise.resolve().then(n.bind(n,31781))).bg;break;case"cs":t=(await Promise.resolve().then(n.bind(n,29603))).cs;break;case"de":t=(await Promise.resolve().then(n.bind(n,52347))).de;break;case"en-US":t=(await Promise.resolve().then(n.bind(n,69441))).enUS;break;case"es":t=(await Promise.resolve().then(n.bind(n,61560))).es;break;case"fa-IR":t=(await Promise.resolve().then(n.bind(n,96433))).faIR;break;case"fr":t=(await Promise.resolve().then(n.bind(n,48976))).fr;break;case"he":t=(await Promise.resolve().then(n.bind(n,32111))).he;break;case"hr":t=(await Promise.resolve().then(n.bind(n,80484))).hr;break;case"hu":t=(await Promise.resolve().then(n.bind(n,50150))).hu;break;case"it":t=(await Promise.resolve().then(n.bind(n,8125))).it;break;case"ja":t=(await Promise.resolve().then(n.bind(n,66964))).ja;break;case"ko":t=(await Promise.resolve().then(n.bind(n,34463))).ko;break;case"nb":t=(await Promise.resolve().then(n.bind(n,6612))).nb;break;case"nl":t=(await Promise.resolve().then(n.bind(n,71816))).nl;break;case"pl":t=(await Promise.resolve().then(n.bind(n,79435))).pl;break;case"pt":t=(await Promise.resolve().then(n.bind(n,42873))).pt;break;case"ro":t=(await Promise.resolve().then(n.bind(n,90947))).ro;break;case"ru":t=(await Promise.resolve().then(n.bind(n,85566))).ru;break;case"sk":t=(await Promise.resolve().then(n.bind(n,95773))).sk;break;case"sv":t=(await Promise.resolve().then(n.bind(n,39734))).sv;break;case"th":t=(await Promise.resolve().then(n.bind(n,61272))).th;break;case"tr":t=(await Promise.resolve().then(n.bind(n,37377))).tr;break;case"uk":t=(await Promise.resolve().then(n.bind(n,98354))).uk;break;case"vi":t=(await Promise.resolve().then(n.bind(n,68121))).vi;break;case"zh-CN":t=(await Promise.resolve().then(n.bind(n,10180))).zhCN;break;case"zh-TW":t=(await Promise.resolve().then(n.bind(n,64609))).zhTW}return t.default?t.default:t},a=(e,t)=>{if("object"==typeof e&&!Object.prototype.hasOwnProperty.call(e,"$$typeof")){if(e[t.language])return e[t.language];let n=[];"string"==typeof t.fallbackLanguage?n=[t.fallbackLanguage]:Array.isArray(t.fallbackLanguage)&&(n=t.fallbackLanguage);const r=n.find((t=>e[t]));return r&&e[r]?e[r]:e[Object.keys(e)[0]]}return"function"==typeof e?e({t:t.t}):e};function o(e,t,n=!0){const r={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(n&&(null===t[a]||void 0===t[a])&&null!==e[a]&&void 0!==e[a])continue;"object"==typeof t[a]&&e[a]?r[a]=o(e[a],t[a],n):r[a]=t[a]}return r}const i=["authentication:account","authentication:accountOfCurrentUser","authentication:accountVerified","authentication:alreadyActivated","authentication:alreadyLoggedIn","authentication:apiKey","authentication:authenticated","authentication:backToLogin","authentication:beginCreateFirstUser","authentication:changePassword","authentication:checkYourEmailForPasswordReset","authentication:confirmGeneration","authentication:confirmPassword","authentication:createFirstUser","authentication:emailNotValid","authentication:usernameNotValid","authentication:emailSent","authentication:emailVerified","authentication:enableAPIKey","authentication:failedToUnlock","authentication:forceUnlock","authentication:forgotPassword","authentication:forgotPasswordEmailInstructions","authentication:forgotPasswordUsernameInstructions","authentication:forgotPasswordQuestion","authentication:generate","authentication:generateNewAPIKey","authentication:generatingNewAPIKeyWillInvalidate","authentication:logBackIn","authentication:loggedOutInactivity","authentication:loggedOutSuccessfully","authentication:loggingOut","authentication:login","authentication:logOut","authentication:loggedIn","authentication:loggedInChangePassword","authentication:logout","authentication:logoutUser","authentication:logoutSuccessful","authentication:newAPIKeyGenerated","authentication:newPassword","authentication:passed","authentication:passwordResetSuccessfully","authentication:resetPassword","authentication:stayLoggedIn","authentication:successfullyRegisteredFirstUser","authentication:successfullyUnlocked","authentication:username","authentication:unableToVerify","authentication:tokenRefreshSuccessful","authentication:verified","authentication:verifiedSuccessfully","authentication:verify","authentication:verifyUser","authentication:youAreInactive","error:autosaving","error:correctInvalidFields","error:deletingTitle","error:emailOrPasswordIncorrect","error:usernameOrPasswordIncorrect","error:loadingDocument","error:logoutFailed","error:noMatchedField","error:notAllowedToAccessPage","error:previewing","error:unableToDeleteCount","error:unableToUpdateCount","error:unauthorized","error:unknown","error:unspecific","error:userEmailAlreadyRegistered","error:usernameAlreadyRegistered","error:tokenNotProvided","error:unPublishingDocument","fields:addLabel","fields:addLink","fields:addNew","fields:addNewLabel","fields:addRelationship","fields:addUpload","fields:block","fields:blocks","fields:blockType","fields:chooseBetweenCustomTextOrDocument","fields:customURL","fields:chooseDocumentToLink","fields:openInNewTab","fields:enterURL","fields:internalLink","fields:chooseFromExisting","fields:linkType","fields:textToDisplay","fields:collapseAll","fields:editLink","fields:editRelationship","fields:itemsAndMore","fields:labelRelationship","fields:latitude","fields:linkedTo","fields:longitude","fields:passwordsDoNotMatch","fields:removeRelationship","fields:removeUpload","fields:saveChanges","fields:searchForBlock","fields:selectFieldsToEdit","fields:showAll","fields:swapRelationship","fields:swapUpload","fields:toggleBlock","fields:uploadNewLabel","general:aboutToDeleteCount","general:aboutToDelete","general:addBelow","general:addFilter","general:adminTheme","general:and","general:applyChanges","general:ascending","general:automatic","general:backToDashboard","general:cancel","general:changesNotSaved","general:close","general:collapse","general:collections","general:columns","general:columnToSort","general:confirm","general:confirmDeletion","general:confirmDuplication","general:copied","general:copy","general:create","general:created","general:createdAt","general:createNew","general:createNewLabel","general:creating","general:creatingNewLabel","general:custom","general:dark","general:dashboard","general:delete","general:deletedSuccessfully","general:deletedCountSuccessfully","general:deleting","general:descending","general:depth","general:deselectAllRows","general:document","general:documents","general:duplicate","general:duplicateWithoutSaving","general:edit","general:editing","general:editingLabel","general:editLabel","general:email","general:emailAddress","general:enterAValue","general:error","general:errors","general:fallbackToDefaultLocale","general:false","general:filters","general:filterWhere","general:globals","general:language","general:lastModified","general:leaveAnyway","general:leaveWithoutSaving","general:light","general:livePreview","general:loading","general:locale","general:menu","general:moveDown","general:moveUp","general:noFiltersSet","general:noLabel","general:none","general:noOptions","general:noResults","general:notFound","general:nothingFound","general:noValue","general:of","general:open","general:or","general:order","general:pageNotFound","general:password","general:payloadSettings","general:perPage","general:remove","general:reset","general:row","general:rows","general:save","general:saving","general:searchBy","general:selectAll","general:selectAllRows","general:selectedCount","general:selectValue","general:showAllLabel","general:sorryNotFound","general:sort","general:sortByLabelDirection","general:stayOnThisPage","general:submissionSuccessful","general:submit","general:submitting","general:success","general:successfullyCreated","general:successfullyDuplicated","general:thisLanguage","general:titleDeleted","general:true","general:users","general:user","general:unauthorized","general:unsavedChangesDuplicate","general:untitled","general:updatedAt","general:updatedCountSuccessfully","general:updatedSuccessfully","general:updating","general:welcome","operators:equals","operators:exists","operators:isNotIn","operators:isIn","operators:contains","operators:isLike","operators:isNotEqualTo","operators:near","operators:isGreaterThan","operators:isLessThan","operators:isGreaterThanOrEqualTo","operators:isLessThanOrEqualTo","operators:within","operators:intersects","upload:crop","upload:cropToolDescription","upload:dragAndDrop","upload:editImage","upload:focalPoint","upload:focalPointDescription","upload:height","upload:previewSizes","upload:selectCollectionToBrowse","upload:selectFile","upload:setCropArea","upload:setFocalPoint","upload:sizesFor","upload:sizes","upload:width","upload:fileName","upload:fileSize","validation:emailAddress","validation:fieldHasNo","validation:limitReached","validation:longerThanMin","validation:required","validation:requiresAtLeast","validation:shorterThanMax","version:aboutToPublishSelection","version:aboutToRestore","version:aboutToRestoreGlobal","version:aboutToRevertToPublished","version:aboutToUnpublish","version:aboutToUnpublishSelection","version:autosave","version:autosavedSuccessfully","version:autosavedVersion","version:changed","version:confirmRevertToSaved","version:compareVersion","version:confirmPublish","version:confirmUnpublish","version:confirmVersionRestoration","version:draft","version:draftSavedSuccessfully","version:lastSavedAgo","version:noFurtherVersionsFound","version:noRowsFound","version:preview","version:problemRestoringVersion","version:publish","version:publishChanges","version:published","version:publishing","version:restoredSuccessfully","version:restoreThisVersion","version:restoring","version:reverting","version:revertToPublished","version:saveDraft","version:selectLocales","version:selectVersionToCompare","version:showLocales","version:status","version:type","version:unpublish","version:unpublishing","version:versionCreatedOn","version:versionID","version:version","version:versions","version:viewingVersion","version:viewingVersionGlobal","version:viewingVersions","version:viewingVersionsGlobal"];function s(e,t="",n){const r={};for(const[a,o]of Object.entries(e))if("$schema"!==a)if("object"==typeof o){const e=s(o,a,n);Object.keys(e).length>0&&(r[a]=e)}else for(const e of n){const[n,i]=e.split(":");if(t===n)if(a===i)r[i]=o;else{["zero","one","two","few","many","other"].forEach((e=>{a===`${i}_${e}`&&(r[`${i}_${e}`]=o)}))}}else r[a]=o;return r}function l(e){const t={};return Object.keys(e).sort().forEach((n=>{"object"==typeof e[n]?t[n]=l(e[n]):t[n]=e[n]})),t}const c=(e,t)=>"client"===t?l(s(e.translations,"",i)):e.translations,u=({count:e,key:t,translations:n})=>{const r=t.split(":");let a="";const o=r.reduce(((t,n,o)=>{if("string"==typeof t)return t;"number"==typeof e&&(0===e&&`${n}_zero`in t?a="_zero":1===e&&`${n}_one`in t?a="_one":2===e&&`${n}_two`in t?a="_two":e>5&&`${n}_many`in t?a="_many":e>2&&e<=5&&`${n}_few`in t?a="_few":`${n}_other`in t&&(a="_other"));let i=n;return o===r.length-1&&a&&(i=`${n}${a}`),t&&i in t?t[i]:void 0}),n);return o||console.log("key not found:",t),o||t},d=({translationString:e,vars:t})=>e.split(/(\{\{.*?\}\})/).map((e=>{if(e.startsWith("{{")&&e.endsWith("}}")){const n=e.substring(2,e.length-2).trim(),r=t[n];return null!=r?r:e}return e})).join("");function f({key:e,translations:t,vars:n}){let r=u({count:"number"==typeof n?.count?n.count:void 0,key:e,translations:t});return n&&(r=d({translationString:r,vars:n})),r||(r=e),r}const p=e=>{const{config:t,language:n,translations:r}=e,a=o(r,t?.translations?.[n]??{});return{t:(e,t)=>f({key:e,translations:a,vars:t}),translations:a}};const m=function(e,t){const n=new Map;return async r=>{const a=t.reduce(((e,t)=>e+r[t]),"");if(!n.has(a)){const t=await e(r);n.set(a,t)}return n.get(a)}}((async({config:e,context:t,language:n=e.fallbackLanguage})=>{const a=c(e.supportedLanguages[n],t),{t:o,translations:i}=p({config:e,language:n||e.fallbackLanguage,translations:a}),s=e.supportedLanguages[n]?.dateFNSKey||"en-US";return{dateFNS:await r(s),dateFNSKey:s,fallbackLanguage:e.fallbackLanguage,language:n||e.fallbackLanguage,t:o,translations:i}}),["language","context"]),h=["ar","fa","he"],g=["ar","az","bg","cs","de","en","es","fa","fr","he","hr","hu","it","ja","ko","my","nb","nl","pl","pt","ro","rs","rs-latin","ru","sk","sv","th","tr","uk","vi","zh","zh-TW"];function v(e){const t=function(e){return e.split(",").map((e=>{const[t,n]=e.trim().split(";q=");return{language:t,quality:n?parseFloat(n):1}})).sort(((e,t)=>t.quality-e.quality))}(e);let n;for(const{language:e}of t)!n&&g.includes(e)&&(n=e);return n}},7064:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ue});var r=n(54147);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return t.apply(n,[].concat(a,r))}}}function p(e){return{}.toString.call(e).includes("Object")}function m(e){return"function"==typeof e}var h=f((function(e,t){throw new Error(e[t]||e.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),g={changes:function(e,t){return p(t)||h("changeType"),Object.keys(t).some((function(t){return n=e,r=t,!Object.prototype.hasOwnProperty.call(n,r);var n,r}))&&h("changeField"),t},selector:function(e){m(e)||h("selectorType")},handler:function(e){m(e)||p(e)||h("handlerType"),p(e)&&Object.values(e).some((function(e){return!m(e)}))&&h("handlersType")},initial:function(e){var t;e||h("initialIsRequired"),p(e)||h("initialType"),t=e,Object.keys(t).length||h("initialContent")}};function v(e,t){return m(t)?t(e.current):t}function b(e,t){return e.current=d(d({},e.current),t),t}function y(e,t,n){return m(t)?t(e.current):Object.keys(n).forEach((function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.call(t,e.current[n])})),n}const w={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g.initial(e),g.handler(t);var n={current:e},r=f(y)(n,t),a=f(b)(n),o=f(g.changes)(e),i=f(v)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return g.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(r,a,o,i)(e)}]}};const x={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};const P=function(e){return{}.toString.call(e).includes("Object")};var j={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},k=function(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return t.apply(n,[].concat(a,r))}}}((function(e,t){throw new Error(e[t]||e.default)}))(j),S={config:function(e){return e||k("configIsRequired"),P(e)||k("configType"),e.urls?(console.warn(j.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};const C=S;const M=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}};const _=function e(t,n){return Object.keys(n).forEach((function(r){n[r]instanceof Object&&t[r]&&Object.assign(n[r],e(t[r],n[r]))})),i(i({},t),n)};var O={type:"cancelation",msg:"operation is manually canceled"};const E=function(e){var t=!1,n=new Promise((function(n,r){e.then((function(e){return t?r(O):n(e)})),e.catch(r)}));return n.cancel=function(){return t=!0},n};var D,N,A=w.create({config:x,isInitialized:!1,resolve:null,reject:null,monaco:null}),T=(N=2,function(e){if(Array.isArray(e))return e}(D=A)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}return n}}(D,N)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.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)?l(e,t):void 0}}(D,N)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),R=T[0],I=T[1];function L(e){return document.body.appendChild(e)}function $(e){var t,n,r=R((function(e){return{config:e.config,reject:e.reject}})),a=(t="".concat(r.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return a.onload=function(){return e()},a.onerror=r.reject,a}function W(){var e=R((function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}})),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],(function(t){F(t),e.resolve(t)}),(function(t){e.reject(t)}))}function F(e){R().monaco||I({monaco:e})}var z=new Promise((function(e,t){return I({resolve:e,reject:t})})),B={config:function(e){var t=C.config(e),n=t.monaco,r=s(t,["monaco"]);I((function(e){return{config:_(e.config,r),monaco:n}}))},init:function(){var e=R((function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}}));if(!e.isInitialized){if(I({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),E(z);if(window.monaco&&window.monaco.editor)return F(window.monaco),e.resolve(window.monaco),E(z);M(L,$)(W)}return E(z)},__getMonacoInstance:function(){return R((function(e){return e.monaco}))}};const H=B;var Y=n(54953),V={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},q={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var U=function({children:e}){return Y.createElement("div",{style:q.container},e)};var G=function({width:e,height:t,isEditorReady:n,loading:r,_ref:a,className:o,wrapperProps:i}){return Y.createElement("section",{style:{...V.wrapper,width:e,height:t},...i},!n&&Y.createElement(U,null,r),Y.createElement("div",{ref:a,style:{...V.fullWidth,...!n&&V.hide},className:o}))},K=(0,Y.memo)(G);var X=function(e){(0,Y.useEffect)(e,[])};var Q=function(e,t,n=!0){let r=(0,Y.useRef)(!0);(0,Y.useEffect)(r.current||!n?()=>{r.current=!1}:e,t)};function J(){}function Z(e,t,n,r){return function(e,t){return e.editor.getModel(ee(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?ee(e,r):void 0)}(e,t,n,r)}function ee(e,t){return e.Uri.parse(t)}var te=function({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:a,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:d={},height:f="100%",width:p="100%",className:m,wrapperProps:h={},beforeMount:g=J,onMount:v=J}){let[b,y]=(0,Y.useState)(!1),[w,x]=(0,Y.useState)(!0),P=(0,Y.useRef)(null),j=(0,Y.useRef)(null),k=(0,Y.useRef)(null),S=(0,Y.useRef)(v),C=(0,Y.useRef)(g),M=(0,Y.useRef)(!1);X((()=>{let e=H.init();return e.then((e=>(j.current=e)&&x(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>P.current?function(){let e=P.current?.getModel();s||e?.original?.dispose(),l||e?.modified?.dispose(),P.current?.dispose()}():e.cancel()})),Q((()=>{let e=P.current.getModifiedEditor();e.getOption(j.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())}),[t],b),Q((()=>{P.current?.getModel()?.original.setValue(e||"")}),[e],b),Q((()=>{let{original:e,modified:t}=P.current.getModel();j.current.editor.setModelLanguage(e,r||n||"text"),j.current.editor.setModelLanguage(t,a||n||"text")}),[n,r,a],b),Q((()=>{j.current?.editor.setTheme(c)}),[c],b),Q((()=>{P.current?.updateOptions(d)}),[d],b);let _=(0,Y.useCallback)((()=>{if(!j.current)return;C.current(j.current);let s=Z(j.current,e||"",r||n||"text",o||""),l=Z(j.current,t||"",a||n||"text",i||"");P.current?.setModel({original:s,modified:l})}),[n,t,a,e,r,o,i]),O=(0,Y.useCallback)((()=>{!M.current&&k.current&&(P.current=j.current.editor.createDiffEditor(k.current,{automaticLayout:!0,...d}),_(),j.current?.editor.setTheme(c),y(!0),M.current=!0)}),[d,c,_]);return(0,Y.useEffect)((()=>{b&&S.current(P.current,j.current)}),[b]),(0,Y.useEffect)((()=>{!w&&!b&&O()}),[w,b,O]),Q((()=>{if(P.current&&j.current){let t=P.current.getOriginalEditor(),a=Z(j.current,e||"",r||n||"text",o||"");a!==t.getModel()&&t.setModel(a)}}),[o],b),Q((()=>{if(P.current&&j.current){let e=P.current.getModifiedEditor(),r=Z(j.current,t||"",a||n||"text",i||"");r!==e.getModel()&&e.setModel(r)}}),[i],b),Y.createElement(K,{width:p,height:f,isEditorReady:b,loading:u,_ref:k,className:m,wrapperProps:h})};(0,Y.memo)(te);var ne=function(e){let t=(0,Y.useRef)();return(0,Y.useEffect)((()=>{t.current=e}),[e]),t.current},re=new Map;var ae=function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:a,path:o,theme:i="light",line:s,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p="100%",height:m="100%",className:h,wrapperProps:g={},beforeMount:v=J,onMount:b=J,onChange:y,onValidate:w=J}){let[x,P]=(0,Y.useState)(!1),[j,k]=(0,Y.useState)(!0),S=(0,Y.useRef)(null),C=(0,Y.useRef)(null),M=(0,Y.useRef)(null),_=(0,Y.useRef)(b),O=(0,Y.useRef)(v),E=(0,Y.useRef)(),D=(0,Y.useRef)(r),N=ne(o),A=(0,Y.useRef)(!1),T=(0,Y.useRef)(!1);X((()=>{let e=H.init();return e.then((e=>(S.current=e)&&k(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>C.current?(E.current?.dispose(),f?d&&re.set(o,C.current.saveViewState()):C.current.getModel()?.dispose(),void C.current.dispose()):e.cancel()})),Q((()=>{let i=Z(S.current,e||r||"",t||a||"",o||n||"");i!==C.current?.getModel()&&(d&&re.set(N,C.current?.saveViewState()),C.current?.setModel(i),d&&C.current?.restoreViewState(re.get(o)))}),[o],x),Q((()=>{C.current?.updateOptions(c)}),[c],x),Q((()=>{!C.current||void 0===r||(C.current.getOption(S.current.editor.EditorOption.readOnly)?C.current.setValue(r):r!==C.current.getValue()&&(T.current=!0,C.current.executeEdits("",[{range:C.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),C.current.pushUndoStop(),T.current=!1))}),[r],x),Q((()=>{let e=C.current?.getModel();e&&a&&S.current?.editor.setModelLanguage(e,a)}),[a],x),Q((()=>{void 0!==s&&C.current?.revealLine(s)}),[s],x),Q((()=>{S.current?.editor.setTheme(i)}),[i],x);let R=(0,Y.useCallback)((()=>{if(M.current&&S.current&&!A.current){O.current(S.current);let s=o||n,l=Z(S.current,r||e||"",t||a||"",s||"");C.current=S.current?.editor.create(M.current,{model:l,automaticLayout:!0,...c},u),d&&C.current.restoreViewState(re.get(s)),S.current.editor.setTheme(i),P(!0),A.current=!0}}),[e,t,n,r,a,o,c,u,d,i]);return(0,Y.useEffect)((()=>{x&&_.current(C.current,S.current)}),[x]),(0,Y.useEffect)((()=>{!j&&!x&&R()}),[j,x,R]),D.current=r,(0,Y.useEffect)((()=>{x&&y&&(E.current?.dispose(),E.current=C.current?.onDidChangeModelContent((e=>{T.current||y(C.current.getValue(),e)})))}),[x,y]),(0,Y.useEffect)((()=>{if(x){let e=S.current.editor.onDidChangeMarkers((e=>{let t=C.current.getModel()?.uri;if(t&&e.find((e=>e.path===t.path))){let e=S.current.editor.getModelMarkers({resource:t});w?.(e)}}));return()=>{e?.dispose()}}return()=>{}}),[x,w]),Y.createElement(K,{width:p,height:m,isEditorReady:x,loading:l,_ref:M,className:h,wrapperProps:g})},oe=(0,Y.memo)(ae),ie=n(44666),se=n(5683);const le=oe.default||oe,ce="code-editor",ue=e=>{const{className:t,height:n,options:a,readOnly:o,...i}=e,{theme:s}=(0,ie.DP)(),l=[ce,t,i?.defaultLanguage?`language--${i.defaultLanguage}`:""].filter(Boolean).join(" ");return(0,r.jsx)(le,{className:l,height:n,loading:(0,r.jsx)(se.l,{height:n}),options:{detectIndentation:!0,minimap:{enabled:!1},readOnly:Boolean(o),scrollBeyondLastLine:!1,tabSize:2,wordWrap:"on",...a},theme:"dark"===s?"vs-dark":"vs",...i})}},73417:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(54147),a=(n(54953),n(94467)),o=n.n(a);const i=()=>(0,r.jsxs)("svg",{className:"icon icon--calendar",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("rect",{className:"stroke",height:"14",width:"16",x:"4.5",y:"6.11401"}),(0,r.jsx)("line",{className:"stroke",x1:"8.625",x2:"8.625",y1:"8.02026",y2:"3.70776"}),(0,r.jsx)("line",{className:"stroke",x1:"16.375",x2:"16.375",y1:"8.02026",y2:"3.70776"}),(0,r.jsx)("line",{className:"stroke",x1:"4.5",x2:"20.5",y1:"11.114",y2:"11.114"})]});var s=n(64526),l=n(19236);const c=o().default||o(),u="date-time-picker",d=e=>{const{displayFormat:t,maxDate:n,maxTime:o,minDate:d,minTime:f,monthsToShow:p=1,onChange:m,overrides:h,pickerAppearance:g="default",placeholder:v,readOnly:b,timeFormat:y="h:mm aa",timeIntervals:w=30,value:x}=e,{i18n:P}=(0,l.B)(),j=((e="enUS")=>({en:"enUS",my:"enUS",ua:"uk",zh:"zhCN"}[e]||e))(P.language);try{(0,a.registerLocale)(j,P.dateFNS)}catch(e){console.warn(`Could not find DatePicker locale for ${P.language}`)}let k=t;t||("default"===g?k="MM/dd/yyyy":"dayAndTime"===g?k="MMM d, yyy h:mm a":"timeOnly"===g?k="h:mm a":"dayOnly"===g?k="MMM dd":"monthOnly"===g&&(k="MMMM"));const S=e=>{const t=e;if(t instanceof Date&&["dayOnly","default","monthOnly"].includes(g)){const n=e.getTimezoneOffset()/60;t.setHours(12-n,0)}"function"==typeof m&&m(t)},C={customInputRef:"ref",dateFormat:k,disabled:b,maxDate:n,maxTime:o,minDate:d,minTime:f,monthsShown:Math.min(2,p),onChange:S,placeholderText:v,popperPlacement:"bottom-start",selected:x&&new Date(x),showMonthYearPicker:"monthOnly"===g,showPopperArrow:!1,showTimeSelect:"dayAndTime"===g||"timeOnly"===g,timeFormat:y,timeIntervals:w,...h},M=[u,`${u}__appearance--${g}`].filter(Boolean).join(" ");return(0,r.jsxs)("div",{className:M,children:[(0,r.jsxs)("div",{className:`${u}__icon-wrap`,children:[C.selected&&(0,r.jsx)("button",{className:`${u}__clear-button`,onClick:()=>S(null),type:"button",children:(0,r.jsx)(s.u,{})}),(0,r.jsx)(i,{})]}),(0,r.jsx)("div",{className:`${u}__input-wrapper`,children:(0,r.jsx)(c,{...C,dropdownMode:"select",locale:j,showMonthDropdown:!0,showYearDropdown:!0})})]})}},5683:(e,t,n)=>{"use strict";n.d(t,{l:()=>o,E:()=>i});var r=n(54147),a=(n(54953),n(55674));const o=({animationDelay:e="0ms",height:t="60px",width:n="100%"})=>(0,r.jsx)("div",{className:"shimmer-effect",style:{height:"number"==typeof t?`${t}px`:t,width:"number"==typeof n?`${n}px`:n},children:(0,r.jsx)("div",{className:"shimmer-effect__shine",style:{animationDelay:e}})}),i=({className:e,count:t,height:n,renderDelay:i=500,shimmerDelay:s=25,shimmerItemClassName:l,width:c})=>{const u="number"==typeof s?`${s}ms`:s,[d]=(0,a.Z)(i,!0);return d?(0,r.jsx)("div",{className:e,children:[...Array(t)].map(((e,t)=>(0,r.jsx)("div",{className:l,children:(0,r.jsx)(o,{animationDelay:`calc(${t} * ${u})`,height:n,width:c})},t)))}):null}},55674:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(54953);const a=(e,t=!1)=>{const[n,a]=r.useState(!1),o=r.useRef(void 0),i=r.useCallback((()=>(a(!1),clearTimeout(o.current),o.current=setTimeout((()=>{a(!0)}),e),()=>{clearTimeout(o.current)})),[e]);return r.useEffect((()=>{t&&i()}),[i,t]),[n,i]}},64526:(e,t,n)=>{"use strict";n.d(t,{u:()=>a});var r=n(54147);n(54953);const a=({className:e})=>(0,r.jsxs)("svg",{className:[e,"icon icon--x"].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("line",{className:"stroke",x1:"8.74612",x2:"16.3973",y1:"16.347",y2:"8.69584"}),(0,r.jsx)("line",{className:"stroke",x1:"8.6027",x2:"16.2539",y1:"8.69585",y2:"16.3471"})]})},84348:(e,t,n)=>{"use strict";n.d(t,{P:()=>l,Y:()=>s});var r=n(54147),a=n(72659),o=n(54953);const i=(0,o.createContext)({clearRouteCache:()=>{}}),s=({children:e})=>{const t=(0,a.usePathname)(),n=(0,a.useRouter)(),s=(0,o.useCallback)((()=>{n.refresh()}),[n]);return(0,o.useEffect)((()=>{s()}),[t,s]),(0,r.jsx)(i.Provider,{value:{clearRouteCache:s},children:e})},l=()=>(0,o.useContext)(i)},44666:(e,t,n)=>{"use strict";n.d(t,{DP:()=>u,NP:()=>c,zQ:()=>l});var r=n(54147),a=n(54953);const o={autoMode:!0,setTheme:()=>null,theme:"light"},i=(0,a.createContext)(o);function s(e,t,n){const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);const a="expires="+r.toUTCString();document.cookie=e+"="+t+";"+a+";path=/"}const l="light",c=({children:e,cookiePrefix:t,theme:n})=>{const o=`${t||"payload"}-theme`,[c,u]=(0,a.useState)(n||l),[d,f]=(0,a.useState)();(0,a.useEffect)((()=>{const{theme:e,themeFromCookies:t}=(e=>{let t;const n=window.document.cookie.split("; ").find((t=>t.startsWith(`${e}=`)))?.split("=")[1];return t="light"===n||"dark"===n?n:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t),{theme:t,themeFromCookies:n}})(o);u(e),f(!t)}),[o]);const p=(0,a.useCallback)((e=>{if("light"===e||"dark"===e)u(e),f(!1),s(o,e,365),document.documentElement.setAttribute("data-theme",e);else if("auto"===e){s(o,e,-1);const t=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";document.documentElement.setAttribute("data-theme",t),f(!0),u(t)}}),[o]);return(0,r.jsx)(i.Provider,{value:{autoMode:d,setTheme:p,theme:c},children:e})},u=()=>(0,a.useContext)(i)},19236:(e,t,n)=>{"use strict";n.d(t,{B:()=>d,D:()=>u});var r=n(54147),a=n(43289),o=n(69441),i=n(54953),s=n.n(i),l=n(84348);const c=(0,i.createContext)({i18n:{dateFNS:o.enUS,dateFNSKey:"en-US",fallbackLanguage:"en",language:"en",t:e=>e,translations:{}},languageOptions:void 0,switchLanguage:void 0,t:e=>{}}),u=({children:e,dateFNSKey:t,fallbackLang:n,language:o,languageOptions:u,switchLanguageServerAction:d,translations:f})=>{const{clearRouteCache:p}=(0,l.P)(),[m,h]=(0,i.useState)(),g=(e,t)=>(0,a.t)({key:e,translations:f,vars:t}),v=s().useCallback((async e=>{try{await d(e),p()}catch(t){console.error(`Error loading language: "${e}"`,t)}}),[d,p]);return(0,i.useEffect)((()=>{(async()=>{const e=await(0,a.pP)(t);h(e)})()}),[t]),(0,r.jsx)(c.Provider,{value:{i18n:{dateFNS:m,dateFNSKey:t,fallbackLanguage:n,language:o,t:g,translations:f},languageOptions:u,switchLanguage:v,t:g},children:e})},d=()=>(0,i.useContext)(c)},54953:e=>{"use strict";e.exports=require("react")},20180:e=>{"use strict";e.exports=require("react-dom")},24333:()=>{},64808:(e,t)=>{"use strict";t._=t._interop_require_default=function(e){return e&&e.__esModule?e:{default:e}}},66727:(e,t)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}t._=t._interop_require_wildcard=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var a={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,r&&r.set(e,a);return a}},90435:(e,t)=>{var n;
|
|
48
48
|
/*!
|
|
49
49
|
Copyright (c) 2018 Jed Watson.
|
|
50
50
|
Licensed under the MIT License (MIT), see
|
|
@@ -59,4 +59,4 @@ var D=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","au
|
|
|
59
59
|
* focus-trap 6.9.4
|
|
60
60
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
61
61
|
*/
|
|
62
|
-
function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){Z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ee,te=(ee=[],{activateTrap:function(e){if(ee.length>0){var t=ee[ee.length-1];t!==e&&t.pause()}var n=ee.indexOf(e);-1===n||ee.splice(n,1),ee.push(e)},deactivateTrap:function(e){var t=ee.indexOf(e);-1!==t&&ee.splice(t,1),ee.length>0&&ee[ee.length-1].unpause()}}),ne=function(e){return setTimeout(e,0)},re=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},ae=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},oe=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},ie=function(e,t){var n,r=(null==t?void 0:t.document)||document,a=J({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},i=function(e,t,n){return e&&void 0!==e[t]?e[t]:a[n||t]},s=function(e){return o.containerGroups.findIndex((function(t){var n=t.container,r=t.tabbableNodes;return n.contains(e)||r.find((function(t){return t===e}))}))},l=function(e){var t=a[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];t=t.apply(void 0,o)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var s=t;if("string"==typeof t&&!(s=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return s},c=function(){var e=l("initialFocus");if(!1===e)return!1;if(void 0===e)if(s(r.activeElement)>=0)e=r.activeElement;else{var t=o.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},u=function(){if(o.containerGroups=o.containers.map((function(e){var t=U(e,a.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?L([e],t.includeContainer,{filter:H.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):I(e,t.includeContainer,H.bind(null,t))}(e,a.tabbableOptions);return{container:e,tabbableNodes:t,focusableNodes:n,firstTabbableNode:t.length>0?t[0]:null,lastTabbableNode:t.length>0?t[t.length-1]:null,nextTabbableNode:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=n.findIndex((function(t){return t===e}));if(!(r<0))return t?n.slice(r+1).find((function(e){return G(e,a.tabbableOptions)})):n.slice(0,r).reverse().find((function(e){return G(e,a.tabbableOptions)}))}}})),o.tabbableGroups=o.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),o.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},d=function e(t){!1!==t&&t!==r.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!a.preventScroll}),o.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(c()))},f=function(e){var t=l("setReturnFocus",e);return t||!1!==t&&e},p=function(e){var t=oe(e);s(t)>=0||(ae(a.clickOutsideDeactivates,e)?n.deactivate({returnFocus:a.returnFocusOnDeactivate&&!X(t,a.tabbableOptions)}):ae(a.allowOutsideClick,e)||e.preventDefault())},m=function(e){var t=oe(e),n=s(t)>=0;n||t instanceof Document?n&&(o.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),d(o.mostRecentlyFocusedNode||c()))},h=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==ae(a.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=oe(e);u();var n=null;if(o.tabbableGroups.length>0){var r=s(t),i=r>=0?o.containerGroups[r]:void 0;if(r<0)n=e.shiftKey?o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:o.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var c=re(o.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(c<0&&(i.container===t||X(t,a.tabbableOptions)&&!G(t,a.tabbableOptions)&&!i.nextTabbableNode(t,!1))&&(c=r),c>=0){var f=0===c?o.tabbableGroups.length-1:c-1;n=o.tabbableGroups[f].lastTabbableNode}}else{var p=re(o.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(p<0&&(i.container===t||X(t,a.tabbableOptions)&&!G(t,a.tabbableOptions)&&!i.nextTabbableNode(t))&&(p=r),p>=0){var m=p===o.tabbableGroups.length-1?0:p+1;n=o.tabbableGroups[m].firstTabbableNode}}}else n=l("fallbackFocus");n&&(e.preventDefault(),d(n))}(e)},g=function(e){var t=oe(e);s(t)>=0||ae(a.clickOutsideDeactivates,e)||ae(a.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},v=function(){if(o.active)return te.activateTrap(n),o.delayInitialFocusTimer=a.delayInitialFocus?ne((function(){d(c())})):d(c()),r.addEventListener("focusin",m,!0),r.addEventListener("mousedown",p,{capture:!0,passive:!1}),r.addEventListener("touchstart",p,{capture:!0,passive:!1}),r.addEventListener("click",g,{capture:!0,passive:!1}),r.addEventListener("keydown",h,{capture:!0,passive:!1}),n},b=function(){if(o.active)return r.removeEventListener("focusin",m,!0),r.removeEventListener("mousedown",p,!0),r.removeEventListener("touchstart",p,!0),r.removeEventListener("click",g,!0),r.removeEventListener("keydown",h,!0),n};return n={get active(){return o.active},get paused(){return o.paused},activate:function(e){if(o.active)return this;var t=i(e,"onActivate"),n=i(e,"onPostActivate"),a=i(e,"checkCanFocusTrap");a||u(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,t&&t();var s=function(){a&&u(),v(),n&&n()};return a?(a(o.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!o.active)return this;var t=J({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},e);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,b(),o.active=!1,o.paused=!1,te.deactivateTrap(n);var r=i(t,"onDeactivate"),s=i(t,"onPostDeactivate"),l=i(t,"checkCanReturnFocus"),c=i(t,"returnFocus","returnFocusOnDeactivate");r&&r();var u=function(){ne((function(){c&&d(f(o.nodeFocusedBeforeActivation)),s&&s()}))};return c&&l?(l(f(o.nodeFocusedBeforeActivation)).then(u,u),this):(u(),this)},pause:function(){return o.paused||!o.active||(o.paused=!0,b()),this},unpause:function(){return o.paused&&o.active?(o.paused=!1,u(),v(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return o.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),o.active&&u(),this}},n.updateContainerElements(e),n},se=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};const le="modal-item",ce=(ue=e=>{const{children:t}=e;return t?"function"==typeof t?o.createElement(o.Fragment,null,t(e)):o.createElement(o.Fragment,null,t):null},e=>{const t=O(),n=(0,o.useRef)(null),[r,a]=(0,o.useState)(!1),i=(0,o.useRef)(!1),[l,c]=(0,o.useState)(null),{modalState:u,classPrefix:d,containerRef:f,transTime:p,setCloseOnBlur:m,setBodyScrollLock:h,openModal:g}=t,{className:v,htmlElement:b="dialog",slug:y="",closeOnBlur:w=!0,lockBodyScroll:x=!0,classPrefix:P,onEnter:j,onEntering:k,onEntered:S,onExit:C,onExiting:_,onExited:D,openOnInit:N,trapFocus:A=!0,focusTrapOptions:T={}}=e,R=se(e,["className","htmlElement","slug","closeOnBlur","lockBodyScroll","classPrefix","onEnter","onEntering","onEntered","onExit","onExiting","onExited","openOnInit","trapFocus","focusTrapOptions"]),I=P||d,L=de||y,$=u[L]&&u[L].isOpen;(0,o.useEffect)((()=>{if(A){const e=n.current;if(!1===i.current&&e){const t=ie(e,Object.assign(Object.assign({},T),{fallbackFocus:(null==T?void 0:T.fallbackFocus)||e,allowOutsideClick:void 0===T.allowOutsideClick||T.allowOutsideClick}));c(t),i.current=!0}}}),[A,r,T]),(0,o.useEffect)((()=>{a(!0)}),[]),(0,o.useEffect)((()=>(l&&($?l.activate():l.deactivate()),()=>{l&&l.deactivate()})),[$,l]),(0,o.useEffect)((()=>{$&&m(w)}),[$,w,m]),(0,o.useEffect)((()=>{const e=n.current;return e&&h(!(!$||!x),e),()=>{e&&h(!1,e)}}),[$,x,h]);const[W,F]=(0,o.useState)($);if((0,o.useEffect)((()=>{$?F($):setTimeout((()=>F(!1)),p)}),[$,p]),(0,o.useEffect)((()=>{N&&g(L)}),[L,N,g]),f.current){const r=I?`${I}__${le}`:le,a=[r,`${r}--slug-${L}`,v].filter(Boolean).join(" "),i=Object.assign({role:"dialog"!==b?"dialog":void 0,open:"dialog"===b?W||$:void 0,"aria-modal":!0,"aria-label":R["aria-labelledby"]?void 0:L},R);return s.createPortal(o.createElement(M,{nodeRef:n,timeout:p,in:$,classNames:E(r),appear:!0,onEnter:j,onEntering:k,onEntered:S,onExit:C,onExiting:_,onExited:D},o.createElement(b,Object.assign({ref:n,id:(null==R?void 0:R.id)||L,className:a},i),o.createElement(ue,Object.assign({},e,{isOpen:$,modal:t})))),f.current)}return null});var ue,de,fe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};const pe="modal-container",me=e=>{const{oneModalIsOpen:t,classPrefix:n,transTime:r,setContainerRef:a,containerRef:i,closeAllModals:s,closeOnBlur:l}=O(),{className:c,htmlElement:u="div",children:d,onClick:f}=e,p=fe(e,["className","htmlElement","children","onClick"]),m=n?`${n}__${pe}`:pe,h=[m,c].filter(Boolean).join(" "),g=Object.assign(Object.assign({},p),{onClick:e=>{l&&s(),"function"==typeof f&&f(e)}});return o.createElement(M,{nodeRef:i,in:t,timeout:r,classNames:E(m),appear:!0},o.createElement(u,Object.assign({className:h,ref:a},g),d&&d))};var he=n(27526),ge=n.n(he);var ve=!1;if("undefined"!=typeof window){var be={get passive(){ve=!0}};window.addEventListener("testPassive",null,be),window.removeEventListener("testPassive",null,be)}var ye="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),we=[],xe=!1,Pe=-1,je=void 0,ke=void 0,Se=function(e){return we.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ce=function(e){var t=e||window.event;return!!Se(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},Me=function(){void 0!==ke&&(document.body.style.paddingRight=ke,ke=void 0),void 0!==je&&(document.body.style.overflow=je,je=void 0)},_e=function(e,t){if(e){if(!we.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};we=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(we),[n]),ye?(e.ontouchstart=function(e){1===e.targetTouches.length&&(Pe=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-Pe;!Se(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?Ce(e):e.stopPropagation())}(t,e)},xe||(document.addEventListener("touchmove",Ce,ve?{passive:!1}:void 0),xe=!0)):function(e){if(void 0===ke){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;t&&n>0&&(ke=document.body.style.paddingRight,document.body.style.paddingRight=n+"px")}void 0===je&&(je=document.body.style.overflow,document.body.style.overflow="hidden")}(t)}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")};const Oe=({classPrefix:e,zIndex:t})=>{const n=e?`${e}__`:"";return`\n .${n}${pe} {\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 .${n}${pe}--appear,\n .${n}${pe}--appearDone,\n .${n}${pe}--enter,\n .${n}${pe}--enterDone,\n .${n}${pe}--exit {\n pointer-events: all;\n visibility: visible;\n z-index: ${t};\n }\n\n .${n}${le} {\n position: absolute;\n visibility: hidden;\n }\n\n .${n}${le}--appear,\n .${n}${le}--appearDone,\n .${n}${le}--enter,\n .${n}${le}--enterDone,\n .${n}${le}--exit {\n visibility: visible;\n }\n `},Ee=(e,t)=>{let n=Object.assign({},e);const{type:r,payload:a}=t;switch(r){case"UPDATE_MODAL":{const{slug:e}=a;e&&(n[e]=Object.assign(Object.assign({},n[e]),a));break}case"OPEN_MODAL":{const{slug:e}=a;if(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":{const{slug:e}=a;if(e){const 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":{const{slug:e}=a;e&&(n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:void 0,isOpen:!1}));break}case"REMOVE_MODAL":{const{slug:e}=a;e&&e in n&&delete n[e];break}case"CLOSE_LATEST_MODAL":{const e=Object.keys(n).reduce(((e,t)=>{const r=n[t];return r.isOpen&&"number"==typeof r.openedOn&&(!e||"number"==typeof e.openedOn&&r.openedOn>e.openedOn)?r: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,n])=>(e[t]=Object.assign(Object.assign({},n),{isOpen:!1,openedOn:void 0}),e)),{})}return n},De=()=>{const e=(()=>{if("undefined"!=typeof window)return he.parse(window.location.search,{ignoreQueryPrefix:!0})})();let t=[];return e&&e.modal&&("string"==typeof e.modal?t=[e.modal]:Array.isArray(e.modal)&&(t=e.modal)),t},Ne=e=>{const{classPrefix:t,minifyCSS:n=!0,generateCSS:r=!0,zIndex:a=9999,handleParamChange:i,children:s,transTime:l=250}=e,c=(0,o.useRef)(null),[u,d]=(0,o.useReducer)(Ee,{},(()=>De().reduce(((e,t)=>(e[t]={slug:t,isOpen:!0,openedOn:Date.now()},e)),{}))),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(!1),[g,v]=(0,o.useState)(!1),[b,y]=(0,o.useState)(""),w=(0,o.useRef)(!1),x=(0,o.useCallback)((e=>{27===e.keyCode&&d({type:"CLOSE_LATEST_MODAL"})}),[]);(0,o.useEffect)((()=>(w.current||(document.addEventListener("keydown",(e=>x(e)),!1),w.current=!0),()=>{w.current&&document.removeEventListener("keydown",(e=>x(e)),!1)})),[x]),(0,o.useEffect)((()=>{if(r){let e="";e=Oe({classPrefix:t,zIndex:a}),n&&(e=e.replace(/\n/g,"").replace(/\s\s+/g," ")),y(e)}}),[r,n,a,t]),(0,o.useEffect)((()=>{if("function"==typeof i&&i(u),"boolean"==typeof i&&i){const e=Object.keys(u).filter((e=>u[e].isOpen)),t=he.stringify({modal:e},{addQueryPrefix:!0,encode:!1}),n=`${window.location.pathname}${t}`;window.history.pushState({},"",n)}}),[u,i]),(0,o.useEffect)((()=>{const e=Object.keys(u).some((e=>u[e].isOpen));p(e)}),[u]);const P=(0,o.useCallback)(((e,t)=>{var n;t&&(e?(_e(t),v(!0)):((n=t)?(we=we.filter((function(e){return e.targetElement!==n})),ye?(n.ontouchstart=null,n.ontouchmove=null,xe&&0===we.length&&(document.removeEventListener("touchmove",Ce,ve?{passive:!1}:void 0),xe=!1)):we.length||Me()):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices."),v(!1)))}),[]),j=(0,o.useCallback)((e=>{c.current=e}),[]),k=(0,o.useCallback)((e=>{d({type:"OPEN_MODAL",payload:{slug:e}})}),[]),S=(0,o.useCallback)((e=>{d({type:"CLOSE_MODAL",payload:{slug:e}})}),[]),C=(0,o.useCallback)((()=>{d({type:"CLOSE_ALL_MODALS"})}),[]),M=(0,o.useCallback)((e=>{d({type:"TOGGLE_MODAL",payload:{slug:e}})}),[]),O=(0,o.useCallback)((e=>u[e]&&u[e].isOpen),[u]),E=Object.assign({},e);return delete E.children,o.createElement(o.Fragment,null,r&&o.createElement("style",{dangerouslySetInnerHTML:{__html:b}}),o.createElement(_.Provider,{value:Object.assign(Object.assign({},E),{transTime:l,containerRef:c,modalState:u,oneModalIsOpen:f,isModalOpen:O,closeOnBlur:m,bodyScrollIsLocked:g,classPrefix:t,closeAllModals:C,setCloseOnBlur:h,openModal:k,closeModal:S,toggleModal:M,setBodyScrollLock:P,setContainerRef:j})},s))};const Ae=(0,o.createContext)({}),Te=(e,t)=>{const{timestamp:n,animationRef:r}=t;r.current=null;const{x:a,y:o,xDirection:i,yDirection:s,eventsFired:l,hasScrolled:c}=e,u=c||Boolean(n),d=u?window.pageXOffset:0,f=u?window.pageYOffset:0,p=u?l+1:l,m=d-a,h=f-o,g=d/(document.body.scrollWidth-window.innerWidth)*100,v=f/(document.body.scrollHeight-window.innerHeight)*100;return{x:d,y:f,xDifference:m,yDifference:h,xDirection:m>0?"right":m<0?"left":i,yDirection:h>0?"down":h<0?"up":s,xPercentage:g,yPercentage:v,totalPercentage:(g+v)/2,eventsFired:p,hasScrolled:u}},Re=e=>{const{children:t}=e,n=(0,o.useRef)(null),[r,a]=(0,o.useReducer)(Te,{x:0,y:0,xDifference:0,yDifference:0,xDirection:void 0,yDirection:void 0,xPercentage:0,yPercentage:0,totalPercentage:0,eventsFired:0,hasScrolled:!1}),i=(0,o.useCallback)((e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame((t=>{a({e,timestamp:t,animationRef:n})}))}),[]);return(0,o.useEffect)((()=>(window.addEventListener("scroll",i),()=>{window.removeEventListener("scroll",i)})),[i]),o.createElement(Ae.Provider,{value:Object.assign({},r)},t&&t)},Ie=(0,o.createContext)({}),Le=()=>(0,o.useContext)(Ie),$e=e=>{const{children:t}=e,n=Le();return t?"function"==typeof t?o.createElement(o.Fragment,null,t(n)):o.createElement(o.Fragment,null,t):null},We=(e,t)=>{const{payload:{breakpoints:n,animationRef:r}}=t;r.current=null;const{eventsFired:a}=e,{documentElement:{style:o,clientWidth:i,clientHeight:s}}=document,{innerWidth:l,innerHeight:c}=window,u=i/100+"px",d=s/100+"px",f=n?Object.keys(n).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:window.matchMedia(n[t]).matches})),{}):{},p={width:l,height:c,"--vw":u,"--vh":d,breakpoints:f,eventsFired:a+1};return o.setProperty("--vw",u),o.setProperty("--vh",d),p},Fe=e=>{const{breakpoints:t,children:n}=e,r=(0,o.useRef)(null),[a,i]=(0,o.useReducer)(We,{width:void 0,height:void 0,"--vw":"","--vh":"",breakpoints:{},eventsFired:0}),s=(0,o.useCallback)((()=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame((()=>i({type:"UPDATE",payload:{breakpoints:t,animationRef:r}})))}),[t]),l=(0,o.useCallback)((()=>{setTimeout((()=>{s()}),500)}),[s]);return(0,o.useEffect)((()=>(window.addEventListener("resize",s),window.addEventListener("orientationchange",l),()=>{window.removeEventListener("resize",s),window.removeEventListener("orientationchange",l)})),[s,l]),(0,o.useEffect)((()=>{0===a.eventsFired&&i({type:"UPDATE",payload:{breakpoints:t,animationRef:r}})}),[t,a]),o.createElement(Ie.Provider,{value:Object.assign({},a)},n&&n)},ze=e=>t=>{const n=Le();return o.createElement(e,Object.assign({},t,{windowInfo:n}))};var Be=n(19236);const He="loading-overlay",Ye=({animationDuration:e,loadingText:n,overlayType:r,show:a=!0})=>{const{t:o}=(0,Be.B)();return(0,t.jsxs)("div",{className:[He,a?`${He}--entering`:`${He}--exiting`,r?`${He}--${r}`:""].filter(Boolean).join(" "),style:{animationDuration:e||"500ms"},children:[(0,t.jsxs)("div",{className:`${He}__bars`,children:[(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`})]}),(0,t.jsx)("span",{className:`${He}__text`,children:n||o("general:loading")})]})},Ve=({name:e,type:t="fullscreen",loadingText:n,show:r})=>{const{toggleLoadingOverlay:a}=Qe();return i().useEffect((()=>(a({type:t,isLoading:r,key:e,loadingText:n||void 0}),()=>{a({type:t,isLoading:!1,key:e})})),[r,a,e,t,n]),null};var qe=n(55674);const Ue={isLoading:!1,loaders:[],loadingText:"",overlayType:null},Ge=(e,t)=>{const n=[...e.loaders],{type:r="fullscreen",key:a="user",loadingText:o}=t.payload;if("add"===t.type)n.push({type:r,key:a,loadingText:o});else if("remove"===t.type){const e=n.findIndex((e=>e.key===a&&e.type===r));n.splice(e,1)}const i=n?.length>0?n[n.length-1]:null;return{isLoading:Boolean(i),loaders:n,loadingText:i?.loadingText||e?.loadingText,overlayType:i?.type||e?.overlayType}},Ke=(0,o.createContext)({isOnScreen:!1,toggleLoadingOverlay:void 0}),Xe=({children:e})=>{const{t:n}=(0,Be.B)(),r=n("general:loading"),[a,s]=i().useReducer(Ge,Ue),{isMounted:l,isUnmounting:c,triggerDelayedRender:u}=(({delayBeforeShow:e,inTimeout:t,minShowTime:n,outTimeout:r,show:a})=>{const i=t+n+r,[s,l]=(0,qe.Z)(e),[c,u]=o.useState(!1),[d,f]=o.useState(!1),p=o.useRef(0),m=o.useRef(void 0),h=o.useCallback((()=>{f(!0),m.current=setTimeout((()=>{u(!1),f(!1)}),r)}),[f,r]);return o.useEffect((()=>{const e=c&&!a;if(s&&!c&&a)p.current=Date.now(),u(!0);else if(e){const e=Date.now()-p.current,t=i-e;clearTimeout(m.current),m.current=setTimeout(h,Math.max(0,t))}}),[c,a,h,i,s]),{isMounted:c,isUnmounting:d,triggerDelayedRender:l}})({delayBeforeShow:1e3,inTimeout:250,minShowTime:500,outTimeout:250,show:a.isLoading}),d=i().useCallback((({type:e,isLoading:t,key:n,loadingText:a=r})=>{t?(u(),s({type:"add",payload:{type:e,key:n,loadingText:a}})):s({type:"remove",payload:{type:e,key:n}})}),[u,r]);return(0,t.jsxs)(Ke.Provider,{value:{isOnScreen:l,toggleLoadingOverlay:d},children:[l&&(0,t.jsx)(Ye,{animationDuration:"250ms",loadingText:a.loadingText||r,overlayType:a.overlayType,show:!c}),e]})},Qe=()=>{const e=i().useContext(Ke);if(void 0===e)throw new Error("useLoadingOverlay must be used within a LoadingOverlayProvider");return e};var Je=!1;if("undefined"!=typeof window){var Ze={get passive(){Je=!0}};window.addEventListener("testPassive",null,Ze),window.removeEventListener("testPassive",null,Ze)}var et="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),tt=[],nt=!1,rt=-1,at=void 0,ot=void 0,it=void 0,st=function(e){return tt.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},lt=function(e){var t=e||window.event;return!!st(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},ct=function(){void 0!==it&&(document.body.style.paddingRight=it,it=void 0),void 0!==at&&(document.body.style.overflow=at,at=void 0)},ut=function(){if(void 0!==ot){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=ot.position,document.body.style.top=ot.top,document.body.style.left=ot.left,window.scrollTo(t,e),ot=void 0}},dt=function(e,t){if(e){if(!tt.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};tt=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(tt),[n]),et?window.requestAnimationFrame((function(){if(void 0===ot){ot={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,r=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=r-window.innerHeight;e&&t>=r&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===it){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);it=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===at&&(at=document.body.style.overflow,document.body.style.overflow="hidden")}(t),et&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(rt=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-rt;!st(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?lt(e):e.stopPropagation())}(t,e)},nt||(document.addEventListener("touchmove",lt,Je?{passive:!1}:void 0),nt=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},ft=Object.prototype.hasOwnProperty;function pt(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&pt(e[r],t[r]););return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(ft.call(e,n)&&++r&&!ft.call(t,n))return!1;if(!(n in t)||!pt(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}const mt={delete:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"delete"};return fetch(e,r)},get:(e,t={headers:{}})=>{let n="";return t.params&&(n=ge().stringify(t.params,{addQueryPrefix:!0})),fetch(`${e}${n}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"PATCH"};return fetch(e,r)},post:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"post"};return fetch(`${e}`,r)},put:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"put"};return fetch(e,r)}};var ht=n(72659),gt=Array(12).fill(0),vt=({visible:e})=>o.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},o.createElement("div",{className:"sonner-spinner"},gt.map(((e,t)=>o.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`}))))),bt=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"})),yt=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"})),wt=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"})),xt=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"})),Pt=1,jt=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{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,...r}=e,a="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Pt++,o=this.toasts.find((e=>e.id===a)),i=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:i,title:n}):t)):this.addToast({title:n,...r,dismissible:i,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)=>{if(!t)return;let n;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 r=e instanceof Promise?e:e(),a=void 0!==n;return r.then((async e=>{if(kt(e)&&!e.ok){a=!1;let r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,o="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:"error",message:r,description:o})}else if(void 0!==t.success){a=!1;let r="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:r,description:o})}})).catch((async e=>{if(void 0!==t.error){a=!1;let r="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:r,description:o})}})).finally((()=>{var e;a&&(this.dismiss(n),n=void 0),null==(e=t.finally)||e.call(t)})),n},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||Pt++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},kt=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,St=(e,t)=>{let n=(null==t?void 0:t.id)||Pt++;return jt.addToast({title:e,...t,id:n}),n},Ct=Object.assign(St,{success:jt.success,info:jt.info,warning:jt.warning,error:jt.error,custom:jt.custom,message:jt.message,promise:jt.promise,dismiss:jt.dismiss,loading:jt.loading},{getHistory:()=>jt.toasts});function Mt(e){return void 0!==e.label}!function(e,{insertAt:t}={}){if(!e||"undefined"==typeof document)return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.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}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-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;left: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;background:var(--gray1);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}: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:0;right:0;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}: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, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);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-border: hsl(0, 0%, 20%);--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%);--error-text: hsl(358, 100%, 81%)}[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 _t=3,Ot=14;function Et(...e){return e.filter(Boolean).join(" ")}var Dt=e=>{var t,n,r,a,i,s,l,c,u,d;let{invert:f,toast:p,unstyled:m,interacting:h,setHeights:g,visibleToasts:v,heights:b,index:y,toasts:w,expanded:x,removeToast:P,defaultRichColors:j,closeButton:k,style:S,cancelButtonStyle:C,actionButtonStyle:M,className:_="",descriptionClassName:O="",duration:E,position:D,gap:N,loadingIcon:A,expandByDefault:T,classNames:R,icons:I,closeButtonAriaLabel:L="Close toast",pauseWhenPageIsHidden:$,cn:W}=e,[F,z]=o.useState(!1),[B,H]=o.useState(!1),[Y,V]=o.useState(!1),[q,U]=o.useState(!1),[G,K]=o.useState(0),[X,Q]=o.useState(0),J=o.useRef(null),Z=o.useRef(null),ee=0===y,te=y+1<=v,ne=p.type,re=!1!==p.dismissible,ae=p.className||"",oe=p.descriptionClassName||"",ie=o.useMemo((()=>b.findIndex((e=>e.toastId===p.id))||0),[b,p.id]),se=o.useMemo((()=>{var e;return null!=(e=p.closeButton)?e:k}),[p.closeButton,k]),le=o.useMemo((()=>p.duration||E||4e3),[p.duration,E]),ce=o.useRef(0),ue=o.useRef(0),de=o.useRef(0),fe=o.useRef(null),[pe,me]=D.split("-"),he=o.useMemo((()=>b.reduce(((e,t,n)=>n>=ie?e:e+t.height),0)),[b,ie]),ge=(()=>{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})(),ve=p.invert||f,be="loading"===ne;ue.current=o.useMemo((()=>ie*N+he),[ie,he]),o.useEffect((()=>{z(!0)}),[]),o.useLayoutEffect((()=>{if(!F)return;let e=Z.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,Q(n),g((e=>e.find((e=>e.toastId===p.id))?e.map((e=>e.toastId===p.id?{...e,height:n}:e)):[{toastId:p.id,height:n,position:p.position},...e]))}),[F,p.title,p.description,g,p.id]);let ye=o.useCallback((()=>{H(!0),K(ue.current),g((e=>e.filter((e=>e.toastId!==p.id)))),setTimeout((()=>{P(p)}),200)}),[p,P,g,ue]);return o.useEffect((()=>{if(p.promise&&"loading"===ne||p.duration===1/0||"loading"===p.type)return;let e,t=le;return x||h||$&&ge?(()=>{if(de.current<ce.current){let e=(new Date).getTime()-ce.current;t-=e}de.current=(new Date).getTime()})():t!==1/0&&(ce.current=(new Date).getTime(),e=setTimeout((()=>{var e;null==(e=p.onAutoClose)||e.call(p,p),ye()}),t)),()=>clearTimeout(e)}),[x,h,T,p,le,ye,p.promise,ne,$,ge]),o.useEffect((()=>{let e=Z.current;if(e){let t=e.getBoundingClientRect().height;return Q(t),g((e=>[{toastId:p.id,height:t,position:p.position},...e])),()=>g((e=>e.filter((e=>e.toastId!==p.id))))}}),[g,p.id]),o.useEffect((()=>{p.delete&&ye()}),[ye,p.delete]),o.createElement("li",{"aria-live":p.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Z,className:W(_,ae,null==R?void 0:R.toast,null==(t=null==p?void 0:p.classNames)?void 0:t.toast,null==R?void 0:R.default,null==R?void 0:R[ne],null==(n=null==p?void 0:p.classNames)?void 0:n[ne]),"data-sonner-toast":"","data-rich-colors":null!=(r=p.richColors)?r:j,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":F,"data-promise":!!p.promise,"data-removed":B,"data-visible":te,"data-y-position":pe,"data-x-position":me,"data-index":y,"data-front":ee,"data-swiping":Y,"data-dismissible":re,"data-type":ne,"data-invert":ve,"data-swipe-out":q,"data-expanded":!!(x||T&&F),style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${B?G:ue.current}px`,"--initial-height":T?"auto":`${X}px`,...S,...p.style},onPointerDown:e=>{be||!re||(J.current=new Date,K(ue.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(V(!0),fe.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,r;if(q||!re)return;fe.current=null;let a=Number((null==(e=Z.current)?void 0:e.style.getPropertyValue("--swipe-amount").replace("px",""))||0),o=(new Date).getTime()-(null==(t=J.current)?void 0:t.getTime()),i=Math.abs(a)/o;if(Math.abs(a)>=20||i>.11)return K(ue.current),null==(n=p.onDismiss)||n.call(p,p),ye(),void U(!0);null==(r=Z.current)||r.style.setProperty("--swipe-amount","0px"),V(!1)},onPointerMove:e=>{var t;if(!fe.current||!re)return;let n=e.clientY-fe.current.y,r=e.clientX-fe.current.x,a=("top"===pe?Math.min:Math.max)(0,n),o="touch"===e.pointerType?10:2;Math.abs(a)>o?null==(t=Z.current)||t.style.setProperty("--swipe-amount",`${n}px`):Math.abs(r)>o&&(fe.current=null)}},se&&!p.jsx?o.createElement("button",{"aria-label":L,"data-disabled":be,"data-close-button":!0,onClick:be||!re?()=>{}:()=>{var e;ye(),null==(e=p.onDismiss)||e.call(p,p)},className:W(null==R?void 0:R.closeButton,null==(a=null==p?void 0:p.classNames)?void 0:a.closeButton)},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"}))):null,p.jsx||o.isValidElement(p.title)?p.jsx||p.title:o.createElement(o.Fragment,null,ne||p.icon||p.promise?o.createElement("div",{"data-icon":"",className:W(null==R?void 0:R.icon,null==(i=null==p?void 0:p.classNames)?void 0:i.icon)},p.promise||"loading"===p.type&&!p.icon?p.icon||(null!=I&&I.loading?o.createElement("div",{className:"sonner-loader","data-visible":"loading"===ne},I.loading):A?o.createElement("div",{className:"sonner-loader","data-visible":"loading"===ne},A):o.createElement(vt,{visible:"loading"===ne})):null,"loading"!==p.type?p.icon||(null==I?void 0:I[ne])||(e=>{switch(e){case"success":return bt;case"info":return wt;case"warning":return yt;case"error":return xt;default:return null}})(ne):null):null,o.createElement("div",{"data-content":"",className:W(null==R?void 0:R.content,null==(s=null==p?void 0:p.classNames)?void 0:s.content)},o.createElement("div",{"data-title":"",className:W(null==R?void 0:R.title,null==(l=null==p?void 0:p.classNames)?void 0:l.title)},p.title),p.description?o.createElement("div",{"data-description":"",className:W(O,oe,null==R?void 0:R.description,null==(c=null==p?void 0:p.classNames)?void 0:c.description)},p.description):null),o.isValidElement(p.cancel)?p.cancel:p.cancel&&Mt(p.cancel)?o.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||C,onClick:e=>{var t,n;Mt(p.cancel)&&re&&(null==(n=(t=p.cancel).onClick)||n.call(t,e),ye())},className:W(null==R?void 0:R.cancelButton,null==(u=null==p?void 0:p.classNames)?void 0:u.cancelButton)},p.cancel.label):null,o.isValidElement(p.action)?p.action:p.action&&Mt(p.action)?o.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||M,onClick:e=>{var t,n;Mt(p.action)&&(e.defaultPrevented||(null==(n=(t=p.action).onClick)||n.call(t,e),ye()))},className:W(null==R?void 0:R.actionButton,null==(d=null==p?void 0:p.classNames)?void 0:d.actionButton)},p.action.label):null))};function Nt(){if("undefined"==typeof window||"undefined"==typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}var At=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:a,closeButton:i,className:l,offset:c,theme:u="light",richColors:d,duration:f,style:p,visibleToasts:m=_t,toastOptions:h,dir:g=Nt(),gap:v=Ot,loadingIcon:b,icons:y,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:x,cn:P=Et}=e,[j,k]=o.useState([]),S=o.useMemo((()=>Array.from(new Set([n].concat(j.filter((e=>e.position)).map((e=>e.position)))))),[j,n]),[C,M]=o.useState([]),[_,O]=o.useState(!1),[E,D]=o.useState(!1),[N,A]=o.useState("system"!==u?u:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=o.useRef(null),R=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),I=o.useRef(null),L=o.useRef(!1),$=o.useCallback((e=>{var t;null!=(t=j.find((t=>t.id===e.id)))&&t.delete||jt.dismiss(e.id),k((t=>t.filter((({id:t})=>t!==e.id))))}),[j]);return o.useEffect((()=>jt.subscribe((e=>{e.dismiss?k((t=>t.map((t=>t.id===e.id?{...t,delete:!0}:t)))):setTimeout((()=>{s.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((()=>{"system"===u?("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?A("dark"):A("light")),"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>{A(e?"dark":"light")}))):A(u)}),[u]),o.useEffect((()=>{j.length<=1&&O(!1)}),[j]),o.useEffect((()=>{let e=e=>{var t,n;r.every((t=>e[t]||e.code===t))&&(O(!0),null==(t=T.current)||t.focus()),"Escape"===e.code&&(document.activeElement===T.current||null!=(n=T.current)&&n.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[r]),o.useEffect((()=>{if(T.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}}),[T.current]),j.length?o.createElement("section",{"aria-label":`${w} ${R}`,tabIndex:-1},S.map(((e,n)=>{var r;let[s,u]=e.split("-");return o.createElement("ol",{key:e,dir:"auto"===g?Nt():g,tabIndex:-1,ref:T,className:l,"data-sonner-toaster":!0,"data-theme":N,"data-y-position":s,"data-x-position":u,style:{"--front-toast-height":`${(null==(r=C[0])?void 0:r.height)||0}px`,"--offset":"number"==typeof c?`${c}px`:c||"32px","--width":"356px","--gap":`${v}px`,...p},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&(I.current.focus({preventScroll:!0}),I.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{E||O(!1)},onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||D(!0)},onPointerUp:()=>D(!1)},j.filter((t=>!t.position&&0===n||t.position===e)).map(((n,r)=>{var s,l;return o.createElement(Dt,{key:n.id,icons:y,index:r,toast:n,defaultRichColors:d,duration:null!=(s=null==h?void 0:h.duration)?s:f,className:null==h?void 0:h.className,descriptionClassName:null==h?void 0:h.descriptionClassName,invert:t,visibleToasts:m,closeButton:null!=(l=null==h?void 0:h.closeButton)?l:i,interacting:E,position:e,style:null==h?void 0:h.style,unstyled:null==h?void 0:h.unstyled,classNames:null==h?void 0:h.classNames,cancelButtonStyle:null==h?void 0:h.cancelButtonStyle,actionButtonStyle:null==h?void 0:h.actionButtonStyle,removeToast:$,toasts:j.filter((e=>e.position==n.position)),heights:C.filter((e=>e.position==n.position)),setHeights:M,expandByDefault:a,gap:v,loadingIcon:b,expanded:_,pauseWhenPageIsHidden:x,cn:P})})))}))):null};const Tt=({className:e,direction:n,size:r})=>(0,t.jsx)("svg",{className:["icon icon--chevron",e,r&&`icon--size-${r}`].filter(Boolean).join(" "),height:"100%",style:{transform:"left"===n?"rotate(90deg)":"right"===n?"rotate(-90deg)":"up"===n?"rotate(180deg)":void 0},viewBox:"0 0 9 7",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{className:"stroke",d:"M1.42871 1.5332L4.42707 4.96177L7.42543 1.5332"})}),Rt=({className:e})=>(0,t.jsxs)("svg",{className:[e,"icon icon--edit"].filter(Boolean).join(" "),viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("polygon",{className:"fill",points:"16.92 16.86 8.25 16.86 8.25 8.21 12.54 8.21 12.54 6.63 6.68 6.63 6.68 18.43 18.5 18.43 18.5 12.53 16.92 12.53 16.92 16.86"}),(0,t.jsx)("polygon",{className:"fill",points:"16.31 7.33 17.42 8.44 12.66 13.2 11.51 13.24 11.55 12.09 16.31 7.33"}),(0,t.jsx)("rect",{className:"fill",height:"1.15",transform:"translate(10.16 -10.48) rotate(45)",width:"1.58",x:"16.94",y:"6.44"})]}),It=()=>(0,t.jsxs)("svg",{"aria-hidden":"true",className:"graphic link icon icon--link",fill:"currentColor",focusable:"false",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,t.jsx)("path",{className:"fill",d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})]}),Lt=()=>(0,t.jsxs)("svg",{className:"icon icon--plus",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("line",{className:"stroke",x1:"12.4589",x2:"12.4589",y1:"16.9175",y2:"8.50115"}),(0,t.jsx)("line",{className:"stroke",x1:"8.05164",x2:"16.468",y1:"12.594",y2:"12.594"})]});var $t=n(38728);const Wt=({root:e=null,rootMargin:t="0px",threshold:n=0}={},r)=>{const[a,i]=(0,o.useState)(),[s,l]=(0,o.useState)(null),c=(0,o.useRef)("undefined"!=typeof window&&"IntersectionObserver"in window&&!r?new window.IntersectionObserver((([e])=>i(e)),{root:e,rootMargin:t,threshold:n}):null);return(0,o.useEffect)((()=>{if(r)return;const{current:e}=c;return e.disconnect(),s&&e.observe(s),()=>e.disconnect()}),[s,r]),[l,a,s]},Ft=e=>{const{alignCaret:n="center",boundingRef:r,children:a,className:s,delay:l=350,show:c=!0,staticPositioning:u=!1}=e,[d,f]=i().useState(c),[p,m]=i().useState("top"),[h,g]=Wt({root:r?.current||null,rootMargin:"-145px 0px 0px 100px",threshold:0},u);return(0,o.useEffect)((()=>{let e;return l&&c?e=setTimeout((()=>{f(c)}),l):f(c),()=>{e&&clearTimeout(e)}}),[c,l]),(0,o.useEffect)((()=>{u||m(g?.isIntersecting?"top":"bottom")}),[g,u]),(0,t.jsxs)(i().Fragment,{children:[!u&&(0,t.jsx)("aside",{"aria-hidden":"true",className:["tooltip",s,`tooltip--caret-${n}`,"tooltip--position-top"].filter(Boolean).join(" "),ref:h,style:{opacity:"0"},children:(0,t.jsx)("div",{className:"tooltip-content",children:a})}),(0,t.jsx)("aside",{className:["tooltip",s,d&&"tooltip--show",`tooltip--caret-${n}`,`tooltip--position-${p}`].filter(Boolean).join(" "),title:(v=a,"string"==typeof v?v:""),children:(0,t.jsx)("div",{className:"tooltip-content",children:a})})]});var v},zt={chevron:Tt,edit:Rt,link:It,plus:Lt,swap:()=>(0,t.jsxs)("svg",{className:"icon icon--swap",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{className:"stroke",d:"M9.84631 4.78679L6.00004 8.63306L9.84631 12.4793"}),(0,t.jsx)("path",{className:"stroke",d:"M15.1537 20.1059L19 16.2596L15.1537 12.4133"}),(0,t.jsx)("line",{className:"stroke",stroke:"#333333",x1:"7",x2:"15",y1:"8.7013",y2:"8.7013"}),(0,t.jsx)("line",{className:"stroke",x1:"18",x2:"10",y1:"16.1195",y2:"16.1195"})]}),x:$t.u},Bt="btn",Ht=({children:e,icon:n,showTooltip:r,tooltip:a})=>{const i=zt[n];return(0,t.jsxs)(o.Fragment,{children:[a&&(0,t.jsx)(Ft,{className:`${Bt}__tooltip`,show:r,children:a}),(0,t.jsxs)("span",{className:`${Bt}__content`,children:[e&&(0,t.jsx)("span",{className:`${Bt}__label`,children:e}),n&&(0,t.jsxs)("span",{className:`${Bt}__icon`,children:[(0,o.isValidElement)(n)&&n,i&&(0,t.jsx)(i,{})]})]})]})},Yt=(0,o.forwardRef)(((e,n)=>{const{id:r,type:a="button",Link:o,"aria-label":s,buttonStyle:l="primary",children:c,className:u,disabled:d,el:f="button",icon:p,iconPosition:m="right",iconStyle:h="without-border",newTab:g,onClick:v,round:b,size:y="medium",to:w,tooltip:x,url:P}=e,[j,k]=i().useState(!1),S=[Bt,u&&u,l&&`${Bt}--style-${l}`,p&&`${Bt}--icon`,h&&`${Bt}--icon-style-${h}`,p&&!c&&`${Bt}--icon-only`,d&&`${Bt}--disabled`,b&&`${Bt}--round`,y&&`${Bt}--size-${y}`,m&&`${Bt}--icon-position-${m}`,x&&`${Bt}--has-tooltip`].filter(Boolean).join(" ");const C={id:r,type:a,"aria-disabled":d,"aria-label":s,className:S,disabled:d,onClick:d?void 0:function(e){k(!1),"submit"!==a&&v&&e.preventDefault(),v&&v(e)},onMouseEnter:x?()=>k(!0):void 0,onMouseLeave:x?()=>k(!1):void 0,rel:g?"noopener noreferrer":void 0,target:g?"_blank":void 0};switch(f){case"link":return o?(0,t.jsx)(o,{...C,href:w||P,to:w||P,children:(0,t.jsx)(Ht,{icon:p,showTooltip:j,tooltip:x,children:c})}):(console.error('Link is required when using el="link"',c),null);case"anchor":return(0,t.jsx)("a",{...C,href:P,ref:n,children:(0,t.jsx)(Ht,{icon:p,showTooltip:j,tooltip:x,children:c})});default:const e=f;return(0,t.jsx)(e,{ref:n,type:"submit",...C,children:(0,t.jsx)(Ht,{icon:p,showTooltip:j,tooltip:x,children:c})})}})),Vt=(0,o.createContext)({}),qt=({children:e,config:n})=>(0,t.jsx)(Vt.Provider,{value:n,children:e}),Ut=()=>(0,o.useContext)(Vt),Gt="stay-logged-in",Kt="stay-logged-in",Xt=()=>{const{refreshCookie:e}=sn(),n=(0,ht.useRouter)(),r=Ut(),{admin:{routes:{logout:a}},routes:{admin:o}}=r,{toggleModal:i}=O(),{t:s}=(0,Be.B)();return(0,t.jsx)(ce,{className:Gt,slug:Kt,children:(0,t.jsxs)("div",{className:`${Gt}__wrapper`,children:[(0,t.jsxs)("div",{className:`${Gt}__content`,children:[(0,t.jsx)("h1",{children:s("authentication:stayLoggedIn")}),(0,t.jsx)("p",{children:s("authentication:youAreInactive")})]}),(0,t.jsxs)("div",{className:`${Gt}__controls`,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:()=>{i(Kt),n.push(`${o}${a}`)},children:s("authentication:logOut")}),(0,t.jsx)(Yt,{onClick:()=>{e(),i(Kt)},children:s("authentication:stayLoggedIn")})]})]})})};function Qt(e,t){const[n,r]=(0,o.useState)(e);return(0,o.useEffect)((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n}const Jt={searchParams:{},stringifyParams:()=>""},Zt=(0,o.createContext)(Jt);function en(e){return ge().parse(e,{depth:10,ignoreQueryPrefix:!0})}const tn=({children:e})=>{const n=(0,ht.useSearchParams)().toString(),r=en(n),[a,o]=i().useState(r),s=i().useCallback((({params:e,replace:t=!1})=>ge().stringify({...t?{}:a,...e},{addQueryPrefix:!0})),[a]);return i().useEffect((()=>{o(en(n))}),[n]),(0,t.jsx)(Zt.Provider,{value:{searchParams:a,stringifyParams:s},children:e})},nn=()=>(0,o.useContext)(Zt),rn=(0,o.createContext)({}),an=2147483647,on=({children:e})=>{const{searchParams:n}=nn(),[r,a]=(0,o.useState)(),[s,l]=(0,o.useState)(),[c,u]=(0,o.useState)(),[d,f]=(0,o.useState)(),p=(0,ht.usePathname)(),m=(0,ht.useRouter)(),h=Ut(),{admin:{autoLogin:g,routes:{inactivity:v},routes:{login:b},user:y},routes:{admin:w,api:x},serverURL:P}=h,[j,k]=(0,o.useState)(),{i18n:S}=(0,Be.B)(),{closeAllModals:C,openModal:M}=O(),[_,E]=(0,o.useState)(0),D=Qt(_,1e4),N=r?.id,A=(0,o.useCallback)((()=>{if(window.location.pathname.startsWith(w)){const e=`?redirect=${encodeURIComponent(window.location.pathname)}`;m.replace(`${w}${v}${e}`)}else m.replace(`${w}${v}`);C()}),[m,w,v,C]),T=(0,o.useCallback)((()=>{l(void 0),u(void 0),f(void 0)}),[]),R=(0,o.useCallback)((e=>{const t=e?.token||e?.refreshedToken;t&&e?.exp?(l(t),u(e.exp),e.strategy&&f(e.strategy)):T()}),[T]),I=(0,o.useCallback)((e=>{const t=Math.round((new Date).getTime()/1e3);(e||c&&("number"==typeof c?c:0)-t<120)&&setTimeout((async()=>{try{const e=await mt.post(`${P}${x}/${y}/refresh-token`,{headers:{"Accept-Language":S.language}});if(200===e.status){const t=await e.json();a(t.user),R(t)}else a(null),A()}catch(e){Ct.error(e.message)}}),1e3)}),[c,P,x,y,S,A,R]),L=(0,o.useCallback)((async e=>{try{const t=await mt.post(`${P}${x}/${y}/refresh-token`,{headers:{"Accept-Language":S.language}});if(200===t.status){const n=await t.json();return e||(a(n.user),R(n)),n.user}return a(null),A(),null}catch(e){return Ct.error(`Refreshing token failed: ${e.message}`),null}}),[P,x,y,S,A,R]),$=(0,o.useCallback)((async()=>{a(null),T();try{await mt.post(`${P}${x}/${y}/logout`)}catch(e){Ct.error(`Logging out failed: ${e.message}`)}}),[P,x,y,T]),W=(0,o.useCallback)((async()=>{const e={locale:"en"};try{const t=await mt.get(`${P}${x}/access?${ge().stringify(e)}`,{headers:{"Accept-Language":S.language}});if(200!==t.status)throw new Error(`Fetching permissions failed with status code ${t.status}`);{const e=await t.json();k(e)}}catch(e){Ct.error(`Refreshing permissions failed: ${e.message}`)}}),[P,x,S,"en"]),F=i().useCallback((async()=>{try{const e=await mt.get(`${P}${x}/${y}/me`,{headers:{"Accept-Language":S.language}});if(200===e.status){const t=await e.json();if(t?.user)a(t.user),t?.token&&R(t);else if(g&&!0!==g.prefillOnly){const e=await mt.post(`${P}${x}/${y}${b}`,{body:JSON.stringify({email:g.email,password:g.password}),headers:{"Accept-Language":S.language,"Content-Type":"application/json"}});if(200===e.status){const t=await e.json();a(t.user),t?.token&&R(t),m.replace("string"==typeof n.redirect?n.redirect:w)}else a(null),T()}else a(null),T()}}catch(e){Ct.error(`Fetching user failed: ${e.message}`)}}),[P,x,y,S.language,g,R,m,n,w,T,d,c,b]);return(0,o.useEffect)((()=>{F()}),[F]),(0,o.useEffect)((()=>{N&&I()}),[D,I,N]),(0,o.useEffect)((()=>{E(Date.now())}),[p]),(0,o.useEffect)((()=>{let e;const t=Math.round((new Date).getTime()/1e3),n="number"==typeof c?c-t:0;return n>0&&(e=setTimeout((()=>{M(Kt)}),Math.max(Math.min(1e3*(n-60),an)))),()=>{e&&clearTimeout(e)}}),[c,M]),(0,o.useEffect)((()=>{let e;const t=Math.round((new Date).getTime()/1e3),n="number"==typeof c?c-t:0;return n>0&&(e=setTimeout((()=>{a(null),T(),A()}),Math.max(Math.min(1e3*n,an),0))),()=>{e&&clearTimeout(e)}}),[c,C,S,A,T]),(0,t.jsx)(rn.Provider,{value:{fetchFullUser:F,logOut:$,permissions:j,refreshCookie:I,refreshCookieAsync:L,refreshPermissions:W,setPermissions:k,setUser:a,token:s,user:r},children:e})},sn=()=>(0,o.useContext)(rn),ln=(0,o.createContext)({}),cn=(e,t)=>({body:JSON.stringify({value:e}),headers:{"Accept-Language":t,"Content-Type":"application/json"}}),un=({children:e})=>{const n=(0,o.useRef)({}),r=(0,o.useRef)({}),a=(0,o.useRef)({}),i=Ut(),{user:s}=sn(),{i18n:l}=(0,Be.B)(),{routes:{api:c},serverURL:u}=i;(0,o.useEffect)((()=>{s||(r.current={})}),[s]);const d=(0,o.useCallback)((async e=>{const t=r.current;if(void 0!==t[e])return t[e];const n=new Promise((t=>{(async()=>{const n=await mt.get(`${u}${c}/payload-preferences/${e}`,{headers:{"Accept-Language":l.language}});let a=null;if(200===n.status){a=(await n.json()).value}r.current[e]=a,t(a)})()}));return t[e]=n,n}),[l.language,c,r,u]),f=(0,o.useCallback)((async(e,t,n=!1)=>{if(!1===n)return r.current[e]=t,void await mt.post(`${u}${c}/payload-preferences/${e}`,cn(t,l.language));let o=t;const i=await d(e);if("object"==typeof t&&"object"==typeof i&&"object"==typeof o){if(o={...i||{},...t},pt(o,i))return;a.current[e]={...a.current[e],...o}}else{if(o===i)return;a.current[e]=o}setTimeout((()=>{(async()=>{pt(a.current[e],r.current[e])||(r.current[e]=a.current[e],await mt.post(`${u}${c}/payload-preferences/${e}`,cn(r.current[e],l.language)),delete a.current[e])})()}))}),[c,d,l.language,a,u]);return n.current.getPreference=d,n.current.setPreference=f,(0,t.jsx)(ln.Provider,{value:n.current,children:e})},dn=()=>(0,o.useContext)(ln),fn=i().createContext({navOpen:!0,navRef:null,setNavOpen:()=>{}}),pn=()=>i().useContext(fn),mn=({children:e})=>{const{breakpoints:{l:n,m:r,s:a}}=Le(),{getPreference:s}=dn(),l=(0,o.useRef)(null),[c,u]=i().useState(!1);return(0,o.useEffect)((()=>{if(!1===n){const e=async()=>{const e=await(async e=>{const t=await e("nav"),n=t?.open;return"boolean"!=typeof n||n})(s);u(e)};e()}}),[n,s,u]),(0,o.useEffect)((()=>{var e;l.current&&(c&&r?dt(l.current):(e=l.current)?(tt=tt.filter((function(t){return t.targetElement!==e})),et&&(e.ontouchstart=null,e.ontouchmove=null,nt&&0===tt.length&&(document.removeEventListener("touchmove",lt,Je?{passive:!1}:void 0),nt=!1)),et?ut():ct()):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices."))}),[c,r]),(0,o.useEffect)((()=>{!1!==n&&!1!==r&&!1!==a||u(!1)}),[n,r,a]),(0,o.useEffect)((()=>()=>{et&&(tt.forEach((function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null})),nt&&(document.removeEventListener("touchmove",lt,Je?{passive:!1}:void 0),nt=!1),rt=-1),et?ut():ct(),tt=[]}),[]),(0,t.jsx)(fn.Provider,{value:{navOpen:c,navRef:l,setNavOpen:u},children:e})},hn=()=>(0,o.useContext)(gn),gn=(0,o.createContext)({}),vn=({children:e})=>{const[n,r]=(0,o.useState)([]);return(0,t.jsx)(gn.Provider,{value:{setStepNav:r,stepNav:n},children:e})},bn=(0,o.createContext)({}),yn=({children:e,componentMap:n})=>{const r=(0,o.useCallback)((({collectionSlug:e,globalSlug:t,path:r})=>{let a;return e&&(a=n.collections[e].fieldMap),t&&(a=n.globals[t].fieldMap),a.find((e=>"name"in e&&e.name===r))}),[n]),a=(0,o.useCallback)((({collectionSlug:e,globalSlug:t})=>e?n.collections[e].fieldMap:t?n.globals[t].fieldMap:[]),[n]),i=(0,o.useCallback)((({collectionSlug:e,globalSlug:t})=>e?n.collections[e]:t?n.globals[t]:{}),[n]);return(0,t.jsx)(bn.Provider,{value:{componentMap:n,getComponentMap:i,getFieldMap:a,getMappedFieldByPath:r},children:e})},wn=()=>(0,o.useContext)(bn),xn=(0,o.createContext)({actions:[],setViewActions:()=>{}}),Pn=()=>(0,o.useContext)(xn),jn=({children:e})=>{const[n,r]=(0,o.useState)([]),[a,i]=(0,o.useState)([]),{componentMap:{actions:s}}=wn();(0,o.useEffect)((()=>{i(s||[])}),[s]);const l=[...n||[],...a||[]];return(0,t.jsx)(xn.Provider,{value:{actions:l,setViewActions:r},children:e})},kn=i().createContext({addClientFunction:()=>null,removeClientFunction:()=>null}),Sn=i().createContext({}),Cn=({children:e})=>{const[n,r]=i().useState({}),a=i().useCallback((e=>{r((t=>{const n={...t};return n[e.key]=e.func,n}))}),[]),o=i().useCallback((e=>{r((t=>{const n={...t};return delete n[e.key],n}))}),[]);return(0,t.jsx)(kn.Provider,{value:{addClientFunction:a,removeClientFunction:o},children:(0,t.jsx)(Sn.Provider,{value:n,children:e})})},Mn=(0,o.createContext)({mostRecentUpdate:null,reportUpdate:e=>null}),_n=({children:e})=>{const[n,r]=(0,o.useState)(null);return(0,t.jsx)(Mn.Provider,{value:{mostRecentUpdate:n,reportUpdate:r},children:e})},On=()=>(0,o.useContext)(Mn);var En=n(49529),Dn=n.n(En);const Nn=Dn().default||Dn(),An="banner",Tn=({type:e="default",alignIcon:n="right",children:r,className:a,icon:o,onClick:s,to:l})=>{const c=[An,`${An}--type-${e}`,a&&a,l&&`${An}--has-link`,(l||s)&&`${An}--has-action`,o&&`${An}--has-icon`,o&&`${An}--align-icon-${n}`].filter(Boolean).join(" ");let u="div";return s&&!l&&(u="button"),l&&(u=Nn),(0,t.jsxs)(u,{className:c,href:l||null,onClick:s,children:[o&&"left"===n&&(0,t.jsx)(i().Fragment,{children:o}),(0,t.jsx)("span",{className:`${An}__content`,children:r}),o&&"right"===n&&(0,t.jsx)(i().Fragment,{children:o})]})};const Rn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function In(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Ln(e){return"nodeType"in e}function $n(e){var t,n;return e?In(e)?e:Ln(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Wn(e){const{Document:t}=$n(e);return e instanceof t}function Fn(e){return!In(e)&&e instanceof $n(e).HTMLElement}function zn(e){return e instanceof $n(e).SVGElement}function Bn(e){return e?In(e)?e.document:Ln(e)?Wn(e)?e:Fn(e)||zn(e)?e.ownerDocument:document:document:document}const Hn=Rn?o.useLayoutEffect:o.useEffect;function Yn(e){const t=(0,o.useRef)(e);return Hn((()=>{t.current=e})),(0,o.useCallback)((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Vn(e,t){void 0===t&&(t=[e]);const n=(0,o.useRef)(e);return Hn((()=>{n.current!==e&&(n.current=e)}),t),n}function qn(e,t){const n=(0,o.useRef)();return(0,o.useMemo)((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function Un(e){const t=Yn(e),n=(0,o.useRef)(null),r=(0,o.useCallback)((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function Gn(e){const t=(0,o.useRef)();return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}let Kn={};function Xn(e,t){return(0,o.useMemo)((()=>{if(t)return t;const n=null==Kn[e]?0:Kn[e]+1;return Kn[e]=n,e+"-"+n}),[e,t])}function Qn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,a]of r){const r=t[n];null!=r&&(t[n]=r+e*a)}return t}),{...t})}}const Jn=Qn(1),Zn=Qn(-1);function er(e){if(!e)return!1;const{KeyboardEvent:t}=$n(e.target);return t&&e instanceof t}function tr(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=$n(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const nr=Object.freeze({Translate:{toString(e){if(!e)return;const{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;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[nr.Translate.toString(e),nr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),rr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ar(e){return e.matches(rr)?e:e.querySelector(rr)}const or={display:"none"};function ir(e){let{id:t,value:n}=e;return i().createElement("div",{id:t,style:or},n)}function sr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return i().createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const lr=(0,o.createContext)(null);const cr={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ur={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function dr(e){let{announcements:t=ur,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=cr}=e;const{announce:l,announcement:c}=function(){const[e,t]=(0,o.useState)("");return{announce:(0,o.useCallback)((e=>{null!=e&&t(e)}),[]),announcement:e}}(),u=Xn("DndLiveRegion"),[d,f]=(0,o.useState)(!1);if((0,o.useEffect)((()=>{f(!0)}),[]),function(e){const t=(0,o.useContext)(lr);(0,o.useEffect)((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}((0,o.useMemo)((()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}})),[l,t])),!d)return null;const p=i().createElement(i().Fragment,null,i().createElement(ir,{id:r,value:a.draggable}),i().createElement(sr,{id:u,announcement:c}));return n?(0,s.createPortal)(p,n):p}var fr;function pr(){}function mr(e,t){return(0,o.useMemo)((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(fr||(fr={}));const hr=Object.freeze({x:0,y:0});function gr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function br(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yr(e){let{left:t,top:n,height:r,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+r},{x:t+a,y:n+r}]}function wr(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function xr(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Pr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=xr(t,t.left,t.top),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=gr(xr(r),a);o.push({id:t,data:{droppableContainer:e,value:n}})}}return o.sort(vr)};function jr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=a-r,s=o-n;if(r<a&&n<o){const n=t.width*t.height,r=e.width*e.height,a=i*s;return Number((a/(n+r-a)).toFixed(4))}return 0}const kr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const e of r){const{id:r}=e,o=n.get(r);if(o){const n=jr(o,t);n>0&&a.push({id:r,data:{droppableContainer:e,value:n}})}}return a.sort(br)};function Sr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:hr}function Cr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Mr=Cr(1);function _r(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const Or={ignoreTransform:!1};function Er(e,t){void 0===t&&(t=Or);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=$n(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=_r(t);if(!r)return e;const{scaleX:a,scaleY:o,x:i,y:s}=r,l=e.left-i-(1-a)*parseFloat(n),c=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?e.width/a:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}(n,t,r))}const{top:r,left:a,width:o,height:i,bottom:s,right:l}=n;return{top:r,left:a,width:o,height:i,bottom:s,right:l}}function Dr(e){return Er(e,{ignoreTransform:!0})}function Nr(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(Wn(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Fn(a)||zn(a))return n;if(n.includes(a))return n;const o=$n(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=$n(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(a,o)&&n.push(a),function(e,t){return void 0===t&&(t=$n(e).getComputedStyle(e)),"fixed"===t.position}(a,o)?n:r(a.parentNode)}(e):n}function Ar(e){const[t]=Nr(e,1);return null!=t?t:null}function Tr(e){return Rn&&e?In(e)?e:Ln(e)?Wn(e)||e===Bn(e).scrollingElement?window:Fn(e)?e:null:null:null}function Rr(e){return In(e)?e.scrollX:e.scrollLeft}function Ir(e){return In(e)?e.scrollY:e.scrollTop}function Lr(e){return{x:Rr(e),y:Ir(e)}}var $r;function Wr(e){return!(!Rn||!e)&&e===document.scrollingElement}function Fr(e){const t={x:0,y:0},n=Wr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}($r||($r={}));const zr={x:.2,y:.2};function Br(e,t,n,r,a){let{top:o,left:i,right:s,bottom:l}=n;void 0===r&&(r=10),void 0===a&&(a=zr);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=Fr(e),p={x:0,y:0},m={x:0,y:0},h=t.height*a.y,g=t.width*a.x;return!c&&o<=t.top+h?(p.y=$r.Backward,m.y=r*Math.abs((t.top+h-o)/h)):!u&&l>=t.bottom-h&&(p.y=$r.Forward,m.y=r*Math.abs((t.bottom-h-l)/h)),!f&&s>=t.right-g?(p.x=$r.Forward,m.x=r*Math.abs((t.right-g-s)/g)):!d&&i<=t.left+g&&(p.x=$r.Backward,m.x=r*Math.abs((t.left+g-i)/g)),{direction:p,speed:m}}function Hr(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Yr(e){return e.reduce(((e,t)=>Jn(e,Lr(t))),hr)}function Vr(e,t){if(void 0===t&&(t=Er),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);Ar(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const qr=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Rr(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Ir(t)),0)}]];class Ur{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Nr(t),r=Yr(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,a]of qr)for(const o of t)Object.defineProperty(this,o,{get:()=>{const t=a(n),i=r[e]-t;return this.rect[o]+i},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Kr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Xr,Qr;function Jr(e){e.preventDefault()}function Zr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Xr||(Xr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(Qr||(Qr={}));const ea={start:[Qr.Space,Qr.Enter],cancel:[Qr.Esc],end:[Qr.Space,Qr.Enter]},ta=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Qr.Right:return{...n,x:n.x+25};case Qr.Left:return{...n,x:n.x-25};case Qr.Down:return{...n,y:n.y+25};case Qr.Up:return{...n,y:n.y-25}}};class na{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Gr(Bn(t)),this.windowListeners=new Gr($n(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Xr.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Vr(n),t(hr)}handleKeyDown(e){if(er(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=ea,coordinateGetter:o=ta,scrollBehavior:i="smooth"}=r,{code:s}=e;if(a.end.includes(s))return void this.handleEnd(e);if(a.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:hr;this.referenceCoordinates||(this.referenceCoordinates=c);const u=o(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=Zn(u,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:o,isRight:s,isLeft:l,isBottom:c,maxScroll:d,minScroll:f}=Fr(n),p=Hr(n),m={x:Math.min(a===Qr.Right?p.right-p.width/2:p.right,Math.max(a===Qr.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(a===Qr.Down?p.bottom-p.height/2:p.bottom,Math.max(a===Qr.Down?p.top:p.top+p.height/2,u.y))},h=a===Qr.Right&&!s||a===Qr.Left&&!l,g=a===Qr.Down&&!c||a===Qr.Up&&!o;if(h&&m.x!==u.x){const e=n.scrollLeft+t.x,o=a===Qr.Right&&e<=d.x||a===Qr.Left&&e>=f.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:i});r.x=o?n.scrollLeft-e:a===Qr.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:i});break}if(g&&m.y!==u.y){const e=n.scrollTop+t.y,o=a===Qr.Down&&e<=d.y||a===Qr.Up&&e>=f.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:i});r.y=o?n.scrollTop-e:a===Qr.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:i});break}}this.handleMove(e,Jn(Zn(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ra(e){return Boolean(e&&"distance"in e)}function aa(e){return Boolean(e&&"delay"in e)}na.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ea,onActivation:a}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class oa{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=$n(e);return e instanceof t?e:Bn(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:o}=a;this.props=e,this.events=t,this.document=Bn(o),this.documentListeners=new Gr(this.document),this.listeners=new Gr(n),this.windowListeners=new Gr($n(o)),this.initialCoordinates=null!=(r=tr(a))?r:hr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.DragStart,Jr),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),this.windowListeners.add(Xr.ContextMenu,Jr),this.documentListeners.add(Xr.Keydown,this.handleKeydown),t){if(ra(t))return;if(aa(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Xr.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:o,options:{activationConstraint:i}}=a;if(!r)return;const s=null!=(t=tr(e))?t:hr,l=Zn(r,s);if(!n&&i){if(aa(i))return Kr(l,i.tolerance)?this.handleCancel():void 0;if(ra(i))return null!=i.tolerance&&Kr(l,i.tolerance)?this.handleCancel():Kr(l,i.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),o(s)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Qr.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const ia={move:{name:"pointermove"},end:{name:"pointerup"}};class sa extends oa{constructor(e){const{event:t}=e,n=Bn(t.target);super(e,ia,n)}}sa.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const la={move:{name:"mousemove"},end:{name:"mouseup"}};var ca;!function(e){e[e.RightClick=2]="RightClick"}(ca||(ca={}));(class extends oa{constructor(e){super(e,la,Bn(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==ca.RightClick&&(null==r||r({event:n}),!0)}}];const ua={move:{name:"touchmove"},end:{name:"touchend"}};var da,fa;function pa(e){let{acceleration:t,activator:n=da.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:s=5,order:l=fa.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=Gn(t);return qn((e=>{if(n||!r||!e)return ma;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[$r.Backward]:e.x[$r.Backward]||-1===a.x,[$r.Forward]:e.x[$r.Forward]||1===a.x},y:{[$r.Backward]:e.y[$r.Backward]||-1===a.y,[$r.Forward]:e.y[$r.Forward]||1===a.y}}}),[n,t,r])}({delta:f,disabled:!i}),[h,g]=function(){const e=(0,o.useRef)(null);return[(0,o.useCallback)(((t,n)=>{e.current=setInterval(t,n)}),[]),(0,o.useCallback)((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),v=(0,o.useRef)({x:0,y:0}),b=(0,o.useRef)({x:0,y:0}),y=(0,o.useMemo)((()=>{switch(n){case da.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case da.DraggableRect:return a}}),[n,a,c]),w=(0,o.useRef)(null),x=(0,o.useCallback)((()=>{const e=w.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)}),[]),P=(0,o.useMemo)((()=>l===fa.TreeOrder?[...u].reverse():u),[l,u]);(0,o.useEffect)((()=>{if(i&&u.length&&y){for(const e of P){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),a=d[n];if(!a)continue;const{direction:o,speed:i}=Br(e,a,y,t,p);for(const e of["x","y"])m[e][o[e]]||(i[e]=0,o[e]=0);if(i.x>0||i.y>0)return g(),w.current=e,h(x,s),v.current=i,void(b.current=o)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()}),[t,x,r,g,i,s,JSON.stringify(y),JSON.stringify(m),h,u,P,d,JSON.stringify(p)])}(class extends oa{constructor(e){super(e,ua)}static setup(){return window.addEventListener(ua.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ua.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(da||(da={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(fa||(fa={}));const ma={x:{[$r.Backward]:!1,[$r.Forward]:!1},y:{[$r.Backward]:!1,[$r.Forward]:!1}};var ha,ga;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(ha||(ha={})),function(e){e.Optimized="optimized"}(ga||(ga={}));const va=new Map;function ba(e,t){return qn((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function ya(e){let{callback:t,disabled:n}=e;const r=Yn(t),a=(0,o.useMemo)((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return(0,o.useEffect)((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function wa(e){return new Ur(Er(e),e)}function xa(e,t,n){void 0===t&&(t=wa);const[r,a]=(0,o.useReducer)((function(r){if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=r?r:n)?a:null;const o=t(e);if(JSON.stringify(r)===JSON.stringify(o))return r;return o}),null),i=function(e){let{callback:t,disabled:n}=e;const r=Yn(t),a=(0,o.useMemo)((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return(0,o.useEffect)((()=>()=>null==a?void 0:a.disconnect()),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ya({callback:a});return Hn((()=>{a(),e?(null==s||s.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==i||i.disconnect())}),[e]),r}const Pa=[];function ja(e,t){void 0===t&&(t=[]);const n=(0,o.useRef)(null);return(0,o.useEffect)((()=>{n.current=null}),t),(0,o.useEffect)((()=>{const t=e!==hr;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?Zn(e,n.current):hr}function ka(e){return(0,o.useMemo)((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Sa=[];function Ca(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Fn(t)?t:e}const Ma=[{sensor:sa,options:{}},{sensor:na,options:{}}],_a={current:{}},Oa={draggable:{measure:Dr},droppable:{measure:Dr,strategy:ha.WhileDragging,frequency:ga.Optimized},dragOverlay:{measure:Er}};class Ea extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Da={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ea,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Oa,measureDroppableContainers:pr,windowRect:null,measuringScheduled:!1},Na={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pr,draggableNodes:new Map,over:null,measureDroppableContainers:pr},Aa=(0,o.createContext)(Na),Ta=(0,o.createContext)(Da);function Ra(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ea}}}function Ia(e,t){switch(t.type){case fr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case fr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case fr.DragEnd:case fr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case fr.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new Ea(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case fr.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ea(e.droppable.containers);return i.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case fr.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new Ea(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function La(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=(0,o.useContext)(Aa),i=Gn(r),s=Gn(null==n?void 0:n.id);return(0,o.useEffect)((()=>{if(!t&&!r&&i&&null!=s){if(!er(i))return;if(document.activeElement===i.target)return;const e=a.get(s);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=ar(e);if(t){t.focus();break}}}))}}),[r,t,a,s,i]),null}function $a(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}const Wa=(0,o.createContext)({...hr,scaleX:1,scaleY:1});var Fa;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Fa||(Fa={}));const za=(0,o.memo)((function(e){var t,n,r,a;let{id:l,accessibility:c,autoScroll:u=!0,children:d,sensors:f=Ma,collisionDetection:p=kr,measuring:m,modifiers:h,...g}=e;const v=(0,o.useReducer)(Ia,void 0,Ra),[b,y]=v,[w,x]=function(){const[e]=(0,o.useState)((()=>new Set)),t=(0,o.useCallback)((t=>(e.add(t),()=>e.delete(t))),[e]),n=(0,o.useCallback)((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]);return[n,t]}(),[P,j]=(0,o.useState)(Fa.Uninitialized),k=P===Fa.Initialized,{draggable:{active:S,nodes:C,translate:M},droppable:{containers:_}}=b,O=S?C.get(S):null,E=(0,o.useRef)({initial:null,translated:null}),D=(0,o.useMemo)((()=>{var e;return null!=S?{id:S,data:null!=(e=null==O?void 0:O.data)?e:_a,rect:E}:null}),[S,O]),N=(0,o.useRef)(null),[A,T]=(0,o.useState)(null),[R,I]=(0,o.useState)(null),L=Vn(g,Object.values(g)),$=Xn("DndDescribedBy",l),W=(0,o.useMemo)((()=>_.getEnabled()),[_]),F=function(e){return(0,o.useMemo)((()=>({draggable:{...Oa.draggable,...null==e?void 0:e.draggable},droppable:{...Oa.droppable,...null==e?void 0:e.droppable},dragOverlay:{...Oa.dragOverlay,...null==e?void 0:e.dragOverlay}})),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}(m),{droppableRects:z,measureDroppableContainers:B,measuringScheduled:H}=function(e,t){let{dragging:n,dependencies:r,config:a}=t;const[i,s]=(0,o.useState)(null),{frequency:l,measure:c,strategy:u}=a,d=(0,o.useRef)(e),f=function(){switch(u){case ha.Always:return!1;case ha.BeforeDragging:return n;default:return!n}}(),p=Vn(f),m=(0,o.useCallback)((function(e){void 0===e&&(e=[]),p.current||s((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[p]),h=(0,o.useRef)(null),g=qn((t=>{if(f&&!n)return va;if(!t||t===va||d.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Ur(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,f,c]);return(0,o.useEffect)((()=>{d.current=e}),[e]),(0,o.useEffect)((()=>{f||m()}),[n,f]),(0,o.useEffect)((()=>{i&&i.length>0&&s(null)}),[JSON.stringify(i)]),(0,o.useEffect)((()=>{f||"number"!=typeof l||null!==h.current||(h.current=setTimeout((()=>{m(),h.current=null}),l))}),[l,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:null!=i}}(W,{dragging:k,dependencies:[M.x,M.y],config:F.droppable}),Y=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return qn((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(C,S),V=(0,o.useMemo)((()=>R?tr(R):null),[R]),q=function(){const e=!1===(null==A?void 0:A.autoScrollEnabled),t="object"==typeof u?!1===u.enabled:!1===u,n=k&&!e&&!t;if("object"==typeof u)return{...u,enabled:n};return{enabled:n}}(),U=function(e,t){return ba(e,t)}(Y,F.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const i=(0,o.useRef)(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;Hn((()=>{if(!s&&!l||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const a=Sr(n(e),r);if(s||(a.x=0),l||(a.y=0),i.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){const t=Ar(e);t&&t.scrollBy({top:a.y,left:a.x})}}),[t,s,l,r,n])}({activeNode:S?C.get(S):null,config:q.layoutShiftCompensation,initialRect:U,measure:F.draggable.measure});const G=xa(Y,F.draggable.measure,U),K=xa(Y?Y.parentElement:null),X=(0,o.useRef)({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Q=_.getNodeFor(null==(t=X.current.over)?void 0:t.id),J=function(e){let{measure:t}=e;const[n,r]=(0,o.useState)(null),a=ya({callback:(0,o.useCallback)((e=>{for(const{target:n}of e)if(Fn(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t])}),i=(0,o.useCallback)((e=>{const n=Ca(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),r(n?t(n):null)}),[t,a]),[s,l]=Un(i);return(0,o.useMemo)((()=>({nodeRef:s,rect:n,setRef:l})),[n,s,l])}({measure:F.dragOverlay.measure}),Z=null!=(n=J.nodeRef.current)?n:Y,ee=k?null!=(r=J.rect)?r:G:null,te=Boolean(J.nodeRef.current&&J.rect),ne=Sr(re=te?null:G,ba(re));var re;const ae=ka(Z?$n(Z):null),oe=function(e){const t=(0,o.useRef)(e),n=qn((n=>e?n&&n!==Pa&&e&&t.current&&e.parentNode===t.current.parentNode?n:Nr(e):Pa),[e]);return(0,o.useEffect)((()=>{t.current=e}),[e]),n}(k?null!=Q?Q:Y:null),ie=function(e,t){void 0===t&&(t=Er);const[n]=e,r=ka(n?$n(n):null),[a,i]=(0,o.useReducer)((function(){return e.length?e.map((e=>Wr(e)?r:new Ur(t(e),e))):Sa}),Sa),s=ya({callback:i});return e.length>0&&a===Sa&&i(),Hn((()=>{e.length?e.forEach((e=>null==s?void 0:s.observe(e))):(null==s||s.disconnect(),i())}),[e]),a}(oe),se=$a(h,{transform:{x:M.x-ne.x,y:M.y-ne.y,scaleX:1,scaleY:1},activatorEvent:R,active:D,activeNodeRect:G,containerNodeRect:K,draggingNodeRect:ee,over:X.current.over,overlayNodeRect:J.rect,scrollableAncestors:oe,scrollableAncestorRects:ie,windowRect:ae}),le=V?Jn(V,M):null,ce=function(e){const[t,n]=(0,o.useState)(null),r=(0,o.useRef)(e),a=(0,o.useCallback)((e=>{const t=Tr(e.target);t&&n((e=>e?(e.set(t,Lr(t)),new Map(e)):null))}),[]);return(0,o.useEffect)((()=>{const t=r.current;if(e!==t){o(t);const i=e.map((e=>{const t=Tr(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Lr(t)]):null})).filter((e=>null!=e));n(i.length?new Map(i):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach((e=>{const t=Tr(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),(0,o.useMemo)((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>Jn(e,t)),hr):Yr(e):hr),[e,t])}(oe),ue=ja(ce),de=ja(ce,[G]),fe=Jn(se,ue),pe=ee?Mr(ee,se):null,me=D&&pe?p({active:D,collisionRect:pe,droppableRects:z,droppableContainers:W,pointerCoordinates:le}):null,he=wr(me,"id"),[ge,ve]=(0,o.useState)(null),be=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?se:Jn(se,de),null!=(a=null==ge?void 0:ge.rect)?a:null,G),ye=(0,o.useCallback)(((e,t)=>{let{sensor:n,options:r}=t;if(null==N.current)return;const a=C.get(N.current);if(!a)return;const o=e.nativeEvent,i=new n({active:N.current,activeNode:a,event:o,options:r,context:X,onStart(e){const t=N.current;if(null==t)return;const n=C.get(t);if(!n)return;const{onDragStart:r}=L.current,a={active:{id:t,data:n.data,rect:E}};(0,s.unstable_batchedUpdates)((()=>{null==r||r(a),j(Fa.Initializing),y({type:fr.DragStart,initialCoordinates:e,active:t}),w({type:"onDragStart",event:a})}))},onMove(e){y({type:fr.DragMove,coordinates:e})},onEnd:l(fr.DragEnd),onCancel:l(fr.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:a}=X.current;let i=null;if(t&&a){const{cancelDrop:s}=L.current;if(i={activatorEvent:o,active:t,collisions:n,delta:a,over:r},e===fr.DragEnd&&"function"==typeof s){await Promise.resolve(s(i))&&(e=fr.DragCancel)}}N.current=null,(0,s.unstable_batchedUpdates)((()=>{y({type:e}),j(Fa.Uninitialized),ve(null),T(null),I(null);const t=e===fr.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=L.current[t];null==e||e(i),w({type:t,event:i})}}))}}(0,s.unstable_batchedUpdates)((()=>{T(i),I(e.nativeEvent)}))}),[C]),we=(0,o.useCallback)(((e,t)=>(n,r)=>{const a=n.nativeEvent,o=C.get(r);if(null!==N.current||!o||a.dndKit||a.defaultPrevented)return;const i={active:o};!0===e(n,t.options,i)&&(a.dndKit={capturedBy:t.sensor},N.current=r,ye(n,t))}),[C,ye]),xe=function(e,t){return(0,o.useMemo)((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(f,we);!function(e){(0,o.useEffect)((()=>{if(!Rn)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(f),Hn((()=>{G&&P===Fa.Initializing&&j(Fa.Initialized)}),[G,P]),(0,o.useEffect)((()=>{const{onDragMove:e}=L.current,{active:t,activatorEvent:n,collisions:r,over:a}=X.current;if(!t||!n)return;const o={active:t,activatorEvent:n,collisions:r,delta:{x:fe.x,y:fe.y},over:a};(0,s.unstable_batchedUpdates)((()=>{null==e||e(o),w({type:"onDragMove",event:o})}))}),[fe.x,fe.y]),(0,o.useEffect)((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:a}=X.current;if(!e||null==N.current||!t||!a)return;const{onDragOver:o}=L.current,i=r.get(he),l=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:l};(0,s.unstable_batchedUpdates)((()=>{ve(l),null==o||o(c),w({type:"onDragOver",event:c})}))}),[he]),Hn((()=>{X.current={activatorEvent:R,active:D,activeNode:Y,collisionRect:pe,collisions:me,droppableRects:z,draggableNodes:C,draggingNode:Z,draggingNodeRect:ee,droppableContainers:_,over:ge,scrollableAncestors:oe,scrollAdjustedTranslate:fe},E.current={initial:ee,translated:pe}}),[D,Y,me,pe,C,Z,ee,z,_,ge,oe,fe]),pa({...q,delta:M,draggingRect:pe,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:ie});const Pe=(0,o.useMemo)((()=>({active:D,activeNode:Y,activeNodeRect:G,activatorEvent:R,collisions:me,containerNodeRect:K,dragOverlay:J,draggableNodes:C,droppableContainers:_,droppableRects:z,over:ge,measureDroppableContainers:B,scrollableAncestors:oe,scrollableAncestorRects:ie,measuringConfiguration:F,measuringScheduled:H,windowRect:ae})),[D,Y,G,R,me,K,J,C,_,z,ge,B,oe,ie,F,H,ae]),je=(0,o.useMemo)((()=>({activatorEvent:R,activators:xe,active:D,activeNodeRect:G,ariaDescribedById:{draggable:$},dispatch:y,draggableNodes:C,over:ge,measureDroppableContainers:B})),[R,xe,D,G,y,$,C,ge,B]);return i().createElement(lr.Provider,{value:x},i().createElement(Aa.Provider,{value:je},i().createElement(Ta.Provider,{value:Pe},i().createElement(Wa.Provider,{value:be},d)),i().createElement(La,{disabled:!1===(null==c?void 0:c.restoreFocus)})),i().createElement(dr,{...c,hiddenTextDescribedById:$}))})),Ba=(0,o.createContext)(null),Ha="button",Ya="Droppable";function Va(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const i=Xn(Ya),{activators:s,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,o.useContext)(Aa),{role:m=Ha,roleDescription:h="draggable",tabIndex:g=0}=null!=a?a:{},v=(null==c?void 0:c.id)===t,b=(0,o.useContext)(v?Wa:Ba),[y,w]=Un(),[x,P]=Un(),j=function(e,t){return(0,o.useMemo)((()=>e.reduce(((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e}),{})),[e,t])}(s,t),k=Vn(n);Hn((()=>(f.set(t,{id:t,key:i,node:y,activatorNode:x,data:k}),()=>{const e=f.get(t);e&&e.key===i&&f.delete(t)})),[f,t]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:(0,o.useMemo)((()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":!(!v||m!==Ha)||void 0,"aria-roledescription":h,"aria-describedby":d.draggable})),[r,m,g,v,h,d.draggable]),isDragging:v,listeners:r?void 0:j,node:y,over:p,setNodeRef:w,setActivatorNodeRef:P,transform:b}}function qa(){return(0,o.useContext)(Ta)}const Ua="Droppable",Ga={timeout:25};function Ka(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const i=Xn(Ua),{active:s,dispatch:l,over:c,measureDroppableContainers:u}=(0,o.useContext)(Aa),d=(0,o.useRef)({disabled:n}),f=(0,o.useRef)(!1),p=(0,o.useRef)(null),m=(0,o.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Ga,...a},b=Vn(null!=g?g:r),y=ya({callback:(0,o.useCallback)((()=>{f.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null}),v)):f.current=!0}),[v]),disabled:h||!s}),w=(0,o.useCallback)(((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))}),[y]),[x,P]=Un(w),j=Vn(t);return(0,o.useEffect)((()=>{y&&x.current&&(y.disconnect(),f.current=!1,y.observe(x.current))}),[x,y]),Hn((()=>(l({type:fr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:x,rect:p,data:j}}),()=>l({type:fr.UnregisterDroppable,key:i,id:r}))),[r]),(0,o.useEffect)((()=>{n!==d.current.disabled&&(l({type:fr.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)}),[r,i,n,l]),{active:s,rect:p,isOver:(null==c?void 0:c.id)===r,node:x,over:c,setNodeRef:P}}function Xa(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Qa(e,t){return e.reduce(((e,n,r)=>{const a=t.get(n);return a&&(e[r]=a),e}),Array(e.length))}function Ja(e){return null!==e&&e>=0}const Za=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=Xa(t,r,n),i=t[a],s=o[a];return s&&i?{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}:null};const eo="Sortable",to=i().createContext({activeIndex:-1,containerId:eo,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Za,disabled:{draggable:!1,droppable:!1}});function no(e){let{children:t,id:n,items:r,strategy:a=Za,disabled:s=!1}=e;const{active:l,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:f}=qa(),p=Xn(eo,n),m=Boolean(null!==c.rect),h=(0,o.useMemo)((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),g=null!=l,v=l?h.indexOf(l.id):-1,b=d?h.indexOf(d.id):-1,y=(0,o.useRef)(h),w=!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}(h,y.current),x=-1!==b&&-1===v||w,P=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);Hn((()=>{w&&g&&f(h)}),[w,h,g,f]),(0,o.useEffect)((()=>{y.current=h}),[h]);const j=(0,o.useMemo)((()=>({activeIndex:v,containerId:p,disabled:P,disableTransforms:x,items:h,overIndex:b,useDragOverlay:m,sortedRects:Qa(h,u),strategy:a})),[v,p,P.draggable,P.droppable,x,h,b,u,m,a]);return i().createElement(to.Provider,{value:j},t)}const ro=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return Xa(n,r,a).indexOf(t)},ao=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:i,previousItems:s,previousContainerId:l,transition:c}=e;return!(!c||!r)&&((s===o||a!==i)&&(!!n||i!==a&&t===l))},oo={duration:200,easing:"ease"},io="transform",so=nr.Transition.toString({property:io,duration:0,easing:"linear"}),lo={roleDescription:"sortable"};function co(e){let{animateLayoutChanges:t=ao,attributes:n,disabled:r,data:a,getNewIndex:i=ro,id:s,strategy:l,resizeObserverConfig:c,transition:u=oo}=e;const{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:b,strategy:y}=(0,o.useContext)(to),w=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,m),x=d.indexOf(s),P=(0,o.useMemo)((()=>({sortable:{containerId:f,index:x,items:d},...a})),[f,a,x,d]),j=(0,o.useMemo)((()=>d.slice(d.indexOf(s))),[d,s]),{rect:k,node:S,isOver:C,setNodeRef:M}=Ka({id:s,data:P,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:_,activatorEvent:O,activeNodeRect:E,attributes:D,setNodeRef:N,listeners:A,isDragging:T,over:R,setActivatorNodeRef:I,transform:L}=Va({id:s,data:P,attributes:{...lo,...n},disabled:w.draggable}),$=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.useMemo)((()=>e=>{t.forEach((t=>t(e)))}),t)}(M,N),W=Boolean(_),F=W&&!h&&Ja(p)&&Ja(v),z=!b&&T,B=z&&F?L:null,H=F?null!=B?B:(null!=l?l:y)({rects:g,activeNodeRect:E,activeIndex:p,overIndex:v,index:x}):null,Y=Ja(p)&&Ja(v)?i({id:s,items:d,activeIndex:p,overIndex:v}):x,V=null==_?void 0:_.id,q=(0,o.useRef)({activeId:V,items:d,newIndex:Y,containerId:f}),U=d!==q.current.items,G=t({active:_,containerId:f,isDragging:T,isSorting:W,id:s,index:x,items:d,newIndex:q.current.newIndex,previousItems:q.current.items,previousContainerId:q.current.containerId,transition:u,wasDragging:null!=q.current.activeId}),K=function(e){let{disabled:t,index:n,node:r,rect:a}=e;const[i,s]=(0,o.useState)(null),l=(0,o.useRef)(n);return Hn((()=>{if(!t&&n!==l.current&&r.current){const e=a.current;if(e){const t=Er(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==l.current&&(l.current=n)}),[t,n,r,a]),(0,o.useEffect)((()=>{i&&s(null)}),[i]),i}({disabled:!G,index:x,node:S,rect:k});return(0,o.useEffect)((()=>{W&&q.current.newIndex!==Y&&(q.current.newIndex=Y),f!==q.current.containerId&&(q.current.containerId=f),d!==q.current.items&&(q.current.items=d)}),[W,Y,f,d]),(0,o.useEffect)((()=>{if(V===q.current.activeId)return;if(V&&!q.current.activeId)return void(q.current.activeId=V);const e=setTimeout((()=>{q.current.activeId=V}),50);return()=>clearTimeout(e)}),[V]),{active:_,activeIndex:p,attributes:D,data:P,rect:k,index:x,newIndex:Y,items:d,isOver:C,isSorting:W,isDragging:T,listeners:A,node:S,overIndex:v,over:R,setNodeRef:$,setActivatorNodeRef:I,setDroppableNodeRef:M,setDraggableNodeRef:N,transform:null!=K?K:H,transition:function(){if(K||U&&q.current.newIndex===x)return so;if(z&&!er(O)||!u)return;if(W||G)return nr.Transition.toString({...u,property:io});return}()}}function uo(e){if(!e)return!1;const 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)}const fo=[Qr.Down,Qr.Right,Qr.Up,Qr.Left],po=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:o,over:i,scrollableAncestors:s}}=t;if(fo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];o.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const o=a.get(n.id);if(o)switch(e.code){case Qr.Down:r.top<o.top&&t.push(n);break;case Qr.Up:r.top>o.top&&t.push(n);break;case Qr.Left:r.left>o.left&&t.push(n);break;case Qr.Right:r.left<o.left&&t.push(n)}}));const l=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=yr(t),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=yr(r),i=a.reduce(((e,t,r)=>e+gr(n[r],t)),0),s=Number((i/4).toFixed(4));o.push({id:t,data:{droppableContainer:e,value:s}})}}return o.sort(vr)})({active:n,collisionRect:r,droppableRects:a,droppableContainers:t,pointerCoordinates:null});let c=wr(l,"id");if(c===(null==i?void 0:i.id)&&l.length>1&&(c=l[1].id),null!=c){const e=o.get(n.id),t=o.get(c),i=t?a.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&i&&e&&t){const n=Nr(l).some(((e,t)=>s[t]!==e)),a=mo(e,t),o=function(e,t){if(!uo(e)||!uo(t))return!1;if(!mo(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!a?{x:0,y:0}:{x:o?r.width-i.width:0,y:o?r.height-i.height:0},u={x:i.left,y:i.top};return c.x&&c.y?u:Zn(u,c)}}}};function mo(e,t){return!(!uo(e)||!uo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const ho=e=>{const{id:t,disabled:n}=e,{attributes:r,isDragging:a,listeners:o,setNodeRef:i,transform:s}=co({id:t,disabled:n});return{attributes:{...r,style:{cursor:a?"grabbing":"grab"}},isDragging:a,listeners:o,setNodeRef:i,transform:s&&`translate3d(${s.x}px, ${s.y}px, 0)`}},go=e=>{const{id:n,children:r,disabled:a}=e,{attributes:i,isDragging:s,listeners:l,setNodeRef:c,transform:u}=ho({id:n,disabled:a});return(0,t.jsx)(o.Fragment,{children:r({attributes:{...i,style:{cursor:s?"grabbing":"grab"}},listeners:l,setNodeRef:c,transform:u})})},vo=e=>{const{children:n,className:r,ids:a,onDragEnd:i}=e,s=(0,o.useId)(),{setNodeRef:l}=Ka({id:s}),c=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.useMemo)((()=>[...t].filter((e=>null!=e))),[...t])}(mr(sa,{activationConstraint:{distance:5}}),mr(na,{coordinateGetter:po})),u=(0,o.useCallback)((e=>{const{active:t,over:n}=e;t&&n&&"function"==typeof i&&i({event:e,moveFromIndex:a.findIndex((e=>e===t.id)),moveToIndex:a.findIndex((e=>e===n.id))})}),[i,a]);return(0,t.jsx)(za,{collisionDetection:Pr,id:s,onDragEnd:u,sensors:c,children:(0,t.jsx)(no,{items:a,children:(0,t.jsx)("div",{className:r,ref:l,children:n})})})},bo="error-pill",yo=e=>{const{className:n,count:r,i18n:a,withMessage:o}=e,i=[bo,!o&&r<99&&`${bo}--fixed-width`,n&&n].filter(Boolean).join(" ");return 0===r?null:(0,t.jsx)("div",{className:i,children:(0,t.jsxs)("div",{className:`${bo}__content`,children:[(0,t.jsx)("span",{className:`${bo}__count`,children:r}),o&&` ${r>1?a.t("general:errors"):a.t("general:error")}`]})})},wo=i().createContext({type:void 0,custom:{},indexPath:void 0,path:void 0,permissions:{},readOnly:!1,schemaPath:void 0,siblingPermissions:{}}),xo=({type:e,children:n,custom:r,indexPath:a,path:o,permissions:i,readOnly:s,schemaPath:l,siblingPermissions:c})=>(0,t.jsx)(wo.Provider,{value:{type:e,custom:r,indexPath:a,path:o,permissions:i,readOnly:s,schemaPath:l,siblingPermissions:c},children:n}),Po=()=>i().useContext(wo);var jo=n(61060);const ko=Symbol(),So=Symbol(),Co="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?o.useEffect:o.useLayoutEffect,Mo=jo.unstable_runWithPriority?e=>{try{(0,jo.unstable_runWithPriority)(jo.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e(),_o=e=>e;function Oo(e,t){const n=(0,o.useContext)(e)[ko];const{v:{current:r},n:{current:a},l:i}=n,s=t(r),[l,c]=(0,o.useReducer)(((e,n)=>{if(!n)return[r,s];if("p"in n)throw n.p;if(n.n===a)return Object.is(e[1],s)?e:[r,s];try{if("v"in n){if(Object.is(e[0],n.v))return e;const r=t(n.v);return Object.is(e[1],r)?e:[n.v,r]}}catch(e){}return[...e]}),[r,s]);return Object.is(l[1],s)||c(),Co((()=>(i.add(c),()=>{i.delete(c)})),[i]),l[1]}const Eo=(0,o.createContext)({}),Do=(0,o.createContext)({}),No=(0,o.createContext)(!1),Ao=(0,o.createContext)(!1),To=(0,o.createContext)(!1),Ro=(0,o.createContext)(!1),Io=function(e){const t=(0,o.createContext)({[ko]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[So]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=(0,o.useRef)(e),a=(0,o.useRef)(0),[i,s]=(0,o.useState)(null);i&&(i(e),s(null));const l=(0,o.useRef)();if(!l.current){const e=new Set,t=(t,n)=>{a.current+=1;const r={n:a.current};(null==n?void 0:n.suspense)&&(r.n*=-1,r.p=new Promise((e=>{s((()=>t=>{r.v=t,delete r.p,e(t)}))}))),e.forEach((e=>e(r))),t()};l.current={[ko]:{v:r,n:a,l:e,u:t}}}return Co((()=>{r.current=e,a.current+=1,Mo((()=>{l.current[ko].l.forEach((t=>{t({n:a.current,v:e})}))}))}),[e]),(0,o.createElement)(n,{value:l.current},t)}),delete t.Consumer,t}([{},()=>null]),Lo=()=>(0,o.useContext)(Eo),$o=()=>(0,o.useContext)(No),Wo=()=>(0,o.useContext)(Ao),Fo=()=>(0,o.useContext)(To),zo=()=>(0,o.useContext)(Ro),Bo=e=>Oo(Io,e),Ho=()=>function(e){return Oo(e,_o)}(Io),Yo=(e,t,n=[])=>{const r=(0,o.useRef)(Date.now());(0,o.useEffect)((()=>{const n=setTimeout((()=>{Date.now()-r.current>=t&&(e(),r.current=Date.now())}),t-(Date.now()-r.current));return()=>{clearTimeout(n)}}),[t,...n])};var Vo=n(69441),qo=n(10719);Math.pow(10,8);const Uo=6048e5,Go=864e5,Ko=43200,Xo=1440;var Qo=n(3002);function Jo(e){const t=(0,Qo.a)(e);return t.setHours(0,0,0,0),t}function Zo(e){const t=(0,Qo.a)(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 ei(e,t){const n=Jo(e),r=Jo(t),a=+n-Zo(n),o=+r-Zo(r);return Math.round((a-o)/Go)}function ti(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function ni(e){const t=(0,Qo.a)(e),n=ti(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ri(e){const t=(0,Qo.a)(e);return ei(t,ni(t))+1}var ai=n(88632);function oi(e){return(0,ai.k)(e,{weekStartsOn:1})}function ii(e){const t=(0,Qo.a)(e),n=t.getFullYear(),r=ti(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=oi(r),o=ti(e,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const i=oi(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function si(e){const t=ii(e),n=ti(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),oi(n)}function li(e){const t=(0,Qo.a)(e),n=+oi(t)-+si(t);return Math.round(n/Uo)+1}function ci(e,t){const n=(0,Qo.a)(e),r=n.getFullYear(),a=(0,qo.q)(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=ti(e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const s=(0,ai.k)(i,t),l=ti(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=(0,ai.k)(l,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function ui(e,t){const n=(0,qo.q)(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=ci(e,t),o=ti(e,0);o.setFullYear(a,0,r),o.setHours(0,0,0,0);return(0,ai.k)(o,t)}function di(e,t){const n=(0,Qo.a)(e),r=+(0,ai.k)(n,t)-+ui(n,t);return Math.round(r/Uo)+1}function fi(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const pi={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return fi("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):fi(n+1,2)},d:(e,t)=>fi(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>fi(e.getHours()%12||12,t.length),H:(e,t)=>fi(e.getHours(),t.length),m:(e,t)=>fi(e.getMinutes(),t.length),s:(e,t)=>fi(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return fi(Math.trunc(r*Math.pow(10,n-3)),t.length)}},mi="midnight",hi="noon",gi="morning",vi="afternoon",bi="evening",yi="night",wi={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:"year"})}return pi.y(e,t)},Y:function(e,t,n,r){const a=ci(e,r),o=a>0?a:1-a;if("YY"===t){return fi(o%100,2)}return"Yo"===t?n.ordinalNumber(o,{unit:"year"}):fi(o,t.length)},R:function(e,t){return fi(ii(e),t.length)},u:function(e,t){return fi(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return fi(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return fi(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return pi.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return fi(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=di(e,r);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):fi(a,t.length)},I:function(e,t,n){const r=li(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):fi(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):pi.d(e,t)},D:function(e,t,n){const r=ri(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):fi(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return fi(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,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return fi(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){const r=e.getDay(),a=0===r?7:r;switch(t){case"i":return String(a);case"ii":return fi(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(a=12===r?hi:0===r?mi:r/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){const r=e.getHours();let a;switch(a=r>=17?bi:r>=12?vi:r>=4?gi:yi,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 pi.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):pi.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):fi(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):fi(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):pi.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):pi.s(e,t)},S:function(e,t){return pi.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Pi(r);case"XXXX":case"XX":return ji(r);default:return ji(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Pi(r);case"xxxx":case"xx":return ji(r);default:return ji(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+xi(r,":");default:return"GMT"+ji(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+xi(r,":");default:return"GMT"+ji(r,":")}},t:function(e,t,n){return fi(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return fi(e.getTime(),t.length)}};function xi(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return 0===o?n+String(a):n+String(a)+t+fi(o,2)}function Pi(e,t){if(e%60==0){return(e>0?"-":"+")+fi(Math.abs(e)/60,2)}return ji(e,t)}function ji(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+fi(Math.trunc(r/60),2)+t+fi(r%60,2)}const ki=(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"})}},Si=(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"})}},Ci={p:Si,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return ki(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"})}return o.replace("{{date}}",ki(r,t)).replace("{{time}}",Si(a,t))}},Mi=/^D+$/,_i=/^Y+$/,Oi=["D","DD","YY","YYYY"];function Ei(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function Di(e){if(!Ei(e)&&"number"!=typeof e)return!1;const t=(0,Qo.a)(e);return!isNaN(Number(t))}const Ni=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ai=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ti=/^'([^]*?)'?$/,Ri=/''/g,Ii=/[a-zA-Z]/;function Li(e,t,n){const r=(0,qo.q)(),a=n?.locale??r.locale??Vo.enUS,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=(0,Qo.a)(e);if(!Di(s))throw new RangeError("Invalid time value");let l=t.match(Ai).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ci[t])(e,a.formatLong)}return e})).join("").match(Ni).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:$i(e)};if(wi[t])return{isToken:!0,value:e};if(t.match(Ii))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));a.localize.preprocessor&&(l=a.localize.preprocessor(s,l));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return l.map((r=>{if(!r.isToken)return r.value;const o=r.value;(!n?.useAdditionalWeekYearTokens&&function(e){return _i.test(e)}(o)||!n?.useAdditionalDayOfYearTokens&&function(e){return Mi.test(e)}(o))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(r),Oi.includes(e))throw new RangeError(r)}(o,t,String(e));return(0,wi[o[0]])(s,o,a.localize,c)})).join("")}function $i(e){const t=e.match(Ti);return t?t[1].replace(Ri,"'"):e}function Wi(e,t){const n=(0,Qo.a)(e),r=(0,Qo.a)(t),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function Fi(e,t){const n=(0,Qo.a)(e),r=(0,Qo.a)(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function zi(e){const t=(0,Qo.a)(e);return t.setHours(23,59,59,999),t}function Bi(e){const t=(0,Qo.a)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Hi(e){const t=(0,Qo.a)(e);return+zi(t)==+Bi(t)}function Yi(e,t){const n=(0,Qo.a)(e),r=(0,Qo.a)(t),a=Wi(n,r),o=Math.abs(Fi(n,r));let i;if(o<1)i=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*o);let t=Wi(n,r)===-a;Hi((0,Qo.a)(e))&&1===o&&1===Wi(e,r)&&(t=!1),i=a*(o-Number(t))}return 0===i?0:i}function Vi(e,t){return+(0,Qo.a)(e)-+(0,Qo.a)(t)}function qi(e,t,n){const r=Vi(e,t)/1e3;return(a=n?.roundingMethod,e=>{const t=(a?Math[a]:Math.trunc)(e);return 0===t?0:t})(r);var a}function Ui(e,t,n){const r=(0,qo.q)(),a=n?.locale??r.locale??Vo.enUS,o=Wi(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:o});let s,l;o>0?(s=(0,Qo.a)(t),l=(0,Qo.a)(e)):(s=(0,Qo.a)(e),l=(0,Qo.a)(t));const c=qi(l,s),u=(Zo(l)-Zo(s))/1e3,d=Math.round((c-u)/60);let f;if(d<2)return n?.includeSeconds?c<5?a.formatDistance("lessThanXSeconds",5,i):c<10?a.formatDistance("lessThanXSeconds",10,i):c<20?a.formatDistance("lessThanXSeconds",20,i):c<40?a.formatDistance("halfAMinute",0,i):c<60?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",1,i):0===d?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",d,i);if(d<45)return a.formatDistance("xMinutes",d,i);if(d<90)return a.formatDistance("aboutXHours",1,i);if(d<Xo){const e=Math.round(d/60);return a.formatDistance("aboutXHours",e,i)}if(d<2520)return a.formatDistance("xDays",1,i);if(d<Ko){const e=Math.round(d/Xo);return a.formatDistance("xDays",e,i)}if(d<2*Ko)return f=Math.round(d/Ko),a.formatDistance("aboutXMonths",f,i);if(f=Yi(l,s),f<12){const e=Math.round(d/Ko);return a.formatDistance("xMonths",e,i)}{const e=f%12,t=Math.trunc(f/12);return e<3?a.formatDistance("aboutXYears",t,i):e<9?a.formatDistance("overXYears",t,i):a.formatDistance("almostXYears",t+1,i)}}function Gi(e,t){return Ui(e,Date.now(),t)}const Ki=({date:e,i18n:t,pattern:n})=>Li(new Date(e),n,{locale:t.dateFNS}),Xi=({date:e,i18n:t})=>Gi(new Date(e),{locale:t.dateFNS}),Qi=({collectionConfig:e,data:t,dateFormat:n,fallback:r,globalConfig:o,i18n:i})=>{let s;if(e){const r=e?.admin?.useAsTitle;if(r&&(s=t?.[r]||s,s)){const t=e.fields.find((e=>"name"in e&&e.name===r));if("date"===t?.type){const e="date"in t.admin&&t?.admin?.date?.displayFormat||n;s=Ki({date:s,i18n:i,pattern:e})||s}}}return o&&(s=(0,a.sC)(o?.label,i)||o?.slug),s||(s=r||`[${i.t("general:untitled")}]`),s},Ji=async e=>{const{apiRoute:t,body:n,onError:r,serverURL:a,signal:o,token:i}=e,s=await fetch(`${a}${t}/form-state`,{body:JSON.stringify(n),credentials:"include",headers:{"Content-Type":"application/json",...i?{Authorization:`JWT ${i}`}:{}},method:"POST",signal:o}),l=await s.json();return s.ok?l:("function"==typeof r&&r(l),n?.formState)},Zi=e=>{const{collectionSlug:t,docPermissions:n,globalSlug:r,isEditing:a}=e;return t?Boolean(a&&n?.update?.permission||!a&&n?.create?.permission):!!r&&Boolean(n?.update?.permission)},es=({id:e,collectionSlug:t,globalSlug:n})=>Boolean(n||t&&!!e);var ts=n(80437),ns=n.n(ts);const rs=(e,t)=>{const n=(t=t||{}).delimiter||".",r=t.overwrite||!1,a=t.recursive||!1,o={};if(ns()(e)||"[object Object]"!==Object.prototype.toString.call(e))return e;const i=e=>{const n=Number(e);return isNaN(n)||-1!==e.indexOf(".")||t.object?e:n};return Object.keys(e).sort(((e,t)=>e.length-t.length)).forEach((s=>{const l=s.split(n);let c=i(l.shift()),u=i(l[0]),d=o;for(;void 0!==u;){if("__proto__"===c)return;const e=Object.prototype.toString.call(d[c]),n="[object Object]"===e||"[object Array]"===e;if(!r&&!n&&void 0!==d[c])return;(r&&!n||!r&&null==d[c])&&(d[c]="number"!=typeof u||t.object?{}:[]),d=d[c],l.length>0&&(c=i(l.shift()),u=i(l[0]))}d[c]=a?rs(e[s],t):e[s]})),o},as=(e,t,n)=>{let r={};return e?(Object.keys(e).forEach((t=>{!0!==n&&e[t]?.disableFormData||(r[t]=e[t]?.value)})),t&&(r=rs(r)),r):r},os=(e,t)=>e?.locales&&0!==e.locales.length?e.locales.find((e=>e?.code===t)):null,is=(0,o.createContext)({}),ss=({children:e})=>{const{localization:n}=Ut(),{user:r}=sn(),a=n&&n.defaultLocale?n.defaultLocale:"en",{searchParams:s}=nn(),l=s?.locale,[c,u]=(0,o.useState)(l||a),[d,f]=(0,o.useState)(n&&os(n,c)),{getPreference:p,setPreference:m}=dn(),h=i().useCallback((async e=>{if(!n)return;const t=n.localeCodes.indexOf(e)>-1?e:a;if(t!==c){u(t),f(os(n,t));try{r&&await m("locale",t)}catch(e){}}}),[n,m,r,a,c]);return(0,o.useEffect)((()=>{!async function(){let e=a;if("string"==typeof l)e=l;else if(r)try{e=await p("locale")}catch(e){}await h(e)}()}),[a,p,n,l,m,r,h]),(0,t.jsx)(is.Provider,{value:d,children:e})},ls=()=>(0,o.useContext)(is),cs=(0,o.createContext)({}),us=()=>(0,o.useContext)(cs),ds=({children:e,...n})=>{const{id:r,collectionSlug:a,docPermissions:s,globalSlug:l,hasPublishPermission:c,hasSavePermission:u,initialData:d,initialState:f,onLoadError:p,onSave:m}=n,{admin:{dateFormat:h},collections:g,globals:v,routes:{api:b},serverURL:y}=Ut(),w=g.find((e=>e.slug===a)),x=v.find((e=>e.slug===l)),P=w||x,{i18n:j}=(0,Be.B)(),[k,S]=(0,o.useState)((()=>d?Qi({collectionConfig:w,data:{...d,id:r},dateFormat:h,fallback:r?.toString(),globalConfig:x,i18n:j}):"")),[C,M]=(0,o.useState)(!1),[_,O]=(0,o.useState)(!1),[E,D]=(0,o.useState)(d),[N,A]=(0,o.useState)(f),[T,R]=(0,o.useState)(null),[I,L]=(0,o.useState)(null),[$,W]=(0,o.useState)(s),[F,z]=(0,o.useState)(u),[B,H]=(0,o.useState)(c),Y=void 0===N||void 0===E,V=(0,o.useRef)(!1),[q,U]=(0,o.useState)(null),{getPreference:G,setPreference:K}=dn(),{permissions:X}=sn(),{code:Q}=ls(),J=(0,o.useRef)(Q),Z=P?.versions,ee=`${y}${b}`;let te,ne;l&&(te=l,ne=`global-${te}`),a&&(te=a,r&&(ne=`collection-${te}-${r}`));const re=es({id:r,collectionSlug:a,globalSlug:l})?"update":"create",ae=Boolean(Z&&$?.readVersions?.permission),oe=(0,o.useCallback)((async()=>{let e,t,n=null,o=null,i=!0;const s={depth:0,where:{and:[]}},c={depth:0,locale:Q||void 0,where:{and:[{or:[{_status:{equals:"published"}},{_status:{exists:!1}}]}]}};if(l&&(e=`${ee}/globals/${l}/versions`,t=`${ee}/globals/${l}?${ge().stringify(c)}`),a&&(e=`${ee}/${a}/versions`,c.where.and.push({id:{equals:r}}),t=`${ee}/${a}?${ge().stringify(c)}`,r||(i=!1),s.where.and.push({parent:{equals:r}})),i){let r;if(Z?.drafts&&(r=await fetch(t,{credentials:"include",headers:{"Accept-Language":j.language}}).then((e=>e.json())),a&&(r=r?.docs?.[0])),ae&&(o=await fetch(`${e}?${ge().stringify(s)}`,{credentials:"include",headers:{"Accept-Language":j.language}}).then((e=>e.json())),r?.updatedAt)){const t={...s,where:{...s.where,and:[...s.where.and,{updatedAt:{greater_than:r?.updatedAt}}]}},a=await fetch(`${e}?${ge().stringify(t)}`,{credentials:"include",headers:{"Accept-Language":j.language}});200===a.status&&(n=await a.json())}R(r),L(o),U(n)}}),[j,l,a,r,ee,Q,Z,ae]),ie=i().useCallback((async e=>{const t={locale:Q||void 0},n=es({id:e?.id,collectionSlug:a,globalSlug:l});if(n){const r=a?`/${a}/access/${e.id}`:l?`/globals/${l}/access`:null;if(r){const o=await fetch(`${y}${b}${r}?${ge().stringify(t)}`,{credentials:"include",headers:{"Accept-Language":j.language}}),i=await o.json(),s=await fetch(`${y}${b}${r}?${ge().stringify(t)}`,{body:JSON.stringify({data:{...e||{},_status:"published"}}),credentials:"include",headers:{"Accept-Language":j.language},method:"POST"}).then((e=>e.json()));W(i),z(Zi({collectionSlug:a,docPermissions:i,globalSlug:l,isEditing:n})),H(s?.update?.permission)}}else{const e=a?X?.collections?.[a]:X?.globals?.[l];W(e),z(Zi({collectionSlug:a,docPermissions:e,globalSlug:l,isEditing:n}))}}),[y,b,X,j.language,Q,a,l]),se=(0,o.useCallback)((()=>G(ne)),[G,ne]),le=(0,o.useCallback)((async(e,t)=>{const n=await se();if(ne)try{await K(ne,{...n,fields:{...n?.fields||{},[e]:{...n?.fields?.[e],...t}}})}catch(e){console.error(e)}}),[K,ne,se]),ce=i().useCallback((async e=>{"function"==typeof m&&m(e);const t=await se(),n=a?e.doc:e.result,o=await Ji({apiRoute:b,body:{id:r,collectionSlug:a,data:n,docPreferences:t,globalSlug:l,locale:Q,operation:re,schemaPath:a||l},serverURL:y});A(o),D(n),await ie(n)}),[b,a,se,l,r,re,Q,m,y,ie]);(0,o.useEffect)((()=>{const e=new AbortController,t=Q!==J.current;if(void 0===f||void 0===d||t){t&&(J.current=Q);(async()=>{O(!1),M(!0);try{const t=await Ji({apiRoute:b,body:{id:r,collectionSlug:a,globalSlug:l,locale:Q,operation:re,schemaPath:a||l},onError:p,serverURL:y,signal:e.signal});D(as(t,!0)),A(t)}catch(t){e.signal.aborted||("function"==typeof p&&p(),O(!0),M(!1))}M(!1)})()}return()=>{e.abort()}}),[b,re,a,y,r,l,Q,p,d,f]),(0,o.useEffect)((()=>{oe()}),[oe]),(0,o.useEffect)((()=>{S(Qi({collectionConfig:w,data:{...E,id:r},dateFormat:h,fallback:r?.toString(),globalConfig:x,i18n:j}))}),[w,E,h,j,r,x]),(0,o.useEffect)((()=>{!V.current&&E&&(a||l)&&(V.current=!0,(async()=>{const e=u,t=c;s&&null!=e&&null!=t||await ie(E)})())}),[ie,s,u,c,W,a,l,E]),_&&(0,ht.notFound)();const ue={...n,docConfig:P,docPermissions:$,getDocPermissions:ie,getDocPreferences:se,getVersions:oe,hasPublishPermission:B,hasSavePermission:F,initialData:E,initialState:N,isInitializing:Y,isLoading:C,onSave:ce,publishedDoc:T,setDocFieldPreferences:le,setDocumentTitle:S,title:k,unpublishedVersions:q,versions:I};return(0,t.jsx)(cs.Provider,{value:ue,children:e})},fs=(0,o.createContext)(""),ps=({children:e,operation:n})=>(0,t.jsx)(fs.Provider,{value:n,children:e}),ms=()=>(0,o.useContext)(fs),hs=e=>{const{disableFormData:t=!1,hasRows:n,validate:r}=e,{path:a,permissions:i,readOnly:s,schemaPath:l}=Po(),c=e.path||a,u=$o(),d=Wo(),f=zo(),{user:p}=sn(),{id:m}=us(),h=ms(),{dispatchField:g,field:v}=Bo((([e,t])=>({dispatchField:t,field:e&&e?.[c]||null}))),{t:b}=(0,Be.B)(),y=Ut(),{getData:w,getDataByPath:x,getSiblingData:P,setModified:j}=Lo(),k=Fo(),S=v?.filterOptions,C=v?.value,M=v?.initialValue,_="boolean"!=typeof v?.valid||v.valid,O=!1===_&&u,E=(0,o.useRef)(_),D=(0,o.useRef)(v?.errorMessage),N=(0,o.useCallback)(((e,r=!1)=>{const a=e&&e.target?e.target.value:e;g({type:"UPDATE",disableFormData:t||n&&a>0,path:c,value:a}),r||"function"==typeof j&&!1===k&&setTimeout((()=>{j(!0)}),10)}),[j,c,g,t,n,k]),A=(0,o.useMemo)((()=>({errorMessage:v?.errorMessage,errorPaths:v?.errorPaths||[],filterOptions:S,formInitializing:f,formProcessing:d,formSubmitted:u,initialValue:M,path:c,permissions:i,readOnly:s||!1,rows:v?.rows,schemaPath:l,setValue:N,showError:O,valid:v?.valid,value:C})),[v?.errorMessage,v?.rows,v?.valid,v?.errorPaths,d,N,O,u,C,M,c,l,s,i,S,f]);return Yo((()=>{(async()=>{let e,a=C;v?.rows&&Array.isArray(v.rows)&&(a=x(c));let o=E.current;const i="function"!=typeof r||await r(a,{id:m,config:y,data:w(),operation:h,siblingData:P(c),t:b,user:p});if("string"==typeof i?(o=!1,e=i):"boolean"==typeof i&&(o=i,e=void 0),o!==E.current||e!==D.current){E.current=o,D.current=e;const r={type:"UPDATE",errorMessage:e,path:c,rows:v?.rows,valid:o,value:C};(t||n&&("number"==typeof C&&C>0))&&(r.disableFormData=!0),"function"==typeof g&&g(r)}})()}),150,[C,t,g,w,P,x,m,h,c,p,r,v?.rows]),A},gs=e=>{const{name:n,type:r,children:a,indexPath:i,path:s}=e,l="string"==typeof s?s:n;let c=l;if(["collapsible","row"].includes(r)){const e=i.split(".").pop();c=`${l?`${l}.`:""}_index-${e}`}const u=Bo((([e])=>e&&e?.[c]||null)),{passesCondition:d}=u||{};return!1===d?null:(0,t.jsx)(o.Fragment,{children:a})},vs=e=>n=>{const{name:r}=n,{type:a,indexPath:o,path:i}=Po(),s=i??r;return(0,t.jsx)(gs,{indexPath:o,name:r,path:s,type:a,children:(0,t.jsx)(e,{...n})})},bs=(0,o.createContext)(0),ys=({children:e,depth:n})=>(0,t.jsx)(bs.Provider,{value:n,children:e}),ws=()=>(0,o.useContext)(bs),xs=(e,t,n)=>`field-${e?.replace(/\./g,"__")}${t>1?`-${t}`:""}${n?`-${n}`:""}`,Ps="field-description",js=e=>{const{className:n,description:r,marginPlacement:o}=e,{path:i}=Po(),{i18n:s}=(0,Be.B)();return r?(0,t.jsx)("div",{className:[Ps,n,`field-description-${i.replace(/\./g,"__")}`,o&&`${Ps}--margin-${o}`].filter(Boolean).join(" "),children:(0,a.sC)(r,s)}):null},ks=e=>{const{CustomDescription:n}=e;return void 0!==n?n:(0,t.jsx)(js,{...e})},Ss=e=>{const{alignCaret:n="right",message:r,path:a,showError:o}=e,{path:i}=Po(),s=i??a,l=$o(),c=Bo((([e])=>e&&e?.[s]||null)),{errorMessage:u,valid:d}=c||{},f=r||u;return(o||l&&!1===d)&&f?.length?(0,t.jsx)(Ft,{alignCaret:n,className:"field-error",delay:0,staticPositioning:!0,children:f}):null},Cs=e=>{const{CustomError:n}=e;return void 0!==n?n:(0,t.jsx)(Ss,{...e})},Ms="field-type";function _s({fieldLocalized:e,fieldRTL:t,locale:n,localizationConfig:r}){const a=n&&r&&r.locales&&r.locales.length>1,o=n?.code===r?.defaultLocale;return!1!==t&&!0===n?.rtl&&(e||!e&&!a||!e&&o)||!0===t}const Os=()=>(0,t.jsxs)("svg",{className:"icon icon--check",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{className:"stroke",d:"M10.6092 16.0192L17.6477 8.98076",strokeLinecap:"square",strokeLinejoin:"bevel"}),(0,t.jsx)("path",{className:"stroke",d:"M7.35229 12.7623L10.6092 16.0192",strokeLinecap:"square",strokeLinejoin:"bevel"})]}),Es=()=>(0,t.jsx)("svg",{className:"icon icon--line",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("line",{className:"stroke",x1:"8.05164",x2:"16.468",y1:"12.594",y2:"12.594"})}),Ds=e=>{const{as:n="label",htmlFor:r,label:o,required:i=!1,unstyled:s=!1}=e,{uuid:l}=Lo(),{path:c}=Po(),u=ws(),d=r||xs(c,u,l),{i18n:f}=(0,Be.B)();return o?(0,t.jsxs)(n,{className:"field-label "+(s?"unstyled":""),htmlFor:d,children:[(0,a.sC)(o,f),i&&!s&&(0,t.jsx)("span",{className:"required",children:"*"})]}):null},Ns=e=>{const{CustomLabel:n}=e;return void 0!==n?n:(0,t.jsx)(Ds,{...e})},As="checkbox-input",Ts=({id:e,name:n,AfterInput:r,BeforeInput:a,CustomLabel:o,checked:i,className:s,inputRef:l,label:c,labelProps:u,onToggle:d,partialChecked:f,readOnly:p,required:m})=>(0,t.jsxs)("div",{className:[s,As,i&&`${As}--checked`,p&&`${As}--read-only`].filter(Boolean).join(" "),children:[(0,t.jsxs)("div",{className:`${As}__input`,children:[a,(0,t.jsx)("input",{"aria-label":"",defaultChecked:Boolean(i),disabled:p,id:e,name:n,onInput:d,ref:l,required:m,type:"checkbox"}),(0,t.jsxs)("span",{className:[`${As}__icon`,!i&&f?"check":"partial"].filter(Boolean).join(" "),children:[i&&(0,t.jsx)(Os,{}),!i&&f&&(0,t.jsx)(Es,{})]}),r]}),(0,t.jsx)(Ns,{CustomLabel:o,htmlFor:e,label:c,required:m,...u||{}})]}),Rs="checkbox",Is=vs((e=>{const{id:n,name:r,AfterInput:a,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,checked:u,className:d,descriptionProps:f,disableFormData:p,errorProps:m,label:h,labelProps:g,onChange:v,partialChecked:b,path:y,readOnly:w,required:x,style:P,validate:j,width:k}=e,{uuid:S}=Lo(),C=ws(),M=(0,o.useCallback)(((e,t)=>{if("function"==typeof j)return j(e,{...t,required:x})}),[j,x]),{path:_,readOnly:O}=Po(),{formInitializing:E,formProcessing:D,path:N,setValue:A,showError:T,value:R}=hs({disableFormData:p,path:_??y??r,validate:M}),I=w||O||D||E,L=(0,o.useCallback)((()=>{I||(A(!R),"function"==typeof v&&v(!R))}),[v,I,A,R]),$=u||Boolean(R),W=n||xs(N,C,S);return(0,t.jsxs)("div",{className:[Ms,Rs,T&&"error",d,R&&`${Rs}--checked`,I&&`${Rs}--read-only`].filter(Boolean).join(" "),style:{...P,width:k},children:[(0,t.jsx)(Cs,{CustomError:l,path:N,...m||{}}),(0,t.jsx)(Ts,{AfterInput:a,BeforeInput:i,CustomLabel:c,checked:$,id:W,inputRef:null,label:h,labelProps:g,name:N,onToggle:L,partialChecked:b,readOnly:I,required:x}),void 0!==s?s:(0,t.jsx)(ks,{...f||{}})]})})),Ls=({fieldValue:e,localized:n,path:r})=>{const{dispatchFields:a,setModified:i}=Lo(),{code:s}=ls(),{localization:l}=Ut(),[c,u]=o.useState("number"!=typeof e),d=l&&l.defaultLocale?l.defaultLocale:"en",{t:f}=(0,Be.B)();if(!n||s===d||l&&!l.fallback)return null;if(e){let t=!1;if("number"==typeof e&&e>0&&(t=!0),Array.isArray(e)&&e.length>0&&(t=!0),t)return c&&u(!1),null}return(0,t.jsx)(Tn,{children:(0,t.jsx)(Is,{checked:c,id:`field-${r.replace(/\./g,"__")}`,label:f("general:fallbackToDefaultLocale")})})},$s=e=>{const t=document.getElementById(e);if(t){const e=t.getBoundingClientRect();window.scrollBy({behavior:"smooth",top:e.top-100})}},Ws=()=>(0,t.jsxs)("svg",{className:"icon icon--copy",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{className:"stroke",height:"8",width:"8",x:"6.5",y:"10"}),(0,t.jsx)("path",{className:"stroke",d:"M10 9.98438V6.5H18V14.5H14"})]}),Fs=({className:e})=>(0,t.jsxs)("svg",{className:["icon icon--more",e].filter(Boolean).join(" "),viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:"fill",cx:"16.3872",cy:"12.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"12.3872",cy:"12.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"8.61279",cy:"12.5",r:"1"})]}),zs="popup-button",Bs=e=>{const{active:n,button:r,buttonType:a,className:o,setActive:i}=e,s=[zs,o,`${zs}--${a}`].filter(Boolean).join(" "),l=()=>{i(!n)};return"none"===a?null:"custom"===a?(0,t.jsx)("div",{className:s,onClick:l,onKeyDown:e=>{"Enter"===e.key&&l()},role:"button",tabIndex:0,children:r}):(0,t.jsx)("button",{className:s,onClick:()=>i(!n),tabIndex:0,type:"button",children:r})},Hs="popup",Ys=e=>{const{boundingRef:n,button:r,buttonClassName:a,buttonType:i="default",caret:s=!0,children:l,className:c,forceOpen:u,horizontalAlign:d="left",initActive:f=!1,onToggleOpen:p,render:m,showOnHover:h=!1,showScrollbar:g=!1,size:v="medium",verticalAlign:b="top"}=e,{height:y,width:w}=Le(),[x,P]=Wt({root:n?.current||null,rootMargin:"-100px 0px 0px 0px",threshold:1}),j=(0,o.useRef)(null),[k,S]=(0,o.useState)(f),[C,M]=(0,o.useState)(b),[_,O]=(0,o.useState)(d),E=(0,o.useCallback)((({horizontal:e=!1,vertical:t=!1})=>{if(j.current){const r=j.current.getBoundingClientRect(),{bottom:a,left:o,right:i,top:s}=r;let l=100,c=document.documentElement.clientWidth,u=document.documentElement.clientHeight,d=0;n?.current&&({bottom:u,left:d,right:c,top:l}=n.current.getBoundingClientRect()),e&&(i>c&&o>d?O("right"):o<d&&i<c&&O("left")),t&&(s<l&&a<u?M("bottom"):a>u&&s>l&&M("top"))}}),[n]),D=(0,o.useCallback)((e=>{j.current.contains(e.target)||S(!1)}),[j]);(0,o.useEffect)((()=>{E({horizontal:!0})}),[P,E,w]),(0,o.useEffect)((()=>{E({vertical:!0})}),[P,E,y]),(0,o.useEffect)((()=>("function"==typeof p&&p(k),k?document.addEventListener("mousedown",D):document.removeEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)})),[k,D,p]),(0,o.useEffect)((()=>{S(u)}),[u]);const N=[Hs,c,`${Hs}--size-${v}`,`${Hs}--v-align-${C}`,`${Hs}--h-align-${_}`,k&&`${Hs}--active`,g&&`${Hs}--show-scrollbar`].filter(Boolean).join(" ");return(0,t.jsxs)("div",{className:N,children:[(0,t.jsx)("div",{className:`${Hs}__trigger-wrap`,children:h?(0,t.jsx)("div",{className:`${Hs}__on-hover-watch`,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:(0,t.jsx)(Bs,{active:k,button:r,buttonType:i,className:a,setActive:S})}):(0,t.jsx)(Bs,{active:k,button:r,buttonType:i,className:a,setActive:S})}),(0,t.jsxs)("div",{className:`${Hs}__content`,ref:j,children:[(0,t.jsx)("div",{className:`${Hs}__hide-scrollbar`,ref:x,children:(0,t.jsx)("div",{className:`${Hs}__scroll-container`,children:(0,t.jsxs)("div",{className:`${Hs}__scroll-content`,children:[m&&m({close:()=>S(!1)}),l&&l]})})}),s&&(0,t.jsx)("div",{className:`${Hs}__caret`})]})]})},Vs=Dn().default||Dn(),qs="popup-button-list",Us=({buttonSize:e="default",children:n,className:r,textAlign:a="left"})=>{const o=[qs,r,`${qs}__text-align--${a}`,`${qs}__button-size--${e}`].filter(Boolean).join(" ");return(0,t.jsx)("div",{className:o,children:n})},Gs=({id:e,active:n,children:r,className:a,href:o,onClick:i})=>{const s=[`${qs}__button`,n&&`${qs}__button--selected`,a].filter(Boolean).join(" ");return o?(0,t.jsx)(Vs,{className:s,href:o,id:e,onClick:()=>{i&&i()},children:r}):i?(0,t.jsx)("button",{className:s,id:e,onClick:()=>{i&&i()},type:"button",children:r}):(0,t.jsx)("div",{className:s,id:e,children:r})},Ks="array-actions",Xs=({addRow:e,duplicateRow:n,hasMaxRows:r,index:a,isSortable:o,moveRow:s,removeRow:l,rowCount:c})=>{const{t:u}=(0,Be.B)();return(0,t.jsx)(Ys,{button:(0,t.jsx)(Fs,{}),buttonClassName:`${Ks}__button`,className:Ks,horizontalAlign:"center",render:({close:d})=>(0,t.jsxs)(Us,{buttonSize:"small",children:[o&&0!==a&&(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__move-up`,onClick:()=>{s(a,a-1),d()},children:[(0,t.jsx)("div",{className:`${Ks}__action-chevron`,children:(0,t.jsx)(Tt,{direction:"up"})}),u("general:moveUp")]}),o&&a<c-1&&(0,t.jsxs)(Gs,{className:`${Ks}__action`,onClick:()=>{s(a,a+1),d()},children:[(0,t.jsx)("div",{className:`${Ks}__action-chevron`,children:(0,t.jsx)(Tt,{})}),u("general:moveDown")]}),!r&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__add`,onClick:()=>{e(a+1),d()},children:[(0,t.jsx)(Lt,{}),u("general:addBelow")]}),(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__duplicate`,onClick:()=>{n(a),d()},children:[(0,t.jsx)(Ws,{}),u("general:duplicate")]})]}),(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__remove`,onClick:()=>{l(a),d()},children:[(0,t.jsx)($t.u,{}),u("general:remove")]})]}),size:"medium"})};var Qs=n(31786);const Js=({className:e})=>(0,t.jsxs)("svg",{className:["icon icon--drag-handle",e].filter(Boolean).join(" "),viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:"fill",cx:"10.468",cy:"14.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"14.532",cy:"14.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"10.468",cy:"11.35",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"14.532",cy:"11.35",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"10.468",cy:"8.3",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"14.532",cy:"8.3",r:"1"})]}),Zs=(0,o.createContext)({isCollapsed:void 0,isVisible:void 0,isWithinCollapsible:void 0,toggle:()=>{}}),el=({children:e,isCollapsed:n,isWithinCollapsible:r=!0,toggle:a})=>{const{isCollapsed:o,isVisible:s}=tl(),l=i().useMemo((()=>({isCollapsed:n,isVisible:s&&!o,isWithinCollapsible:r,toggle:a})),[n,r,a,o,s]);return(0,t.jsx)(Zs.Provider,{value:l,children:e})},tl=()=>(0,o.useContext)(Zs),nl=Qs.A.default||Qs.A,rl="collapsible",al=({actions:e,children:n,className:r,collapsibleStyle:a="default",dragHandleProps:s,header:l,initCollapsed:c,isCollapsed:u,onToggle:d})=>{const[f,p]=(0,o.useState)(Boolean(c)),[m,h]=(0,o.useState)(!1),{isWithinCollapsible:g}=tl(),{t:v}=(0,Be.B)(),b="boolean"==typeof u?u:f,y=i().useCallback((()=>{"function"==typeof d&&d(!b),p(!b)}),[d,b]);return(0,t.jsx)("div",{className:[rl,r,s&&`${rl}--has-drag-handle`,b&&`${rl}--collapsed`,g&&`${rl}--nested`,m&&`${rl}--hovered`,`${rl}--style-${a}`].filter(Boolean).join(" "),children:(0,t.jsxs)(el,{isCollapsed:b,toggle:y,children:[(0,t.jsxs)("div",{className:`${rl}__toggle-wrap`,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[s&&(0,t.jsx)("div",{className:`${rl}__drag`,...s.attributes,...s.listeners,children:(0,t.jsx)(Js,{})}),(0,t.jsx)("button",{className:[`${rl}__toggle`,`${rl}__toggle--${b?"collapsed":"open"}`].filter(Boolean).join(" "),onClick:y,type:"button",children:(0,t.jsx)("span",{children:v("fields:toggleBlock")})}),l&&(0,t.jsx)("div",{className:[`${rl}__header-wrap`,s&&`${rl}__header-wrap--has-drag-handle`].filter(Boolean).join(" "),children:l&&l}),(0,t.jsxs)("div",{className:`${rl}__actions-wrap`,children:[e&&(0,t.jsx)("div",{className:`${rl}__actions`,children:e}),(0,t.jsx)("div",{className:`${rl}__indicator`,children:(0,t.jsx)(Tt,{direction:b?void 0:"up"})})]})]}),(0,t.jsx)(nl,{duration:200,height:b?0:"auto",children:(0,t.jsx)("div",{className:`${rl}__content`,children:n})})]})})},ol=vs((e=>{const{name:n,disableModifyingForm:r=!0,forceUsePathFromProps:a,path:i,value:s}=e,{path:l}=Po(),{path:c,setValue:u,value:d}=hs({path:(a?null:l)||i||n});return(0,o.useEffect)((()=>{void 0!==s&&u(s,r)}),[s,u,r]),(0,t.jsx)("input",{id:`field-${c?.replace(/\./g,"__")}`,name:c,onChange:u,type:"hidden",value:d||""})})),il=({name:e,type:n,CustomField:r,custom:a,disabled:o,fieldComponentProps:i,indexPath:s,isHidden:l,path:c,permissions:u,readOnly:d,schemaPath:f,siblingPermissions:p})=>{const m=ms(),{readOnly:h}=Po(),g=qm(),v=[c,e].filter(Boolean).join("."),b=[f,e].filter(Boolean).join(".");if(!1===u?.read?.permission||o)return null;let y=d;h&&!1!==y&&(y=!0),!1===u?.[m]?.permission&&(y=!0);const w=l?ol:g[n];return void 0!==r||w?(0,t.jsx)(xo,{custom:a,indexPath:s,path:v,permissions:u,readOnly:y,schemaPath:b,siblingPermissions:p,type:n,children:void 0!==r?r:(0,t.jsx)(w,{...i})}):null},sl="render-fields",ll=e=>{const{className:n,fieldMap:r,forceRender:a,indexPath:o,margins:s,path:l,permissions:c,schemaPath:u}=e,{i18n:d}=(0,Be.B)(),[f,p]=i().useState(Boolean(a)),[m,h]=Wt({rootMargin:"1000px"},Boolean(a)),g=Boolean(h?.isIntersecting),v=a||g||h?.boundingClientRect?.top<0;return i().useEffect((()=>{v&&!f&&p(!0)}),[v,f]),!r||Array.isArray(r)&&0===r.length?null:(d||console.error("Need to implement i18n when calling RenderFields"),r?(0,t.jsx)("div",{className:[sl,n,s&&`${sl}--margins-${s}`,!1===s&&`${sl}--margins-none`].filter(Boolean).join(" "),ref:m,children:f&&r?.map(((e,n)=>{const{type:r,CustomField:i,custom:s,disabled:d,fieldComponentProps:f,fieldComponentProps:{readOnly:p},isHidden:m}=e,h="number"==typeof a&&n<=a||!0,g="name"in e?e.name:void 0;return(0,t.jsx)(il,{CustomField:i,custom:s,disabled:d,fieldComponentProps:{...f,forceRender:h},indexPath:void 0!==o?`${o}.${n}`:`${n}`,isHidden:m,name:g,path:l,permissions:c?.[g],readOnly:p,schemaPath:u,siblingPermissions:c,type:r},n)}))}):null)},cl=i().createContext({data:{},path:"",rowNumber:void 0}),ul=({children:e,path:n,rowNumber:r})=>{const{getDataByPath:a,getSiblingData:i}=(0,o.useContext)(Do),s=i(n),l=a(n)||s;return(0,t.jsx)(cl.Provider,{value:{data:l,path:n,rowNumber:r},children:e})},dl="row-label",fl=e=>{const{RowLabelComponent:n,className:r,i18n:o,path:i,rowLabel:s,rowNumber:l}=e;if(n)return(0,t.jsx)(ul,{path:i,rowNumber:l,children:n});const c=s?"object"==typeof s?(0,a.sC)(s,o):"string"==typeof s?s:"":"";return(0,t.jsx)("span",{className:[dl,r].filter(Boolean).join(" "),style:{pointerEvents:"none"},children:c})},pl="array-field",ml=({CustomRowLabel:e,addRow:n,attributes:r,duplicateRow:o,errorCount:i,fieldMap:s,forceRender:l=!1,hasMaxRows:c,indexPath:u,isSortable:d,labels:f,listeners:p,moveRow:m,path:h,permissions:g,readOnly:v,removeRow:b,row:y,rowCount:w,rowIndex:x,schemaPath:P,setCollapse:j,setNodeRef:k,transform:S})=>{const C=`${h}.${x}`,{i18n:M}=(0,Be.B)(),_=$o(),O=`${(0,a.sC)(f.singular,M)} ${String(x+1).padStart(2,"0")}`,E=i>0&&_,D=[`${pl}__row`,E?`${pl}__row--has-errors`:`${pl}__row--no-errors`].filter(Boolean).join(" ");return(0,t.jsx)("div",{id:`${h.split(".").join("-")}-row-${x}`,ref:k,style:{transform:S},children:(0,t.jsx)(al,{actions:v?void 0:(0,t.jsx)(Xs,{addRow:n,duplicateRow:o,hasMaxRows:c,index:x,isSortable:d,moveRow:m,removeRow:b,rowCount:w}),className:D,collapsibleStyle:E?"error":"default",dragHandleProps:d?{id:y.id,attributes:r,listeners:p}:void 0,header:(0,t.jsxs)("div",{className:`${pl}__row-header`,children:[(0,t.jsx)(fl,{RowLabelComponent:e,i18n:M,path:C,rowLabel:O,rowNumber:x+1}),E&&(0,t.jsx)(yo,{count:i,i18n:M,withMessage:!0})]}),isCollapsed:y.collapsed,onToggle:e=>j(y.id,e),children:(0,t.jsx)(ll,{className:`${pl}__fields`,fieldMap:s,forceRender:l,indexPath:u,margins:"small",path:C,permissions:g?.fields,readOnly:v,schemaPath:P})})},`${h}-row-${y.id}`)},hl="array-field",gl=vs((e=>{const{name:n,CustomDescription:r,CustomError:s,CustomLabel:l,CustomRowLabel:c,className:u,descriptionProps:d,errorProps:f,fieldMap:p,forceRender:m=!1,isSortable:h=!0,label:g,labelProps:v,localized:b,maxRows:y,minRows:w,path:x,readOnly:P,required:j,validate:k}=e,{indexPath:S,path:C,permissions:M,readOnly:_}=Po(),O=w??j?1:0,{setDocFieldPreferences:E}=us(),{addFieldRow:D,dispatchFields:N,setModified:A}=Lo(),T=$o(),{code:R}=ls(),{i18n:I,t:L}=(0,Be.B)(),{localization:$}=Ut(),W=(()=>{if($&&$.fallback){const e=$.defaultLocale||"en";return R===e}return!0})(),F="labels"in(z=e)&&z?.labels?z.labels:"label"in z&&z?.label?{plural:void 0,singular:z?.label}:{plural:L("general:rows"),singular:L("general:row")};var z;const B=(0,o.useCallback)(((e,t)=>!W&&null===e||("function"==typeof k?k(e,{...t,maxRows:y,minRows:O,required:j}):void 0)),[y,O,j,k,W]),{errorPaths:H,formInitializing:Y,formProcessing:V,path:q,rows:U=[],schemaPath:G,showError:K,valid:X,value:Q}=hs({hasRows:!0,path:C??x??n,validate:B}),J=P||_||V||Y,Z=(0,o.useCallback)((async e=>{await D({path:q,rowIndex:e,schemaPath:G}),A(!0),setTimeout((()=>{$s(`${q}-row-${e+1}`)}),0)}),[D,q,A,G]),ee=(0,o.useCallback)((e=>{N({type:"DUPLICATE_ROW",path:q,rowIndex:e}),A(!0),setTimeout((()=>{$s(`${q}-row-${e}`)}),0)}),[N,q,A]),te=(0,o.useCallback)((e=>{N({type:"REMOVE_ROW",path:q,rowIndex:e}),A(!0)}),[N,q,A]),ne=(0,o.useCallback)(((e,t)=>{N({type:"MOVE_ROW",moveFromIndex:e,moveToIndex:t,path:q}),A(!0)}),[N,q,A]),re=(0,o.useCallback)((e=>{N({type:"SET_ALL_ROWS_COLLAPSED",collapsed:e,path:q,setDocFieldPreferences:E})}),[N,q,E]),ae=(0,o.useCallback)(((e,t)=>{N({type:"SET_ROW_COLLAPSED",collapsed:t,path:q,rowID:e,setDocFieldPreferences:E})}),[N,q,E]),oe=y&&U.length>=y,ie=H.length,se=T&&H.length>0,le=J&&0===U.length,ce=U.length<O||j&&0===U.length;return(0,t.jsxs)("div",{className:[Ms,hl,u,se?`${hl}--has-error`:`${hl}--has-no-error`].filter(Boolean).join(" "),id:`field-${q.replace(/\./g,"__")}`,children:[K&&(0,t.jsx)(Cs,{CustomError:s,path:q,...f||{}}),(0,t.jsxs)("header",{className:`${hl}__header`,children:[(0,t.jsxs)("div",{className:`${hl}__header-wrap`,children:[(0,t.jsxs)("div",{className:`${hl}__header-content`,children:[(0,t.jsx)("h3",{className:`${hl}__title`,children:(0,t.jsx)(Ns,{CustomLabel:l,as:"span",label:g,required:j,unstyled:!0,...v||{}})}),se&&ie>0&&(0,t.jsx)(yo,{count:ie,i18n:I,withMessage:!0})]}),U.length>0&&(0,t.jsxs)("ul",{className:`${hl}__header-actions`,children:[(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${hl}__header-action`,onClick:()=>re(!0),type:"button",children:L("fields:collapseAll")})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${hl}__header-action`,onClick:()=>re(!1),type:"button",children:L("fields:showAll")})})]})]}),(0,t.jsx)(ks,{CustomDescription:r,...d||{}})]}),(0,t.jsx)(Ls,{fieldValue:Q,localized:b,path:q}),(U.length>0||!X&&(le||ce))&&(0,t.jsxs)(vo,{className:`${hl}__draggable-rows`,ids:U.map((e=>e.id)),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>ne(e,t),children:[U.map(((e,n)=>{const r=H?.filter((e=>e.startsWith(`${q}.${n}.`))).length;return(0,t.jsx)(go,{disabled:J||!h,id:e.id,children:a=>(0,t.jsx)(ml,{...a,CustomRowLabel:c,addRow:Z,duplicateRow:ee,errorCount:r,fieldMap:p,forceRender:m,hasMaxRows:oe,indexPath:S,isSortable:h,labels:F,moveRow:ne,path:q,permissions:M,readOnly:J,removeRow:te,row:e,rowCount:U.length,rowIndex:n,schemaPath:G,setCollapse:ae})},e.id)})),!X&&(0,t.jsxs)(i().Fragment,{children:[le&&(0,t.jsx)(Tn,{children:L("validation:fieldHasNo",{label:(0,a.sC)(F.plural,I)})}),ce&&(0,t.jsx)(Tn,{type:"error",children:L("validation:requiresAtLeast",{count:O,label:(0,a.sC)(O>1?F.plural:F.singular,I)||L(O>1?"general:rows":"general:row")})})]})]}),!J&&!oe&&(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${hl}__add-row`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>Z(Q||0),children:L("fields:addLabel",{label:(0,a.sC)(F.singular,I)})})]})})),vl="gutter",bl=(0,o.forwardRef)(((e,n)=>{const{children:r,className:a,left:o=!0,negativeLeft:i=!1,negativeRight:s=!1,right:l=!0}=e,c=o&&!i,u=l&&!s;return(0,t.jsx)("div",{className:[c&&`${vl}--left`,u&&`${vl}--right`,i&&`${vl}--negative-left`,s&&`${vl}--negative-right`,a].filter(Boolean).join(" "),ref:n,children:r})}));bl.displayName="Gutter";const yl="drawer",wl=({slug:e,children:n,className:r,disabled:a,onClick:i,...s})=>{const{openModal:l}=O(),c=(0,o.useCallback)((t=>{l(e),"function"==typeof i&&i(t)}),[l,e,i]);return(0,t.jsx)("button",{className:r,disabled:a,onClick:c,type:"button",...s,children:n})},xl=({slug:e,Header:n,children:r,className:a,gutter:i=!0,hoverTitle:s,title:l})=>{const{t:c}=(0,Be.B)(),{closeModal:u,modalState:d}=O(),f=ws(),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{m(d[e]?.isOpen)}),[e,d]),(0,o.useEffect)((()=>{g(p)}),[p]),p?(0,t.jsxs)(ce,{className:[a,yl,h&&`${yl}--is-open`,f>1&&`${yl}--nested`].filter(Boolean).join(" "),slug:e,style:{zIndex:100+f},children:[(!f||1===f)&&(0,t.jsx)("div",{className:`${yl}__blur-bg`}),(0,t.jsx)("button",{"aria-label":c("general:close"),className:`${yl}__close`,id:`close-drawer__${e}`,onClick:()=>u(e),type:"button"}),(0,t.jsxs)("div",{className:`${yl}__content`,children:[(0,t.jsx)("div",{className:`${yl}__blur-bg-content`}),(0,t.jsx)(bl,{className:`${yl}__content-children`,left:i,right:i,children:(0,t.jsxs)(bs.Provider,{value:f+1,children:[n,void 0===n&&(0,t.jsxs)("div",{className:`${yl}__header`,children:[(0,t.jsx)("h2",{className:`${yl}__header__title`,title:s?l:null,children:l}),(0,t.jsx)("button",{"aria-label":c("general:close"),className:`${yl}__header__close`,id:`close-drawer__${e}`,onClick:()=>u(e),type:"button",children:(0,t.jsx)($t.u,{})})]}),r]})})]})]}):null},Pl=e=>(({slug:e,depth:t})=>`drawer_${t}_${e}`)({slug:`${e}-${(0,o.useId)()}`,depth:ws()}),jl=Dn().default,kl="pill",Sl=e=>{const{id:n,className:r}=e,{attributes:a,isDragging:o,listeners:i,setNodeRef:s,transform:l}=ho({id:n});return(0,t.jsx)(Cl,{...e,className:[o&&`${kl}--is-dragging`,r].filter(Boolean).join(" "),elementProps:{...i,...a,ref:s,style:{transform:l}}})},Cl=e=>{const{alignIcon:n="right","aria-checked":r,"aria-controls":a,"aria-expanded":o,"aria-label":i,children:s,className:l,draggable:c,elementProps:u,icon:d,onClick:f,pillStyle:p="light",rounded:m,to:h}=e,g=[kl,`${kl}--style-${p}`,l&&l,h&&`${kl}--has-link`,(h||f)&&`${kl}--has-action`,d&&`${kl}--has-icon`,d&&`${kl}--align-icon-${n}`,c&&`${kl}--draggable`,m&&`${kl}--rounded`].filter(Boolean).join(" ");let v="div";return f&&!h&&(v="button"),h&&(v=jl),(0,t.jsxs)(v,{...u,"aria-checked":r,"aria-controls":a,"aria-expanded":o,"aria-label":i,className:g,href:h||null,onClick:f,type:"button"===v?"button":void 0,children:[d&&"left"===n&&(0,t.jsx)("span",{className:`${kl}__icon`,children:d}),(0,t.jsx)("span",{className:`${kl}__label`,children:s}),d&&"right"===n&&(0,t.jsx)("span",{className:`${kl}__icon`,children:d})]})},Ml=e=>{const{draggable:n}=e;return n?(0,t.jsx)(Sl,{...e}):(0,t.jsx)(Cl,{...e})},_l="thumbnail-card",Ol=e=>{const{alignLabel:n,className:r,collection:a,doc:o,label:i,onClick:s,thumbnail:l}=e,c=Ut(),{i18n:u}=(0,Be.B)(),d=[_l,r,"function"==typeof s&&`${_l}--has-on-click`,n&&`${_l}--align-label-${n}`].filter(Boolean).join(" ");let f=i;return f||(f=Qi({collectionConfig:a,data:o,dateFormat:c.admin.dateFormat,fallback:o?.filename,i18n:u})),(0,t.jsxs)("button",{className:d,onClick:s,title:f,type:"button",children:[(0,t.jsx)("div",{className:`${_l}__thumbnail`,children:l}),(0,t.jsx)("div",{className:`${_l}__label`,children:f})]})};const El={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var Dl,Nl=new Uint8Array(16);function Al(){if(!Dl&&!(Dl="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dl(Nl)}for(var Tl=[],Rl=0;Rl<256;++Rl)Tl.push((Rl+256).toString(16).slice(1));function Il(e,t=0){return(Tl[e[t+0]]+Tl[e[t+1]]+Tl[e[t+2]]+Tl[e[t+3]]+"-"+Tl[e[t+4]]+Tl[e[t+5]]+"-"+Tl[e[t+6]]+Tl[e[t+7]]+"-"+Tl[e[t+8]]+Tl[e[t+9]]+"-"+Tl[e[t+10]]+Tl[e[t+11]]+Tl[e[t+12]]+Tl[e[t+13]]+Tl[e[t+14]]+Tl[e[t+15]]).toLowerCase()}const Ll=function(e,t,n){if(El.randomUUID&&!t&&!e)return El.randomUUID();var r=(e=e||{}).random||(e.rng||Al)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return Il(r)},$l=()=>{const[e]=(0,o.useState)(`pattern${Ll()}`),[n]=(0,o.useState)(`image${Ll()}`);return(0,t.jsxs)("svg",{fill:"none",height:"53",viewBox:"0 0 82 53",width:"82",children:[(0,t.jsx)("rect",{fill:`url(#${e})`,height:"52.7791",width:"80.574",x:"0.713013"}),(0,t.jsxs)("defs",{children:[(0,t.jsx)("pattern",{height:"1",id:`${e}`,patternContentUnits:"objectBoundingBox",width:"1",children:(0,t.jsx)("use",{transform:"scale(0.00387597 0.00591716)",xlinkHref:`#${n}`})}),(0,t.jsx)("image",{height:"169",id:n,width:"258",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQIAAACpCAYAAADA4zPJAAALpklEQVR4Ae2dSY/UOhSF+///DCSGHQuEgAVI7BBITAI2zCCGZuhmpqEBP53W8yOvK1UdO3Zyr/NFilJdXalyTo4/X984zlZgQQEUWLwCW4tXAAFQAAUCIMAEKIACgAAPoAAKBECACVAABQABHkABFAiAABOgAAoAAjyAAiggBbhqgA9QAAUAAR5AARQgIsADKIACdA3wAAqggBQgR4APUAAFAAEeQAEUICLAAyiAAnQN8AAKoIAUIEeAD1AABQABHkABFCAiwAMogAJ0DfAACqCAFCBHgA9QAAUAAR5AARQgIsADKIACdA3wAAqggBQgR4APUAAFAAEeQAEUICLAAyiAAnQN8AAKoIAUIEeAD1AABQABHkABFCAiwAMogAJ0DfAACqCAFCBHgA9QAAUAAR5AARQgIsADKIACdA3wAAqggBQgR4APUAAFAAEeQAEUICLAAyiAAnQN8AAKoIAUIEeAD1AABQABHkABFCAiwAMLVmB/fz98+/YtfPr0KXz48CHs7u6GnZ2dg+3Hjx/D169fw48fP8KfP3+aV4muQfOnmAPsKqDKr4r/9u3bsL29PXgVKPb29pqFAiDouoTXzSrw8+fPg5Y+pfL3ffbdu3fh+/fvzekECJo7pRxQVwGF9YoA+ir1mPfUhVB00coCCFo5kxzHigKqqGrBx1T4Tfu+efOmmegAEKzYhzdaUEBdAVXUTRW51P+UVPS+AALvZ5DyryigSGAqCESYeIcBIFixEW94VuDXr1/JVwRiZR671VUFrwsg8HrmKPeKAkoMKok3tkLn7q8oRCDyuAACj2eNMvcqoMFBuZW41H4alORxAQQezxplXlHg9+/fk+cF1sHDYxcBEKxYijc8KvDly5fZo4EIhvfv37uTEBC4O2UU+LACyg2kDhmOlbbWVpcvPS2AwNPZoqy9CigUr1Whc79Xoxk9LYDA09mirL0K1BhCnAuAuJ8iFE8LIPB0tihrrwI1hxHHip2z9XQpERD0Wos3vSig/EBOJZ1iH09XDwCBF8dTzl4FNJx4ikqd8xu6kuFlAQRezhTl7FVAMwjlVNIp9vn8+XNvmS2+aR4E6md56mtZPMktl8niFYMIGU9XDkyDQCdZ47e1eupvtVzxrB0bEUGZM2ISBEoAafLISNa4FWH1PxYUiApo4E70h7UtOYJ4ljK2OrGbLgfpfy1NEZUhEbt0FNA9BtYAEMvjaW5DMxGBWnpN7hBFPGrrfSKIjpd5OVIBa8OLo3c9DTM2AQJRXbdvRgGHbrWP9mVZtgKaanyoZ6b6nPJanrqxs4MgJgRzTxCJxGVDQEevEDzXP7X2E5w8LbOBQLQsOUZ8TCLx9evX4fHjx+HRo0esTjW4efNmKL3eu3cvyBs5sPB2lWsWENSaZlr3gacmEi9fvhyOHTvGiga9Hjh79mwyDJSz8NQtUOQyOQhSEoI5JNY+mrJqyPLy5cvekw8YAGPXA7du3UqKCob6b4hHp/rMZCDITQjmwmBIIvH+/fuAgEjgSA9cuXJlMAh0edtbNCDYTAICjf6a4xKPflO/vW4BBLT83ZZ/3esUEHi6ZNitF1VBIDLqxovcVr3UfipDH6UBASBYV/m77w8FgaeRhF0I6HU1EChpp+Rdqco89nv6EomAABB0K/y610NAoCHxfY3N4Qpn9e8qILAwv3wfODTmoJvIef78+ZH9w3Xm4P3lQOTGjRsbGzSNGfAMgeIRgRKCFkd5HYaCyqiyaj1//jwwIGG41gOnT58Ourp02EPx7zHjVyxFB8UigrkSgvGEpG5jIlEw0ECiO3fusDaowe3bt8PVq1eDwvvU9fr162sh0NqI1tEgsJIQTAVB/Py6RKIlWlOWcQrIo+oSlrpypShADUhLyygQaOYgSwnBWLlTtzoGZkFqydb9xxKBkONZQUSNRqs+yQaBbvRQeJRa6ax+Xsfi6f7xfqvz7lAFVKEVJSjbLzCookc/a6uBQcol6ZKgxgZ4TwYepUsyCBQSeUgI5gJHxmgt7DvKBPwfBZJAIDKW6mflVtQp9tMxeh0hhqVRIEeBQSBQWKQQaYpKaOk3dMyth4Q5pmGf9hQ4EgTqS+3s7CwOAhFIOvZWE0Tt2ZkjylVgIwhaSwjGyp26JZGYay/286JALwiULOubTjy1ArX2ee/jyb2YknJOr8AKCJQk06WT1ipxqeORNiQSpzcqv1hXgf9AsNSEYC4gSCTWNSbfPq0CByBYekIwFwYkEqc1K79WT4GtsdOJ51aiVvZTItHbjLX17MQ3e1Vgq5UKOfdxtHI7ajSy7iYlFxLVaH8LCLa3iyVGlUhMnU7dmsWUK+pOL6dZpxlUZe0slS8PICgIghiV6F4M3ct+6dIlV+vFixcPJmo5d+5c6K4XLlwI+p/l47l27RpdtBF8AAQVQHDmzJm1M94wxVm9Kc6kOzeM5dEAEBQGgR6dRmWvV9mP0lbdM5Z0BQBBYRA8ePAAEMw4B6KeVciSrgAgAARNgQsQpENAewACQAAI8upOU3sBgsIgePjwYVMV66g+ubX/ExHk8QkQFAaB5sA/ceIEMJghT3D8+HHmnczjAF2DeO2/5Pbu3bvh1KlTwGBCGJw8eTI8efIksxqwGxFB4YggAuXVq1fh2bNn4enTp0euL168OJj/QaP4Sq26O1JzLw75/Rqf0czApY5lyPcwfmAczABBJRBEIAzd6ual7nMZx5xWK3eTxkfLjTkW9p1GAUBgBAQRGGMrj7W7SRWV6AYmFtsKAAJjIBAQciqPbgyyPL0cj5YDBMXu7out5lK2QyuPl+nleLScXRgQERiMCLqg2zQLkqIAJdK6n7f+mhmhbcIAEBgHgSp2X+VRlnx3d9cVBLqQGpsLsVmd/JYKEDgAQaxA8bmM1hKCsXypWx4tZwccgMARCFTRFB2kVjjrn2dG6PmBAAicgcB6pc4t36ZcyPzVpP0SAAJAYCbC6MuFtF8FbRwhIAAEZkAQowkeLTc9HAABIDAHAgGBR8tNCwNAAAhMgiBGByQSpwECIAAEpkEgIJBIrA8DQAAIzINAMFAikUfL1QMCIAAELkAQuwqtPVquXtVO+2ZAAAhcgUBAaOHRcmnVtP6nAQEgcAeCGB3ohiuWMgoAAkDgFgQCgm68Ypqy8TAABIDANQgEAxKJgMC9iWOYy3b84+lJJOYDgYiAiKApmGoWpP39/fwasdA9AQEgaAoEMbIqNSP0UrgACABBkyAQEEgkDscYIAAEzYJAMMiZEXp49Wnnk4AAEDQNgthVGDojdDtVO+1IAAEgWAQIBAQSievhAAgAwWJAIBhozAGJxFUgAAJAsCgQxK4C06n/HwaAABAsEgQCAonEvzAABIBgsSCI0QGJxBAAASBYPAgEhKU/lxEQAAJA8K8HljydOiAABIDgkAfio+X+9qDbfwUIDpkg9hvZjr8b0LOGS3suIyAABEQEGzywlOnUAcEGE3hu0Sh7uYhmCdOpAwJAQEQwwAOtJxIBwQAT0LqWa129a9nqcxkBASAgIkj0QIvPZQQEiSbw3qJR/nLRTUuJREAACIgIRniglUQiIBhhAlrXcq2rZy1bmE4dEAACIoJCHvA8nTogKGQCzy0aZS8X2Xh9LiMgAAREBBU84O25jICgggloYcu1sJ619DSdOiAABEQEFT3gJZEICCqawHNrRtnLRjXWE4mAABAQEUzkAcvTqQOCiUxAC1u2hfWsp8Xp1AEBICAimMED1hKJgGAGE3huzSh7ucjG0nTqgAAQEBHM7AEL06kDgplNQAtbroX1rOXciURAAAiICIx4QGMO5kokAgIjJvDcmlH2slHNHM9lBASAgIjAoAemTiQCAoMmoIUt28J61nOqRCIgAAREBMY9MMUsSIDAuAk8t2aUvVxkU3s6dUAACIgIHHmg1nMZAYEjE9DClmthPWtZYzp1QAAIiAiceqDkdOqAwKkJPLdolL1cZFMqkbilkUysaIAH/Hpgb28vjF3+AbSb48mcXO9tAAAAAElFTkSuQmCC"})]})]})},Wl=()=>(0,t.jsxs)("svg",{className:"icon icon--search",fill:"none",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:"stroke",cx:"11.2069",cy:"10.7069",r:"5"}),(0,t.jsx)("line",{className:"stroke",x1:"14.914",x2:"20.5002",y1:"13.9998",y2:"19.586"})]}),Fl="block-search",zl=e=>{const{setSearchTerm:n}=e,{t:r}=(0,Be.B)();return(0,t.jsxs)("div",{className:Fl,children:[(0,t.jsx)("input",{className:`${Fl}__input`,onChange:e=>{n(e.target.value)},placeholder:r("fields:searchForBlock")}),(0,t.jsx)(Wl,{})]})},Bl="blocks-drawer",Hl=e=>{const{addRow:n,addRowIndex:r,blocks:i,drawerSlug:s,labels:l}=e,[c,u]=(0,o.useState)(""),[d,f]=(0,o.useState)(i),{closeModal:p,isModalOpen:m}=O(),{i18n:h,t:g}=(0,Be.B)();return(0,o.useEffect)((()=>{m||u("")}),[m]),(0,o.useEffect)((()=>{const e=c.toLowerCase(),t=i?.reduce(((t,n)=>{const r=((e,t)=>"string"==typeof e.labels.singular?e.labels.singular.toLowerCase():"object"==typeof e.labels.singular?(0,a.sC)(e.labels.singular,t).toLowerCase():"")(n,h);return r.includes(e)&&t.push(n),t}),[]);f(t)}),[c,i,h]),(0,t.jsxs)(xl,{slug:s,title:g("fields:addLabel",{label:(0,a.sC)(l.singular,h)}),children:[(0,t.jsx)(zl,{setSearchTerm:u}),(0,t.jsx)("div",{className:`${Bl}__blocks-wrapper`,children:(0,t.jsx)("ul",{className:`${Bl}__blocks`,children:d?.map(((e,o)=>{const{slug:i,imageAltText:l,imageURL:c,labels:u}=e;return(0,t.jsx)("li",{className:`${Bl}__block`,children:(0,t.jsx)(Ol,{alignLabel:"center",label:(0,a.sC)(u?.singular,h),onClick:()=>{n(r,i),p(s)},thumbnail:c?(0,t.jsx)("img",{alt:l,src:c}):(0,t.jsx)("div",{className:`${Bl}__default-image`,children:(0,t.jsx)($l,{})})})},o)}))})})]})},Yl=e=>{const{addRow:n,blockType:r,blocks:a,duplicateRow:o,hasMaxRows:s,isSortable:l,labels:c,moveRow:u,removeRow:d,rowCount:f,rowIndex:p}=e,{closeModal:m,openModal:h}=O(),g=Pl("blocks-drawer"),[v,b]=i().useState(null);return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Hl,{addRow:(e,t)=>{"function"==typeof n&&n(v,t),m(g)},addRowIndex:p,blocks:a,drawerSlug:g,labels:c}),(0,t.jsx)(Xs,{addRow:e=>{b(e),h(g)},duplicateRow:()=>o(p,r),hasMaxRows:s,index:p,isSortable:l,moveRow:u,removeRow:d,rowCount:f})]})},Vl="section-title",ql=e=>{const{customOnChange:n,customValue:r,path:a,readOnly:o}=e,{setValue:i,value:s}=hs({path:a}),{t:l}=(0,Be.B)(),c=[Vl].filter(Boolean).join(" "),u=n||(e=>{e.stopPropagation(),e.preventDefault(),i(e.target.value)});return(0,t.jsx)("div",{className:c,"data-value":r||s,children:(0,t.jsx)("input",{className:`${Vl}__input`,id:a,name:a,onChange:u,placeholder:l("general:untitled"),readOnly:o,type:"text",value:r||s||""})})},Ul="blocks-field",Gl=({addRow:e,attributes:n,block:r,blocks:o,duplicateRow:i,errorCount:s,forceRender:l,hasMaxRows:c,isSortable:u,labels:d,listeners:f,moveRow:p,path:m,permissions:h,readOnly:g,removeRow:v,row:b,rowCount:y,rowIndex:w,schemaPath:x,setCollapse:P,setNodeRef:j,transform:k})=>{const S=`${m}.${w}`,{i18n:C}=(0,Be.B)(),M=$o()&&s>0,_=[`${Ul}__row`,M?`${Ul}__row--has-errors`:`${Ul}__row--no-errors`].filter(Boolean).join(" ");return(0,t.jsx)("div",{id:`${m.split(".").join("-")}-row-${w}`,ref:j,style:{transform:k},children:(0,t.jsx)(al,{actions:g?void 0:(0,t.jsx)(Yl,{addRow:e,blockType:b.blockType,blocks:o,duplicateRow:i,fieldMap:r.fieldMap,hasMaxRows:c,isSortable:u,labels:d,moveRow:p,removeRow:v,rowCount:y,rowIndex:w}),className:_,collapsibleStyle:M?"error":"default",dragHandleProps:u?{id:b.id,attributes:n,listeners:f}:void 0,header:(0,t.jsxs)("div",{className:`${Ul}__block-header`,children:[(0,t.jsx)("span",{className:`${Ul}__block-number`,children:String(w+1).padStart(2,"0")}),(0,t.jsx)(Ml,{className:`${Ul}__block-pill ${Ul}__block-pill-${b.blockType}`,pillStyle:"white",children:(0,a.sC)(r.labels.singular,C)}),(0,t.jsx)(ql,{path:`${S}.blockName`,readOnly:g}),M&&(0,t.jsx)(yo,{count:s,i18n:C,withMessage:!0})]}),isCollapsed:b.collapsed,onToggle:e=>P(b.id,e),children:(0,t.jsx)(ll,{className:`${Ul}__fields`,fieldMap:r.fieldMap,forceRender:l,margins:"small",path:S,permissions:h?.blocks?.[r.slug]?.fields,readOnly:g,schemaPath:`${x}.${r.slug}`})},b.id)},`${m}-row-${w}`)},Kl="blocks-field",Xl=vs((e=>{const{i18n:n,t:r}=(0,Be.B)(),{name:s,CustomDescription:l,CustomError:c,CustomLabel:u,blocks:d,className:f,descriptionProps:p,errorProps:m,forceRender:h=!1,isSortable:g=!0,label:v,labelProps:b,labels:y,localized:w,maxRows:x,minRows:P,path:j,readOnly:k,required:S,validate:C}=e,{indexPath:M,readOnly:_}=Po(),O=P??S?1:0,{setDocFieldPreferences:E}=us(),{addFieldRow:D,dispatchFields:N,setModified:A}=Lo(),{code:T}=ls(),{localization:R}=Ut(),I=Pl("blocks-drawer"),L=$o(),$={plural:r("fields:blocks"),singular:r("fields:block"),...y},W=(()=>{if(R&&R.fallback){const e=R.defaultLocale||"en";return T===e}return!0})(),F=(0,o.useCallback)(((e,t)=>!W&&null===e||("function"==typeof C?C(e,{...t,maxRows:x,minRows:O,required:S}):void 0)),[x,O,S,C,W]),{path:z}=Po(),{errorPaths:B,formInitializing:H,formProcessing:Y,path:V,permissions:q,rows:U=[],schemaPath:G,showError:K,valid:X,value:Q}=hs({hasRows:!0,path:z??j??s,validate:F}),J=k||_||Y||H,Z=(0,o.useCallback)((async(e,t)=>{await D({data:{blockType:t},path:V,rowIndex:e,schemaPath:`${G}.${t}`}),A(!0),setTimeout((()=>{$s(`${V}-row-${e+1}`)}),0)}),[D,V,A,G]),ee=(0,o.useCallback)((e=>{N({type:"DUPLICATE_ROW",path:V,rowIndex:e}),A(!0),setTimeout((()=>{$s(`${V}-row-${e+1}`)}),0)}),[N,V,A]),te=(0,o.useCallback)((e=>{N({type:"REMOVE_ROW",path:V,rowIndex:e}),A(!0)}),[V,N,A]),ne=(0,o.useCallback)(((e,t)=>{N({type:"MOVE_ROW",moveFromIndex:e,moveToIndex:t,path:V}),A(!0)}),[N,V,A]),re=(0,o.useCallback)((e=>{N({type:"SET_ALL_ROWS_COLLAPSED",collapsed:e,path:V,setDocFieldPreferences:E})}),[N,V,E]),ae=(0,o.useCallback)(((e,t)=>{N({type:"SET_ROW_COLLAPSED",collapsed:t,path:V,rowID:e,setDocFieldPreferences:E})}),[N,V,E]),oe=x&&U.length>=x,ie=B.length,se=L&&ie+(X?0:1)>0,le=U.length<O||S&&0===U.length,ce=J&&0===U.length;return(0,t.jsxs)("div",{className:[Ms,Kl,f,se?`${Kl}--has-error`:`${Kl}--has-no-error`].filter(Boolean).join(" "),id:`field-${V.replace(/\./g,"__")}`,children:[K&&(0,t.jsx)(Cs,{CustomError:c,path:V,...m||{}}),(0,t.jsxs)("header",{className:`${Kl}__header`,children:[(0,t.jsxs)("div",{className:`${Kl}__header-wrap`,children:[(0,t.jsxs)("div",{className:`${Kl}__heading-with-error`,children:[(0,t.jsx)("h3",{children:(0,t.jsx)(Ns,{CustomLabel:u,as:"span",label:v,required:S,unstyled:!0,...b||{}})}),se&&ie>0&&(0,t.jsx)(yo,{count:ie,i18n:n,withMessage:!0})]}),U.length>0&&(0,t.jsxs)("ul",{className:`${Kl}__header-actions`,children:[(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${Kl}__header-action`,onClick:()=>re(!0),type:"button",children:r("fields:collapseAll")})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${Kl}__header-action`,onClick:()=>re(!1),type:"button",children:r("fields:showAll")})})]})]}),(0,t.jsx)(ks,{CustomDescription:l,...p||{}})]}),(0,t.jsx)(Ls,{fieldValue:Q,localized:w,path:V}),(U.length>0||!X&&(ce||le))&&(0,t.jsxs)(vo,{className:`${Kl}__rows`,ids:U.map((e=>e.id)),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>ne(e,t),children:[U.map(((e,n)=>{const{blockType:r}=e,a=d.find((e=>e.slug===r));if(a){const r=B.filter((e=>e.startsWith(`${V}.${n}`))).length;return(0,t.jsx)(go,{disabled:J||!g,id:e.id,children:o=>(0,t.jsx)(Gl,{...o,addRow:Z,block:a,blocks:d,duplicateRow:ee,errorCount:r,forceRender:h,hasMaxRows:oe,indexPath:M,isSortable:g,labels:$,moveRow:ne,path:V,permissions:q,readOnly:J,removeRow:te,row:e,rowCount:U.length,rowIndex:n,schemaPath:G,setCollapse:ae})},e.id)}return null})),!W&&(0,t.jsxs)(i().Fragment,{children:[le&&(0,t.jsx)(Tn,{type:"error",children:r("validation:requiresAtLeast",{count:O,label:(0,a.sC)(O>1?$.plural:$.singular,n)||r(O>1?"general:row":"general:rows")})}),ce&&(0,t.jsx)(Tn,{children:r("validation:fieldHasNo",{label:(0,a.sC)($.plural,n)})})]})]}),!J&&!oe&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(wl,{className:`${Kl}__drawer-toggler`,slug:I,children:(0,t.jsx)(Yt,{buttonStyle:"icon-label",el:"span",icon:"plus",iconPosition:"left",iconStyle:"with-border",children:r("fields:addLabel",{label:(0,a.sC)($.singular,n)})})}),(0,t.jsx)(Hl,{addRow:Z,addRowIndex:U?.length||0,blocks:d,drawerSlug:I,labels:$})]})]})}));var Ql=n(32293);const Jl=(0,o.lazy)((()=>Promise.resolve().then(n.bind(n,94917)))),Zl=e=>{const{height:n="35vh"}=e;return(0,t.jsx)(o.Suspense,{fallback:(0,t.jsx)(Ql.l,{height:n}),children:(0,t.jsx)(Jl,{...e,height:n})})},ec={js:"javascript",ts:"typescript"},tc="code-field",nc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,editorOptions:d={},errorProps:f,label:p,labelProps:m,language:h="javascript",path:g,readOnly:v,required:b,style:y,validate:w,width:x}=e,P=(0,o.useCallback)(((e,t)=>{if("function"==typeof w)return w(e,{...t,required:b})}),[w,b]),{path:j,readOnly:k}=Po(),{formInitializing:S,formProcessing:C,path:M,setValue:_,showError:O,value:E}=hs({path:j??g??n,validate:P}),D=v||k||C||S;return(0,t.jsxs)("div",{className:[Ms,tc,c,O&&"error",D&&"read-only"].filter(Boolean).join(" "),style:{...y,width:x},children:[(0,t.jsx)(Ns,{CustomLabel:l,label:p,required:b,...m||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:s,path:M,...f||{}}),a,(0,t.jsx)(Zl,{defaultLanguage:ec[h]||h,onChange:D?()=>null:e=>_(e),options:d,readOnly:D,value:E||""}),r]}),i||(0,t.jsx)(ks,{...u||{}})]})})),rc=(e,t)=>t.reduce(((t,n)=>{const r="fieldMap"in n.fieldComponentProps?n.fieldComponentProps.fieldMap:void 0;if(r)if(n.isFieldAffectingData){const r="name"in n?n.name:"unnamed";t.push(e?`${e}.${r}.`:`${r}.`)}else t.push(...rc(e,r));else if("tabs"===n.type)"tabs"in n.fieldComponentProps&&n.fieldComponentProps.tabs?.forEach((n=>{let r=e;"name"in n&&(r=e?`${e}.${n.name}`:n.name),t.push(...rc(r,n.fieldMap))}));else if(n.isFieldAffectingData){const r="name"in n?n.name:"unnamed";t.push(e?`${e}.${r}`:r)}return t}),[]),ac=({fieldMap:e,path:t,setErrorCount:n})=>{const[r]=Ho(),a=$o(),o=rc(t,e);return Yo((()=>{if(a){const{errorCount:e}=(({formState:e,pathSegments:t})=>{const n={};let r=0;return Object.entries(e).forEach((([a])=>{const o=t?.some((e=>e.endsWith(".")?a.startsWith(e):a===e));if(o){const t=e[a];n[a]=t,"valid"in t&&!t.valid&&(r+=1)}})),{errorCount:r,fieldState:n}})({formState:r,pathSegments:o});n(e)}}),250,[r,a,e]),null},oc="collapsible-field",ic=vs((e=>{const{CustomDescription:n,CustomLabel:r,className:a,descriptionProps:i,fieldMap:s,initCollapsed:l=!1,label:c,path:u,readOnly:d}=e,{indexPath:f,path:p,readOnly:m,schemaPath:h,siblingPermissions:g}=Po(),v=zo(),b=Wo(),y=p??u,{i18n:w}=(0,Be.B)(),{getPreference:x,setPreference:P}=dn(),{preferencesKey:j}=us(),[k,S]=(0,o.useState)(),C=`collapsible-${f.replace(/\./g,"__")}`,[M,_]=(0,o.useState)(0),O=M>0,E=(0,o.useCallback)((async e=>{const t=await x(j);j&&P(j,{...t,...y?{fields:{...t?.fields||{},[y]:{...t?.fields?.[y],collapsed:e}}}:{fields:{...t?.fields||{},[C]:{...t?.fields?.[C],collapsed:e}}}})}),[j,C,x,P,y]);if((0,o.useEffect)((()=>{(async()=>{if(j){const e=await x(j),t=y?e?.fields?.[y]?.collapsed:e?.fields?.[C]?.collapsed;S(void 0!==t?Boolean(t):"boolean"==typeof l&&l)}else S("boolean"==typeof l&&l)})()}),[x,j,C,l,y]),"boolean"!=typeof k)return null;const D=d||m||b||v;return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(ac,{fieldMap:s,path:y,setErrorCount:_}),(0,t.jsxs)("div",{className:[Ms,oc,a,O?`${oc}--has-error`:`${oc}--has-no-error`].filter(Boolean).join(" "),id:`field-${C}${y?`-${y.replace(/\./g,"__")}`:""}`,children:[(0,t.jsx)(al,{className:`${oc}__collapsible`,collapsibleStyle:O?"error":"default",header:(0,t.jsxs)("div",{className:`${oc}__row-label-wrap`,children:[(0,t.jsx)(fl,{RowLabelComponent:r,i18n:w,path:y,rowLabel:c}),O&&(0,t.jsx)(yo,{count:M,i18n:w,withMessage:!0})]}),initCollapsed:k,onToggle:E,children:(0,t.jsx)(ll,{fieldMap:s,forceRender:!0,indexPath:f,margins:"small",path:y,permissions:g,readOnly:D,schemaPath:h})}),(0,t.jsx)(ks,{CustomDescription:n,...i||{}})]})]})})),sc=e=>{const{disabled:n}=e,r=Bo((([e])=>e?.password)),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((e=>e?e===r?.value||a("fields:passwordsDoNotMatch"):a("validation:required")),[r,a]),s="confirm-password",{setValue:l,showError:c,value:u}=hs({disableFormData:!0,path:s,validate:i});return(0,t.jsxs)("div",{className:[Ms,"confirm-password",c&&"error"].filter(Boolean).join(" "),children:[(0,t.jsx)(Ns,{htmlFor:"field-confirm-password",label:a("authentication:confirmPassword"),required:!0}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{path:s}),(0,t.jsx)("input",{autoComplete:"off",disabled:!!n,id:"field-confirm-password",name:"confirm-password",onChange:l,type:"password",value:u||""})]})]})},lc=(0,o.lazy)((()=>Promise.resolve().then(n.bind(n,99304)))),cc=e=>(0,t.jsx)(o.Suspense,{fallback:(0,t.jsx)(Ql.l,{height:50}),children:(0,t.jsx)(lc,{...e})}),uc="date-time-field",dc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,date:d,descriptionProps:f,errorProps:p,label:m,labelProps:h,path:g,placeholder:v,readOnly:b,required:y,style:w,validate:x,width:P}=e,{i18n:j}=(0,Be.B)(),k=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:y})}),[x,y]),{path:S,readOnly:C}=Po(),{formInitializing:M,formProcessing:_,path:O,setValue:E,showError:D,value:N}=hs({path:S??g??n,validate:k}),A=b||C||_||M;return(0,t.jsxs)("div",{className:[Ms,uc,u,D&&`${uc}--has-error`,A&&"read-only"].filter(Boolean).join(" "),style:{...w,width:P},children:[(0,t.jsx)(Ns,{CustomLabel:c,label:m,required:y,...h||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,id:`field-${O.replace(/\./g,"__")}`,children:[(0,t.jsx)(Cs,{CustomError:l,path:O,...p||{}}),i,(0,t.jsx)(cc,{...d,onChange:e=>{A||E(e?.toISOString()||null)},placeholder:(0,a.sC)(v,j),readOnly:A,value:N}),r]}),void 0!==s?s:(0,t.jsx)(ks,{...f||{}})]})})),fc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,autoComplete:u,className:d,descriptionProps:f,errorProps:p,label:m,labelProps:h,path:g,placeholder:v,readOnly:b,required:y,style:w,validate:x,width:P}=e,{i18n:j}=(0,Be.B)(),k=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:y})}),[x,y]),{path:S,readOnly:C}=Po(),{formInitializing:M,formProcessing:_,path:O,setValue:E,showError:D,value:N}=hs({path:S??g??n,validate:k}),A=b||C||_||M;return(0,t.jsxs)("div",{className:[Ms,"email",d,D&&"error",A&&"read-only"].filter(Boolean).join(" "),style:{...w,width:P},children:[(0,t.jsx)(Ns,{CustomLabel:c,label:m,required:y,...h||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:l,path:O,...p||{}}),i,(0,t.jsx)("input",{autoComplete:u,disabled:A,id:`field-${O.replace(/\./g,"__")}`,name:O,onChange:E,placeholder:(0,a.sC)(v,j),type:"email",value:N||""}),r]}),void 0!==s?s:(0,t.jsx)(ks,{...f||{}})]})})),pc=(0,o.createContext)(!1),mc=({children:e,withinRow:n=!0})=>(0,t.jsx)(pc.Provider,{value:n,children:e}),hc=(0,o.createContext)(!1),gc=({children:e,withinTab:n=!0})=>(0,t.jsx)(hc.Provider,{value:n,children:e}),vc=(0,o.createContext)(!1),bc=({children:e,withinGroup:n=!0})=>(0,t.jsx)(vc.Provider,{value:n,children:e}),yc="group-field",wc=vs((e=>{const{CustomDescription:n,CustomLabel:r,className:i,descriptionProps:s,fieldMap:l,hideGutter:c,label:u,readOnly:d,style:f,width:p}=e,{path:m,permissions:h,readOnly:g,schemaPath:v}=Po(),{i18n:b}=(0,Be.B)(),{isWithinCollapsible:y}=tl(),w=(0,o.useContext)(vc),x=(0,o.useContext)(pc),P=(0,o.useContext)(hc),{errorPaths:j}=hs({path:m}),k=zo(),S=Wo(),C=$o(),M=j.length,_=C&&M>0,O=d||g||S||k,E=!(y||w||x);return(0,t.jsx)(o.Fragment,{children:(0,t.jsx)("div",{className:[Ms,yc,E&&`${yc}--top-level`,y&&`${yc}--within-collapsible`,w&&`${yc}--within-group`,x&&`${yc}--within-row`,P&&`${yc}--within-tab`,!c&&w&&`${yc}--gutter`,_&&`${yc}--has-error`,i].filter(Boolean).join(" "),id:`field-${m?.replace(/\./g,"__")}`,style:{...f,width:p},children:(0,t.jsx)(bc,{children:(0,t.jsxs)("div",{className:`${yc}__wrap`,children:[(0,t.jsxs)("div",{className:`${yc}__header`,children:[(r||n||u)&&(0,t.jsxs)("header",{children:[void 0!==r?r:u?(0,t.jsx)("h3",{className:`${yc}__title`,children:(0,a.sC)(u,b)}):null,void 0!==n?n:(0,t.jsx)(ks,{...s||{}})]}),_&&(0,t.jsx)(yo,{count:M,i18n:b,withMessage:!0})]}),(0,t.jsx)(ll,{fieldMap:l,margins:"small",path:m,permissions:h?.fields,readOnly:O,schemaPath:v})]})})})})})),xc="json-field",Pc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,editorOptions:d,errorProps:f,jsonSchema:p,label:m,labelProps:h,path:g,readOnly:v,required:b,style:y,validate:w,width:x}=e,[P,j]=(0,o.useState)(),[k,S]=(0,o.useState)(),[C,M]=(0,o.useState)(!1),_=(0,o.useCallback)(((e,t)=>{if("function"==typeof w)return w(e,{...t,jsonError:k,required:b})}),[w,b,k]),{path:O,readOnly:E}=Po(),{formInitializing:D,formProcessing:N,initialValue:A,path:T,setValue:R,showError:I,value:L}=hs({path:O??g??n,validate:_}),$=v||E||N||D,W=(0,o.useCallback)(((e,t)=>{if(!p)return;const n=t.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],r=t.Uri.parse(p.uri),a=t.editor.createModel(JSON.stringify(L,null,2),"json",r);t.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...n,p],validate:!0}),e.setModel(a)}),[p,L]),F=(0,o.useCallback)((e=>{if(!$){j(e);try{R(e?JSON.parse(e):null),S(void 0)}catch(t){R(e||null),S(t)}}}),[$,R,j]);return(0,o.useEffect)((()=>{C||void 0===L||(j(L||A?JSON.stringify(L||A,null,2):""),M(!0))}),[A,L,C]),(0,t.jsxs)("div",{className:[Ms,xc,c,I&&"error",$&&"read-only"].filter(Boolean).join(" "),style:{...y,width:x},children:[(0,t.jsx)(Ns,{CustomLabel:l,label:m,required:b,...h||{}}),(0,t.jsx)(Cs,{CustomError:s,path:T,...f||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:s,path:T,...f||{}}),a,(0,t.jsx)(Zl,{defaultLanguage:"json",onChange:F,onMount:W,options:d,readOnly:$,value:P}),r]}),void 0!==i?i:(0,t.jsx)(ks,{...u||{}})]})})),jc=require("payload/shared");function kc(e){return kc="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},kc(e)}function Sc(e){var t=function(e,t){if("object"!=kc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=kc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==kc(t)?t:t+""}function Cc(e,t,n){return(t=Sc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mc(Object(n),!0).forEach((function(t){Cc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Oc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ec(e,t){if(e){if("string"==typeof e)return Oc(e,t);var n=Object.prototype.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)?Oc(e,t):void 0}}function Dc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||Ec(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nc(e,t){if(null==e)return{};var n,r,a=u(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ac=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Tc(e){var t=e.defaultInputValue,n=void 0===t?"":t,r=e.defaultMenuIsOpen,a=void 0!==r&&r,i=e.defaultValue,s=void 0===i?null:i,l=e.inputValue,c=e.menuIsOpen,u=e.onChange,d=e.onInputChange,f=e.onMenuClose,p=e.onMenuOpen,m=e.value,h=Nc(e,Ac),g=Dc((0,o.useState)(void 0!==l?l:n),2),v=g[0],b=g[1],y=Dc((0,o.useState)(void 0!==c?c:a),2),w=y[0],x=y[1],P=Dc((0,o.useState)(void 0!==m?m:s),2),j=P[0],k=P[1],S=(0,o.useCallback)((function(e,t){"function"==typeof u&&u(e,t),k(e)}),[u]),C=(0,o.useCallback)((function(e,t){var n;"function"==typeof d&&(n=d(e,t)),b(void 0!==n?n:e)}),[d]),M=(0,o.useCallback)((function(){"function"==typeof p&&p(),x(!0)}),[p]),_=(0,o.useCallback)((function(){"function"==typeof f&&f(),x(!1)}),[f]),O=void 0!==l?l:v,E=void 0!==c?c:w,D=void 0!==m?m:j;return _c(_c({},h),{},{inputValue:O,menuIsOpen:E,onChange:S,onInputChange:C,onMenuClose:_,onMenuOpen:M,value:D})}function Rc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sc(r.key),r)}}function Ic(e){return Ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ic(e)}function Lc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Lc=function(){return!!e})()}function $c(e,t){if(t&&("object"===kc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Wc(e){return function(e){if(Array.isArray(e))return Oc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ec(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Fc=n(45396),zc=n(87205),Bc=n(33622),Hc=!!o.useInsertionEffect&&o.useInsertionEffect,Yc=Hc||function(e){return e()},Vc=(Hc||o.useLayoutEffect,{}.hasOwnProperty),qc=o.createContext("undefined"!=typeof HTMLElement?(0,Fc.A)({key:"css"}):null);qc.Provider;var Uc=function(e){return(0,o.forwardRef)((function(t,n){var r=(0,o.useContext)(qc);return e(t,r,n)}))};var Gc=o.createContext({});var Kc="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Xc=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return(0,zc.SF)(t,n,r),Yc((function(){return(0,zc.sk)(t,n,r)})),null},Qc=Uc((function(e,t,n){var r=e.css;"string"==typeof r&&void 0!==t.registered[r]&&(r=t.registered[r]);var a=e[Kc],i=[r],s="";"string"==typeof e.className?s=(0,zc.Rk)(t.registered,i,e.className):null!=e.className&&(s=e.className+" ");var l=(0,Bc.J)(i,void 0,o.useContext(Gc));s+=t.key+"-"+l.name;var c={};for(var u in e)Vc.call(e,u)&&"css"!==u&&u!==Kc&&(c[u]=e[u]);return c.ref=n,c.className=s,o.createElement(o.Fragment,null,o.createElement(Xc,{cache:t,serialized:l,isStringTag:"string"==typeof a}),o.createElement(a,c))}));var Jc=Qc,Zc=(n(8896),function(e,t){var n=arguments;if(null==t||!Vc.call(t,"css"))return o.createElement.apply(void 0,n);var r=n.length,a=new Array(r);a[0]=Jc,a[1]=function(e,t){var n={};for(var r in t)Vc.call(t,r)&&(n[r]=t[r]);return n[Kc]=e,n}(e,t);for(var i=2;i<r;i++)a[i]=n[i];return o.createElement.apply(null,a)});function eu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,Bc.J)(t)}var tu=n(97036);const nu=o.useLayoutEffect;var ru=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],au=function(){};function ou(e,t){return t?"-"===t[0]?e+t:e+"__"+t:e}function iu(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];var o=[].concat(r);if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&o.push("".concat(ou(e,i)));return o.filter((function(e){return e})).map((function(e){return String(e).trim()})).join(" ")}var su=function(e){return t=e,Array.isArray(t)?e.filter(Boolean):"object"===kc(e)&&null!==e?[e]:[];var t},lu=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,_c({},Nc(e,ru))},cu=function(e,t,n){var r=e.cx,a=e.getStyles,o=e.getClassNames,i=e.className;return{css:a(t,e),className:r(null!=n?n:{},o(t,e),i)}};function uu(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function du(e){return uu(e)?window.pageYOffset:e.scrollTop}function fu(e,t){uu(e)?window.scrollTo(0,t):e.scrollTop=t}function pu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:au,a=du(e),o=t-a,i=0;!function t(){var s,l=o*((s=(s=i+=10)/n-1)*s*s+1)+a;fu(e,l),i<n?window.requestAnimationFrame(t):r(e)}()}function mu(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.offsetHeight/3;r.bottom+a>n.bottom?fu(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+a,e.scrollHeight)):r.top-a<n.top&&fu(e,Math.max(t.offsetTop-a,0))}function hu(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}var gu=!1,vu={get passive(){return gu=!0}},bu="undefined"!=typeof window?window:{};bu.addEventListener&&bu.removeEventListener&&(bu.addEventListener("p",au,vu),bu.removeEventListener("p",au,!1));var yu=gu;function wu(e){return null!=e}function xu(e,t,n){return e?t:n}var Pu=["children","innerProps"],ju=["children","innerProps"];function ku(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,a=e.placement,o=e.shouldScroll,i=e.isFixedPosition,s=e.controlHeight,l=function(e){var t=getComputedStyle(e),n="absolute"===t.position,r=/(auto|scroll)/;if("fixed"===t.position)return document.documentElement;for(var a=e;a=a.parentElement;)if(t=getComputedStyle(a),(!n||"static"!==t.position)&&r.test(t.overflow+t.overflowY+t.overflowX))return a;return document.documentElement}(n),c={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return c;var u,d=l.getBoundingClientRect().height,f=n.getBoundingClientRect(),p=f.bottom,m=f.height,h=f.top,g=n.offsetParent.getBoundingClientRect().top,v=i?window.innerHeight:uu(u=l)?window.innerHeight:u.clientHeight,b=du(l),y=parseInt(getComputedStyle(n).marginBottom,10),w=parseInt(getComputedStyle(n).marginTop,10),x=g-w,P=v-h,j=x+b,k=d-b-h,S=p-v+b+y,C=b+h-w,M=160;switch(a){case"auto":case"bottom":if(P>=m)return{placement:"bottom",maxHeight:t};if(k>=m&&!i)return o&&pu(l,S,M),{placement:"bottom",maxHeight:t};if(!i&&k>=r||i&&P>=r)return o&&pu(l,S,M),{placement:"bottom",maxHeight:i?P-y:k-y};if("auto"===a||i){var _=t,O=i?x:j;return O>=r&&(_=Math.min(O-y-s,t)),{placement:"top",maxHeight:_}}if("bottom"===a)return o&&fu(l,S),{placement:"bottom",maxHeight:t};break;case"top":if(x>=m)return{placement:"top",maxHeight:t};if(j>=m&&!i)return o&&pu(l,C,M),{placement:"top",maxHeight:t};if(!i&&j>=r||i&&x>=r){var E=t;return(!i&&j>=r||i&&x>=r)&&(E=i?x-w:j-w),o&&pu(l,C,M),{placement:"top",maxHeight:E}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(a,'".'))}return c}var Su,Cu=function(e){return"auto"===e?"bottom":e},Mu=(0,o.createContext)(null),_u=function(e){var t=e.children,n=e.minMenuHeight,r=e.maxMenuHeight,a=e.menuPlacement,i=e.menuPosition,s=e.menuShouldScrollIntoView,l=e.theme,c=((0,o.useContext)(Mu)||{}).setPortalPlacement,u=(0,o.useRef)(null),d=Dc((0,o.useState)(r),2),f=d[0],p=d[1],m=Dc((0,o.useState)(null),2),h=m[0],g=m[1],v=l.spacing.controlHeight;return nu((function(){var e=u.current;if(e){var t="fixed"===i,o=ku({maxHeight:r,menuEl:e,minHeight:n,placement:a,shouldScroll:s&&!t,isFixedPosition:t,controlHeight:v});p(o.maxHeight),g(o.placement),null==c||c(o.placement)}}),[r,a,i,s,n,c,v]),t({ref:u,placerProps:_c(_c({},e),{},{placement:h||Cu(a),maxHeight:f})})},Ou=function(e){var t=e.children,n=e.innerRef,r=e.innerProps;return Zc("div",c({},cu(e,"menu",{menu:!0}),{ref:n},r),t)},Eu=function(e,t){var n=e.theme,r=n.spacing.baseUnit,a=n.colors;return _c({textAlign:"center"},t?{}:{color:a.neutral40,padding:"".concat(2*r,"px ").concat(3*r,"px")})},Du=Eu,Nu=Eu,Au=["size"],Tu=["innerProps","isRtl","size"];var Ru,Iu,Lu={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},$u=function(e){var t=e.size,n=Nc(e,Au);return Zc("svg",c({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Lu},n))},Wu=function(e){return Zc($u,c({size:20},e),Zc("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"}))},Fu=function(e){return Zc($u,c({size:20},e),Zc("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"}))},zu=function(e,t){var n=e.isFocused,r=e.theme,a=r.spacing.baseUnit,o=r.colors;return _c({label:"indicatorContainer",display:"flex",transition:"color 150ms"},t?{}:{color:n?o.neutral60:o.neutral20,padding:2*a,":hover":{color:n?o.neutral80:o.neutral40}})},Bu=zu,Hu=zu,Yu=function(){var e=eu.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_"}}}(Su||(Ru=["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"],Iu||(Iu=Ru.slice(0)),Su=Object.freeze(Object.defineProperties(Ru,{raw:{value:Object.freeze(Iu)}})))),Vu=function(e){var t=e.delay,n=e.offset;return Zc("span",{css:eu({animation:"".concat(Yu," 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"},"","")})},qu=function(e){var t=e.children,n=e.isDisabled,r=e.isFocused,a=e.innerRef,o=e.innerProps,i=e.menuIsOpen;return Zc("div",c({ref:a},cu(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":r,"control--menu-is-open":i}),o,{"aria-disabled":n||void 0}),t)},Uu=["data"],Gu=function(e){var t=e.children,n=e.cx,r=e.getStyles,a=e.getClassNames,o=e.Heading,i=e.headingProps,s=e.innerProps,l=e.label,u=e.theme,d=e.selectProps;return Zc("div",c({},cu(e,"group",{group:!0}),s),Zc(o,c({},i,{selectProps:d,theme:u,getStyles:r,getClassNames:a,cx:n}),l),Zc("div",null,t))},Ku=["innerRef","isDisabled","isHidden","inputClassName"],Xu={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},Qu={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":_c({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Xu)},Ju=function(e){return _c({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},Xu)},Zu=function(e){var t=e.cx,n=e.value,r=lu(e),a=r.innerRef,o=r.isDisabled,i=r.isHidden,s=r.inputClassName,l=Nc(r,Ku);return Zc("div",c({},cu(e,"input",{"input-container":!0}),{"data-value":n||""}),Zc("input",c({className:t({input:!0},s),ref:a,style:Ju(i),disabled:o},l)))},ed=function(e){var t=e.children,n=e.innerProps;return Zc("div",n,t)};var td=function(e){var t=e.children,n=e.components,r=e.data,a=e.innerProps,o=e.isDisabled,i=e.removeProps,s=e.selectProps,l=n.Container,c=n.Label,u=n.Remove;return Zc(l,{data:r,innerProps:_c(_c({},cu(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:s},Zc(c,{data:r,innerProps:_c({},cu(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:s},t),Zc(u,{data:r,innerProps:_c(_c({},cu(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},i),selectProps:s}))},nd={ClearIndicator:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),t||Zc(Wu,null))},Control:qu,DropdownIndicator:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),t||Zc(Fu,null))},DownChevron:Fu,CrossIcon:Wu,Group:Gu,GroupHeading:function(e){var t=lu(e);t.data;var n=Nc(t,Uu);return Zc("div",c({},cu(e,"groupHeading",{"group-heading":!0}),n))},IndicatorsContainer:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"indicatorsContainer",{indicators:!0}),n),t)},IndicatorSeparator:function(e){var t=e.innerProps;return Zc("span",c({},t,cu(e,"indicatorSeparator",{"indicator-separator":!0})))},Input:Zu,LoadingIndicator:function(e){var t=e.innerProps,n=e.isRtl,r=e.size,a=void 0===r?4:r,o=Nc(e,Tu);return Zc("div",c({},cu(_c(_c({},o),{},{innerProps:t,isRtl:n,size:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),Zc(Vu,{delay:0,offset:n}),Zc(Vu,{delay:160,offset:!0}),Zc(Vu,{delay:320,offset:!n}))},Menu:Ou,MenuList:function(e){var t=e.children,n=e.innerProps,r=e.innerRef,a=e.isMulti;return Zc("div",c({},cu(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:r},n),t)},MenuPortal:function(e){var t=e.appendTo,n=e.children,r=e.controlElement,a=e.innerProps,i=e.menuPlacement,l=e.menuPosition,u=(0,o.useRef)(null),d=(0,o.useRef)(null),f=Dc((0,o.useState)(Cu(i)),2),p=f[0],m=f[1],h=(0,o.useMemo)((function(){return{setPortalPlacement:m}}),[]),g=Dc((0,o.useState)(null),2),v=g[0],b=g[1],y=(0,o.useCallback)((function(){if(r){var e=function(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}(r),t="fixed"===l?0:window.pageYOffset,n=e[p]+t;n===(null==v?void 0:v.offset)&&e.left===(null==v?void 0:v.rect.left)&&e.width===(null==v?void 0:v.rect.width)||b({offset:n,rect:e})}}),[r,l,p,null==v?void 0:v.offset,null==v?void 0:v.rect.left,null==v?void 0:v.rect.width]);nu((function(){y()}),[y]);var w=(0,o.useCallback)((function(){"function"==typeof d.current&&(d.current(),d.current=null),r&&u.current&&(d.current=(0,tu.ll)(r,u.current,y,{elementResize:"ResizeObserver"in window}))}),[r,y]);nu((function(){w()}),[w]);var x=(0,o.useCallback)((function(e){u.current=e,w()}),[w]);if(!t&&"fixed"!==l||!v)return null;var P=Zc("div",c({ref:x},cu(_c(_c({},e),{},{offset:v.offset,position:l,rect:v.rect}),"menuPortal",{"menu-portal":!0}),a),n);return Zc(Mu.Provider,{value:h},t?(0,s.createPortal)(P,t):P)},LoadingMessage:function(e){var t=e.children,n=void 0===t?"Loading...":t,r=e.innerProps,a=Nc(e,ju);return Zc("div",c({},cu(_c(_c({},a),{},{children:n,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),n)},NoOptionsMessage:function(e){var t=e.children,n=void 0===t?"No options":t,r=e.innerProps,a=Nc(e,Pu);return Zc("div",c({},cu(_c(_c({},a),{},{children:n,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),n)},MultiValue:td,MultiValueContainer:ed,MultiValueLabel:ed,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({role:"button"},n),t||Zc(Wu,{size:14}))},Option:function(e){var t=e.children,n=e.isDisabled,r=e.isFocused,a=e.isSelected,o=e.innerRef,i=e.innerProps;return Zc("div",c({},cu(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":r,"option--is-selected":a}),{ref:o,"aria-disabled":n},i),t)},Placeholder:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"placeholder",{placeholder:!0}),n),t)},SelectContainer:function(e){var t=e.children,n=e.innerProps,r=e.isDisabled,a=e.isRtl;return Zc("div",c({},cu(e,"container",{"--is-disabled":r,"--is-rtl":a}),n),t)},SingleValue:function(e){var t=e.children,n=e.isDisabled,r=e.innerProps;return Zc("div",c({},cu(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),r),t)},ValueContainer:function(e){var t=e.children,n=e.innerProps,r=e.isMulti,a=e.hasValue;return Zc("div",c({},cu(e,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":a}),n),t)}},rd=n(38237);for(var ad={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"},od=function(e){return Zc("span",c({css:ad},e))},id={guidance:function(e){var t=e.isSearchable,n=e.isMulti,r=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(r?", 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,r=void 0===n?"":n,a=e.labels,o=e.isDisabled;switch(t){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(a.length>1?"s":""," ").concat(a.join(","),", selected.");case"select-option":return"option ".concat(r,o?" is disabled. Select another option.":", selected.");default:return""}},onFocus:function(e){var t=e.context,n=e.focused,r=e.options,a=e.label,o=void 0===a?"":a,i=e.selectValue,s=e.isDisabled,l=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&&i)return"value ".concat(o," focused, ").concat(u(i,n),".");if("menu"===t&&c){var d=s?" disabled":"",f="".concat(l?" selected":"").concat(d);return"".concat(o).concat(f,", ").concat(u(r,n),".")}return""},onFilter:function(e){var t=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}},sd=function(e){var t=e.ariaSelection,n=e.focusedOption,r=e.focusedValue,a=e.focusableOptions,i=e.isFocused,s=e.selectValue,l=e.selectProps,c=e.id,u=e.isAppleDevice,d=l.ariaLiveMessages,f=l.getOptionLabel,p=l.inputValue,m=l.isMulti,h=l.isOptionDisabled,g=l.isSearchable,v=l.menuIsOpen,b=l.options,y=l.screenReaderStatus,w=l.tabSelectsValue,x=l.isLoading,P=l["aria-label"],j=l["aria-live"],k=(0,o.useMemo)((function(){return _c(_c({},id),d||{})}),[d]),S=(0,o.useMemo)((function(){var e,n="";if(t&&k.onChange){var r=t.option,a=t.options,o=t.removedValue,i=t.removedValues,l=t.value,c=o||r||(e=l,Array.isArray(e)?null:e),u=c?f(c):"",d=a||i||void 0,p=d?d.map(f):[],m=_c({isDisabled:c&&h(c,s),label:u,labels:p},t);n=k.onChange(m)}return n}),[t,k,h,s,f]),C=(0,o.useMemo)((function(){var e="",t=n||r,o=!!(n&&s&&s.includes(n));if(t&&k.onFocus){var i={focused:t,label:f(t),isDisabled:h(t,s),isSelected:o,options:a,context:t===n?"menu":"value",selectValue:s,isAppleDevice:u};e=k.onFocus(i)}return e}),[n,r,f,h,k,a,s,u]),M=(0,o.useMemo)((function(){var e="";if(v&&b.length&&!x&&k.onFilter){var t=y({count:a.length});e=k.onFilter({inputValue:p,resultsMessage:t})}return e}),[a,p,v,k,b,y,x]),_="initial-input-focus"===(null==t?void 0:t.action),O=(0,o.useMemo)((function(){var e="";if(k.guidance){var t=r?"value":v?"menu":"input";e=k.guidance({"aria-label":P,context:t,isDisabled:n&&h(n,s),isMulti:m,isSearchable:g,tabSelectsValue:w,isInitialFocus:_})}return e}),[P,n,r,m,h,g,v,k,s,w,_]),E=Zc(o.Fragment,null,Zc("span",{id:"aria-selection"},S),Zc("span",{id:"aria-focused"},C),Zc("span",{id:"aria-results"},M),Zc("span",{id:"aria-guidance"},O));return Zc(o.Fragment,null,Zc(od,{id:c},_&&E),Zc(od,{"aria-live":j,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!_&&E))},ld=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],cd=new RegExp("["+ld.map((function(e){return e.letters})).join("")+"]","g"),ud={},dd=0;dd<ld.length;dd++)for(var fd=ld[dd],pd=0;pd<fd.letters.length;pd++)ud[fd.letters[pd]]=fd.base;var md=function(e){return e.replace(cd,(function(e){return ud[e]}))},hd=(0,rd.default)(md),gd=function(e){return e.replace(/^\s+|\s+$/g,"")},vd=function(e){return"".concat(e.label," ").concat(e.value)},bd=["innerRef"];function yd(e){var t=e.innerRef,n=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var a=Object.entries(e).filter((function(e){var t=Dc(e,1)[0];return!n.includes(t)}));return a.reduce((function(e,t){var n=Dc(t,2),r=n[0],a=n[1];return e[r]=a,e}),{})}(Nc(e,bd),"onExited","in","enter","exit","appear");return Zc("input",c({ref:t},n,{css:eu({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 wd=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};var xd=["boxSizing","height","overflow","paddingRight","position"],Pd={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function jd(e){e.preventDefault()}function kd(e){e.stopPropagation()}function Sd(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Cd(){return"ontouchstart"in window||navigator.maxTouchPoints}var Md=!("undefined"==typeof window||!window.document||!window.document.createElement),_d=0,Od={capture:!1,passive:!1};var Ed=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},Dd={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Nd(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,a=function(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,a=e.onTopArrive,i=e.onTopLeave,s=(0,o.useRef)(!1),l=(0,o.useRef)(!1),c=(0,o.useRef)(0),u=(0,o.useRef)(null),d=(0,o.useCallback)((function(e,t){if(null!==u.current){var o=u.current,c=o.scrollTop,d=o.scrollHeight,f=o.clientHeight,p=u.current,m=t>0,h=d-f-c,g=!1;h>t&&s.current&&(r&&r(e),s.current=!1),m&&l.current&&(i&&i(e),l.current=!1),m&&t>h?(n&&!s.current&&n(e),p.scrollTop=d,g=!0,s.current=!0):!m&&-t>c&&(a&&!l.current&&a(e),p.scrollTop=0,g=!0,l.current=!0),g&&wd(e)}}),[n,r,a,i]),f=(0,o.useCallback)((function(e){d(e,e.deltaY)}),[d]),p=(0,o.useCallback)((function(e){c.current=e.changedTouches[0].clientY}),[]),m=(0,o.useCallback)((function(e){var t=c.current-e.changedTouches[0].clientY;d(e,t)}),[d]),h=(0,o.useCallback)((function(e){if(e){var t=!!yu&&{passive:!1};e.addEventListener("wheel",f,t),e.addEventListener("touchstart",p,t),e.addEventListener("touchmove",m,t)}}),[m,p,f]),g=(0,o.useCallback)((function(e){e&&(e.removeEventListener("wheel",f,!1),e.removeEventListener("touchstart",p,!1),e.removeEventListener("touchmove",m,!1))}),[m,p,f]);return(0,o.useEffect)((function(){if(t){var e=u.current;return h(e),function(){g(e)}}}),[t,h,g]),function(e){u.current=e}}({isEnabled:void 0===r||r,onBottomArrive:e.onBottomArrive,onBottomLeave:e.onBottomLeave,onTopArrive:e.onTopArrive,onTopLeave:e.onTopLeave}),i=function(e){var t=e.isEnabled,n=e.accountForScrollbars,r=void 0===n||n,a=(0,o.useRef)({}),i=(0,o.useRef)(null),s=(0,o.useCallback)((function(e){if(Md){var t=document.body,n=t&&t.style;if(r&&xd.forEach((function(e){var t=n&&n[e];a.current[e]=t})),r&&_d<1){var o=parseInt(a.current.paddingRight,10)||0,i=document.body?document.body.clientWidth:0,s=window.innerWidth-i+o||0;Object.keys(Pd).forEach((function(e){var t=Pd[e];n&&(n[e]=t)})),n&&(n.paddingRight="".concat(s,"px"))}t&&Cd()&&(t.addEventListener("touchmove",jd,Od),e&&(e.addEventListener("touchstart",Sd,Od),e.addEventListener("touchmove",kd,Od))),_d+=1}}),[r]),l=(0,o.useCallback)((function(e){if(Md){var t=document.body,n=t&&t.style;_d=Math.max(_d-1,0),r&&_d<1&&xd.forEach((function(e){var t=a.current[e];n&&(n[e]=t)})),t&&Cd()&&(t.removeEventListener("touchmove",jd,Od),e&&(e.removeEventListener("touchstart",Sd,Od),e.removeEventListener("touchmove",kd,Od)))}}),[r]);return(0,o.useEffect)((function(){if(t){var e=i.current;return s(e),function(){l(e)}}}),[t,s,l]),function(e){i.current=e}}({isEnabled:n});return Zc(o.Fragment,null,n&&Zc("div",{onClick:Ed,css:Dd}),t((function(e){a(e),i(e)})))}var Ad={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Td=function(e){var t=e.name,n=e.onFocus;return Zc("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:Ad,value:"",onChange:function(){}})};function Rd(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function Id(){return Rd(/^Mac/i)}function Ld(){return Rd(/^iPhone/i)||Rd(/^iPad/i)||Id()&&navigator.maxTouchPoints>1}var $d=function(e){return e.label},Wd=function(e){return e.value},Fd={clearIndicator:Hu,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,r=e.isFocused,a=e.theme,o=a.colors,i=a.borderRadius;return _c({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:r?o.primary:o.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:r?o.primary:o.neutral30}})},dropdownIndicator:Bu,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,r=n.colors,a=n.spacing;return _c({label:"group",cursor:"default",display:"block"},t?{}:{color:r.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,r=e.theme,a=r.spacing.baseUnit,o=r.colors;return _c({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,r=e.value,a=e.theme,o=a.spacing,i=a.colors;return _c(_c({visibility:n?"hidden":"visible",transform:r?"translateZ(0)":""},Qu),t?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:i.neutral80})},loadingIndicator:function(e,t){var n=e.isFocused,r=e.size,a=e.theme,o=a.colors,i=a.spacing.baseUnit;return _c({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},t?{}:{color:n?o.neutral60:o.neutral20,padding:2*i})},loadingMessage:Nu,menu:function(e,t){var n,r=e.placement,a=e.theme,o=a.borderRadius,i=a.spacing,s=a.colors;return _c((Cc(n={label:"menu"},function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(r),"100%"),Cc(n,"position","absolute"),Cc(n,"width","100%"),Cc(n,"zIndex",1),n),t?{}:{backgroundColor:s.neutral0,borderRadius:o,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:i.menuGutter,marginTop:i.menuGutter})},menuList:function(e,t){var n=e.maxHeight,r=e.theme.spacing.baseUnit;return _c({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},t?{}:{paddingBottom:r,paddingTop:r})},menuPortal:function(e){var t=e.rect,n=e.offset,r=e.position;return{left:t.left,position:r,top:n,width:t.width,zIndex:1}},multiValue:function(e,t){var n=e.theme,r=n.spacing,a=n.borderRadius,o=n.colors;return _c({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:r.baseUnit/2})},multiValueLabel:function(e,t){var n=e.theme,r=n.borderRadius,a=n.colors,o=e.cropWithEllipsis;return _c({overflow:"hidden",textOverflow:o||void 0===o?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:r/2,color:a.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},multiValueRemove:function(e,t){var n=e.theme,r=n.spacing,a=n.borderRadius,o=n.colors,i=e.isFocused;return _c({alignItems:"center",display:"flex"},t?{}:{borderRadius:a/2,backgroundColor:i?o.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},noOptionsMessage:Du,option:function(e,t){var n=e.isDisabled,r=e.isFocused,a=e.isSelected,o=e.theme,i=o.spacing,s=o.colors;return _c({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:a?s.primary:r?s.primary25:"transparent",color:n?s.neutral20:a?s.neutral0:"inherit",padding:"".concat(2*i.baseUnit,"px ").concat(3*i.baseUnit,"px"),":active":{backgroundColor:n?void 0:a?s.primary:s.primary50}})},placeholder:function(e,t){var n=e.theme,r=n.spacing,a=n.colors;return _c({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:a.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},singleValue:function(e,t){var n=e.isDisabled,r=e.theme,a=r.spacing,o=r.colors;return _c({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,r=e.isMulti,a=e.hasValue,o=e.selectProps.controlShouldRenderValue;return _c({alignItems:"center",display:r&&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")})}};var zd={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}},Bd={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:hu(),captureMenuScroll:!hu(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:function(e){return function(t,n){if(t.data.__isNew__)return!0;var r=_c({ignoreCase:!0,ignoreAccents:!0,stringify:vd,trim:!0,matchFrom:"any"},e),a=r.ignoreCase,o=r.ignoreAccents,i=r.stringify,s=r.trim,l=r.matchFrom,c=s?gd(n):n,u=s?gd(i(t)):i(t);return a&&(c=c.toLowerCase(),u=u.toLowerCase()),o&&(c=hd(c),u=md(u)),"start"===l?u.substr(0,c.length)===c:u.indexOf(c)>-1}}(),formatGroupLabel:function(e){return e.label},getOptionLabel:$d,getOptionValue:Wd,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 Hd(e,t,n,r){return{type:"option",data:t,isDisabled:Qd(e,t,n),isSelected:Jd(e,t,n),label:Kd(e,t),value:Xd(e,t),index:r}}function Yd(e,t){return e.options.map((function(n,r){if("options"in n){var a=n.options.map((function(n,r){return Hd(e,n,t,r)})).filter((function(t){return Ud(e,t)}));return a.length>0?{type:"group",data:n,options:a,index:r}:void 0}var o=Hd(e,n,t,r);return Ud(e,o)?o:void 0})).filter(wu)}function Vd(e){return e.reduce((function(e,t){return"group"===t.type?e.push.apply(e,Wc(t.options.map((function(e){return e.data})))):e.push(t.data),e}),[])}function qd(e,t){return e.reduce((function(e,n){return"group"===n.type?e.push.apply(e,Wc(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 Ud(e,t){var n=e.inputValue,r=void 0===n?"":n,a=t.data,o=t.isSelected,i=t.label,s=t.value;return(!ef(e)||!o)&&Zd(e,{label:i,value:s,data:a},r)}var Gd=function(e,t){var n;return(null===(n=e.find((function(e){return e.data===t})))||void 0===n?void 0:n.id)||null},Kd=function(e,t){return e.getOptionLabel(t)},Xd=function(e,t){return e.getOptionValue(t)};function Qd(e,t,n){return"function"==typeof e.isOptionDisabled&&e.isOptionDisabled(t,n)}function Jd(e,t,n){if(n.indexOf(t)>-1)return!0;if("function"==typeof e.isOptionSelected)return e.isOptionSelected(t,n);var r=Xd(e,t);return n.some((function(t){return Xd(e,t)===r}))}function Zd(e,t,n){return!e.filterOption||e.filterOption(t,n)}var ef=function(e){var t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},tf=1,nf=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(l,e);var t,n,r,a,i,s=(t=l,n=Lc(),function(){var e,r=Ic(t);if(n){var a=Ic(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return $c(this,e)});function l(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=s.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=Id()||Ld(),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 r=t.props,a=r.onChange,o=r.name;n.name=o,t.ariaOnChange(e,n),a(e,n)},t.setValue=function(e,n,r){var a=t.props,o=a.closeMenuOnSelect,i=a.isMulti,s=a.inputValue;t.onInputChange("",{action:"set-value",prevInputValue:s}),o&&(t.setState({inputIsHiddenAfterUpdate:!i}),t.onMenuClose()),t.setState({clearFocusValueOnUpdate:!0}),t.onChange(e,{action:n,option:r})},t.selectOption=function(e){var n=t.props,r=n.blurInputOnSelect,a=n.isMulti,o=n.name,i=t.state.selectValue,s=a&&t.isOptionSelected(e,i),l=t.isOptionDisabled(e,i);if(s){var c=t.getOptionValue(e);t.setValue(i.filter((function(e){return t.getOptionValue(e)!==c})),"deselect-option",e)}else{if(l)return void t.ariaOnChange(e,{action:"select-option",option:e,name:o});a?t.setValue([].concat(Wc(i),[e]),"select-option",e):t.setValue(e,"select-option")}r&&t.blurInput()},t.removeValue=function(e){var n=t.props.isMulti,r=t.state.selectValue,a=t.getOptionValue(e),o=r.filter((function(e){return t.getOptionValue(e)!==a})),i=xu(n,o,o[0]||null);t.onChange(i,{action:"remove-value",removedValue:e}),t.focusInput()},t.clearValue=function(){var e=t.state.selectValue;t.onChange(xu(t.props.isMulti,[],null),{action:"clear",removedValues:e})},t.popValue=function(){var e=t.props.isMulti,n=t.state.selectValue,r=n[n.length-1],a=n.slice(0,n.length-1),o=xu(e,a,a[0]||null);t.onChange(o,{action:"pop-value",removedValue:r})},t.getFocusedOptionId=function(e){return Gd(t.state.focusableOptionsWithIds,e)},t.getFocusableOptionsWithIds=function(){return qd(Yd(t.props,t.state.selectValue),t.getElementId("option"))},t.getValue=function(){return t.state.selectValue},t.cx=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return iu.apply(void 0,[t.props.classNamePrefix].concat(n))},t.getOptionLabel=function(e){return Kd(t.props,e)},t.getOptionValue=function(e){return Xd(t.props,e)},t.getStyles=function(e,n){var r=t.props.unstyled,a=Fd[e](n,r);a.boxSizing="border-box";var o=t.props.styles[e];return o?o(a,n):a},t.getClassNames=function(e,n){var r,a;return null===(r=(a=t.props.classNames)[e])||void 0===r?void 0:r.call(a,n)},t.getElementId=function(e){return"".concat(t.state.instancePrefix,"-").concat(e)},t.getComponents=function(){return e=t.props,_c(_c({},nd),e.components);var e},t.buildCategorizedOptions=function(){return Yd(t.props,t.state.selectValue)},t.getCategorizedOptions=function(){return t.props.menuIsOpen?t.buildCategorizedOptions():[]},t.buildFocusableOptions=function(){return Vd(t.buildCategorizedOptions())},t.getFocusableOptions=function(){return t.props.menuIsOpen?t.buildFocusableOptions():[]},t.ariaOnChange=function(e,n){t.setState({ariaSelection:_c({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,r=n.isMulti,a=n.menuIsOpen;t.focusInput(),a?(t.setState({inputIsHiddenAfterUpdate:!r}),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.focusInput():setTimeout((function(){return t.focusInput()})))},t.onScroll=function(e){"boolean"==typeof t.props.closeMenuOnScroll?e.target instanceof HTMLElement&&uu(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,r=n&&n.item(0);r&&(t.initialTouchX=r.clientX,t.initialTouchY=r.clientY,t.userIsDragging=!1)},t.onTouchMove=function(e){var n=e.touches,r=n&&n.item(0);if(r){var a=Math.abs(r.clientX-t.initialTouchX),o=Math.abs(r.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,r=e.currentTarget.value;t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange(r,{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;t.menuListRef&&t.menuListRef.contains(document.activeElement)?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 ef(t.props)},t.onValueInputFocus=function(e){e.preventDefault(),e.stopPropagation(),t.focus()},t.onKeyDown=function(e){var n=t.props,r=n.isMulti,a=n.backspaceRemovesValue,o=n.escapeClearsValue,i=n.inputValue,s=n.isClearable,l=n.isDisabled,c=n.menuIsOpen,u=n.onKeyDown,d=n.tabSelectsValue,f=n.openMenuOnFocus,p=t.state,m=p.focusedOption,h=p.focusedValue,g=p.selectValue;if(!(l||"function"==typeof u&&(u(e),e.defaultPrevented))){switch(t.blockOptionHover=!0,e.key){case"ArrowLeft":if(!r||i)return;t.focusValue("previous");break;case"ArrowRight":if(!r||i)return;t.focusValue("next");break;case"Delete":case"Backspace":if(i)return;if(h)t.removeValue(h);else{if(!a)return;r?t.popValue():s&&t.clearValue()}break;case"Tab":if(t.isComposing)return;if(e.shiftKey||!c||!d||!m||f&&t.isOptionSelected(m,g))return;t.selectOption(m);break;case"Enter":if(229===e.keyCode)break;if(c){if(!m)return;if(t.isComposing)return;t.selectOption(m);break}return;case"Escape":c?(t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange("",{action:"menu-close",prevInputValue:i}),t.onMenuClose()):s&&o&&t.clearValue();break;case" ":if(i)return;if(!c){t.openMenu("first");break}if(!m)return;t.selectOption(m);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||++tf),t.state.selectValue=su(e.value),e.menuIsOpen&&t.state.selectValue.length){var n=t.getFocusableOptionsWithIds(),r=t.buildFocusableOptions(),a=r.indexOf(t.state.selectValue[0]);t.state.focusableOptionsWithIds=n,t.state.focusedOption=r[a],t.state.focusedOptionId=Gd(n,r[a])}return t}return r=l,a=[{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&&mu(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,r=t.menuIsOpen,a=this.state.isFocused;(a&&!n&&e.isDisabled||a&&r&&!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&&(mu(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,r=n.selectValue,a=n.isFocused,o=this.buildFocusableOptions(),i="first"===e?0:o.length-1;if(!this.props.isMulti){var s=o.indexOf(r[0]);s>-1&&(i=s)}this.scrollToFocusedOptionOnUpdate=!(a&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:o[i],focusedOptionId:this.getFocusedOptionId(o[i])},(function(){return t.onMenuOpen()}))}},{key:"focusValue",value:function(e){var t=this.state,n=t.selectValue,r=t.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var a=n.indexOf(r);r||(a=-1);var o=n.length-1,i=-1;if(n.length){switch(e){case"previous":i=0===a?0:-1===a?o:a-1;break;case"next":a>-1&&a<o&&(i=a+1)}this.setState({inputIsHidden:-1!==i,focusedValue:n[i]})}}}},{key:"focusOption",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props.pageSize,n=this.state.focusedOption,r=this.getFocusableOptions();if(r.length){var a=0,o=r.indexOf(n);n||(o=-1),"up"===e?a=o>0?o-1:r.length-1:"down"===e?a=(o+1)%r.length:"pageup"===e?(a=o-t)<0&&(a=0):"pagedown"===e?(a=o+t)>r.length-1&&(a=r.length-1):"last"===e&&(a=r.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:r[a],focusedValue:null,focusedOptionId:this.getFocusedOptionId(r[a])})}}},{key:"getTheme",value:function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(zd):_c(_c({},zd),this.props.theme):zd}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,r=this.getClassNames,a=this.getValue,o=this.selectOption,i=this.setValue,s=this.props,l=s.isMulti,c=s.isRtl,u=s.options;return{clearValue:e,cx:t,getStyles:n,getClassNames:r,getValue:a,hasValue:this.hasValue(),isMulti:l,isRtl:c,options:u,selectOption:o,selectProps:s,setValue:i,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 Qd(this.props,e,t)}},{key:"isOptionSelected",value:function(e,t){return Jd(this.props,e,t)}},{key:"filterOption",value:function(e,t){return Zd(this.props,e,t)}},{key:"formatOptionLabel",value:function(e,t){if("function"==typeof this.props.formatOptionLabel){var n=this.props.inputValue,r=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:r})}return this.getOptionLabel(e)}},{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,r=e.inputId,a=e.inputValue,i=e.tabIndex,s=e.form,l=e.menuIsOpen,u=e.required,d=this.getComponents().Input,f=this.state,p=f.inputIsHidden,m=f.ariaSelection,h=this.commonProps,g=r||this.getElementId("input"),v=_c(_c(_c({"aria-autocomplete":"list","aria-expanded":l,"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":u,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},l&&{"aria-controls":this.getElementId("listbox")}),!n&&{"aria-readonly":!0}),this.hasValue()?"initial-input-focus"===(null==m?void 0:m.action)&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return n?o.createElement(d,c({},h,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:g,innerRef:this.getInputRef,isDisabled:t,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:i,form:s,type:"text",value:a},v)):o.createElement(yd,c({id:g,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:au,onFocus:this.onInputFocus,disabled:t,tabIndex:i,inputMode:"none",form:s,value:""},v))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.getComponents(),n=t.MultiValue,r=t.MultiValueContainer,a=t.MultiValueLabel,i=t.MultiValueRemove,s=t.SingleValue,l=t.Placeholder,u=this.commonProps,d=this.props,f=d.controlShouldRenderValue,p=d.isDisabled,m=d.isMulti,h=d.inputValue,g=d.placeholder,v=this.state,b=v.selectValue,y=v.focusedValue,w=v.isFocused;if(!this.hasValue()||!f)return h?null:o.createElement(l,c({},u,{key:"placeholder",isDisabled:p,isFocused:w,innerProps:{id:this.getElementId("placeholder")}}),g);if(m)return b.map((function(t,s){var l=t===y,d="".concat(e.getOptionLabel(t),"-").concat(e.getOptionValue(t));return o.createElement(n,c({},u,{components:{Container:r,Label:a,Remove:i},isFocused:l,isDisabled:p,key:d,index:s,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(h)return null;var x=b[0];return o.createElement(s,c({},u,{data:x,isDisabled:p}),this.formatOptionLabel(x,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.getComponents().ClearIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,a=n.isLoading,i=this.state.isFocused;if(!this.isClearable()||!e||r||!this.hasValue()||a)return null;var s={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,c({},t,{innerProps:s,isFocused:i}))}},{key:"renderLoadingIndicator",value:function(){var e=this.getComponents().LoadingIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,a=n.isLoading,i=this.state.isFocused;return e&&a?o.createElement(e,c({},t,{innerProps:{"aria-hidden":"true"},isDisabled:r,isFocused:i})):null}},{key:"renderIndicatorSeparator",value:function(){var e=this.getComponents(),t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var r=this.commonProps,a=this.props.isDisabled,i=this.state.isFocused;return o.createElement(n,c({},r,{isDisabled:a,isFocused:i}))}},{key:"renderDropdownIndicator",value:function(){var e=this.getComponents().DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,r=this.state.isFocused,a={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,c({},t,{innerProps:a,isDisabled:n,isFocused:r}))}},{key:"renderMenu",value:function(){var e=this,t=this.getComponents(),n=t.Group,r=t.GroupHeading,a=t.Menu,i=t.MenuList,s=t.MenuPortal,l=t.LoadingMessage,u=t.NoOptionsMessage,d=t.Option,f=this.commonProps,p=this.state.focusedOption,m=this.props,h=m.captureMenuScroll,g=m.inputValue,v=m.isLoading,b=m.loadingMessage,y=m.minMenuHeight,w=m.maxMenuHeight,x=m.menuIsOpen,P=m.menuPlacement,j=m.menuPosition,k=m.menuPortalTarget,S=m.menuShouldBlockScroll,C=m.menuShouldScrollIntoView,M=m.noOptionsMessage,_=m.onMenuScrollToTop,O=m.onMenuScrollToBottom;if(!x)return null;var E,D=function(t,n){var r=t.type,a=t.data,i=t.isDisabled,s=t.isSelected,l=t.label,u=t.value,m=p===a,h=i?void 0:function(){return e.onOptionHover(a)},g=i?void 0:function(){return e.selectOption(a)},v="".concat(e.getElementId("option"),"-").concat(n),b={id:v,onClick:g,onMouseMove:h,onMouseOver:h,tabIndex:-1,role:"option","aria-selected":e.isAppleDevice?void 0:s};return o.createElement(d,c({},f,{innerProps:b,data:a,isDisabled:i,isSelected:s,key:v,label:l,type:r,value:u,isFocused:m,innerRef:m?e.getFocusedOptionRef:void 0}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())E=this.getCategorizedOptions().map((function(t){if("group"===t.type){var a=t.data,i=t.options,s=t.index,l="".concat(e.getElementId("group"),"-").concat(s),u="".concat(l,"-heading");return o.createElement(n,c({},f,{key:l,data:a,options:i,Heading:r,headingProps:{id:u,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return D(e,"".concat(s,"-").concat(e.index))})))}if("option"===t.type)return D(t,"".concat(t.index))}));else if(v){var N=b({inputValue:g});if(null===N)return null;E=o.createElement(l,f,N)}else{var A=M({inputValue:g});if(null===A)return null;E=o.createElement(u,f,A)}var T={minMenuHeight:y,maxMenuHeight:w,menuPlacement:P,menuPosition:j,menuShouldScrollIntoView:C},R=o.createElement(_u,c({},f,T),(function(t){var n=t.ref,r=t.placerProps,s=r.placement,l=r.maxHeight;return o.createElement(a,c({},f,T,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:v,placement:s}),o.createElement(Nd,{captureEnabled:h,onTopArrive:_,onBottomArrive:O,lockEnabled:S},(function(t){return o.createElement(i,c({},f,{innerRef:function(n){e.getMenuListRef(n),t(n)},innerProps:{role:"listbox","aria-multiselectable":f.isMulti,id:e.getElementId("listbox")},isLoading:v,maxHeight:l,focusedOption:p}),E)})))}));return k||"fixed"===j?o.createElement(s,c({},f,{appendTo:k,controlElement:this.controlRef,menuPlacement:P,menuPosition:j}),R):R}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,r=t.isDisabled,a=t.isMulti,i=t.name,s=t.required,l=this.state.selectValue;if(s&&!this.hasValue()&&!r)return o.createElement(Td,{name:i,onFocus:this.onValueInputFocus});if(i&&!r){if(a){if(n){var c=l.map((function(t){return e.getOptionValue(t)})).join(n);return o.createElement("input",{name:i,type:"hidden",value:c})}var u=l.length>0?l.map((function(t,n){return o.createElement("input",{key:"i-".concat(n),name:i,type:"hidden",value:e.getOptionValue(t)})})):o.createElement("input",{name:i,type:"hidden",value:""});return o.createElement("div",null,u)}var d=l[0]?this.getOptionValue(l[0]):"";return o.createElement("input",{name:i,type:"hidden",value:d})}}},{key:"renderLiveRegion",value:function(){var e=this.commonProps,t=this.state,n=t.ariaSelection,r=t.focusedOption,a=t.focusedValue,i=t.isFocused,s=t.selectValue,l=this.getFocusableOptions();return o.createElement(sd,c({},e,{id:this.getElementId("live-region"),ariaSelection:n,focusedOption:r,focusedValue:a,isFocused:i,selectValue:s,focusableOptions:l,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var e=this.getComponents(),t=e.Control,n=e.IndicatorsContainer,r=e.SelectContainer,a=e.ValueContainer,i=this.props,s=i.className,l=i.id,u=i.isDisabled,d=i.menuIsOpen,f=this.state.isFocused,p=this.commonProps=this.getCommonProps();return o.createElement(r,c({},p,{className:s,innerProps:{id:l,onKeyDown:this.onKeyDown},isDisabled:u,isFocused:f}),this.renderLiveRegion(),o.createElement(t,c({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:u,isFocused:f,menuIsOpen:d}),o.createElement(a,c({},p,{isDisabled:u}),this.renderPlaceholderOrValue(),this.renderInput()),o.createElement(n,c({},p,{isDisabled:u}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],i=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,r=t.clearFocusValueOnUpdate,a=t.inputIsHiddenAfterUpdate,o=t.ariaSelection,i=t.isFocused,s=t.prevWasFocused,l=t.instancePrefix,c=e.options,u=e.value,d=e.menuIsOpen,f=e.inputValue,p=e.isMulti,m=su(u),h={};if(n&&(u!==n.value||c!==n.options||d!==n.menuIsOpen||f!==n.inputValue)){var g=d?function(e,t){return Vd(Yd(e,t))}(e,m):[],v=d?qd(Yd(e,m),"".concat(l,"-option")):[],b=r?function(e,t){var n=e.focusedValue,r=e.selectValue.indexOf(n);if(r>-1){if(t.indexOf(n)>-1)return n;if(r<t.length)return t[r]}return null}(t,m):null,y=function(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}(t,g);h={selectValue:m,focusedOption:y,focusedOptionId:Gd(v,y),focusableOptionsWithIds:v,focusedValue:b,clearFocusValueOnUpdate:!1}}var w=null!=a&&e!==n?{inputIsHidden:a,inputIsHiddenAfterUpdate:void 0}:{},x=o,P=i&&s;return i&&!P&&(x={value:xu(p,m,m[0]||null),options:m,action:"initial-input-focus"},P=!s),"initial-input-focus"===(null==o?void 0:o.action)&&(x=null),_c(_c(_c({},h),w),{},{prevProps:e,ariaSelection:x,prevWasFocused:P})}}],a&&Rc(r.prototype,a),i&&Rc(r,i),Object.defineProperty(r,"prototype",{writable:!1}),l}(o.Component);nf.defaultProps=Bd;var rf=(0,o.forwardRef)((function(e,t){var n=Tc(e);return o.createElement(nf,c({ref:t},n))})),af=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],of=function(){var e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,n=String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase(),r=String(t.getOptionValue(e)).toLowerCase(),a=String(t.getOptionLabel(e)).toLowerCase();return r===n||a===n},sf={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,t,n,r){return!(!e||t.some((function(t){return of(e,t,r)}))||n.some((function(t){return of(e,t,r)})))},getNewOptionData:function(e,t){return{label:t,value:e,__isNew__:!0}}};var lf=(0,o.forwardRef)((function(e,t){var n=function(e){var t=e.allowCreateWhileLoading,n=void 0!==t&&t,r=e.createOptionPosition,a=void 0===r?"last":r,i=e.formatCreateLabel,s=void 0===i?sf.formatCreateLabel:i,l=e.isValidNewOption,c=void 0===l?sf.isValidNewOption:l,u=e.getNewOptionData,d=void 0===u?sf.getNewOptionData:u,f=e.onCreateOption,p=e.options,m=void 0===p?[]:p,h=e.onChange,g=Nc(e,af),v=g.getOptionValue,b=void 0===v?Wd:v,y=g.getOptionLabel,w=void 0===y?$d:y,x=g.inputValue,P=g.isLoading,j=g.isMulti,k=g.value,S=g.name,C=(0,o.useMemo)((function(){return c(x,su(k),m,{getOptionValue:b,getOptionLabel:w})?d(x,s(x)):void 0}),[s,d,w,b,x,c,m,k]),M=(0,o.useMemo)((function(){return!n&&P||!C?m:"first"===a?[C].concat(Wc(m)):[].concat(Wc(m),[C])}),[n,a,P,C,m]),_=(0,o.useCallback)((function(e,t){if("select-option"!==t.action)return h(e,t);var n=Array.isArray(e)?e:[e];if(n[n.length-1]!==C)h(e,t);else if(f)f(x);else{var r=d(x,x),a={action:"create-option",name:S,option:r};h(xu(j,[].concat(Wc(su(k)),[r]),r),a)}}),[d,x,j,S,C,f,h,k]);return _c(_c({},g),{},{options:M,onChange:_})}(Tc(e));return o.createElement(nf,c({ref:t},n))})),cf=lf;const uf="clear-indicator",df=e=>{const{clearValue:n,innerProps:{ref:r,...a}}=e;return(0,t.jsx)("div",{className:uf,ref:"string"==typeof r?null:r,...a,onKeyDown:e=>{"Enter"===e.key&&(n(),e.stopPropagation())},role:"button",tabIndex:0,children:(0,t.jsx)($t.u,{className:`${uf}__icon`})})},ff=e=>{const{children:n,innerProps:r,selectProps:{customProps:{disableKeyDown:a,disableMouseDown:o}={}}={}}=e;return(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.Control,{...e,innerProps:{...r,onKeyDown:e=>{if(a){e.stopPropagation();const t=new CustomEvent("bypassKeyDown",{detail:e});document.dispatchEvent(t)}},onMouseDown:e=>{o||r.onMouseDown(e)}},children:n})})},pf="dropdown-indicator",mf=e=>{const{innerProps:{ref:n,...r}}=e;return(0,t.jsx)("button",{className:pf,ref:n,...r,onKeyDown:e=>{"Enter"===e.key&&(e.key=" ")},type:"button",children:(0,t.jsx)(Tt,{className:`${pf}__icon`})})},hf=e=>(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.Input,{...e,"aria-activedescendant":void 0})}),gf="multi-value";function vf(e,t){return"function"==typeof t?t(e):e.value}const bf=e=>{const{className:n,data:r,innerProps:a,isDisabled:o,selectProps:{customProps:{disableMouseDown:s}={},getOptionValue:l,isSortable:c}={}}=e,{attributes:u,isDragging:d,listeners:f,setNodeRef:p,transform:m}=ho({id:vf(r,l),disabled:!c}),h=[gf,n,!o&&c&&"draggable",d&&`${gf}--is-dragging`].filter(Boolean).join(" ");return(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.MultiValue,{...e,className:h,innerProps:{...c?{...u,...f}:{},...a,onMouseDown:e=>{s||e.stopPropagation()},ref:p,style:c?{transform:m,...u?.style}:{}}})})},yf="multi-value-label",wf=e=>{const{selectProps:{customProps:{draggableProps:n}={}}={}}=e;return(0,t.jsx)("div",{className:yf,children:(0,t.jsx)(nd.MultiValueLabel,{...e,innerProps:{className:`${yf}__text`,...n||{}}})})},xf="multi-value-remove",Pf=e=>{const{innerProps:{className:n,onClick:r,onTouchEnd:a}}=e,[o,s]=i().useState(!1),{t:l}=(0,Be.B)();return(0,t.jsxs)("button",{"aria-label":l("general:remove"),className:[xf,n].filter(Boolean).join(" "),onClick:e=>{s(!1),r(e)},onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onTouchEnd:a,type:"button",children:[(0,t.jsx)(Ft,{className:`${xf}__tooltip`,show:o,children:l("general:remove")}),(0,t.jsx)($t.u,{className:`${xf}__icon`})]})},jf="react-select--single-value",kf=e=>{const{children:n,className:r}=e;return(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.SingleValue,{...e,className:[jf,r].filter(Boolean).join(" "),children:n})})},Sf=e=>{const{selectProps:{customProps:n}={}}=e;return(0,t.jsx)("div",{className:"value-container",ref:n?.droppableRef,children:(0,t.jsx)(nd.ValueContainer,{...e})})},Cf=e=>{const{i18n:n,t:r}=(0,Be.B)(),[s,l]=i().useState(""),c=(0,o.useId)(),[u,d]=i().useState(!1);(0,o.useEffect)((()=>{d(!0)}),[]);const{className:f,components:p,customProps:m,disabled:h=!1,filterOption:g,getOptionValue:v,isClearable:b=!0,isCreatable:y,isLoading:w,isSearchable:x=!0,noOptionsMessage:P=(()=>r("general:noOptions")),numberOnly:j=!1,onChange:k,onMenuClose:S,onMenuOpen:C,options:M,placeholder:_=r("general:selectValue"),showError:O,value:E}=e,D=()=>r("general:loading")+"...",N=[f,"react-select",O&&"react-select--error"].filter(Boolean).join(" ");if(!u)return(0,t.jsx)(Ql.l,{height:"calc(var(--base) * 2 + 2px)"});if(!y)return(0,t.jsx)(rf,{captureMenuScroll:!0,customProps:m,isLoading:w,placeholder:(0,a.sC)(_,n),...e,className:N,classNamePrefix:"rs",components:{ClearIndicator:df,Control:ff,DropdownIndicator:mf,Input:hf,MultiValue:bf,MultiValueLabel:wf,MultiValueRemove:Pf,SingleValue:kf,ValueContainer:Sf,...p},filterOption:g,getOptionValue:v,instanceId:c,isClearable:b,isDisabled:h,isSearchable:x,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:P,onChange:k,onMenuClose:S,onMenuOpen:C,options:M,value:E});return(0,t.jsx)(cf,{captureMenuScroll:!0,isLoading:w,placeholder:(0,a.sC)(_,n),...e,className:N,classNamePrefix:"rs",components:{ClearIndicator:df,Control:ff,DropdownIndicator:mf,Input:hf,MultiValue:bf,MultiValueLabel:wf,MultiValueRemove:Pf,SingleValue:kf,ValueContainer:Sf,...p},filterOption:g,inputValue:s,instanceId:c,isClearable:b,isDisabled:h,isSearchable:x,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:P,onChange:k,onInputChange:e=>l(e),onKeyDown:e=>{if(!0===j){const t=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],n=!/\D/.test(e.key),r=t.includes(e.key);if(!n&&!r)return void e.preventDefault()}var t;if(E&&s&&""!==s.trim()&&(!g||g(null,s)))switch(e.key){case"Enter":case"Tab":k([...E,(t=s,{label:t,value:t})]),l(""),e.preventDefault()}},onMenuClose:S,onMenuOpen:C,options:M,value:E})},Mf=e=>{const{getOptionValue:n,onChange:r,value:a}=e;let o=[];return a&&(o=(Array.isArray(a)?a:[a]).map((e=>vf(e,n)))),(0,t.jsx)(vo,{className:"react-select-container",ids:o,onDragEnd:({moveFromIndex:e,moveToIndex:t})=>{let n=a;a&&Array.isArray(a)&&(n=Xa(a,e,t)),r(n)},children:(0,t.jsx)(Cf,{...e})})},_f=e=>{const{isMulti:n,isSortable:r}=e;return n&&r?(0,t.jsx)(Mf,{...e}):(0,t.jsx)(Cf,{...e})},Of=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,hasMany:p=!1,label:m,labelProps:h,max:g=1/0,maxRows:v=1/0,min:b=-1/0,onChange:y,path:w,placeholder:x,readOnly:P,required:j,step:k=1,style:S,validate:C,width:M}=e,{i18n:_,t:O}=(0,Be.B)(),E=(0,o.useCallback)(((e,t)=>{if("function"==typeof C)return C(e,{...t,max:g,min:b,required:j})}),[C,b,g,j]),{path:D,readOnly:N}=Po(),{formInitializing:A,formProcessing:T,path:R,setValue:I,showError:L,value:$}=hs({path:D??w??n,validate:E}),W=P||N||T||A,F=(0,o.useCallback)((e=>{const t=parseFloat(e.target.value);let n=t;Number.isNaN(t)&&(n=void 0),"function"==typeof y&&y(n),I(n)}),[y,I]),[z,B]=(0,o.useState)([]),H=(0,o.useCallback)((e=>{if(!W){let t;t=e?Array.isArray(e)?e.map((e=>Number(e.value?.value||e.value))):[Number(e.value?.value||e.value)]:[],I(t)}}),[W,I]);return(0,o.useEffect)((()=>{p&&Array.isArray($)&&B($.map(((e,t)=>({id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}}))))}),[$,p]),(0,t.jsxs)("div",{className:[Ms,"number",u,L&&"error",W&&"read-only",p&&"has-many"].filter(Boolean).join(" "),style:{...S,width:M},children:[(0,t.jsx)(Ns,{CustomLabel:c,label:m,required:j,...h||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:l,path:R,...f||{}}),p?(0,t.jsx)(_f,{className:`field-${R.replace(/\./g,"__")}`,disabled:W,filterOption:(e,t)=>{const n=Array.isArray($)&&$.length>=v;return(0,jc.isNumber)(t)&&!n},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray($)&&$.length>=v?O("validation:limitReached",{max:v,value:$.length+1}):null,onChange:H,options:[],placeholder:O("general:enterAValue"),showError:L,value:z}):(0,t.jsxs)("div",{children:[i,(0,t.jsx)("input",{disabled:W,id:`field-${R.replace(/\./g,"__")}`,max:g,min:b,name:R,onChange:F,onWheel:e=>{e.target.blur()},placeholder:(0,a.sC)(x,_),step:k,type:"number",value:"number"==typeof $?$:""}),r]}),void 0!==s?s:(0,t.jsx)(ks,{...d||{}})]})]})})),Ef=vs((e=>{const{name:n,CustomError:r,CustomLabel:a,autoComplete:i,className:s,disabled:l,errorProps:c,label:u,labelProps:d,path:f,required:p,style:m,validate:h,width:g}=e,v=(0,o.useCallback)(((e,t)=>{if("function"==typeof h)return h(e,{...t,required:p})}),[h,p]),{formInitializing:b,formProcessing:y,path:w,setValue:x,showError:P,value:j}=hs({path:f||n,validate:v}),k=l||b||y;return(0,t.jsxs)("div",{className:[Ms,"password",s,P&&"error",k&&"read-only"].filter(Boolean).join(" "),style:{...m,width:g},children:[(0,t.jsx)(Ns,{CustomLabel:a,label:u,required:p,...d||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:r,path:w,...c||{}}),(0,t.jsx)("input",{autoComplete:i,disabled:k,id:`field-${w.replace(/\./g,"__")}`,name:w,onChange:x,type:"password",value:j||""})]})]})})),Df="point",Nf=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,label:p,labelProps:m,path:h,placeholder:g,readOnly:v,required:b,step:y,style:w,validate:x,width:P}=e,{i18n:j,t:k}=(0,Be.B)(),S=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:b})}),[x,b]),{path:C,readOnly:M}=Po(),_=v||M,{path:O,setValue:E,showError:D,value:N=[null,null]}=hs({path:C??h??n,validate:S}),A=(0,o.useCallback)(((e,t)=>{let n=parseFloat(e.target.value);Number.isNaN(n)&&(n=e.target.value);const r=[...N];r[t]=n,E(r)}),[E,N]),T=e=>{const t=k("longitude"===e?"fields:longitude":"fields:latitude"),n=p?(0,a.sC)(p,j):"";return{...m,label:`${n}${n?" - ":""}${t}`}};return(0,t.jsxs)("div",{className:[Ms,Df,u,D&&"error",_&&"read-only"].filter(Boolean).join(" "),style:{...w,width:P},children:[(0,t.jsx)(Cs,{CustomError:l,path:O,...f||{}}),(0,t.jsxs)("ul",{className:`${Df}__wrap`,children:[(0,t.jsxs)("li",{children:[void 0!==c?c:(0,t.jsx)(Ns,{...T("longitude")}),(0,t.jsxs)("div",{className:"input-wrapper",children:[i,(0,t.jsx)("input",{disabled:_,id:`field-longitude-${O.replace(/\./g,"__")}`,name:`${O}.longitude`,onChange:e=>A(e,0),placeholder:(0,a.sC)(g,j),step:y,type:"number",value:N&&"number"==typeof N[0]?N[0]:""}),r]})]}),(0,t.jsxs)("li",{children:[void 0!==c?c:(0,t.jsx)(Ns,{...T("latitude")}),(0,t.jsxs)("div",{className:"input-wrapper",children:[i,(0,t.jsx)("input",{disabled:_,id:`field-latitude-${O.replace(/\./g,"__")}`,name:`${O}.latitude`,onChange:e=>A(e,1),placeholder:(0,a.sC)(g,j),step:y,type:"number",value:N&&"number"==typeof N[1]?N[1]:""}),r]})]})]}),void 0!==s?s:(0,t.jsx)(ks,{...d||{}})]})})),Af="radio-input",Tf=e=>{const{isSelected:n,onChange:r,option:o,path:i,readOnly:s,uuid:l}=e,{i18n:c}=(0,Be.B)(),u=ws(),d=`field-${i}-${o.value}${u>1?`-${u}`:""}${l?`-${l}`:""}`;return(0,t.jsx)("label",{htmlFor:d,children:(0,t.jsxs)("div",{className:[Af,n&&`${Af}--is-selected`].filter(Boolean).join(" "),children:[(0,t.jsx)("input",{checked:n,disabled:s,id:d,name:i,onChange:()=>"function"==typeof r?r(o.value):null,type:"radio"}),(0,t.jsx)("span",{className:`${Af}__styled-radio`}),(0,t.jsx)("span",{className:`${Af}__label`,children:(0,a.sC)(o.label,c)})]})})},Rf="radio-group",If=vs((e=>{const{name:n,CustomDescription:r,CustomError:a,CustomLabel:i,className:s,descriptionProps:l,errorProps:c,label:u,labelProps:d,layout:f="horizontal",onChange:p,options:m=[],path:h,readOnly:g,required:v,style:b,validate:y,value:w,width:x}=e,{uuid:P}=Lo(),j=(0,o.useCallback)(((e,t)=>{if("function"==typeof y)return y(e,{...t,options:m,required:v})}),[y,m,v]),{path:k,readOnly:S}=Po(),{formInitializing:C,formProcessing:M,path:_,setValue:O,showError:E,value:D}=hs({path:k??h??n,validate:j}),N=g||S||M||C,A=D||w;return(0,t.jsxs)("div",{className:[Ms,Rf,s,`${Rf}--layout-${f}`,E&&"error",N&&`${Rf}--read-only`].filter(Boolean).join(" "),style:{...b,width:x},children:[(0,t.jsx)(Ns,{CustomLabel:i,label:u,required:v,...d||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:a,path:_,...c||{}}),(0,t.jsx)("ul",{className:`${Rf}--group`,id:`field-${_.replace(/\./g,"__")}`,children:m.map((e=>{let n="";n=(0,jc.optionIsObject)(e)?e.value:e;const r=String(n)===String(A),a=`field-${_}-${n}${P?`-${P}`:""}`;return(0,t.jsx)("li",{children:(0,t.jsx)(Tf,{id:a,isSelected:r,onChange:()=>{"function"==typeof p&&p(n),N||O(n)},option:(0,jc.optionIsObject)(e)?e:{label:e,value:e},path:_,readOnly:N,uuid:P})},`${_} - ${n}`)}))}),void 0!==r?r:(0,t.jsx)(ks,{...l||{}})]})]})})),Lf=e=>{const t=Ut(),[n]=(0,o.useState)((()=>{if(e){return("string"==typeof e?[e]:e).map((e=>t.collections.find((t=>t.slug===e))))}return[]}));return n},$f=(0,o.createContext)({}),Wf=({children:e,initialParams:n})=>{const[r,a]=i().useReducer(((e,t)=>{const n={...e};return"SET"===t.type?(null===t.params?.uploadEdits&&n?.uploadEdits&&delete n.uploadEdits,null===t.params?.uploadEdits?.crop&&n?.uploadEdits?.crop&&delete n.uploadEdits.crop,null===t.params?.uploadEdits?.focalPoint&&n?.uploadEdits?.focalPoint&&delete n.uploadEdits.focalPoint,{...n,...t.params}):e}),n||{}),o=ls();return i().useEffect((()=>{o?.code&&a({type:"SET",params:{locale:o.code}})}),[o.code]),(0,t.jsx)($f.Provider,{value:{dispatchFormQueryParams:a,formQueryParams:r},children:e})},Ff=()=>(0,o.useContext)($f),zf="id-label",Bf=({id:e,className:n,prefix:r="ID:"})=>(0,t.jsxs)("div",{className:[zf,n].filter(Boolean).join(" "),title:e,children:[r," ",e]}),Hf="render-title",Yf=e=>{const{className:n,element:r="h1",fallback:a,title:i}=e,{id:s,isInitializing:l,title:c}=us(),u=i||c||a,d=u===s,f=r,p=(0,t.jsx)(o.Fragment,{children:" "});return(0,t.jsx)(f,{className:[n,Hf,d&&`${Hf}--has-id`].filter(Boolean).join(" "),title:u,children:l?p:(0,t.jsx)(o.Fragment,{children:d?(0,t.jsx)(Bf,{className:`${Hf}__id`,id:s}):u||p})})},Vf=({id:e,Header:n,collectionSlug:r,drawerSlug:a,onSave:s})=>{const l=Ut(),{routes:{api:c},serverURL:u}=l,{closeModal:d,modalState:f,toggleModal:p}=O(),m=ls(),{t:h}=(0,Be.B)(),[g,v]=(0,o.useState)(e),[b,y]=(0,o.useState)(!1),[w]=Lf(r),{formQueryParams:x}=Ff(),P=ge().stringify(x),{componentMap:j}=wn(),{Edit:k}=j[""+(r?"collections":"globals")][r],S=Boolean(g),C=g?`${u}${c}/${r}/${g}${m?.code?`?locale=${m.code}`:""}`:null,M=`${u}${c}/${r}${S?`/${g}`:""}?${P}`;(0,o.useEffect)((()=>{y(Boolean(f[a]?.isOpen))}),[f,a]);const _=i().useCallback((e=>{b&&(d(a),Ct.error(e.errors?.[0].message||h("error:unspecific")))}),[d,a,b,h]),E=(0,o.useCallback)((e=>{v(e.doc.id),"function"==typeof s&&s({...e,collectionConfig:w})}),[s,w]);return(0,t.jsx)(ds,{BeforeDocument:(0,t.jsxs)(bl,{className:`${Uf}__header`,children:[(0,t.jsxs)("div",{className:`${Uf}__header-content`,children:[(0,t.jsx)("h2",{className:`${Uf}__header-text`,children:n||(0,t.jsx)(Yf,{element:"span"})}),(0,t.jsx)("button",{"aria-label":h("general:close"),className:`${Uf}__header-close`,onClick:()=>p(a),type:"button",children:(0,t.jsx)($t.u,{})})]}),(0,t.jsx)(qf,{})]}),action:M,apiURL:C,collectionSlug:w.slug,disableActions:!0,disableLeaveWithoutSaving:!0,id:g,isEditing:S,onLoadError:_,onSave:E,children:k})},qf=()=>{const{id:e,title:n}=us();return e&&e!==n?(0,t.jsx)(Bf,{id:e.toString()}):null},Uf="doc-drawer",Gf=({id:e,children:n,className:r,collectionSlug:o,disabled:i,drawerSlug:s,...l})=>{const{i18n:c,t:u}=(0,Be.B)(),[d]=Lf(o);return(0,t.jsx)(wl,{"aria-label":u(e?"general:editLabel":"fields:addNewLabel",{label:(0,a.sC)(d.labels.singular,c)}),className:[r,`${Uf}__toggler`].filter(Boolean).join(" "),disabled:i,slug:s,...l,children:n})},Kf=e=>{const{drawerSlug:n}=e;return(0,t.jsx)(xl,{Header:null,className:Uf,gutter:!1,slug:n,children:(0,t.jsx)(Vf,{...e})})},Xf=({id:e,collectionSlug:n})=>{const r=ws(),a=(0,o.useId)(),{closeModal:i,modalState:s,openModal:l,toggleModal:c}=O(),[u,d]=(0,o.useState)(!1),f=(({id:e,collectionSlug:t,depth:n,uuid:r})=>`doc-drawer_${t}_${n}${e?`_${e}`:""}_${r}`)({id:e,collectionSlug:n,depth:r,uuid:a});(0,o.useEffect)((()=>{d(Boolean(s[f]?.isOpen))}),[s,f]);const p=(0,o.useCallback)((()=>{c(f)}),[c,f]),m=(0,o.useCallback)((()=>{i(f)}),[i,f]),h=(0,o.useCallback)((()=>{l(f)}),[l,f]);return[(0,o.useMemo)((()=>t=>(0,o.createElement)(Kf,{...t,collectionSlug:n,drawerSlug:f,id:e,key:f})),[e,f,n]),(0,o.useMemo)((()=>r=>(0,t.jsx)(Gf,{...r,collectionSlug:n,drawerSlug:f,id:e})),[e,f,n]),(0,o.useMemo)((()=>({closeDrawer:m,drawerDepth:r,drawerSlug:f,isDrawerOpen:u,openDrawer:h,toggleDrawer:p})),[r,f,u,p,m,h])]},Qf="relationship-add-new",Jf=({hasMany:e,path:n,relationTo:r,setValue:i,value:s})=>{const l=Lf(r),{permissions:c}=sn(),[u,d]=(0,o.useState)(!1),[f,p]=(0,o.useState)(),m=l.length>1,[h,g]=(0,o.useState)((()=>m?void 0:l[0])),[v,b]=(0,o.useState)(!1),{i18n:y,t:w}=(0,Be.B)(),[x,P]=(0,o.useState)(!1),[j,k,{isDrawerOpen:S,toggleDrawer:C}]=Xf({collectionSlug:h?.slug}),M=(0,o.useCallback)((({doc:t,operation:n})=>{if("create"===n){const n=Array.isArray(r)?{relationTo:h?.slug,value:t.id}:t.id,a=Array.isArray(r)&&Array.isArray(s)?!s.some((e=>e&&"object"==typeof e&&e.value===t.id)):s!==t.id;a&&i(e?[...Array.isArray(s)?s:[],n]:n),p(void 0)}}),[r,h,e,i,s]),_=(0,o.useCallback)((e=>{b(e)}),[]);return(0,o.useEffect)((()=>{c&&(1===l.length?d(c.collections[l[0]?.slug]?.create?.permission):d(l.some((e=>c.collections[e?.slug]?.create?.permission))))}),[c,l]),(0,o.useEffect)((()=>{m&&f&&g(l.find((e=>e?.slug===f)))}),[f,m,l]),(0,o.useEffect)((()=>{m&&h&&(C(),p(void 0))}),[C,m,h]),(0,o.useEffect)((()=>{m&&!S&&g(void 0)}),[S,m]),u?(0,t.jsxs)("div",{className:Qf,id:`${n}-add-new`,children:[1===l.length&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)(k,{className:`${Qf}__add-button`,onClick:()=>P(!1),onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:[(0,t.jsx)(Ft,{className:`${Qf}__tooltip`,show:x,children:w("fields:addNewLabel",{label:(0,a.sC)(l[0].labels.singular,y)})}),(0,t.jsx)(Lt,{})]}),(0,t.jsx)(j,{onSave:M})]}),l.length>1&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Ys,{button:(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Qf}__add-button`,tooltip:v?void 0:w("fields:addNew"),children:(0,t.jsx)(Lt,{})}),buttonType:"custom",horizontalAlign:"center",onToggleOpen:_,render:({close:e})=>(0,t.jsx)(Us,{children:l.map((n=>c.collections[n?.slug].create.permission?(0,t.jsx)(Gs,{className:`${Qf}__relation-button--${n?.slug}`,onClick:()=>{e(),p(n?.slug)},children:(0,a.sC)(n?.labels?.singular,y)},n?.slug):null))}),size:"medium"}),h&&c.collections[h?.slug]?.create?.permission&&(0,t.jsx)(j,{onSave:M})]})]}):null},Zf=({hasMany:e,relationTo:t,value:n})=>{const r=Array.isArray(t);let a;if(a=Array.isArray(t)?t.reduce(((e,t)=>({...e,[t]:[]})),{}):{[t]:[]},null===n)return a;const o=(e,t)=>{"string"!=typeof t&&"number"!=typeof t||"string"!=typeof e||(a[e]?a[e].push(t):a[e]=[t])};return e&&Array.isArray(n)?n.forEach((e=>{r&&"object"==typeof e&&"relationTo"in e&&"value"in e&&o(e.relationTo,e.value),r||"string"!=typeof t||o(t,e)})):r&&Array.isArray(t)?"object"==typeof n&&"relationTo"in n&&"value"in n&&o(n.relationTo,n.value):o(t,n),a},ep=e=>e.reduce(((e,t)=>t.options?[...e,...ep(t.options)]:[...e,{id:t.value,relationTo:t.relationTo}]),[]),tp=e=>e.sort(((e,t)=>"function"==typeof e?.label?.localeCompare&&"function"==typeof t?.label?.localeCompare?e.label.localeCompare(t.label):0)),np=(e,t)=>{switch(t.type){case"CLEAR":return[];case"UPDATE":{const{collection:n,config:r,doc:a,i18n:o}=t,i=n.slug,s=[...e],l=Qi({collectionConfig:n,data:a,dateFormat:r.admin.dateFormat,fallback:`${o.t("general:untitled")} - ID: ${a.id}`,i18n:o}),c=s.find((e=>e.label===n.labels.plural)),u=c?.options?.find((e=>e.value===a.id));return u&&(u.label=l,u.relationTo=i),s}case"ADD":{const{collection:n,config:r,docs:o,i18n:i,ids:s=[],sort:l}=t,c=n.slug,u=ep(e),d=[...e],f=d.find((e=>e.label===n.labels.plural)),p=o.reduce(((e,t)=>{if(0===u.filter((e=>e.id===t.id&&e.relationTo===c)).length){u.push({id:t.id,relationTo:c});const a=Qi({collectionConfig:n,data:t,dateFormat:r.admin.dateFormat,fallback:`${i.t("general:untitled")} - ID: ${t.id}`,i18n:i});return[...e,{label:a,relationTo:c,value:t.id}]}return e}),[]);if(s.forEach((e=>{0===u.filter((t=>t.id===e&&t.relationTo===c)).length&&(u.push({id:e,relationTo:c}),p.push({label:`${i.t("general:untitled")} - ID: ${e}`,relationTo:c,value:e}))})),f){const e=[...f.options,...p];f.options=l?tp(e):e}else d.push({label:(0,a.sC)(n.labels.plural,i),options:l?tp(p):p});return d}default:return e}},rp="relationship--multi-value-label",ap=e=>{const{data:{label:n,relationTo:r,value:a},selectProps:{customProps:{draggableProps:i,setDrawerIsOpen:s}={}}={}}=e,{permissions:l}=sn(),[c,u]=(0,o.useState)(!1),{t:d}=(0,Be.B)(),f=Boolean(l?.collections?.[r]?.read?.permission),[p,m,{isDrawerOpen:h}]=Xf({id:a?.toString(),collectionSlug:r});return(0,o.useEffect)((()=>{"function"==typeof s&&s(h)}),[h,s]),(0,t.jsxs)("div",{className:rp,children:[(0,t.jsx)("div",{className:`${rp}__content`,children:(0,t.jsx)(nd.MultiValueLabel,{...e,innerProps:{className:`${rp}__text`,...i||{}}})}),r&&f&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)(m,{"aria-label":`Edit ${n}`,className:`${rp}__drawer-toggler`,onClick:()=>u(!1),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onTouchEnd:e=>e.stopPropagation(),children:[(0,t.jsx)(Ft,{className:`${rp}__tooltip`,show:c,children:d("general:editLabel",{label:""})}),(0,t.jsx)(Rt,{className:`${rp}__icon`})]}),(0,t.jsx)(p,{onSave:null})]})]})},op="relationship--single-value",ip=e=>{const{children:n,data:{label:r,relationTo:a,value:s},selectProps:{customProps:{onSave:l,setDrawerIsOpen:c}={}}={}}=e,[u,d]=(0,o.useState)(!1),{t:f}=(0,Be.B)(),{permissions:p}=sn(),m=Boolean(p?.collections?.[a]?.read?.permission),[h,g,{isDrawerOpen:v}]=Xf({id:s.toString(),collectionSlug:a});return(0,o.useEffect)((()=>{"function"==typeof c&&c(v)}),[v,c]),(0,t.jsx)(i().Fragment,{children:(0,t.jsxs)(nd.SingleValue,{...e,className:op,children:[(0,t.jsx)("div",{className:`${op}__label`,children:(0,t.jsxs)("div",{className:`${op}__label-text`,children:[(0,t.jsx)("div",{className:`${op}__text`,children:n}),a&&m&&(0,t.jsx)(o.Fragment,{children:(0,t.jsxs)(g,{"aria-label":f("general:editLabel",{label:r}),className:`${op}__drawer-toggler`,onClick:()=>d(!1),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onTouchEnd:e=>e.stopPropagation(),children:[(0,t.jsx)(Ft,{className:`${op}__tooltip`,show:u,children:f("general:edit")}),(0,t.jsx)(Rt,{})]})})]})}),a&&m&&(0,t.jsx)(h,{onSave:l})]})})},sp="relationship",lp=vs((e=>{const{name:n,CustomDescription:r,CustomError:a,CustomLabel:i,allowCreate:s=!0,className:l,descriptionProps:c,errorProps:u,hasMany:d,isSortable:f=!0,label:p,labelProps:m,path:h,readOnly:g,relationTo:v,required:b,sortOptions:y,style:w,validate:x,width:P}=e,j=Ut(),{collections:k,routes:{api:S},serverURL:C}=j,{i18n:M,t:_}=(0,Be.B)(),{permissions:O}=sn(),{code:E}=ls(),D=Array.isArray(v),[N,A]=(0,o.useReducer)(np,[]),[T,R]=(0,o.useState)(-1),[I,L]=(0,o.useState)({}),[$,W]=(0,o.useState)(""),[F,z]=(0,o.useState)(""),[B,H]=(0,o.useState)(!1),[Y,V]=(0,o.useState)(!1),q=(0,o.useRef)(!1),U=(0,o.useRef)(!1),G=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:b})}),[x,b]),{path:K,readOnly:X}=Po(),{filterOptions:Q,formInitializing:J,formProcessing:Z,initialValue:ee,path:te,setValue:ne,showError:re,value:ae}=hs({path:K??h??n,validate:G}),oe=g||X||J,ie=(0,o.useRef)(ae);ie.current=ae;const[se,le]=(0,o.useState)(!1),ce=(0,o.useCallback)((async({lastFullyLoadedRelation:e,lastLoadedPage:t,onSuccess:n,search:r,sort:a,value:o})=>{if(!O)return;const i=void 0!==e?e:-1,s=Array.isArray(v)?v:[v],l=-1===i?s:s.slice(i+1);let c=0;const u=Zf({hasMany:d,relationTo:v,value:o});$||(await l.reduce((async(e,n)=>{const o=Q?.[n];let i;if(i=F!==r?1:t[n]+1,await e,!1===o)return R(s.indexOf(n)),Promise.resolve();if(c<10){const e=k.find((e=>e.slug===n)),t=e?.admin?.useAsTitle||"id";let l=e?.defaultSort||"id";"string"==typeof y?l=y:y?.[n]&&(l=y[n]);const d={depth:0,draft:!0,limit:10,locale:E,page:i,sort:l,where:{and:[{id:{not_in:u[n]}}]}};r&&d.where.and.push({[t]:{like:r}}),o&&"boolean"!=typeof o&&d.where.and.push(o);const f=await fetch(`${C}${S}/${n}`,{body:ge().stringify(d),credentials:"include",headers:{"Accept-Language":M.language,"Content-Type":"application/x-www-form-urlencoded","X-HTTP-Method-Override":"GET"},method:"POST"});if(f.ok){const t=await f.json();L((e=>({...e,[n]:i}))),t.nextPage||R(s.indexOf(n)),t.docs.length>0&&(c+=t.docs.length,A({type:"ADD",collection:e,config:j,docs:t.docs,i18n:M,sort:a}))}else 403===f.status?(R(s.indexOf(n)),A({type:"ADD",collection:e,config:j,docs:[],i18n:M,ids:u[n],sort:a})):W(_("error:unspecific"))}}),Promise.resolve()),"function"==typeof n&&n())}),[O,v,d,$,F,k,E,Q,C,y,S,M,j,_]),ue=((e,t)=>{const n=(0,o.useRef)(void 0);return(0,o.useCallback)(((...r)=>{clearTimeout(n.current),n.current=setTimeout((()=>{clearTimeout(n.current),e(...r)}),t)}),[e,t])})(((e,t)=>{ce({lastLoadedPage:{},search:e,sort:!0,value:t}),z(e)}),300),de=(0,o.useCallback)(((e,t)=>{F!==e&&(L({}),ue(e,t,""!==e))}),[F,ue]);(0,o.useEffect)((()=>{const e=Zf({hasMany:d,relationTo:v,value:ae});Object.entries(e).reduce((async(e,[t,n])=>{await e;const r=n.filter((e=>!N.find((n=>n?.options?.find((n=>n.value===e&&n.relationTo===t))))));if(r.length>0){const e={depth:0,draft:!0,limit:r.length,locale:E,where:{id:{in:r}}};if(!$){const n=await fetch(`${C}${S}/${t}`,{body:ge().stringify(e),credentials:"include",headers:{"Accept-Language":M.language,"Content-Type":"application/x-www-form-urlencoded","X-HTTP-Method-Override":"GET"},method:"POST"}),a=k.find((e=>e.slug===t));let o=[];if(n.ok){o=(await n.json()).docs}A({type:"ADD",collection:a,config:j,docs:o,i18n:M,ids:r,sort:!0})}}}),Promise.resolve())}),[N,ae,d,$,k,D,C,S,M,v,E,j]),(0,o.useEffect)((()=>{const e=(Array.isArray(v)?v:[v]).reduce(((e,t)=>{const n=k.find((e=>e.slug===t));return"id"===(n?.admin?.useAsTitle||"id")&&e}),!0);V(!e)}),[v,k]),(0,o.useEffect)((()=>{U.current&&q.current&&(H(!0),ce({lastLoadedPage:{},onSuccess:()=>{U.current=!0,H(!1)},value:ie.current})),A({type:"CLEAR"}),R(-1),L({}),U.current=!1}),[v,Q,E,q,ce,ie,U,te]);const fe=(0,o.useCallback)((e=>{A({type:"UPDATE",collection:e.collectionConfig,config:j,doc:e.doc,i18n:M})}),[M,j]),pe=(0,o.useCallback)(((e,t)=>{if(!t)return!0;const n=(0,jc.wordBoundariesRegex)(t||"");let r=e.label;for(;r.length>250;){const e=r.indexOf(" ",t.length);if(n.test(r.slice(0,-1===e?t.length:e+1)))return!0;r=r.slice(-1===e?t.length:e+1)}return n.test(r.slice(-250))}),[]),me=(({options:e,value:t})=>{if(t||"number"==typeof t){if(Array.isArray(t))return t.map((t=>{let n;return e.forEach((e=>{n||(n=e.options.find((e=>"object"==typeof t?e.value===t.value&&e.relationTo===t.relationTo:t===e.value)))})),n}));let n;return e.forEach((e=>{n||(n=e.options.find((e=>"object"==typeof t?e.value===t.value&&e.relationTo===t.relationTo:t===e.value)))})),n}})({options:N,value:ae});return Array.isArray(me)||"null"!==me?.value||(me.value=null),(0,t.jsxs)("div",{className:[Ms,sp,l,re&&"error",$&&"error-loading",oe&&`${sp}--read-only`].filter(Boolean).join(" "),id:`field-${te.replace(/\./g,"__")}`,style:{...w,width:P},children:[(0,t.jsx)(Ns,{CustomLabel:i,label:p,required:b,...m||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:a,path:te,...u||{}}),!$&&(0,t.jsxs)("div",{className:`${sp}__wrap`,children:[(0,t.jsx)(_f,{backspaceRemovesValue:!se,components:{MultiValueLabel:ap,SingleValue:ip},customProps:{disableKeyDown:se,disableMouseDown:se,onSave:fe,setDrawerIsOpen:le},disabled:oe||Z||se,filterOption:Y?pe:void 0,getOptionValue:e=>{if(e)return d&&Array.isArray(v)?`${e.relationTo}_${e.value}`:e.value},isLoading:B,isMulti:d,isSortable:f,onChange:oe?void 0:e=>{null===e?ne(d?[]:null):d&&Array.isArray(e)?ne(e?e.map((e=>D?{relationTo:e.relationTo,value:e.value}:e.value)):null):D&&!Array.isArray(e)?ne({relationTo:e.relationTo,value:e.value}):Array.isArray(e)||ne(e.value)},onInputChange:e=>de(e,ae),onMenuClose:()=>{q.current=!1},onMenuOpen:()=>{q.current=!0,U.current||(H(!0),ce({lastLoadedPage:{},onSuccess:()=>{U.current=!0,H(!1)},value:ee}))},onMenuScrollToBottom:()=>{ce({lastFullyLoadedRelation:T,lastLoadedPage:I,search:F,sort:!1,value:ee})},options:N,showError:re,value:me??null}),!oe&&s&&(0,t.jsx)(Jf,{dispatchOptions:A,hasMany:d,options:N,path:te,relationTo:v,setValue:ne,value:ae})]}),$&&(0,t.jsx)("div",{className:`${sp}__error-loading`,children:$}),void 0!==r?r:(0,t.jsx)(ks,{...c||{}})]})]})})),cp="row",up=vs((e=>{const{className:n,fieldMap:r,forceRender:a=!1}=e,{indexPath:o,path:i,readOnly:s,schemaPath:l,siblingPermissions:c}=Po();return(0,t.jsx)(mc,{children:(0,t.jsx)("div",{className:[Ms,cp,n].filter(Boolean).join(" "),children:(0,t.jsx)(ll,{fieldMap:r,forceRender:a,path:i,readOnly:s,schemaPath:l,className:`${cp}__fields`,fieldMap:r,forceRender:a,indexPath:o,margins:!1,permissions:c})})})})),dp=e=>{const{AfterInput:n,BeforeInput:r,CustomDescription:o,CustomError:i,CustomLabel:s,className:l,descriptionProps:c,errorProps:u,hasMany:d=!1,isClearable:f=!0,isSortable:p=!0,label:m,labelProps:h,onChange:g,options:v,path:b,readOnly:y,required:w,showError:x,style:P,value:j,width:k}=e,{i18n:S}=(0,Be.B)();let C;if(d&&Array.isArray(j))C=j.map((e=>{const t=v.find((t=>t.value===e));return{label:t?(0,a.sC)(t.label,S):e,value:t?.value??e}}));else if(j){const e=v.find((e=>e.value===j));C={label:e?(0,a.sC)(e.label,S):j,value:e?.value??j}}return(0,t.jsxs)("div",{className:[Ms,"select",l,x&&"error",y&&"read-only"].filter(Boolean).join(" "),id:`field-${b.replace(/\./g,"__")}`,style:{...P,width:k},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:m,required:w,...h||{}}),(0,t.jsx)(Cs,{CustomError:i,path:b,...u||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:i,path:b,...u||{}}),r,(0,t.jsx)(_f,{disabled:y,isClearable:f,isMulti:d,isSortable:p,onChange:g,options:v.map((e=>({...e,label:(0,a.sC)(e.label,S)}))),showError:x,value:C}),n]}),void 0!==o?o:(0,t.jsx)(ks,{...c||{}})]})},fp=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,hasMany:p=!1,isClearable:m=!0,isSortable:h=!0,label:g,labelProps:v,onChange:b,options:y=[],path:w,readOnly:x,required:P,style:j,validate:k,width:S}=e,C=i().useMemo((()=>(e=>e.map((e=>"object"!=typeof e||!e.value&&""!==e.value?{label:e,value:e}:e)))(y)),[y]),M=(0,o.useCallback)(((e,t)=>{if("function"==typeof k)return k(e,{...t,hasMany:p,options:C,required:P})}),[k,P,p,C]),{path:_,readOnly:O}=Po(),{formInitializing:E,formProcessing:D,path:N,setValue:A,showError:T,value:R}=hs({path:_??w??n,validate:M}),I=x||O||D||E,L=(0,o.useCallback)((e=>{if(!I){let t=null;e&&p?t=Array.isArray(e)?e.map((e=>e.value)):[]:e&&!Array.isArray(e)&&(t=e.value),"function"==typeof b&&b(t),A(t)}}),[I,p,A,b]);return(0,t.jsx)(dp,{AfterInput:r,BeforeInput:a,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,hasMany:p,isClearable:m,isSortable:h,label:g,labelProps:v,name:n,onChange:L,options:C,path:N,readOnly:I,required:P,showError:T,style:j,value:R,width:S})})),pp="tabs-field__tab-button",mp=({isActive:e,parentPath:n,setIsActive:r,tab:s})=>{const{name:l,label:c}=s,{i18n:u}=(0,Be.B)(),[d,f]=(0,o.useState)(void 0),p="name"in s,m=`${n?`${n}.`:""}${"name"in s?l:""}`,h=d>0;return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(ac,{fieldMap:s.fieldMap,path:m,setErrorCount:f}),(0,t.jsxs)("button",{className:[pp,h&&`${pp}--has-error`,e&&`${pp}--active`].filter(Boolean).join(" "),onClick:r,type:"button",children:[c?(0,a.sC)(c,u):p&&l,h&&(0,t.jsx)(yo,{count:d,i18n:u})]})]})},hp="tabs-field",gp=vs((e=>{const{name:n,CustomDescription:r,className:s,descriptionProps:l,forceRender:c=!1,path:u,readOnly:d,tabs:f=[]}=e,{indexPath:p,path:m,readOnly:h,schemaPath:g,siblingPermissions:v}=Po(),b=d||h,y=m??u??n,{getPreference:w,setPreference:x}=dn(),{preferencesKey:P}=us(),{i18n:j}=(0,Be.B)(),{isWithinCollapsible:k}=tl(),[S,C]=(0,o.useState)(0),M=`tabs-${p}`;(0,o.useEffect)((()=>{if(P){(async()=>{const e=await w(P);C((y?e?.fields?.[y]?.tabIndex:e?.fields?.[M]?.tabIndex)||0)})()}}),[y,w,P,M]);const _=(0,o.useCallback)((async e=>{C(e);const t=await w(P);P&&x(P,{...t,...y?{fields:{...t?.fields||{},[y]:{...t?.fields?.[y],tabIndex:e}}}:{fields:{...t?.fields,[M]:{...t?.fields?.[M],tabIndex:e}}}})}),[P,w,x,y,M]),O=f[S];return(0,t.jsx)("div",{className:[Ms,s,hp,k&&`${hp}--within-collapsible`].filter(Boolean).join(" "),children:(0,t.jsxs)(gc,{children:[(0,t.jsx)("div",{className:`${hp}__tabs-wrap`,children:(0,t.jsx)("div",{className:`${hp}__tabs`,children:f.map(((e,n)=>(0,t.jsx)(mp,{isActive:S===n,parentPath:y,setIsActive:()=>_(n),tab:e},n)))})}),(0,t.jsx)("div",{className:`${hp}__content-wrap`,children:O&&(0,t.jsx)(i().Fragment,{children:(0,t.jsxs)("div",{className:[`${hp}__tab`,O.label&&`${hp}__tabConfigLabel-${(0,jc.toKebabCase)((0,a.sC)(O.label,j))}`].filter(Boolean).join(" "),children:[r||(0,t.jsx)(ks,{...l||{}}),(0,t.jsx)(ll,{fieldMap:O.fieldMap,forceRender:c,margins:"small",path:function(){let e=y;return y&&O.name?e=`${y}.${O.name}`:!y&&O.name&&(e=O.name),e}(),permissions:"name"in O&&v?.[O.name]?.fields?v[O.name]?.fields:v,readOnly:b,schemaPath:`${g?`${g}`:""}${O.name?`.${O.name}`:""}`},O.label?(0,a.sC)(O.label,j):O.name)]})})})]})})})),vp=e=>{const{AfterInput:n,BeforeInput:r,CustomDescription:o,CustomError:i,CustomLabel:s,className:l,descriptionProps:c,errorProps:u,hasMany:d,inputRef:f,label:p,labelProps:m,maxRows:h,onChange:g,onKeyDown:v,path:b,placeholder:y,readOnly:w,required:x,rtl:P,showError:j,style:k,value:S,valueToRender:C,width:M}=e,{i18n:_,t:O}=(0,Be.B)();return(0,t.jsxs)("div",{className:[Ms,"text",l,j&&"error",w&&"read-only",d&&"has-many"].filter(Boolean).join(" "),style:{...k,width:M},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:p,required:x,...m||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:i,path:b,...u||{}}),d?(0,t.jsx)(_f,{className:`field-${b.replace(/\./g,"__")}`,disabled:w,filterOption:()=>!h||!(Array.isArray(S)&&h&&S.length>=h),isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(S)&&S.length>=h?O("validation:limitReached",{max:h,value:S.length+1}):null,onChange:g,options:[],placeholder:O("general:enterAValue"),showError:j,value:C}):(0,t.jsxs)("div",{children:[r,(0,t.jsx)("input",{"data-rtl":P,disabled:w,id:`field-${b?.replace(/\./g,"__")}`,name:b,onChange:g,onKeyDown:v,placeholder:(0,a.sC)(y,_),ref:f,type:"text",value:S||""}),n]}),void 0!==o?o:(0,t.jsx)(ks,{...c||{}})]})]})},bp=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,errorProps:d,hasMany:f,inputRef:p,label:m,labelProps:h,localized:g,maxLength:v,maxRows:b,minLength:y,minRows:w,path:x,placeholder:P,readOnly:j,required:k,rtl:S,style:C,validate:M,width:_}=e,O=ls(),{localization:E}=Ut(),D=(0,o.useCallback)(((e,t)=>{if("function"==typeof M)return M(e,{...t,maxLength:v,minLength:y,required:k})}),[M,y,v,k]),{path:N,readOnly:A}=Po(),{formInitializing:T,formProcessing:R,path:I,setValue:L,showError:$,value:W}=hs({path:N??x??n,validate:D}),F=j||A||R||T,z=_s({fieldLocalized:g,fieldRTL:S,locale:O,localizationConfig:E||void 0}),[B,H]=(0,o.useState)([]),Y=(0,o.useCallback)((e=>{if(!F){let t;t=e?Array.isArray(e)?e.map((e=>e.value?.value||e.value)):[e.value?.value||e.value]:[],L(t)}}),[F,L]);return(0,o.useEffect)((()=>{f&&Array.isArray(W)&&H(W.map(((e,t)=>({id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}}))))}),[W,f]),(0,t.jsx)(vp,{AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,errorProps:d,hasMany:f,inputRef:p,label:m,labelProps:h,maxRows:b,minRows:w,onChange:f?Y:e=>{L(e.target.value)},path:I,placeholder:P,readOnly:F,required:k,rtl:z,showError:$,style:C,value:W||"",valueToRender:B,width:_})})),yp=e=>{const{AfterInput:n,BeforeInput:r,CustomDescription:o,CustomError:i,CustomLabel:s,className:l,descriptionProps:c,errorProps:u,label:d,labelProps:f,onChange:p,path:m,placeholder:h,readOnly:g,required:v,rows:b,rtl:y,showError:w,style:x,value:P,width:j}=e,{i18n:k}=(0,Be.B)();return(0,t.jsxs)("div",{className:[Ms,"textarea",l,w&&"error",g&&"read-only"].filter(Boolean).join(" "),style:{...x,width:j},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:d,required:v,...f||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:i,path:m,...u||{}}),r,(0,t.jsx)("label",{className:"textarea-outer",htmlFor:`field-${m.replace(/\./g,"__")}`,children:(0,t.jsxs)("div",{className:"textarea-inner",children:[(0,t.jsx)("div",{className:"textarea-clone","data-value":P||h||""}),(0,t.jsx)("textarea",{className:"textarea-element","data-rtl":y,disabled:g,id:`field-${m.replace(/\./g,"__")}`,name:m,onChange:p,placeholder:(0,a.sC)(h,k),rows:b,value:P||""})]})}),n,void 0!==o?o:(0,t.jsx)(ks,{...c||{}})]})]})},wp=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,label:p,labelProps:m,locale:h,localized:g,maxLength:v,minLength:b,path:y,placeholder:w,readOnly:x,required:P,rows:j,rtl:k,style:S,validate:C,width:M}=e,{i18n:_}=(0,Be.B)(),{localization:O}=Ut(),E=_s({fieldLocalized:g,fieldRTL:k,locale:h,localizationConfig:O||void 0}),D=(0,o.useCallback)(((e,t)=>{if("function"==typeof C)return C(e,{...t,maxLength:v,minLength:b,required:P})}),[C,P,v,b]),{path:N,readOnly:A}=Po(),{formInitializing:T,formProcessing:R,path:I,setValue:L,showError:$,value:W}=hs({path:N??y??n,validate:D}),F=x||A||R||T;return(0,t.jsx)(yp,{AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,label:p,labelProps:m,onChange:e=>{L(e.target.value)},path:I,placeholder:(0,a.sC)(w,_),readOnly:F,required:P,rows:j,rtl:E,showError:$,style:S,value:W,width:M})})),xp=e=>{e.preventDefault(),e.stopPropagation()},Pp="dropzone",jp=({className:e,mimeTypes:n,onChange:r})=>{const a=i().useRef(null),[o,s]=i().useState(!1),l=i().useRef(null),{t:c}=(0,Be.B)(),u=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),e.clipboardData.files&&e.clipboardData.files.length>0&&r(e.clipboardData.files)}),[r]),d=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),s(!0)}),[]),f=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),s(!1)}),[]),p=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),s(!1),e.dataTransfer.files&&e.dataTransfer.files.length>0&&(r(e.dataTransfer.files),s(!1),e.dataTransfer.clearData())}),[r]),m=i().useCallback((e=>{e.target.files&&e.target.files.length>0&&r(e.target.files)}),[r]);i().useEffect((()=>{const e=a.current;return e?(e.addEventListener("dragenter",d),e.addEventListener("dragleave",f),e.addEventListener("dragover",xp),e.addEventListener("drop",p),e.addEventListener("paste",u),()=>{e.removeEventListener("dragenter",d),e.removeEventListener("dragleave",f),e.removeEventListener("dragover",xp),e.removeEventListener("drop",p),e.removeEventListener("paste",u)}):()=>null}),[d,f,p,u]);const h=[Pp,e,o?"dragging":""].filter(Boolean).join(" ");return(0,t.jsxs)("div",{className:h,ref:a,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",className:`${Pp}__file-button`,onClick:()=>{l.current.click()},size:"small",children:c("upload:selectFile")}),(0,t.jsx)("input",{accept:n?.join(","),className:`${Pp}__hidden-input`,onChange:m,ref:l,type:"file"}),(0,t.jsxs)("p",{className:`${Pp}__label`,children:[c("general:or")," ",c("upload:dragAndDrop")]})]})},kp=require("react-image-crop");var Sp=n.n(kp);const Cp="edit-upload",Mp=(0,o.forwardRef)(((e,n)=>{const{name:r,onChange:a,value:o}=e;return(0,t.jsxs)("div",{className:`${Cp}__input`,children:[r,(0,t.jsx)("input",{name:r,onChange:e=>a(e.target.value),ref:n,type:"number",value:o})]})})),_p={height:100,heightPixels:0,unit:"%",width:100,widthPixels:0,x:0,y:0},Op=({fileName:e,fileSrc:n,imageCacheTag:r,initialCrop:a,initialFocalPoint:s,onSave:l,showCrop:c,showFocalPoint:u})=>{const{closeModal:d}=O(),{t:f}=(0,Be.B)(),[p,m]=(0,o.useState)((()=>({..._p,...a}))),h={x:50,y:50},[g,v]=(0,o.useState)((()=>({...h,...s}))),[b,y]=(0,o.useState)(!1),[w,x]=(0,o.useState)(0),[P,j]=(0,o.useState)(0),k=(0,o.useRef)(void 0),S=(0,o.useRef)(void 0),C=(0,o.useRef)(void 0),M=(0,o.useRef)(null),_=(0,o.useRef)(null),[E,D]=(0,o.useState)(!1),N=e=>{x(e.currentTarget.naturalHeight),j(e.currentTarget.naturalWidth),D(!0)},A=({dimension:e,value:t})=>{const n=parseInt(t);if("width"===e&&n>=P)return null;if("height"===e&&n>=w)return null;const r=n/("width"===e?P:w)*100;if(100===r||0===r)return null;m({...p,[e]:r})},T=({coordinate:e,value:t})=>{const n=parseInt(t);n>=0&&n<=100&&v((t=>({...t,[e]:n})))},R=i().useCallback((({x:e,y:t})=>{v({x:e,y:t}),y(!1)}),[]),I=r?`${n}?${r}`:n;return(0,t.jsxs)("div",{className:Cp,children:[(0,t.jsxs)("div",{className:`${Cp}__header`,children:[(0,t.jsxs)("h2",{title:`${f("general:editing")} ${e}`,children:[f("general:editing")," ",e]}),(0,t.jsxs)("div",{className:`${Cp}__actions`,children:[(0,t.jsx)(Yt,{"aria-label":f("general:cancel"),buttonStyle:"secondary",className:`${Cp}__cancel`,onClick:()=>d(Bp),children:f("general:cancel")}),(0,t.jsx)(Yt,{"aria-label":f("general:applyChanges"),buttonStyle:"primary",className:`${Cp}__save`,disabled:!E,onClick:()=>{"function"==typeof l&&l({crop:p?{...p,heightPixels:Number(M.current?.value??p.heightPixels),widthPixels:Number(_.current?.value??p.widthPixels)}:void 0,focalPosition:g}),d(Bp)},children:f("general:applyChanges")})]})]}),(0,t.jsxs)("div",{className:`${Cp}__toolWrap`,children:[(0,t.jsx)("div",{className:`${Cp}__crop`,children:(0,t.jsxs)("div",{className:`${Cp}__focal-wrapper`,ref:k,style:{aspectRatio:""+P/w},children:[c?(0,t.jsx)(Sp(),{className:`${Cp}__reactCrop`,crop:p,onChange:(e,t)=>m(t),onComplete:()=>y(!0),renderSelectionAddon:()=>(0,t.jsx)("div",{className:`${Cp}__crop-window`,ref:C}),children:(0,t.jsx)("img",{alt:f("upload:setCropArea"),onLoad:N,ref:S,src:I})}):(0,t.jsx)("img",{alt:f("upload:setFocalPoint"),onLoad:N,ref:S,src:I}),u&&(0,t.jsx)(Ep,{boundsRef:c?C:S,checkBounds:!!c&&b,className:`${Cp}__focalPoint`,containerRef:k,initialPosition:g,onDragEnd:R,setCheckBounds:!!c&&y,children:(0,t.jsx)(Lt,{})})]})}),(c||u)&&(0,t.jsxs)("div",{className:`${Cp}__sidebar`,children:[c&&(0,t.jsxs)("div",{className:`${Cp}__groupWrap`,children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:`${Cp}__titleWrap`,children:[(0,t.jsx)("h3",{children:f("upload:crop")}),(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Cp}__reset`,onClick:()=>m({height:100,heightPixels:w,unit:"%",width:100,widthPixels:P,x:0,y:0}),children:f("general:reset")})]})}),(0,t.jsx)("span",{className:`${Cp}__description`,children:f("upload:cropToolDescription")}),(0,t.jsxs)("div",{className:`${Cp}__inputsWrap`,children:[(0,t.jsx)(Mp,{name:`${f("upload:width")} (px)`,onChange:e=>A({dimension:"width",value:e}),ref:_,value:(p.width/100*P).toFixed(0)}),(0,t.jsx)(Mp,{name:`${f("upload:height")} (px)`,onChange:e=>A({dimension:"height",value:e}),ref:M,value:(p.height/100*w).toFixed(0)})]})]}),u&&(0,t.jsxs)("div",{className:`${Cp}__groupWrap`,children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:`${Cp}__titleWrap`,children:[(0,t.jsx)("h3",{children:f("upload:focalPoint")}),(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Cp}__reset`,onClick:()=>{const e=k.current.getBoundingClientRect(),t=c?C.current.getBoundingClientRect():S.current.getBoundingClientRect(),n=(t.left-e.left+t.width/2)/e.width*100,r=(t.top-e.top+t.height/2)/e.height*100;v({x:n,y:r})},children:f("general:reset")})]})}),(0,t.jsx)("span",{className:`${Cp}__description`,children:f("upload:focalPointDescription")}),(0,t.jsxs)("div",{className:`${Cp}__inputsWrap`,children:[(0,t.jsx)(Mp,{name:"X %",onChange:e=>T({coordinate:"x",value:e}),value:g.x.toFixed(0)}),(0,t.jsx)(Mp,{name:"Y %",onChange:e=>T({coordinate:"y",value:e}),value:g.y.toFixed(0)})]})]})]})]})]})},Ep=({boundsRef:e,checkBounds:n,children:r,className:a,containerRef:s,initialPosition:l={x:50,y:50},onDragEnd:c,setCheckBounds:u})=>{const[d,f]=(0,o.useState)({x:l.x,y:l.y}),[p,m]=(0,o.useState)(!1),h=(0,o.useRef)(void 0),g=i().useCallback(((t,n,r)=>{const a=s.current.getBoundingClientRect(),o=e.current.getBoundingClientRect(),i=t??o.left,l=n??o.top,c=i<o.left||i>o.right,u=l<o.top||l>o.bottom;let d=(i-a.left)/a.width*100,f=(l-a.top)/a.height*100;const p=(o.left-a.left+o.width/2)/a.width*100,h=(o.top-a.top+o.height/2)/a.height*100;return(c||u)&&(m(!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),l<o.top?f=(o.top-a.top)/a.height*100:l>o.bottom&&(f=(a.height-(a.bottom-o.bottom))/a.height*100),r&&(d=c?p:d,f=u?h:f)),{x:d,y:f}}),[e,s]);return i().useEffect((()=>{if(!p&&h.current&&n){const{height:e,left:t,top:n,width:r}=h.current.getBoundingClientRect(),{x:a,y:o}=g(t+r/2,n+e/2,!0);return c({x:a,y:o}),f({x:a,y:o}),void u(!1)}}),[g,p,n,u,d.x,d.y,c]),i().useEffect((()=>{f({x:l.x,y:l.y})}),[l.x,l.y]),(0,t.jsxs)("div",{className:[`${Cp}__draggable-container`,p&&`${Cp}__draggable-container--dragging`].filter(Boolean).join(" "),onMouseMove:e=>{if(!p)return null;const{x:t,y:n}=g(e.clientX,e.clientY);f({x:t,y:n})},children:[(0,t.jsx)("button",{className:[`${Cp}__draggable`,a].filter(Boolean).join(" "),onMouseDown:e=>{e.preventDefault(),m(!0)},onMouseUp:()=>{m(!1),c(d)},ref:h,style:{left:`${d.x}%`,top:`${d.y}%`},type:"button",children:r}),(0,t.jsx)("div",{})]})},Dp=({defaultMessage:e,successMessage:n,value:r})=>{const a=(0,o.useRef)(null),[i,s]=(0,o.useState)(!1),[l,c]=(0,o.useState)(!1),{t:u}=(0,Be.B)();return r?(0,t.jsxs)("button",{className:"copy-to-clipboard",onClick:()=>{a&&a.current&&(a.current.select(),a.current.setSelectionRange(0,r.length+1),document.execCommand("copy"),s(!0))},onMouseEnter:()=>{c(!0),s(!1)},onMouseLeave:()=>{c(!1),s(!1)},type:"button",children:[(0,t.jsx)(Ws,{}),(0,t.jsxs)(Ft,{delay:i?0:void 0,show:l||i,children:[i&&(n??u("general:copied")),!i&&(e??u("general:copy"))]}),(0,t.jsx)("textarea",{readOnly:!0,ref:a,tabIndex:-1,value:r})]}):null},Np="file-meta",Ap=e=>{const{id:n,collection:r,filename:a,filesize:s,height:l,mimeType:c,url:u,width:d}=e,[f,p]=(0,o.useState)(!1),m=Boolean(n&&r),[h,g]=Xf({id:n,collectionSlug:r});return(0,t.jsxs)("div",{className:Np,children:[(0,t.jsxs)("div",{className:`${Np}__url`,children:[m&&(0,t.jsx)(h,{}),(0,t.jsx)("a",{href:u,rel:"noopener noreferrer",target:"_blank",children:a}),(0,t.jsx)(Dp,{defaultMessage:"Copy URL",value:u}),m&&(0,t.jsxs)(g,{className:`${Np}__edit`,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[(0,t.jsx)(Rt,{}),(0,t.jsx)(Ft,{show:f,children:"Edit"})]})]}),(0,t.jsxs)("div",{className:`${Np}__size-type`,children:[(0,jc.formatFilesize)(s),d&&l&&(0,t.jsxs)(i().Fragment,{children:[" - ",d,"x",l]}),c&&(0,t.jsxs)(i().Fragment,{children:[" - ",c]})]})]})},Tp="preview-sizes",Rp=(e,t)=>{if(!t||0===t.length)return e;const n={};return t.forEach((({name:t})=>{e[t]&&(n[t]=e[t])})),n},Ip=({name:e,active:n,meta:r,onClick:a,previewSrc:o})=>(0,t.jsxs)("div",{className:[`${Tp}__sizeOption`,n&&`${Tp}--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,t.jsx)("div",{className:`${Tp}__image`,children:(0,t.jsx)("img",{alt:r.filename,src:o})}),(0,t.jsxs)("div",{className:`${Tp}__sizeMeta`,children:[(0,t.jsx)("div",{className:`${Tp}__sizeName`,children:e}),(0,t.jsx)(Ap,{...r})]})]}),Lp=({doc:e,imageCacheTag:n,uploadConfig:r})=>{const{imageSizes:a}=r,{sizes:i}=e,[s,l]=(0,o.useState)((()=>Rp(i,a))),[c,u]=(0,o.useState)(null),d=e=>e.filename?e.url?`${e.url}${n?`?${n}`:""}`:void 0:null;(0,o.useEffect)((()=>{l(Rp(i,a))}),[i,a,n]);const f=d(c?e.sizes[c]:e),p=(0,o.useMemo)((()=>({filename:e.filename,filesize:e.filesize,height:e.height,mimeType:e.mimeType,url:e.url,width:e.width})),[e]),m="Original";return(0,t.jsxs)("div",{className:Tp,children:[(0,t.jsxs)("div",{className:`${Tp}__imageWrap`,children:[(0,t.jsxs)("div",{className:`${Tp}__meta`,children:[(0,t.jsx)("div",{className:`${Tp}__sizeName`,children:c||m}),(0,t.jsx)(Ap,{...c?s[c]:p})]}),(0,t.jsx)("img",{alt:e.filename,className:`${Tp}__preview`,src:f})]}),(0,t.jsx)("div",{className:`${Tp}__listWrap`,children:(0,t.jsxs)("div",{className:`${Tp}__list`,children:[(0,t.jsx)(Ip,{active:!c,meta:p,name:m,onClick:()=>u(null),previewSrc:d(e)}),Object.entries(s).map((([e,n])=>{const r=c===e,a=d(n);return a?(0,t.jsx)(Ip,{active:r,meta:n,name:e,onClick:()=>u(e),previewSrc:a},e):null}))]})})]})},$p=()=>(0,t.jsxs)("svg",{height:"150",viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{fill:"#333333",height:"150",transform:"translate(0 0.5)",width:"150"}),(0,t.jsx)("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),(0,t.jsx)("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]}),Wp="thumbnail",Fp=e=>{const{className:n="",doc:{filename:r}={},fileSrc:a,imageCacheTag:o,size:s}=e,[l,c]=i().useState(void 0),u=[Wp,`${Wp}--size-${s||"medium"}`,n].join(" ");return i().useEffect((()=>{if(!a)return void c(!1);const e=new Image;e.src=a,e.onload=()=>{c(!0)},e.onerror=()=>{c(!1)}}),[a]),(0,t.jsxs)("div",{className:u,children:[void 0===l&&(0,t.jsx)(Ql.l,{height:"100%"}),l&&(0,t.jsx)("img",{alt:r,src:`${a}${o?`?${o}`:""}`}),!1===l&&(0,t.jsx)($p,{})]})},zp="file-field",Bp="edit-upload",Hp="preview-sizes",Yp=e=>!(!e&&void 0!==e)||"A file is required.",Vp=({customActions:e,enableAdjustments:n,enablePreviewSizes:r,mimeType:a})=>{const{t:o}=(0,Be.B)(),s=(0,jc.isImage)(a)&&"image/svg+xml"!==a;return s||e&&0!==e.length?(0,t.jsxs)("div",{className:`${zp}__upload-actions`,children:[s&&(0,t.jsxs)(i().Fragment,{children:[r&&(0,t.jsx)(wl,{className:`${zp}__previewSizes`,slug:Hp,children:o("upload:previewSizes")}),n&&(0,t.jsx)(wl,{className:`${zp}__edit`,slug:Bp,children:o("upload:editImage")})]}),e&&e.map(((e,n)=>(0,t.jsx)(i().Fragment,{children:e},n)))]}):null},qp=e=>{const{collectionSlug:n,customActions:r,initialState:a,onChange:s,uploadConfig:l}=e,[c,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(null),{t:p}=(0,Be.B)(),{setModified:m}=Lo(),{dispatchFormQueryParams:h,formQueryParams:g}=Ff(),[v,b]=(0,o.useState)(as(a||{},!0)),{docPermissions:y}=us(),{errorMessage:w,setValue:x,showError:P,value:j}=hs({path:"file",validate:Yp}),[k,S]=(0,o.useState)({x:0,y:0}),C=i().useCallback((e=>{if(e instanceof File){const t=new FileReader;t.onload=e=>{const t=e.target?.result;"string"==typeof t&&f(t)},t.readAsDataURL(e)}x(e),"function"==typeof s&&s(e)}),[s,x]),M=i().useCallback((e=>{const t=e?.[0];C(t)}),[C]),_=(0,o.useCallback)((()=>{u(!0),C(null),f("")}),[C]),O=i().useCallback((({crop:e,focalPosition:t})=>{S({x:e.x||0,y:e.y||0}),m(!0),h({type:"SET",params:{uploadEdits:e||t?{crop:e||null,focalPoint:t||null}:null}})}),[h,m]);(0,o.useEffect)((()=>{b(as(a||{},!0)),u(!1)}),[a]);const E=y?.update?.permission&&"delete"in y&&y?.delete?.permission,D=l?.imageSizes?.length>0,N=Boolean(l?.resizeOptions),A=!0===l?.focalPoint,{crop:T=!0,focalPoint:R=!0}=l,I=R&&(D||N||A);return(0,t.jsxs)("div",{className:[Ms,zp].filter(Boolean).join(" "),children:[(0,t.jsx)(Cs,{message:w,showError:P}),v.filename&&!c&&(0,t.jsx)(Gp,{collectionSlug:n,doc:v,enableAdjustments:T||I,handleRemove:E?_:void 0,hasImageSizes:D,imageCacheTag:v.updatedAt,uploadConfig:l}),(!v.filename||c)&&(0,t.jsxs)("div",{className:`${zp}__upload`,children:[!j&&(0,t.jsx)(jp,{className:`${zp}__dropzone`,mimeTypes:l?.mimeTypes,onChange:M}),j&&d&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${zp}__thumbnail-wrap`,children:(0,t.jsx)(Fp,{collectionSlug:n,fileSrc:(0,jc.isImage)(j.type)?d:null})}),(0,t.jsxs)("div",{className:`${zp}__file-adjustments`,children:[(0,t.jsx)("input",{className:`${zp}__filename`,onChange:e=>{const t=e.target.value;if(j){const e=new File([j],t,{type:j.type});C(e)}},type:"text",value:j.name}),(0,t.jsx)(Vp,{customActions:r,enableAdjustments:T||I,enablePreviewSizes:D&&v.filename&&!c,mimeType:j.type})]}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${zp}__remove`,icon:"x",iconStyle:"with-border",onClick:_,round:!0,tooltip:p("general:cancel")})]})]}),(j||v.filename)&&(0,t.jsx)(xl,{Header:null,slug:Bp,children:(0,t.jsx)(Op,{fileName:j?.name||v?.filename,fileSrc:d||v?.url,imageCacheTag:v.updatedAt,initialCrop:g?.uploadEdits?.crop??{},initialFocalPoint:{x:g?.uploadEdits?.focalPoint.x||v.focalX||50,y:g?.uploadEdits?.focalPoint.y||v.focalY||50},onSave:O,showCrop:T,showFocalPoint:I})}),v&&D&&(0,t.jsx)(xl,{className:`${zp}__previewDrawer`,hoverTitle:!0,slug:Hp,title:p("upload:sizesFor",{label:v?.filename}),children:(0,t.jsx)(Lp,{doc:v,imageCacheTag:v.updatedAt,uploadConfig:l})})]})},Up="file-details",Gp=e=>{const{collectionSlug:n,customUploadActions:r,doc:a,enableAdjustments:o,handleRemove:i,hasImageSizes:s,imageCacheTag:l,uploadConfig:c}=e,{id:u,filename:d,filesize:f,height:p,mimeType:m,thumbnailURL:h,url:g,width:v}=a;return(0,t.jsx)("div",{className:Up,children:(0,t.jsxs)("header",{children:[(0,t.jsx)(Fp,{collectionSlug:n,doc:a,fileSrc:h||g,imageCacheTag:l,uploadConfig:c}),(0,t.jsxs)("div",{className:`${Up}__main-detail`,children:[(0,t.jsx)(Ap,{collection:n,filename:d,filesize:f,height:p,id:u,mimeType:m,url:g,width:v}),(0,t.jsx)(Vp,{customActions:r,enableAdjustments:o,enablePreviewSizes:s&&a.filename,mimeType:m})]}),i&&(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${Up}__remove`,icon:"x",iconStyle:"with-border",onClick:i,round:!0})]})})},Kp=(e,t={})=>{const{initialData:n,initialParams:r={}}=t,{i18n:a}=(0,Be.B)(),[i,s]=(0,o.useState)(n||{}),[l,c]=(0,o.useState)(r),[u,d]=(0,o.useState)(!n),[f,p]=(0,o.useState)(!1),{code:m}=ls(),h=(0,o.useRef)(!1),g=ge().stringify({locale:m,..."object"==typeof l?l:{}},{addQueryPrefix:!0});return(0,o.useEffect)((()=>{if(n&&!h.current)return void(h.current=!0);const t=new AbortController;return e?(async()=>{p(!1),d(!0);try{const n=await mt.get(`${e}${g}`,{headers:{"Accept-Language":a.language},signal:t.signal});n.status>201&&p(!0);const r=await n.json();s(r),d(!1)}catch(e){t.signal.aborted||(p(!0),d(!1))}})():(p(!1),d(!1)),()=>{t.abort()}}),[e,m,g,a.language,n]),(0,o.useEffect)((()=>{n&&h.current&&s(n)}),[n]),[{data:i,isError:f,isLoading:u},{setParams:c}]},Xp=(0,o.createContext)({}),Qp=({children:e,...n})=>(0,t.jsx)(Xp.Provider,{value:n,children:e}),Jp=(0,o.createContext)({}),Zp=()=>(0,o.useContext)(Jp),em=({children:e,data:n,defaultLimit:r,defaultSort:a,handlePageChange:o,handlePerPageChange:s,handleSearchChange:l,handleSortChange:c,handleWhereChange:u,modifySearchParams:d,preferenceKey:f})=>{const p=(0,ht.useRouter)(),{setPreference:m}=dn(),h=i().useRef(!1),{searchParams:g}=nn(),v=i().useCallback((async e=>{if(!d)return;const t={};let n=!1;"limit"in e&&(t.limit=e.limit,n=!0),"sort"in e&&(t.sort=e.sort,n=!0),n&&f&&await m(f,t);const r={limit:"limit"in e?e.limit:g?.limit,page:"page"in e?e.page:g?.page,search:"search"in e?e.search:g?.search,sort:"sort"in e?e.sort:g?.sort,where:"where"in e?e.where:g?.where};p.replace(`${ge().stringify(r,{addQueryPrefix:!0})}`)}),[f,d,p,m,g]),b=i().useCallback((async e=>{"function"==typeof o&&o(e),await v({page:String(e)})}),[v,o]),y=i().useCallback((async e=>{"function"==typeof s&&s(e),await v({limit:String(e)})}),[v,s]),w=i().useCallback((async e=>{"function"==typeof l&&l(e),await v({search:e})}),[v,l]),x=i().useCallback((async e=>{"function"==typeof c&&c(e),await v({sort:e})}),[v,c]),P=i().useCallback((async e=>{"function"==typeof u&&u(e),await v({where:e})}),[v,u]);return i().useEffect((()=>{if(!h.current){if(d){let e=!1;(0,jc.isNumber)(r)&&!("limit"in g)&&(g.limit=String(r),e=!0),a&&!("sort"in g)&&(g.sort=a,e=!0),e&&p.replace(`?${ge().stringify(g)}`)}h.current=!0}}),[a,r,p,d,g]),(0,t.jsx)(Jp.Provider,{value:{data:n,handlePageChange:b,handlePerPageChange:y,handleSearchChange:w,handleSortChange:x,handleWhereChange:P,refineListData:v},children:e})},tm=(e,t)=>e.reduce(((e,n)=>{if("name"in n||t&&n.fieldIsPresentational)return e.push(n),e;if("fieldMap"in n.fieldComponentProps)e.push(...tm(n.fieldComponentProps.fieldMap,t));else if("tabs"===n.type&&"tabs"in n.fieldComponentProps&&Array.isArray(n.fieldComponentProps.tabs))return[...e,...n.fieldComponentProps.tabs.reduce(((e,n)=>[...e,..."name"in n?[{...n}]:tm(n.fieldMap,t)]),[])];return e}),[]);var nm;!function(e){e.AllAvailable="allAvailable",e.AllInPage="allInPage",e.None="none",e.Some="some"}(nm||(nm={}));const rm=(0,o.createContext)({}),am=({children:e,docs:n=[],totalDocs:r})=>{const a=(0,o.useRef)({}),{code:i}=ls(),[s,l]=(0,o.useState)((()=>{const e={};return n.forEach((({id:t})=>{e[t]=!1})),e})),[c,u]=(0,o.useState)("none"),[d,f]=(0,o.useState)(0),{searchParams:p}=nn(),m=(0,o.useCallback)(((e=!1)=>{const t={};e?(u("allAvailable"),n.forEach((({id:e})=>{t[e]=!0}))):"allAvailable"===c||"allInPage"===c?(u("none"),n.forEach((({id:e})=>{t[e]=!1}))):n.forEach((({id:e})=>{t[e]="some"!==c})),l(t)}),[n,c]),h=(0,o.useCallback)((e=>{const t=!s[e],n={...s,[e]:t};t||u("some"),l(n)}),[s]),g=(0,o.useCallback)((e=>{let t;if("allAvailable"===c){const e=p?.where;t=e||{id:{not_equals:""}}}else t={id:{in:Object.keys(s).filter((e=>s[e])).map((e=>e))}};return e&&(t={and:[{...e},t]}),ge().stringify({locale:i,where:t},{addQueryPrefix:!0})}),[c,s,i,p]);return(0,o.useEffect)((()=>{if("allAvailable"===c)return;let e=!1,t=!0;Object.values(s).forEach((n=>{t=t&&n,e=e||n})),u(t?"allInPage":e?"some":"none")}),[c,s]),(0,o.useEffect)((()=>{const e="allAvailable"===c?r:Object.keys(s).filter((e=>s[e])).length;f(e)}),[c,s,r]),a.current={count:d,getQueryParams:g,selectAll:c,selected:s,setSelection:h,toggleAll:m,totalDocs:r},(0,t.jsx)(rm.Provider,{value:a.current,children:e})},om=()=>(0,o.useContext)(rm),im="select-all",sm=()=>{const{selectAll:e,toggleAll:n}=om(),{i18n:r}=(0,Be.B)();return(0,t.jsx)(Ts,{"aria-label":e===nm.None?r.t("general:selectAllRows"):r.t("general:deselectAllRows"),checked:e===nm.AllInPage||e===nm.AllAvailable,className:[im,`${im}__checkbox`].join(" "),id:"select-all",name:"select-all",onToggle:()=>n(),partialChecked:e===nm.Some})},lm=i().createContext({}),cm=e=>{const{cellData:n,cellProps:r,children:a,columnIndex:o,customCellContext:i,rowData:s}=e,l=um();return(0,t.jsx)(lm.Provider,{value:{cellData:n,cellProps:r,columnIndex:o,customCellContext:i,rowData:s,...l},children:a})},um=()=>i().useContext(lm),dm="select-row",fm=()=>{const{selected:e,setSelection:n}=om(),{rowData:r}=um();return(0,t.jsx)(Ts,{checked:e?.[r?.id],className:[dm,`${dm}__checkbox`].join(" "),onToggle:()=>n(r.id)})},pm="sort-column",mm=e=>{const{name:n,Label:r,disable:a=!1,label:i}=e,{searchParams:s}=nn(),{refineListData:l}=Zp(),{t:c}=(0,Be.B)(),{sort:u}=s,d=`-${n}`,f=n,p=[`${pm}__asc`];u===f&&p.push(`${pm}--active`);const m=[`${pm}__desc`];u===d&&m.push(`${pm}--active`);const h=(0,o.useCallback)((e=>{l({sort:e})}),[l]);return(0,t.jsxs)("div",{className:pm,children:[(0,t.jsx)("span",{className:`${pm}__label`,children:r}),!a&&(0,t.jsxs)("div",{className:`${pm}__buttons`,children:[(0,t.jsx)("button",{"aria-label":c("general:sortByLabelDirection",{direction:c("general:ascending"),label:i}),className:[...p,`${pm}__button`].filter(Boolean).join(" "),onClick:()=>h(f),type:"button",children:(0,t.jsx)(Tt,{direction:"up"})}),(0,t.jsx)("button",{"aria-label":c("general:sortByLabelDirection",{direction:c("general:descending"),label:i}),className:[...m,`${pm}__button`].filter(Boolean).join(" "),onClick:()=>h(d),type:"button",children:(0,t.jsx)(Tt,{})})]})]})},hm=({cellData:e,nowrap:n})=>{const r=e.length>100?`${e.substring(0,100)}…`:e,a=n?{whiteSpace:"nowrap"}:{};return(0,t.jsx)("code",{className:"code-cell",style:a,children:(0,t.jsx)("span",{children:r})})},gm="file",vm=!("undefined"==typeof window||!window.document||!window.document.createElement);function bm(e,t){switch(t.type){case"REQUEST":{const n={...e};return t.docs.forEach((({relationTo:e,value:t})=>{"object"!=typeof n[e]&&(n[e]={}),n[e][t]=null})),n}case"ADD_LOADED":{const n={...e};"object"!=typeof n[t.relationTo]&&(n[t.relationTo]={});const r=[...t.idsToLoad];return Array.isArray(t.docs)&&t.docs.forEach((e=>{r.splice(r.indexOf(e.id),1),n[t.relationTo][e.id]=e})),r.forEach((e=>{n[t.relationTo][e]=!1})),n}default:return e}}const ym=(0,o.createContext)({}),wm=({children:e})=>{const[n,r]=(0,o.useReducer)(bm,{}),a=Qt(n,100),i=Ut(),{i18n:s}=(0,Be.B)(),{code:l}=ls(),c=(0,o.useRef)(l),{routes:{api:u},serverURL:d}=i,f=(0,o.useCallback)(((e=!1)=>{Object.entries(a).forEach((async([t,n])=>{const a=[];if(Object.entries(n).forEach((([t,n])=>{(null===n||e)&&a.push(t)})),a.length>0){const e=`${d}${u}/${t}`,n=new URLSearchParams;if(n.append("depth","0"),n.append("limit","250"),l&&n.append("locale",l),a&&a.length>0){const e=a.map((e=>String(e)));n.append("where[id][in]",e.join(","))}const o=`?${n.toString()}`,i=await fetch(`${e}${o}`,{credentials:"include",headers:{"Accept-Language":s.language}});if(i.ok){const e=await i.json();e.docs&&r({type:"ADD_LOADED",docs:e.docs,idsToLoad:a,relationTo:t})}else r({type:"ADD_LOADED",docs:[],idsToLoad:a,relationTo:t})}}))}),[a,d,u,s,l]);(0,o.useEffect)((()=>{f(l&&c.current!==l),c.current=l}),[l,f]);const p=(0,o.useCallback)((e=>{r({type:"REQUEST",docs:e})}),[]);return(0,t.jsx)(ym.Provider,{value:{documents:n,getRelationships:p},children:e})},xm=({cellData:e,label:n,relationTo:r})=>{const s=Ut(),{collections:l,routes:c}=s,[u,d]=Wt(),[f,p]=(0,o.useState)([]),{documents:m,getRelationships:h}=(0,o.useContext)(ym),[g,v]=(0,o.useState)(!1),{i18n:b,t:y}=(0,Be.B)(),w=!!vm&&d?.boundingClientRect?.top<window.innerHeight;return(0,o.useEffect)((()=>{if((e||"number"==typeof e)&&w&&!g){const t=[],n=Array.isArray(e)?e:[e];n.slice(0,n.length<3?n.length:3).forEach((e=>{"object"==typeof e&&"relationTo"in e&&"value"in e&&t.push(e),"number"!=typeof e&&"string"!=typeof e||"string"!=typeof r||t.push({relationTo:r,value:e})})),h(t),v(!0),p(t)}}),[e,r,l,w,c.api,g,h]),(0,o.useEffect)((()=>{g&&v(!1)}),[e]),(0,t.jsxs)("div",{className:"relationship-cell",ref:u,children:[f.map((({relationTo:e,value:n},r)=>{const a=m[e][n],o=l.find((({slug:t})=>t===e)),c=Qi({collectionConfig:o,data:a||null,dateFormat:s.admin.dateFormat,fallback:`${y("general:untitled")} - ID: ${n}`,i18n:b});return(0,t.jsxs)(i().Fragment,{children:[!1===a&&`${y("general:untitled")} - ID: ${n}`,null===a&&`${y("general:loading")}...`,a?c:null,f.length>r+1&&", "]},r)})),Array.isArray(e)&&e.length>3&&y("fields:itemsAndMore",{count:e.length-3,items:""}),0===f.length&&y("general:noLabel",{label:(0,a.sC)(n||"",b)})]})},Pm=({cellData:e,options:n})=>{const{i18n:r}=(0,Be.B)(),o=e=>e.map((e=>{const t=n.filter((t=>t.value===e))?.[0]?.label;return(0,a.sC)(t,r)})).join(", ");let i="";return i=(0,jc.optionsAreObjects)(n)?Array.isArray(e)?o(e):o([e]):Array.isArray(e)?e.join(", "):e,(0,t.jsx)("span",{children:i})},jm={File:({cellData:e,customCellContext:n,rowData:r})=>{const{collectionSlug:a,uploadConfig:o}=n;return(0,t.jsxs)("div",{className:gm,children:[(0,t.jsx)(Fp,{className:`${gm}__thumbnail`,collectionSlug:a,doc:{...r,filename:e},fileSrc:r?.thumbnailURL||r?.url,size:"small",uploadConfig:o}),(0,t.jsx)("span",{className:`${gm}__filename`,children:String(e)})]})},array:({cellData:e,labels:n})=>{const{i18n:r}=(0,Be.B)(),o=`${(e??[]).length} ${(0,a.sC)(n?.plural||r.t("general:rows"),r)}`;return(0,t.jsx)("span",{children:o})},blocks:({blocks:e,cellData:n,labels:r})=>{const{i18n:o}=(0,Be.B)(),i=Array.isArray(n)?n.map((({blockType:e})=>e)):[],s=e?.map((e=>({slug:e.slug,label:(0,a.sC)(e.labels.singular,o)})));let l=`0 ${(0,a.sC)(r?.plural,o)}`;const c=e=>e.map((e=>{const t=s.filter((t=>t.slug===e))?.[0];return t?.label})).join(", ");if(i.length>5){const e=i.length-5;l=`${i.length} ${(0,a.sC)(r?.plural,o)} - ${o.t("fields:itemsAndMore",{count:e,items:c(i.slice(0,5))})}`}else i.length>0&&(l=`${i.length} ${(0,a.sC)(1===i.length?r?.singular:r?.plural,o)} - ${c(i)}`);return(0,t.jsx)("span",{children:l})},checkbox:({cellData:e})=>{const{t:n}=(0,Be.B)();return(0,t.jsx)("code",{className:"bool-cell",children:(0,t.jsx)("span",{children:n(`general:${e}`).toLowerCase()})})},code:hm,date:({cellData:e,dateDisplayFormat:n})=>{const{admin:{dateFormat:r}}=Ut(),{i18n:a}=(0,Be.B)(),o=n||r;return(0,t.jsx)("span",{children:e&&Ki({date:e,i18n:a,pattern:o})})},json:({cellData:e})=>{const n=e?.length>100?`${e.substring(0,100)}…`:e;return(0,t.jsx)("code",{className:"json-cell",children:(0,t.jsx)("span",{children:JSON.stringify(n)})})},radio:Pm,relationship:xm,select:Pm,textarea:({cellData:e})=>{const n=e?.length>100?`${e.substring(0,100)}…`:e;return(0,t.jsx)("span",{children:n})},upload:xm},km=Dn().default||Dn(),Sm=e=>{const{name:n,className:r,fieldType:o,isFieldAffectingData:i,label:s,onClick:l}=e,{i18n:c}=(0,Be.B)(),{routes:{admin:u}}=Ut(),d=um(),{cellData:f,cellProps:p,columnIndex:m,customCellContext:h,rowData:g}=d||{},{className:v,link:b,onClick:y}=p||{},w=l||y;let x="span";const P={className:r||v};if((void 0!==b?b:0===m)&&(x=km,P.href=h?.collectionSlug?`${u}/collections/${h?.collectionSlug}/${g.id}`:""),"function"==typeof w&&(x="button",P.type="button",P.onClick=()=>{w({cellData:f,collectionSlug:h?.collectionSlug,rowData:g})}),"id"===n)return(0,t.jsx)(x,{...P,children:(0,t.jsx)(hm,{cellData:`ID: ${f}`,name:n,nowrap:!0,rowData:g,schemaPath:d?.cellProps?.schemaPath})});const j=void 0!==f&&jm[o];let k=null;if(j)k=(0,t.jsx)(j,{cellData:f,customCellContext:h,rowData:g,...e});else if(!j){if(!h.uploadConfig||!i||"filename"!==n)return(0,t.jsxs)(x,{...P,children:[(""===f||void 0===f)&&"label"in e&&c.t("general:noLabel",{label:(0,a.sC)(s||"data",c)}),"string"==typeof f&&f,"number"==typeof f&&f,"object"==typeof f&&JSON.stringify(f)]});{const n=jm.File;k=(0,t.jsx)(n,{cellData:f,customCellContext:h,rowData:g,...e})}}return(0,t.jsx)(x,{...P,children:k})},Cm=e=>"ui"===e.type,Mm=e=>{const{cellProps:n,columnPreferences:r,columns:a,enableRowSelections:o,fieldMap:i,useAsTitle:s}=e;let l=tm(i);const c=l.findIndex((e=>"id"===e.name));if(c>-1){const e=l.splice(c,1)[0];l.unshift(e)}const u=s?l.findIndex((e=>e.name===s)):-1;if(u>-1){const e=l.splice(u,1)[0];l.unshift(e)}const d=r||a;d&&(l=l.sort(((e,t)=>{const n=d.findIndex((t=>"name"in e&&t.accessor===e.name)),r=d.findIndex((e=>"name"in t&&e.accessor===t.name));return-1===n&&-1===r?0:-1===n?1:-1===r?-1:n-r})));const f=[],p=l.reduce(((e,o,i)=>{const s=r?.find((e=>"name"in o&&e.accessor===o.name));let l=!1;s?l=s.active:a&&Array.isArray(a)&&a.length>0?l=a.find((e=>e.accessor===o.name))?.active:f.length<4&&(l=!0),l&&!f.includes(i)&&f.push(i);const c=f[0]===i,u="name"in o?o.name:void 0,d=void 0!==o.CustomCell?o.CustomCell:(0,t.jsx)(Sm,{...o.cellComponentProps}),p=o&&"fieldComponentProps"in o&&"CustomLabel"in o.fieldComponentProps&&void 0!==o.fieldComponentProps.CustomLabel?o.fieldComponentProps.CustomLabel:void 0,m=(0,t.jsx)(Ns,{CustomLabel:p,label:o.fieldComponentProps?.label,...o.fieldComponentProps?.labelProps||{},unstyled:!0}),h=o&&o.type&&("array"===o.type||"group"===o.type||"blocks"===o.type),g=(0,t.jsx)(mm,{Label:m,disable:h||Cm(o)||void 0,label:"fieldComponentProps"in o&&"label"in o.fieldComponentProps?o.fieldComponentProps.label:void 0,name:"name"in o?o.name:void 0});if(o){const t={name:u,type:o.type,Label:m,accessor:u,active:l,admin:{disableListColumn:o.disableListColumn,disableListFilter:o.disableListFilter},cellProps:{...o.cellComponentProps,...n?.[i],link:c,relationTo:"relationship"===o.type&&"relationTo"in o.fieldComponentProps?o.fieldComponentProps.relationTo:void 0},components:{Cell:d,Heading:g}};e.push(t)}return e}),[]);return o&&p.unshift({name:"",accessor:"_select",active:!0,components:{Cell:(0,t.jsx)(fm,{}),Heading:(0,t.jsx)(sm,{})},label:null}),p};function _m(e){return"name"in e&&"ui"!==e.type}const Om=(e,t)=>e.reduce(((e,n)=>_m(n)&&n.name===t?e:!_m(n)&&"fieldMap"in n.fieldComponentProps?[...e,...Om(n.fieldComponentProps.fieldMap,t)]:"tabs"===n.type&&"tabs"in n.fieldComponentProps?[...e,...n.fieldComponentProps.tabs.reduce(((e,n)=>[...e,..."name"in n?[n.name]:Om(n.fieldMap,t)]),[])]:[...e,n.name]),[]),Em=(0,o.createContext)({}),Dm=()=>(0,o.useContext)(Em),Nm=({cellProps:e,children:n,collectionSlug:r,enableRowSelections:a=!1,listPreferences:s,preferenceKey:l})=>{const c=Ut(),{componentMap:u}=wn(),{fieldMap:d}=u.collections[r],f=c.collections.find((e=>e.slug===r)),{admin:{defaultColumns:p,useAsTitle:m}}=f,h=i().useRef(r),{getPreference:g,setPreference:v}=dn(),[b]=(0,o.useState)((()=>((e,t,n)=>{let r=[];if(Array.isArray(n)&&n.length>=1)r=n;else{t&&r.push(t);const n=Om(e,t);r=r.concat(n),r=r.slice(0,4)}return r.map((e=>({accessor:e,active:!0})))})((e=>{const t=e=>"ui"!==e.type&&!0===e.disabled||!0===e?.disableListColumn;return e.reduce(((e,n)=>{if(t(n))return e;const r="tabs"===n.type&&"tabs"in n.fieldComponentProps?{...n,fieldComponentProps:{...n.fieldComponentProps,tabs:n.fieldComponentProps.tabs.map((e=>({...e,fieldMap:e.fieldMap.filter((e=>!t(e)))})))}}:n;return[...e,r]}),[])})(d),m,p))),[y,w]=i().useState((()=>Mm({cellProps:e,columnPreferences:s?.columns,columns:b,enableRowSelections:a,fieldMap:d,useAsTitle:m}))),x=i().useCallback((e=>{const t=e.map((e=>({accessor:e?.accessor,active:e?.active})));v(l,{columns:t},!0)}),[l,v]),P=e=>{let t=!1;return e.map((e=>{const n=e.active&&!t&&"_select"!==e.accessor;return n&&(t=!0),{...e,cellProps:{...e.cellProps,link:n}}}))},j=(0,o.useCallback)((e=>{const{fromIndex:t,toIndex:n}=e,r=[...y],[a]=r.splice(t,1);r.splice(n,0,a);const o=P(r);w(o),x(o)}),[y,x]),k=(0,o.useCallback)((e=>{const t=y.map((t=>({...t,active:t?.name===e?!t.active:t.active}))),n=P(t);w(n),x(n)}),[y,x]),S=i().useCallback((e=>{const t=y.map((t=>({...t,active:e.includes(t.accessor)}))),n=P(t);x(n)}),[y,x]);return i().useEffect((()=>{(async()=>{if(h.current!==r||!s){const t=await g(l);h.current=r,t?.columns&&w(Mm({cellProps:e,columnPreferences:t?.columns,columns:b,enableRowSelections:!0,fieldMap:d,useAsTitle:m}))}})()}),[l,g,r,d,e,p,m,s,b]),(0,t.jsx)(Em.Provider,{value:{columns:y,moveColumn:j,setActiveColumns:S,toggleColumn:k},children:n})};const Am=e=>{const{i18n:n}=(0,Be.B)(),{description:r}=e;if(function(e){return i().isValidElement(e)}(r)){const e=r;return(0,t.jsx)(e,{})}return r?(0,t.jsx)("div",{className:"view-description",children:"function"==typeof r?r():(0,a.sC)(r,n)}):null},Tm=(e,t)=>("and"in e?e.and.push(t):e={and:[e,t]},e),Rm=({collectionSlugs:e,customHeader:n,drawerSlug:r,filterOptions:i,onSelect:s,selectedCollection:l})=>{const{i18n:c,t:u}=(0,Be.B)(),{permissions:d}=sn(),{setPreference:f}=dn(),{closeModal:p,isModalOpen:m}=O(),[h,g]=(0,o.useState)(),[v,b]=(0,o.useState)(null),[y,w]=(0,o.useState)(1),[x,P]=(0,o.useState)(null),[j,k]=(0,o.useState)(""),{componentMap:S}=wn(),{collections:C,routes:{api:M},serverURL:_}=Ut(),E=C.filter((({slug:t})=>e.includes(t))),[D,N]=(0,o.useState)((()=>E.find((({slug:e})=>e===l))||E?.[0])),{List:A}=S.collections?.[D?.slug]||{},[T,R]=(0,o.useState)((()=>D?{label:(0,a.sC)(D.labels.singular,c),value:D.slug}:void 0));(0,o.useEffect)((()=>{}),[D]),(0,o.useEffect)((()=>{if(l){const e=E.find((({slug:e})=>e===l))||E?.[0];N(e)}}),[l,E,s,u]);const I=`${D.slug}-list`,[L,$,{drawerSlug:W}]=Xf({collectionSlug:D.slug});(0,o.useEffect)((()=>{T&&!Array.isArray(T)&&N(E.find((({slug:e})=>T.value===e)))}),[T,E]);const F=d?.collections?.[D?.slug],z=F?.create?.permission,B=m(r)?`${_}${M}/${D.slug}`:null,[H,Y]=(0,o.useReducer)((e=>e+1),0),[{data:V,isError:q,isLoading:U},{setParams:G}]=Kp(B,{}),K=E.length>1;(0,o.useEffect)((()=>{const{slug:e,admin:{listSearchableFields:t,useAsTitle:n}={},versions:r}=D,a={};let o={...x||{}};const s=i?.[e];if(i&&"boolean"!=typeof s&&(o=Tm(o,s)),j){const e=(t||[n]).map((e=>({[e]:{like:j}})),[]);if(e.length>0){const t={or:[...e]};o=Tm(o,t)}}y&&(a.page=y),v&&(a.sort=v),H&&(a.cacheBust=H),o&&(a.where=o),r?.drafts&&(a.draft="true"),G(a)}),[y,v,x,j,H,i,D,u,G]),(0,o.useEffect)((()=>{f(I,{limit:h,sort:v},!0)}),[v,h,f,I]);const X=(0,o.useCallback)((({doc:e})=>{"function"==typeof s&&s({collectionSlug:D.slug,docID:e.id}),Y(),p(W),p(r)}),[p,W,r,s,D]);return!D||q?null:U?(0,t.jsx)(Ye,{}):(0,t.jsx)(Qp,{Header:(0,t.jsxs)("header",{className:`${Im}__header`,children:[(0,t.jsxs)("div",{className:`${Im}__header-wrap`,children:[(0,t.jsxs)("div",{className:`${Im}__header-content`,children:[(0,t.jsx)("h2",{className:`${Im}__header-text`,children:n||(0,a.sC)(D?.labels?.plural,c)}),z&&(0,t.jsx)($,{className:`${Im}__create-new-button`,children:(0,t.jsx)(Ml,{children:u("general:createNew")})})]}),(0,t.jsx)("button",{"aria-label":u("general:close"),className:`${Im}__header-close`,onClick:()=>{p(r)},type:"button",children:(0,t.jsx)($t.u,{})})]}),D?.admin?.description&&(0,t.jsx)("div",{className:`${Im}__sub-header`,children:(0,t.jsx)(Am,{description:D.admin.description})}),K&&(0,t.jsxs)("div",{className:`${Im}__select-collection-wrap`,children:[(0,t.jsx)(Ns,{label:u("upload:selectCollectionToBrowse")}),(0,t.jsx)(_f,{className:`${Im}__select-collection`,onChange:R,options:E.map((e=>({label:(0,a.sC)(e.labels.singular,c),value:e.slug}))),value:T})]})]}),collectionConfig:D,collectionSlug:D.slug,hasCreatePermission:z,newDocumentURL:null,children:(0,t.jsx)(em,{data:V,defaultLimit:h||D?.admin?.pagination?.defaultLimit,defaultSort:v,handlePageChange:w,handlePerPageChange:g,handleSearchChange:k,handleSortChange:b,handleWhereChange:P,modifySearchParams:!1,preferenceKey:I,children:(0,t.jsxs)(Nm,{cellProps:[{className:`${Im}__first-cell`,link:!1,onClick:({collectionSlug:e,rowData:t})=>{"function"==typeof s&&s({collectionSlug:e,docID:t.id})}}],collectionSlug:D.slug,preferenceKey:I,children:[A,(0,t.jsx)(L,{onSave:X})]})})})},Im="list-drawer",Lm=({children:e,className:n,disabled:r,drawerSlug:a,...o})=>(0,t.jsx)(wl,{className:[n,`${Im}__toggler`].filter(Boolean).join(" "),disabled:r,slug:a,...o,children:e}),$m=e=>{const{drawerSlug:n}=e;return(0,t.jsx)(xl,{Header:null,className:Im,gutter:!1,slug:n,children:(0,t.jsx)(Rm,{...e})})},Wm=({collectionSlugs:e,filterOptions:n,selectedCollection:r,uploads:a})=>{const{collections:i}=Ut(),s=ws(),l=(0,o.useId)(),{closeModal:c,modalState:u,openModal:d,toggleModal:f}=O(),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(e),v=(({depth:e,uuid:t})=>`list-drawer_${e}_${t}`)({depth:s,uuid:l});(0,o.useEffect)((()=>{m(Boolean(u[v]?.isOpen))}),[u,v]),(0,o.useEffect)((()=>{if(!h||0===h.length){const e=i.filter((({upload:e})=>!a||!0===Boolean(e)));g(e.map((({slug:e})=>e)))}}),[h,a,i]);const b=(0,o.useCallback)((()=>{f(v)}),[f,v]),y=(0,o.useCallback)((()=>{c(v)}),[v,c]),w=(0,o.useCallback)((()=>{d(v)}),[v,d]);return[(0,o.useMemo)((()=>e=>(0,o.createElement)($m,{...e,closeDrawer:y,collectionSlugs:h,drawerSlug:v,filterOptions:n,key:v,selectedCollection:r,uploads:a})),[v,h,a,y,r,n]),(0,o.useMemo)((()=>e=>(0,t.jsx)(Lm,{...e,drawerSlug:v})),[v]),(0,o.useMemo)((()=>({closeDrawer:y,drawerDepth:s,drawerSlug:v,isDrawerOpen:p,openDrawer:w,toggleDrawer:b})),[s,v,p,b,y,w])]},Fm="upload",zm=e=>{const{CustomDescription:n,CustomError:r,CustomLabel:s,api:l="/api",className:c,collection:u,customUploadActions:d,descriptionProps:f,errorProps:p,filterOptions:m,label:h,labelProps:g,onChange:v,readOnly:b,relationTo:y,required:w,serverURL:x,showError:P,style:j,value:k,width:S}=e,{i18n:C,t:M}=(0,Be.B)(),[_,O]=(0,o.useState)(void 0),[E,D]=(0,o.useState)(!1),[N]=(0,o.useState)([u?.slug]),[A,T,{closeDrawer:R}]=Xf({collectionSlug:N[0]}),[I,L,{closeDrawer:$}]=Wm({collectionSlugs:N,filterOptions:m});(0,o.useEffect)((()=>{if(null!=k&&""!==k){(async()=>{const e=await fetch(`${x}${l}/${y}/${k}`,{credentials:"include",headers:{"Accept-Language":C.language}});if(e.ok){const t=await e.json();O(t)}else D(!0),O(void 0)})()}else O(void 0)}),[k,y,l,x,C]);const W=(0,o.useCallback)((e=>{D(!1),v(e.doc),R()}),[v,R]),F=(0,o.useCallback)((e=>{D(!1),v({id:e.docID}),$()}),[v,$]);return u.upload?(0,t.jsxs)("div",{className:[Ms,Fm,c,P&&"error",b&&"read-only"].filter(Boolean).join(" "),style:{...j,width:S},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:h,required:w,...g||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:r,...p||{}}),u?.upload&&(0,t.jsxs)(i().Fragment,{children:[_&&!E&&(0,t.jsx)(Gp,{collectionSlug:y,customUploadActions:d,doc:_,handleRemove:b?void 0:()=>{v(null)},uploadConfig:u.upload}),(!_||E)&&(0,t.jsx)("div",{className:`${Fm}__wrap`,children:(0,t.jsxs)("div",{className:`${Fm}__buttons`,children:[(0,t.jsx)(T,{className:`${Fm}__toggler`,disabled:b,children:(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:b,el:"div",children:M("fields:uploadNewLabel",{label:(0,a.sC)(u.labels.singular,C)})})}),(0,t.jsx)(L,{className:`${Fm}__toggler`,disabled:b,children:(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:b,el:"div",children:M("fields:chooseFromExisting")})})]})}),void 0!==n?n:(0,t.jsx)(ks,{...f||{}})]}),!b&&(0,t.jsx)(A,{onSave:W}),!b&&(0,t.jsx)(I,{onSelect:F})]})]}):null},Bm=vs((e=>{const{CustomDescription:n,CustomError:r,CustomLabel:a,className:i,descriptionProps:s,errorProps:l,label:c,labelProps:u,path:d,readOnly:f,relationTo:p,required:m,style:h,validate:g,width:v}=e,{collections:b,routes:{api:y},serverURL:w}=Ut(),x=b.find((e=>e.slug===p)),P=(0,o.useCallback)(((e,t)=>{if("function"==typeof g)return g(e,{...t,required:m})}),[g,m]),{path:j,readOnly:k}=Po(),{filterOptions:S,formInitializing:C,formProcessing:M,path:_,setValue:O,showError:E,value:D}=hs({path:j??d,validate:P}),N=f||k||M||C,A=(0,o.useCallback)((e=>{O(e?.id||e)}),[O]);return x.upload?(0,t.jsx)(zm,{CustomDescription:n,CustomError:r,CustomLabel:a,api:y,className:i,collection:x,descriptionProps:s,errorProps:l,filterOptions:S,label:c,labelProps:u,onChange:A,path:_,readOnly:N,relationTo:p,required:m,serverURL:w,showError:E,style:h,value:D,width:v}):null})),Hm={array:gl,blocks:Xl,checkbox:Is,code:nc,collapsible:ic,confirmPassword:sc,date:dc,email:fc,group:wc,hidden:ol,json:Pc,number:Of,password:Ef,point:Nf,radio:If,relationship:lp,richText:()=>null,row:up,select:fp,tabs:gp,text:bp,textarea:wp,ui:()=>null,upload:Bm},Ym=(0,o.createContext)(Hm),Vm=({children:e})=>(0,t.jsx)(Ym.Provider,{value:Hm,children:e}),qm=()=>(0,o.useContext)(Ym),Um=(0,o.createContext)({}),Gm=({children:e})=>{const n=(0,ht.useParams)();return(0,t.jsx)(Um.Provider,{value:n,children:e})};var Km=n(84348),Xm=n(44666);const Qm=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#FF8C91"}),(0,t.jsx)("path",{d:"M15.4001 10.5996L10.6001 15.3996M10.6001 10.5996L15.4001 15.3996",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})]}),Jm=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#C3C3C3"}),(0,t.jsx)("path",{d:"M13 16.1998V12.9998M13 9.7998H13.0077",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})]}),Zm=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#A0E6C1"}),(0,t.jsx)("path",{d:"M10.6001 13.0004L12.2001 14.6004L15.4001 11.4004",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})]}),eh=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#E4E694"}),(0,t.jsx)("path",{d:"M13 10V13.2M13 16.4H13.008",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})]}),th=()=>(0,t.jsx)(At,{className:"payload-toast-container",closeButton:!0,dir:"undefined",icons:{error:(0,t.jsx)(Qm,{}),info:(0,t.jsx)(Jm,{}),success:(0,t.jsx)(Zm,{}),warning:(0,t.jsx)(eh,{})},offset:"36px",toastOptions:{classNames:{closeButton:"payload-toast-close-button",content:"toast-content",error:"toast-error",icon:"toast-icon",info:"toast-info",success:"toast-success",toast:"payload-toast-item",warning:"toast-warning"},unstyled:!0},visibleToasts:5}),nh=({children:e,componentMap:n,config:r,dateFNSKey:a,fallbackLang:i,languageCode:s,languageOptions:l,switchLanguageServerAction:c,theme:u,translations:d})=>(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Km.Y,{children:(0,t.jsx)(qt,{config:r,children:(0,t.jsx)(yn,{componentMap:n,children:(0,t.jsx)(Vm,{children:(0,t.jsx)(Cn,{children:(0,t.jsx)(Be.D,{dateFNSKey:a,fallbackLang:i,language:s,languageOptions:l,switchLanguageServerAction:c,translations:d,children:(0,t.jsx)(Fe,{breakpoints:{l:"(max-width: 1440px)",m:"(max-width: 1024px)",s:"(max-width: 768px)",xs:"(max-width: 400px)"},children:(0,t.jsx)(Re,{children:(0,t.jsx)(tn,{children:(0,t.jsx)(Ne,{classPrefix:"payload",transTime:0,zIndex:"var(--z-modal)",children:(0,t.jsxs)(on,{children:[(0,t.jsx)(un,{children:(0,t.jsx)(Xm.NP,{cookiePrefix:r.cookiePrefix,theme:u,children:(0,t.jsx)(Gm,{children:(0,t.jsx)(ss,{children:(0,t.jsx)(vn,{children:(0,t.jsx)(Xe,{children:(0,t.jsx)(_n,{children:(0,t.jsx)(jn,{children:(0,t.jsx)(mn,{children:e})})})})})})})})}),(0,t.jsx)(me,{}),(0,t.jsx)(Xt,{})]})})})})})})})})})})}),(0,t.jsx)(th,{})]}),rh=({Component:e,serverOnlyProps:n,...r})=>{if(e){const a=r=>{const a={...r,...(0,jc.isReactServerComponentOrFunction)(e)?n??{}:{}};return(0,t.jsx)(e,{...a})};return(0,t.jsx)(a,{...r})}return null},ah=e=>{const{WithServerSideProps:n,collectionConfig:r,globalConfig:a}=e,o=(r||a)?.admin?.components?.views?.Edit,i="object"==typeof r?.admin?.components?.views?.List?r?.admin?.components?.views?.List?.actions:void 0,s={Edit:{},List:[]};return o&&Object.entries(o).forEach((([e,r])=>{"object"==typeof r&&"actions"in r&&r.actions.forEach((r=>{const a=r;"function"==typeof a&&(s.Edit[e]=[...s[e]||[],(0,t.jsx)(n,{Component:a})])}))})),i&&i.forEach((e=>{const r=e;"function"==typeof r&&(s.List=[...s.List,(0,t.jsx)(n,{Component:r})])})),s},oh=require("payload");const ih=e=>{const{WithServerSideProps:n,config:r,disableAddingID:a,fieldSchema:i,filter:s,i18n:l,i18n:{t:c},parentPath:u,readOnly:d}=e,f=i.reduce(((e,a)=>{const i=(0,jc.fieldIsPresentationalOnly)(a);let f=a.admin?.components?.Field,p=a.admin?.components?.Cell;const m=a?.admin&&"hidden"in a.admin&&a.admin.hidden;if((i||!a?.hidden&&!0!==a?.admin?.disabled)&&(s&&"function"==typeof s&&s(a)||!s)){m&&f&&(f=ol);const h=(0,jc.fieldAffectsData)(a),g=function(e,t){let n=e||"";return e&&t?n=`${e}.${t}`:!e&&t&&(n=t),n}(u,h&&"name"in a?a.name:""),v="admin"in a&&"components"in a.admin&&"afterInput"in a.admin.components&&Array.isArray(a.admin?.components?.afterInput)&&(0,t.jsx)(o.Fragment,{children:a.admin.components.afterInput.map(((e,r)=>(0,t.jsx)(n,{Component:e},r)))})||null,b="admin"in a&&a.admin?.components&&"beforeInput"in a.admin.components&&Array.isArray(a.admin.components.beforeInput)&&(0,t.jsx)(o.Fragment,{children:a.admin.components.beforeInput.map(((e,r)=>(0,t.jsx)(n,{Component:e},r)))})||null;let y;"label"in a&&("string"==typeof a.label||"object"==typeof a.label?y=a.label:"function"==typeof a.label&&(y=a.label({t:c})));const w={label:y,required:"required"in a?a.required:void 0,schemaPath:g},x="admin"in a&&a.admin?.components&&"Label"in a.admin.components&&a.admin.components?.Label||void 0,P=void 0!==x?(0,t.jsx)(n,{Component:x,...w||{}}):void 0;let j;a.admin&&"description"in a.admin&&("string"==typeof a.admin?.description||"object"==typeof a.admin?.description?j=a.admin.description:"function"==typeof a.admin?.description&&(j=a.admin?.description({t:c})));const k={description:j};let S;a.admin?.components&&"Description"in a.admin.components&&a.admin.components?.Description?S=a.admin.components.Description:j&&(S=ks);const C=void 0!==S?(0,t.jsx)(n,{Component:S,...k||{}}):void 0,M={path:g},_="admin"in a&&a.admin?.components&&"Error"in a.admin.components&&a.admin?.components?.Error||void 0,O={AfterInput:v,BeforeInput:b,CustomDescription:C,CustomError:void 0!==_?(0,t.jsx)(n,{Component:_,...M||{}}):void 0,CustomLabel:P,custom:"admin"in a&&"custom"in a.admin?a.admin?.custom:void 0,descriptionProps:k,disabled:"admin"in a&&"disabled"in a.admin&&a.admin?.disabled,errorProps:M,label:w?.label,path:g,required:"required"in a?a.required:void 0};let E,D;"options"in a&&(D=a.options.map((e=>"object"==typeof e&&"function"==typeof e.label?{label:e.label({t:c}),value:e.value}:e)));const N={name:"name"in a?a.name:void 0,fieldType:a.type,isFieldAffectingData:h,label:w?.label||void 0,labels:"labels"in a?a.labels:void 0,options:"options"in a?D:void 0,relationTo:"relationTo"in a?a.relationTo:void 0,schemaPath:g};switch(a.type){case"array":{let e;if("admin"in a&&a.admin.components&&"RowLabel"in a.admin.components&&a.admin.components.RowLabel){const r=a.admin.components.RowLabel;e=(0,t.jsx)(n,{Component:r,...w||{}})}E={...O,name:a.name,CustomRowLabel:e,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),isSortable:a.admin?.isSortable,labels:a.labels,maxRows:a.maxRows,minRows:a.minRows,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break}case"blocks":{const e=a.blocks.map((e=>{const t=ih({WithServerSideProps:n,config:r,fieldSchema:e.fields,filter:s,i18n:l,parentPath:`${g}.${e.slug}`,readOnly:d});return{slug:e.slug,custom:e.admin?.custom,fieldMap:t,imageAltText:e.imageAltText,imageURL:e.imageURL,labels:e.labels}}));E={...O,name:a.name,blocks:e,className:a.admin?.className,disabled:a.admin?.disabled,isSortable:a.admin?.isSortable,labels:a.labels,maxRows:a.maxRows,minRows:a.minRows,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width},N.blocks=a.blocks.map((e=>({slug:e.slug,labels:e.labels})));break}case"checkbox":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"code":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,editorOptions:a.admin?.editorOptions,language:a.admin?.language,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"collapsible":{let e;if(a?.admin?.components&&"RowLabel"in a.admin.components&&a?.admin?.components?.RowLabel){const r=a.admin.components.RowLabel;e=(0,t.jsx)(n,{Component:r,...w||{}})}E={...O,CustomLabel:e,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),initCollapsed:a.admin?.initCollapsed,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break}case"date":E={...O,name:a.name,className:a.admin?.className,date:a.admin?.date,disabled:a.admin?.disabled,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width},N.dateDisplayFormat=a.admin?.date?.displayFormat;break;case"email":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"group":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),hideGutter:a.admin?.hideGutter,readOnly:a.admin?.readOnly,style:a.admin?.style,width:a.admin?.width};break;case"json":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,editorOptions:a.admin?.editorOptions,jsonSchema:a.jsonSchema,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"number":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,max:a.max,maxRows:a.maxRows,min:a.min,readOnly:a.admin?.readOnly,required:a.required,step:a.admin?.step,style:a.admin?.style,width:a.admin?.width};break;case"point":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"relationship":{const e={...O,name:a.name,allowCreate:a.admin.allowCreate,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,isSortable:a.admin?.isSortable,readOnly:a.admin?.readOnly,relationTo:a.relationTo,required:a.required,sortOptions:a.admin.sortOptions,style:a.admin?.style,width:a.admin?.width};N.relationTo=a.relationTo,E=e;break}case"radio":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,options:D,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};N.options=D,E=e;break}case"richText":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};if(!a?.editor)throw new oh.MissingEditorProp(a);if("function"==typeof a?.editor)throw new Error("Attempted to access unsanitized rich text editor.");const t=a.editor.FieldComponent,o=a.editor.CellComponent;if("function"==typeof a.editor.generateComponentMap){const t=a.editor.generateComponentMap({WithServerSideProps:n,config:r,i18n:l,schemaPath:g});e.richTextComponentMap=t,N.richTextComponentMap=t}t&&(f=t),o&&(p=o),E=e;break}case"row":E={...O,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"tabs":{const e=a.tabs.map((e=>{const t=ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:e.fields,filter:s,i18n:l,parentPath:g,readOnly:d});return{name:"name"in e?e.name:void 0,fieldMap:t,label:e.label}}));E={...O,name:"name"in a?a.name:void 0,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,tabs:e,width:a.admin?.width};break}case"text":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,maxLength:a.maxLength,minLength:a.minLength,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"textarea":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,maxLength:a.maxLength,minLength:a.minLength,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,rows:a.admin?.rows,style:a.admin?.style,width:a.admin?.width};break;case"ui":E=O;break;case"upload":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,filterOptions:a.filterOptions,readOnly:a.admin?.readOnly,relationTo:a.relationTo,required:a.required,style:a.admin?.style,width:a.admin?.width};N.relationTo=a.relationTo,E=e;break}case"select":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,isClearable:a.admin?.isClearable,options:D,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};N.options=D,E=e;break}}const A={name:"name"in a?a.name:void 0,type:a.type,CustomCell:p?(0,t.jsx)(n,{Component:p,...N}):void 0,CustomField:f?(0,t.jsx)(n,{Component:f,...E}):void 0,cellComponentProps:N,custom:a?.admin?.custom,disableBulkEdit:"admin"in a&&"disableBulkEdit"in a.admin&&a.admin.disableBulkEdit,disableListColumn:"admin"in a&&"disableListColumn"in a.admin&&a.admin.disableListColumn,disableListFilter:"admin"in a&&"disableListFilter"in a.admin&&a.admin.disableListFilter,fieldComponentProps:E,fieldIsPresentational:i,isFieldAffectingData:h,isHidden:m,isSidebar:"admin"in a&&"position"in a.admin&&"sidebar"===a.admin.position,localized:"localized"in a&&a.localized,unique:"unique"in a&&a.unique};e.push(A)}return e}),[]),p=f.findIndex((e=>"name"in e&&e.isFieldAffectingData&&"id"===e.name))>-1;return a||p||f.push({name:"id",type:"text",CustomField:null,cellComponentProps:{name:"id",schemaPath:"id"},disableBulkEdit:!0,fieldComponentProps:{name:"id",label:"ID"},fieldIsPresentational:!1,isFieldAffectingData:!0,isHidden:!0,localized:void 0}),f},sh=e=>{const{DefaultEditView:n,DefaultListView:r,children:a,i18n:o,payload:i,readOnly:s}=e,l=i.config,c=({Component:e,...n})=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:o,payload:i},...n}),u=(e=>{const{DefaultEditView:n,DefaultListView:r,WithServerSideProps:a,collections:o,config:i,i18n:s,i18n:{t:l},readOnly:c}=e;return o.reduce(((e,o)=>{const{slug:u,fields:d}=o;if(["payload-preferences","payload-migrations"].includes(u))return e;const f=o?.admin?.components?.views?.Edit,p=o?.admin?.components?.views?.List,m="function"==typeof f?f:"object"==typeof f&&(0,jc.isReactComponentOrFunction)(f.Default)?f.Default:"object"==typeof f?.Default&&"Component"in f.Default&&(0,jc.isReactComponentOrFunction)(f.Default.Component)?f.Default.Component:void 0,h="function"==typeof p?p:"object"==typeof p&&(0,jc.isReactComponentOrFunction)(p.Component)?p.Component:void 0,g=m||n,v=h||r,b=o?.admin?.components?.edit?.SaveButton,y=b?(0,t.jsx)(a,{Component:b}):void 0,w=o?.admin?.components?.edit?.SaveDraftButton,x=w?(0,t.jsx)(a,{Component:w}):void 0,P=o?.admin?.components?.edit?.PreviewButton,j=P?(0,t.jsx)(a,{Component:P}):void 0,k=o?.admin?.components?.edit?.PublishButton,S=k?(0,t.jsx)(a,{Component:k}):void 0,C=o?.admin?.components?.edit?.Upload,M=C?(0,t.jsx)(a,{Component:C}):void 0,_=o?.admin?.components?.beforeList,O=_&&Array.isArray(_)&&_?.map((e=>(0,t.jsx)(a,{Component:e})))||null,E=o?.admin?.components?.beforeListTable,D=E&&Array.isArray(E)&&E?.map((e=>(0,t.jsx)(a,{Component:e})))||null,N=o?.admin?.components?.afterList,A=N&&Array.isArray(N)&&N?.map((e=>(0,t.jsx)(a,{Component:e})))||null,T=o?.admin?.components?.afterListTable,R=T&&Array.isArray(T)&&T?.map((e=>(0,t.jsx)(a,{Component:e})))||null;let I;o.admin&&"description"in o.admin&&("string"==typeof o.admin?.description||"object"==typeof o.admin?.description?I=o.admin.description:"function"==typeof o.admin?.description&&(I=o.admin?.description({t:l})));const L={description:I},$=o.admin?.components?.edit?.Description||(I?Am:void 0),W={AfterList:A,AfterListTable:R,BeforeList:O,BeforeListTable:D,Description:void 0!==$?(0,t.jsx)(a,{Component:$,...L||{}}):void 0,Edit:(0,t.jsx)(g,{collectionSlug:o.slug}),List:(0,t.jsx)(v,{collectionSlug:o.slug}),PreviewButton:j,PublishButton:S,SaveButton:y,SaveDraftButton:x,Upload:M,actionsMap:ah({WithServerSideProps:a,collectionConfig:o}),fieldMap:ih({WithServerSideProps:a,config:i,fieldSchema:d,i18n:s,readOnly:c}),isPreviewEnabled:!!o?.admin?.preview};return{...e,[u]:W}}),{})})({DefaultEditView:n,DefaultListView:r,WithServerSideProps:c,collections:l.collections,config:l,i18n:o,readOnly:s}),d=(({args:e})=>{const{DefaultEditView:n,WithServerSideProps:r,config:a,globals:o,i18n:i,i18n:{t:s},readOnly:l}=e;return o.reduce(((e,o)=>{const{slug:c,fields:u}=o,d=o?.admin?.components?.views?.Edit,f=o?.admin?.components?.elements?.SaveButton,p=f?(0,t.jsx)(r,{Component:f}):void 0,m=o?.admin?.components?.elements?.SaveDraftButton,h=m?(0,t.jsx)(r,{Component:m}):void 0,g=o?.admin?.components?.elements?.PreviewButton,v=g?(0,t.jsx)(r,{Component:g}):void 0,b=o?.admin?.components?.elements?.PublishButton,y=b?(0,t.jsx)(r,{Component:b}):void 0,w=("function"==typeof d?d:"object"==typeof d&&(0,jc.isReactComponentOrFunction)(d.Default)?d.Default:"object"==typeof d?.Default&&"Component"in d.Default&&(0,jc.isReactComponentOrFunction)(d.Default.Component)?d.Default.Component:void 0)||n;let x;o.admin&&"description"in o.admin&&("string"==typeof o.admin?.description||"object"==typeof o.admin?.description?x=o.admin.description:"function"==typeof o.admin?.description&&(x=o.admin?.description({t:s})));const P={description:x},j=o.admin?.components?.elements?.Description||(x?Am:void 0),k={Description:void 0!==j?(0,t.jsx)(r,{Component:j,...P||{}}):void 0,Edit:(0,t.jsx)(w,{globalSlug:o.slug}),PreviewButton:v,PublishButton:y,SaveButton:p,SaveDraftButton:h,Upload:null,actionsMap:ah({WithServerSideProps:r,globalConfig:o}),fieldMap:ih({WithServerSideProps:r,config:a,fieldSchema:u,i18n:i,readOnly:l}),isPreviewEnabled:!!o?.admin?.preview};return{...e,[c]:k}}),{})})({args:{DefaultEditView:n,WithServerSideProps:c,config:l,globals:l.globals,i18n:o,readOnly:s}}),f=({children:e,providers:n})=>{const r=n[0];return n.length>1?(0,t.jsx)(r,{children:(0,t.jsx)(f,{providers:n.slice(1),children:e})}):(0,t.jsx)(r,{children:e})},p=l.admin?.components?.logout?.Button,m=p?(0,t.jsx)(c,{Component:p}):null,h=l.admin?.components?.graphics?.Icon;return{componentMap:{Icon:h?(0,t.jsx)(c,{Component:h}):null,LogoutButton:m,actions:l.admin?.components?.actions?.map((e=>(0,t.jsx)(c,{Component:e}))),collections:u,globals:d},wrappedChildren:Array.isArray(l.admin?.components?.providers)&&l.admin?.components?.providers.length>0?(0,t.jsx)(f,{providers:l.admin?.components?.providers,children:a}):a}};var lh=n(97922),ch=n(15186);n(22411);let uh=n.g._payload;uh||(uh=n.g._payload={payload:null,promise:null,reload:!1});const dh=async e=>{if(!e?.config)throw new Error("Error: the payload config is required for getPayload to work.");if(uh.payload){const t=await e.config;if(!0===uh.reload){let e;uh.reload=new Promise((t=>e=t)),await(async(e,t)=>{"function"==typeof t.db.destroy&&await t.db.destroy(),t.config=e,t.collections=e.collections.reduce(((e,n)=>(e[n.slug]={config:n,customIDType:t.collections[n.slug]?.customIDType},e)),{}),t.globals={config:e.globals},!1!==e.typescript.autoGenerate&&t.bin({args:["generate:types"],log:!1}),await t.db.init(),t.db.connect&&await t.db.connect({hotReload:!0})})(t,uh.payload),e()}return uh.reload instanceof Promise&&await uh.reload,uh.payload}uh.promise||(uh.promise=(new oh.BasePayload).init(e));try{uh.payload=await uh.promise}catch(e){throw uh.promise=null,e}return uh.payload},fh=({config:e,cookies:t,headers:n})=>{const r=Object.keys(e.i18n.supportedLanguages),o=t.get(`${e.cookiePrefix||"payload"}-lng`),i="string"==typeof o?o:o?.value;if(i&&r.includes(i))return i;const s=n.get("Accept-Language")?(0,a.R8)(n.get("Accept-Language")):void 0;return s&&r.includes(s)?s:e.i18n.fallbackLanguage},ph=["dark","light"];var mh=n(98077);const hh={413:"Your request was too large to submit successfully."};var gh=n(4648),vh=n.n(gh);const bh=(e,t)=>{const n={},r=Object.entries(t).reduce(((t,[r,a])=>{const o=t;if(0===r.indexOf(`${e}.`)){const[t]=r.replace(`${e}.`,"").split(".");o[t]||(o[t]={}),o[t][r.replace(`${e}.${String(t)}.`,"")]={...a}}else n[r]=a;return o}),[]);return{remainingFields:n,rows:r}},yh=(e,t)=>t.reduce(((t,n,r)=>({...t,...Object.entries(n).reduce(((t,[n,a])=>({...t,[`${e}.${r}.${n}`]:{...a}})),{})})),{}),wh=vh().default||vh();function xh(e,t){switch(t.type){case"REPLACE_STATE":if(!1!==t.optimize){const n={};return Object.entries(t.state).forEach((([t,r])=>{const a=e[t],o=r;pt(a,o)?a&&(n[t]=a):n[t]=o})),n}return t.state;case"REMOVE":{const n={...e};return n[t.path]&&delete n[t.path],n}case"ADD_SERVER_ERRORS":{let n={...e};const r=[];return t.errors.forEach((({field:e,message:t})=>{n[e]={...n[e]||{initialValue:null,value:null},errorMessage:t,valid:!1};const a=e.split(".");a.length>1&&r.push({fieldErrorPath:e,parentPath:a.slice(0,a.length-1).join(".")})})),n=Object.entries(n).reduce(((e,[t,n])=>{const a=r.reduce(((e,{fieldErrorPath:n,parentPath:r})=>(r.startsWith(t)&&e.push(n),e)),[]);let o=!1;if(a.length>0){const r=Array.isArray(n.errorPaths)?n.errorPaths:[];a.forEach((e=>{r.includes(e)||(r.push(e),o=!0)})),o&&(e[t]={...n,errorPaths:r})}return o||(e[t]=n),e}),{}),n}case"UPDATE":{const n=Object.entries(t).reduce(((e,[t,n])=>["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(t)?{...e,[t]:n}:e),e[t.path]||{});return{...e,[t.path]:n}}case"REMOVE_ROW":{const{path:n,rowIndex:r}=t,{remainingFields:a,rows:o}=bh(n,e),i=[...e[n]?.rows||[]];o.splice(r,1),i.splice(r,1);return{...a,[n]:{...e[n],disableFormData:o.length>0,rows:i,value:o.length},...yh(n,o)}}case"ADD_ROW":{const{blockType:n,path:r,rowIndex:a,subFieldState:o={}}=t,i="number"==typeof a?a:e[r]?.rows?.length||0,s=[...e[r]?.rows||[]],l={id:o?.id?.value||(new wh).toHexString(),blockType:n||void 0,collapsed:!1};s.splice(i,0,l),n&&(o.blockType={initialValue:n,valid:!0,value:n});const{remainingFields:c,rows:u}=bh(r,e);u.splice(i,0,o);return{...c,...yh(r,u),[r]:{...e[r],disableFormData:!0,rows:s,value:u.length}}}case"REPLACE_ROW":{const{blockType:n,path:r,rowIndex:a,subFieldState:o={}}=t,{remainingFields:i,rows:s}=bh(r,e),l=Math.max(0,Math.min(a,s?.length-1||0)),c=[...e[r]?.rows||[]];c[l]={id:(new wh).toHexString(),blockType:n||void 0,collapsed:!1},n&&(o.blockType={initialValue:n,valid:!0,value:n}),s[l]=o;return{...i,...yh(r,s),[r]:{...e[r],disableFormData:!0,rows:c,value:s.length}}}case"DUPLICATE_ROW":{const{path:n,rowIndex:r}=t,{remainingFields:a,rows:o}=bh(n,e),i=[...e[n].rows||[]],s=(0,jc.deepCopyObject)(i[r]);s.id&&(s.id=(new wh).toHexString());const l=(0,jc.deepCopyObject)(o[r]);l.id&&(l.id=(new wh).toHexString()),Object.keys(l).length>0&&(o.splice(r+1,0,l),i.splice(r+1,0,s));return{...a,...yh(n,o),[n]:{...e[n],disableFormData:!0,rows:i,value:o.length}}}case"MOVE_ROW":{const{moveFromIndex:n,moveToIndex:r,path:a}=t,{remainingFields:o,rows:i}=bh(a,e),s=i[n];i.splice(n,1),i.splice(r,0,s);const l=[...e[a]?.rows||[]],c={...l[n]};l.splice(n,1),l.splice(r,0,c);return{...o,...yh(a,i),[a]:{...e[a],rows:l}}}case"SET_ROW_COLLAPSED":{const{collapsed:n,path:r,rowID:a,setDocFieldPreferences:o}=t,i=e[r],{collapsedRowIDs:s,matchedIndex:l}=e[r].rows.reduce(((e,t,r)=>{const o=t.id===a;return o&&(e.matchedIndex=r),(!o&&t.collapsed||o&&n)&&e.collapsedRowIDs.push(t.id),e}),{collapsedRowIDs:[],matchedIndex:void 0});l>-1&&(i.rows[l].collapsed=n,o(r,{collapsed:s}));return{...e,[r]:{...i}}}case"SET_ALL_ROWS_COLLAPSED":{const{collapsed:n,path:r,setDocFieldPreferences:a}=t,{collapsedRowIDs:o,rows:i}=e[r].rows.reduce(((e,t)=>(n&&e.collapsedRowIDs.push(t.id),e.rows.push({...t,collapsed:n}),e)),{collapsedRowIDs:[],rows:[]});return a(r,{collapsed:o}),{...e,[r]:{...e[r],rows:i}}}default:return e}}const Ph={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:()=>{},disabled:!1,dispatchFields:()=>{},fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:()=>{},initializing:void 0,removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:()=>{},setDisabled:()=>{},setModified:()=>{},setProcessing:()=>{},setSubmitted:()=>{},submit:()=>{},validateForm:()=>{}};const jh=["passesCondition","valid","errorMessage"],kh=(e,t)=>{let n=!1;const r={};return e&&Object.entries(e).forEach((([e,a])=>{if(!t[e])return;const o=((e,t)=>{if(!e)return{changed:!1,result:void 0};const n=[],r=[];return Array.isArray(t)&&t?.length&&t.forEach((e=>r.push(e))),Array.isArray(e)&&e?.length&&e.forEach((e=>n.push(e))),function(e,t){if(e.length!==t.length)return!1;const n=e.slice().sort(),r=t.slice().sort();for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}(n,r)?{changed:!1,result:e}:{changed:!0,result:r}})(a.errorPaths,t[e].errorPaths);o.result&&(o.changed&&(n=o.changed),a.errorPaths=o.result),(t[e]?.filterOptions||a.filterOptions)&&(pt(t[e]?.filterOptions,a.filterOptions)||(n=!0,a.filterOptions=t[e].filterOptions)),jh.forEach((r=>{t[e]?.[r]!==a[r]&&(n=!0,r in t[e]?a[r]=t[e][r]:delete a[r])})),r[e]={...a}})),{changed:n,newState:r}},Sh="form",Ch=e=>{const{id:n,collectionSlug:r,globalSlug:a}=us(),{action:i,beforeSubmit:s,children:l,className:c,disableSuccessStatus:u,disableValidationOnSubmit:d,disabled:f,handleResponse:p,initialState:m,isInitializing:h,onChange:g,onSubmit:v,onSuccess:b,redirect:y,submitted:w,uuid:x,waitForAutocomplete:P}=e,j="method"in e?e?.method:void 0,k=(0,ht.useRouter)(),{code:S}=ls(),{i18n:C,t:M}=(0,Be.B)(),{refreshCookie:_,user:O}=sn(),E=ms(),{formQueryParams:D}=Ff(),N=Ut(),{routes:{api:A},serverURL:T}=N,[R,I]=(0,o.useState)(f||!1),[L,$]=(0,o.useState)(!1),[W,F]=(0,o.useState)(!1),[z,B]=(0,o.useState)(h),[H,Y]=(0,o.useState)(!1),[V,q]=(0,o.useState)(!1),U=(0,o.useRef)(null),G=(0,o.useRef)({}),K=(0,o.useReducer)(xh,{},(()=>m)),[X,Q]=K;G.current.fields=X;const J=(0,o.useCallback)((async()=>{const e={};let t=!0;const r=G.current.getData(),a=Object.entries(G.current.fields).map((async([a,o])=>{const i=o;if(!1!==o.passesCondition){let e=i.valid;if("function"==typeof o.validate){let t=o.value;o?.rows&&Array.isArray(o.rows)&&(t=G.current.getDataByPath(a)),e=await o.validate(t,{id:n,config:N,data:r,operation:E,siblingData:G.current.getSiblingData(a),t:M,user:O}),"string"==typeof e?(i.errorMessage=e,i.valid=!1):(i.valid=!0,i.errorMessage=void 0)}!1===i.valid&&(t=!1)}e[a]=i}));return await Promise.all(a),pt(G.current.fields,e)||Q({type:"REPLACE_STATE",state:e}),t}),[n,O,E,M,Q,N]),Z=(0,o.useCallback)((async(e={},t)=>{const{action:n,method:r=j,overrides:a={},skipValidation:o}=e;if(R)return void(t&&t.preventDefault());let l,c;const f=new Promise(((e,t)=>{l=e,c=t})),m=n||"string"==typeof i||"function"==typeof i;if(y||u||!m?(l=e=>Ct.success(e),c=e=>Ct.error(e)):Ct.promise(f,{error:e=>e,loading:M("general:submitting"),success:e=>e}),t&&(t.stopPropagation(),t.preventDefault()),Y(!0),I(!0),P&&await(0,jc.wait)(100),Array.isArray(s)){let e;await s.reduce((async(t,n)=>{await t;const r=await n({formState:X});e=r}),Promise.resolve());if(!Object.entries(e).every((([,e])=>e.valid)))return Y(!1),q(!0),I(!1),Q({type:"REPLACE_STATE",state:e})}if(!(!(!o&&!d)||await G.current.validateForm()))return c(M("error:correctInvalidFields")),Y(!1),q(!0),void I(!1);if(v){const e={...as(X,!0),...a};v(X,e)}if(!m)return Y(!1),q(!0),void I(!1);const h=G.current.createFormData(a);try{let e;const t=n||("string"==typeof i?`${i}${ge().stringify(D,{addQueryPrefix:!0})}`:null);if(t?e=await mt[r.toLowerCase()](t,{body:h,headers:{"Accept-Language":C.language}}):"function"==typeof i&&(e=await i(h)),F(!1),I(!1),"function"==typeof p)return void p(e,l,c);const a=e.headers.get("content-type"),o=a&&-1!==a.indexOf("application/json");let s={};if(o&&(s=await e.json()),e.status<400)"function"==typeof b&&await b(s),q(!1),Y(!1),y?k.push(y):u||l(s.message||M("general:submissionSuccessful"));else{if(Y(!1),q(!0),G.current={...G.current},s.message)return void c(s.message);if(Array.isArray(s.errors)){const[e,t]=s.errors.reduce((([e,t],n)=>{const r=[],a=[];return n?.message&&a.push(n),Array.isArray(n?.data?.errors)&&n.data?.errors.forEach((e=>{e?.field?r.push(e):a.push(e)})),[[...e,...r],[...t,...a]]}),[[],[]]);return Q({type:"ADD_SERVER_ERRORS",errors:e}),void t.forEach((e=>{c(e.message||M("error:unknown"))}))}const t=hh?.[e.status]||e?.statusText||M("error:unknown");c(t)}}catch(e){console.error("Error submitting form",e),Y(!1),q(!0),I(!1),c(e.message)}}),[s,i,u,d,R,Q,X,p,j,v,b,y,k,M,C,P,D]),ee=(0,o.useCallback)((()=>G.current.fields),[]),te=(0,o.useCallback)((e=>G.current.fields[e]),[]),ne=(0,o.useCallback)((()=>as(G.current.fields,!0)),[]),re=(0,o.useCallback)((e=>((e,t)=>{if(!e)return null;if(-1===t.indexOf("."))return as(e,!0);const n={},r=t.split("."),a=r[r.length-1],o=!Number.isNaN(Number(a));let i;return i=o?`${t}.`:t.substring(0,t.lastIndexOf(".")+1),Object.keys(e).forEach((t=>{e[t].disableFormData||0!==t.indexOf(i)||(n[t.replace(i,"")]=e[t].value)})),rs(n)})(G.current.fields,e)),[]),ae=(0,o.useCallback)((e=>((e,t)=>{const n=t.substring(0,t.lastIndexOf(".")+1),r=t.split(".").pop(),a={};Object.keys(e).forEach((r=>{e[r].disableFormData||0!==r.indexOf(`${t}.`)&&r!==t||(a[r.replace(n,"")]=e[r].value,e[r]?.rows&&0===e[r].rows.length&&(a[r.replace(n,"")]=[]))}));const o=rs(a);return o?.[r]})(G.current.fields,e)),[]),oe=(0,o.useCallback)(((e={})=>{const t=as(G.current.fields,!0),n=t?.file;n&&delete t.file;const r={...t,...e},a={_payload:JSON.stringify(r),file:n};return(0,mh.serialize)(a,{indices:!0,nullsAsUndefineds:!1})}),[]),ie=(0,o.useCallback)((async e=>{const t=await Ji({apiRoute:A,body:{id:n,collectionSlug:r,data:e,globalSlug:a,operation:E,schemaPath:r||a},serverURL:T});G.current={...Ph},F(!1),Q({type:"REPLACE_STATE",state:t})}),[A,r,Q,a,n,E,T]),se=(0,o.useCallback)((e=>{G.current={...Ph},F(!1),Q({type:"REPLACE_STATE",state:e})}),[Q]),le=(0,o.useCallback)((async({data:e,schemaPath:t})=>await Ji({apiRoute:A,body:{collectionSlug:r,data:e,globalSlug:a,schemaPath:t},serverURL:T})),[A,r,a,T]),ce=(0,o.useCallback)((async({data:e,path:t,rowIndex:n,schemaPath:r})=>{const a=await le({data:e,schemaPath:r});Q({type:"ADD_ROW",blockType:e?.blockType,path:t,rowIndex:n,subFieldState:a})}),[le,Q]),ue=(0,o.useCallback)((({path:e,rowIndex:t})=>{Q({type:"REMOVE_ROW",path:e,rowIndex:t})}),[Q]),de=(0,o.useCallback)((async({data:e,path:t,rowIndex:n,schemaPath:r})=>{const a=await le({data:e,schemaPath:r});Q({type:"REPLACE_ROW",blockType:e?.blockType,path:t,rowIndex:n,subFieldState:a})}),[le,Q]);(0,o.useEffect)((()=>{void 0!==h&&B(h)}),[h]),G.current.submit=Z,G.current.getFields=ee,G.current.getField=te,G.current.getData=ne,G.current.getSiblingData=re,G.current.getDataByPath=ae,G.current.validateForm=J,G.current.createFormData=oe,G.current.setModified=F,G.current.setProcessing=Y,G.current.setSubmitted=q,G.current.disabled=R,G.current.setDisabled=I,G.current.formRef=U,G.current.reset=ie,G.current.replaceState=se,G.current.dispatchFields=Q,G.current.addFieldRow=ce,G.current.removeFieldRow=ue,G.current.replaceFieldRow=de,G.current.uuid=x,G.current.initializing=z,(0,o.useEffect)((()=>{$(!0)}),[]),(0,o.useEffect)((()=>{"boolean"==typeof f&&I(f)}),[f]),(0,o.useEffect)((()=>{"boolean"==typeof w&&q(w)}),[w]),(0,o.useEffect)((()=>{m&&(G.current={...Ph},Q({type:"REPLACE_STATE",optimize:!1,state:m}))}),[m,Q]),Yo((()=>{_()}),15e3,[X]),(0,o.useEffect)((()=>{G.current={...G.current},F(!1)}),[S]);const fe=[c,Sh].filter(Boolean).join(" ");!function(e,t,n){const[r,a]=(0,o.useState)((()=>e));(0,o.useEffect)((()=>{const n=setTimeout((()=>{a((()=>e))}),t);return()=>{clearTimeout(n)}}),[...n,t]),(0,o.useEffect)((()=>{r()}),[r])}((()=>{W&&(async()=>{if(Array.isArray(g)){let e=G.current.fields;for(const t of g)e=await t({formState:e});const{changed:t,newState:n}=kh(G.current.fields||{},e);t&&Q({type:"REPLACE_STATE",optimize:!1,state:n})}})()}),150,[G.current.fields,Q,g,W]);const pe="string"==typeof i?`${i}${ge().stringify(D,{addQueryPrefix:!0})}`:"";return(0,t.jsx)("form",{action:j?pe:i,className:fe,method:j,noValidate:!0,onSubmit:e=>G.current.submit({},e),ref:U,children:(0,t.jsx)(Eo.Provider,{value:G.current,children:(0,t.jsx)(Do.Provider,{value:{fields:X,...G.current},children:(0,t.jsx)(No.Provider,{value:V,children:(0,t.jsx)(Ro.Provider,{value:!L||L&&z,children:(0,t.jsx)(Ao.Provider,{value:H,children:(0,t.jsx)(To.Provider,{value:W,children:(0,t.jsx)(Io.Provider,{value:K,children:l})})})})})})})})},Mh=(e,t,n)=>{const r={data:{},valid:!0};return e?(Object.keys(e).forEach((t=>{!0!==n&&e[t]?.disableFormData||(r.data[t]=e[t]?.value,e[t].valid||(r.valid=!1))})),t&&(r.data=rs(r.data)),r):r},_h=({id:e,collection:n,global:r,publishedDocUpdatedAt:a})=>{const{routes:{api:s},serverURL:l}=Ut(),{docConfig:c,getVersions:u,versions:d}=us(),{reportUpdate:f}=On(),{dispatchFields:p,setSubmitted:m}=Lo(),h=$o(),g=c?.versions,[v]=Ho(),b=Fo(),{code:y}=ls(),{i18n:w,t:x}=(0,Be.B)();let P=jc.versionDefaults.autosaveInterval;g.drafts&&g.drafts.autosave&&(P=g.drafts.autosave.interval);const[j,k]=(0,o.useState)(!1),[S,C]=(0,o.useState)(),M=Qt(v,P),_=Qt(b,P),O=(0,o.useRef)(v),E=(0,o.useRef)(_),D=(0,o.useRef)(y);return(0,o.useRef)(M).current=M,O.current=v,E.current=_,D.current=y,(0,o.useEffect)((()=>{const t=new AbortController;let a;return(()=>{if(_){let o,i,c;k(!0),n&&e&&(c=n.slug,o=`${l}${s}/${c}/${e}?draft=true&autosave=true&locale=${D.current}`,i="PATCH"),r&&(c=r.slug,o=`${l}${s}/globals/${c}?draft=true&autosave=true&locale=${D.current}`,i="POST"),o&&(a=setTimeout((async()=>{if(E.current){const{data:n,valid:r}={...Mh(O.current,!0)};n._status="draft";if(!(h&&!r&&g?.drafts&&g?.drafts?.validate)){const r=await fetch(o,{body:JSON.stringify(n),credentials:"include",headers:{"Accept-Language":w.language,"Content-Type":"application/json"},method:i,signal:t.signal});if(200===r.status){const t=new Date;C(t.getTime()),f({id:e,entitySlug:c,updatedAt:t.toISOString()}),u()}if(g?.drafts&&g?.drafts?.validate&&400===r.status){const e=await r.json();if(Array.isArray(e.errors)){const[t,n]=e.errors.reduce((([e,t],n)=>{const r=[],a=[];return n?.message&&a.push(n),Array.isArray(n?.data)&&n.data.forEach((e=>{e?.field?r.push(e):a.push(e)})),[[...e,...r],[...t,...a]]}),[[],[]]);return p({type:"ADD_SERVER_ERRORS",errors:t}),n.forEach((e=>{Ct.error(e.message||w.t("error:unknown"))})),m(!0),void k(!1)}}}}k(!1)}),1e3))}})(),()=>{clearTimeout(a),t.signal&&t.abort(),k(!1)}}),[s,n,p,u,r,w,e,P,_,f,l,m,g?.drafts,M,h]),(0,o.useEffect)((()=>{d?.docs?.[0]?C(new Date(d.docs[0].updatedAt).getTime()):a&&C(new Date(a).getTime())}),[a,d]),(0,t.jsxs)("div",{className:"autosave",children:[j&&x("general:saving"),!j&&S&&(0,t.jsx)(i().Fragment,{children:x("version:lastSavedAgo",{distance:Xi({date:S,i18n:w})})})]})},Oh=({elements:e,translationString:n})=>{const r=n.split(/(<[^>]+>.*?<\/[^>]+>)/g);return(0,t.jsx)("span",{children:r.map(((n,r)=>{if(e&&n.startsWith("<")&&n.endsWith(">")){const a=n[1],o=e[a];if(o){const e=new RegExp(`<${a}>(.*?)</${a}>`,"g"),i=n.replace(e,((e,t)=>t));return(0,t.jsx)(o,{children:(0,t.jsx)(Oh,{translationString:i})},r)}}return n}))})},Eh=({elements:e,i18nKey:n,t:r,variables:a})=>{const o=r(n,a||{});return e?(0,t.jsx)(Oh,{elements:e,translationString:o}):o},Dh="delete-document",Nh=e=>{const{id:n,buttonId:r,collectionSlug:s,singularLabel:l,title:c}=e,{routes:{admin:u,api:d},serverURL:f}=Ut(),{setModified:p}=Lo(),[m,h]=(0,o.useState)(!1),{toggleModal:g}=O(),v=(0,ht.useRouter)(),{i18n:b,t:y}=(0,Be.B)(),{title:w}=us(),x=c||w||n,P=`delete-${n}`,j=(0,o.useCallback)((()=>{h(!1),Ct.error(y("error:deletingTitle",{title:w}))}),[y,w]),k=(0,o.useCallback)((async()=>{h(!0),p(!1);try{await mt.delete(`${f}${d}/${s}/${n}`,{headers:{"Accept-Language":b.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return e.status<400?(h(!1),g(P),Ct.success(y("general:titleDeleted",{label:(0,a.sC)(l,b),title:w})||t.message),v.push(`${u}/collections/${s}`)):(g(P),t.errors?t.errors.forEach((e=>Ct.error(e.message))):j(),!1)}catch(e){return j()}}))}catch(e){j()}}),[p,f,d,s,n,g,P,y,l,b,w,v,u,j]);return n?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Gs,{id:r,onClick:()=>{h(!1),g(P)},children:y("general:delete")}),(0,t.jsx)(ce,{className:Dh,slug:P,children:(0,t.jsxs)("div",{className:`${Dh}__template`,children:[(0,t.jsx)("h1",{children:y("general:confirmDeletion")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{1:({children:e})=>(0,t.jsx)("strong",{children:e})},i18nKey:"general:aboutToDelete",t:y,variables:{label:(0,a.sC)(l,b),title:x}})}),(0,t.jsxs)("div",{className:`${Dh}__actions`,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:m?void 0:()=>g(P),type:"button",children:y("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-delete",onClick:m?void 0:k,children:y(m?"general:deleting":"general:confirm")})]})]})})]}):null},Ah="duplicate",Th=({id:e,slug:n,singularLabel:r})=>{const s=(0,ht.useRouter)(),l=Fo(),{toggleModal:c}=O(),u=ls(),{setModified:d}=Lo(),{routes:{api:f},serverURL:p}=Ut(),{routes:{admin:m}}=Ut(),[h,g]=(0,o.useState)(!1),{i18n:v,t:b}=(0,Be.B)(),y=`duplicate-${e}`,w=(0,o.useCallback)((async(t=!1)=>{g(!0),!l||t?await mt.post(`${p}${f}/${n}/${e}/duplicate${u?.code?`?locale=${u.code}`:""}`,{body:JSON.stringify({}),headers:{"Accept-Language":v.language,"Content-Type":"application/json",credentials:"include"}}).then((async e=>{const{doc:t,errors:o,message:i}=await e.json();e.status<400?(Ct.success(i||b("general:successfullyDuplicated",{label:(0,a.sC)(r,v)})),d(!1),s.push(`${m}/collections/${n}/${t.id}${u?.code?`?locale=${u.code}`:""}`)):Ct.error(o?.[0].message||i||b("error:unspecific",{label:(0,a.sC)(r,v)}))})):c(y)}),[u,l,p,f,n,e,v,c,y,b,r,d,s,m]),x=(0,o.useCallback)((async()=>{g(!1),await w(!0)}),[w]);return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Gs,{id:"action-duplicate",onClick:()=>w(!1),children:b("general:duplicate")}),l&&h&&(0,t.jsx)(ce,{className:`${Ah}__modal`,slug:y,children:(0,t.jsxs)("div",{className:`${Ah}__modal-template`,children:[(0,t.jsx)("h1",{children:b("general:confirmDuplication")}),(0,t.jsx)("p",{children:b("general:unsavedChangesDuplicate")}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:()=>c(y),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-duplicate",onClick:x,children:b("general:duplicateWithoutSaving")})]})})]})},Rh=()=>{const{generatePreviewURL:e,label:n}=(()=>{const{id:e,collectionSlug:t,globalSlug:n}=us(),[r,a]=(0,o.useState)(!1),[i,s]=(0,o.useState)(""),{code:l}=ls(),{routes:{api:c},serverURL:u}=Ut(),{t:d}=(0,Be.B)(),f=(0,o.useRef)(!1);return{generatePreviewURL:(0,o.useCallback)((async({openPreviewWindow:r=!1})=>{if(!f.current){f.current=!0;try{a(!0);let o=`${u}${c}`;t&&(o=`${o}/${t}/${e}/preview`),n&&(o=`${o}/globals/${n}/preview`);const i=await fetch(`${o}${l?`?locale=${l}`:""}`);if(!i.ok)throw new Error;const d=await i.json();if(!d)throw new Error;s(d),a(!1),f.current=!1,r&&window.open(d,"_blank")}catch(e){a(!1),f.current=!1,Ct.error(d("error:previewing"))}}}),[u,c,t,n,e,l,d]),isLoading:r,label:d(r?"general:loading":"version:preview"),previewURL:i}})();return(0,t.jsx)(Yt,{buttonStyle:"secondary",className:"preview-btn",onClick:()=>e({openPreviewWindow:!0}),size:"small",children:n})},Ih=({CustomComponent:e})=>e||(0,t.jsx)(Rh,{}),Lh=(0,o.forwardRef)(((e,n)=>{const{type:r="submit",buttonId:a,children:o,disabled:i}=e,s=Wo(),l=zo(),{disabled:c}=Lo(),u=!(i||l||s||c);return(0,t.jsx)("div",{className:"form-submit",children:(0,t.jsx)(Yt,{ref:n,...e,disabled:!u||void 0,id:a,type:r,children:o})})})),$h=({label:e})=>{const{hasPublishPermission:n,publishedDoc:r,unpublishedVersions:a}=us(),{submit:i}=Lo(),s=Fo(),{t:l}=(0,Be.B)(),c=e||l("version:publishChanges"),u=n&&(s||a?.totalDocs>0||!r),d=(0,o.useCallback)((()=>{i({overrides:{_status:"published"}})}),[i]);return n?(0,t.jsx)(Lh,{buttonId:"action-save",disabled:!u,onClick:d,size:"small",type:"button",children:c}):null},Wh=({CustomComponent:e})=>e||(0,t.jsx)($h,{}),Fh=new Map([]),zh={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"},Bh=e=>(zh[e.toLowerCase()]||e).trim().toLowerCase().replace("key",""),Hh=(e,t)=>{const{cmdCtrlKey:n,editDepth:r,keyCodes:a}=e,{modalState:i}=O(),s=(0,o.useCallback)((e=>{const o=e.detail?.key?e.detail:e;if(void 0===o.key)return;Fh.forEach(((e,t)=>{Date.now()-e>3e3&&Fh.delete(t)})),o.code&&(e=>{const t=Bh(e);"meta"===t&&Fh.forEach(((e,t)=>"meta"!==t&&Fh.delete(t))),Fh.set(t,Date.now())})(o.code);const s=window.navigator.userAgent.includes("Mac OS X"),l=[...Fh.keys()].filter((e=>!["alt","ctrl","meta","shift"].includes(e)));if((0,jc.setsAreEqual)(new Set(l),new Set(a))&&(!n||s&&Fh.has("meta")||!s&&o.ctrlKey)){const e=Object.keys(i).filter((e=>i[e]?.isOpen))?.length+1||1;if(e!==r)return;t(o)}}),[a,n,r,i,t]),l=(0,o.useCallback)((e=>{e.code&&(e=>{const t=Bh(e);"meta"===t&&Fh.clear(),Fh.delete(t)})(e.code)}),[]);(0,o.useEffect)((()=>(document.addEventListener("keydown",s,!1),document.addEventListener("bypassKeyDown",s,!1),document.addEventListener("keyup",l,!1),()=>{document.removeEventListener("keydown",s),document.removeEventListener("bypassKeyDown",s),document.removeEventListener("keyup",l)})),[s,l])},Yh=({label:e})=>{const{t:n}=(0,Be.B)(),{submit:r}=Lo(),a=Fo(),i=e||n("general:save"),s=(0,o.useRef)(null),l=ws(),c="update"===ms()&&!a;return Hh({cmdCtrlKey:!0,editDepth:l,keyCodes:["s"]},(e=>{e.preventDefault(),e.stopPropagation(),s?.current&&s.current.click()})),(0,t.jsx)(Lh,{buttonId:"action-save",disabled:c,onClick:()=>r(),ref:s,size:"small",type:"button",children:i})},Vh=({CustomComponent:e})=>e||(0,t.jsx)(Yh,{}),qh=()=>{const{routes:{api:e},serverURL:n}=Ut(),{id:r,collectionSlug:a,globalSlug:i}=us(),s=Fo(),{code:l}=ls(),c=(0,o.useRef)(null),u=ws(),{t:d}=(0,Be.B)(),{submit:f}=Lo(),p="update"===ms()&&!s,m=(0,o.useCallback)((async()=>{if(p)return;const t=`?locale=${l}&depth=0&fallback-locale=null&draft=true`;let o,s="POST";a&&(o=`${n}${e}/${a}${r?`/${r}`:""}${t}`,r&&(s="PATCH")),i&&(o=`${n}${e}/globals/${i}${t}`),await f({action:o,method:s,overrides:{_status:"draft"},skipValidation:!0})}),[f,a,i,n,e,l,r,p]);return Hh({cmdCtrlKey:!0,editDepth:u,keyCodes:["s"]},(e=>{e.preventDefault(),e.stopPropagation(),c?.current&&c.current.click()})),(0,t.jsx)(Lh,{buttonId:"action-save-draft",buttonStyle:"secondary",className:"save-draft",disabled:p,onClick:m,ref:c,size:"small",type:"button",children:d("version:saveDraft")})},Uh=({CustomComponent:e})=>e||(0,t.jsx)(qh,{}),Gh="status",Kh=()=>{const{id:e,collectionSlug:n,docPermissions:r,getVersions:a,globalSlug:s,publishedDoc:l,unpublishedVersions:c}=us(),{toggleModal:u}=O(),{routes:{api:d},serverURL:f}=Ut(),[p,m]=(0,o.useState)(!1),{reset:h}=Lo(),{code:g}=ls(),{i18n:v,t:b}=(0,Be.B)(),y=`confirm-un-publish-${e}`,w=`confirm-revert-${e}`;let x;c?.docs?.length>0&&l?x="changed":l?l&&c?.docs?.length<=1&&(x="published"):x="draft";const P=(0,o.useCallback)((async t=>{let r,o,i;m(!0),"unpublish"===t&&(i={_status:"draft"}),"revert"===t&&(i=l),n&&(r=`${f}${d}/${n}/${e}?locale=${g}&fallback-locale=null`,o="patch"),s&&(r=`${f}${d}/globals/${s}?locale=${g}&fallback-locale=null`,o="post");const c=await mt[o](r,{body:JSON.stringify(i),headers:{"Accept-Language":v.language,"Content-Type":"application/json"}});if(200===c.status){let e;const t=await c.json();s?e=t.result:n&&(e=t.doc),h(e),Ct.success(t.message),a()}else Ct.error(b("error:unPublishingDocument"));m(!1),"revert"===t&&u(w),"unpublish"===t&&u(y)}),[d,n,a,s,v.language,e,g,l,h,w,f,b,u,y]),j=r?.update?.permission;return x?(0,t.jsx)("div",{className:Gh,title:`${b("version:status")}: ${b(`version:${x}`)}`,children:(0,t.jsxs)("div",{className:`${Gh}__value-wrap`,children:[(0,t.jsxs)("span",{className:`${Gh}__label`,children:[b("version:status"),": "]}),(0,t.jsx)("span",{className:`${Gh}__value`,children:b(`version:${x}`)}),j&&"published"===x&&(0,t.jsxs)(i().Fragment,{children:[" — ",(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Gh}__action`,onClick:()=>u(y),children:b("version:unpublish")}),(0,t.jsx)(ce,{className:`${Gh}__modal`,slug:y,children:(0,t.jsxs)("div",{className:`${Gh}__modal-template`,children:[(0,t.jsx)("h1",{children:b("version:confirmUnpublish")}),(0,t.jsx)("p",{children:b("version:aboutToUnpublish")}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:p?void 0:()=>u(y),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{onClick:p?void 0:()=>P("unpublish"),children:b(p?"version:unpublishing":"general:confirm")})]})})]}),j&&"changed"===x&&(0,t.jsxs)(i().Fragment,{children:[" — ",(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Gh}__action`,id:"action-revert-to-published",onClick:()=>u(w),children:b("version:revertToPublished")}),(0,t.jsx)(ce,{className:`${Gh}__modal`,slug:w,children:(0,t.jsxs)("div",{className:`${Gh}__modal-template`,children:[(0,t.jsx)("h1",{children:b("version:confirmRevertToSaved")}),(0,t.jsx)("p",{children:b("version:aboutToRevertToPublished")}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:p?void 0:()=>u(w),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{id:"action-revert-to-published-confirm",onClick:p?void 0:()=>P("revert"),children:b(p?"version:reverting":"general:confirm")})]})})]})]})}):null},Xh="doc-controls",Qh=e=>{const{id:n,slug:r,data:s,disableActions:l,hasSavePermission:c,isAccountView:u,isEditing:d,permissions:f}=e,{i18n:p}=(0,Be.B)(),m=Ut(),{getComponentMap:h}=wn(),g=m.collections.find((e=>e.slug===r)),v=m.globals.find((e=>e.slug===r)),b=h({collectionSlug:g?.slug,globalSlug:v?.slug}),{admin:{dateFormat:y},routes:{admin:w}}=m,[x,P]=i().useState(""),[j,k]=i().useState("");(0,o.useEffect)((()=>{s?.updatedAt&&P(Ki({date:s.updatedAt,i18n:p,pattern:y})),s?.createdAt&&k(Ki({date:s.createdAt,i18n:p,pattern:y}))}),[s,p,y]);const S=f&&"create"in f&&f.create?.permission,C=f&&"delete"in f&&f.delete?.permission,M=Boolean(g&&n&&!l&&(S||C)),_=!n&&g?.versions?.drafts&&g.versions?.drafts.validate;return(0,t.jsxs)(bl,{className:Xh,children:[(0,t.jsxs)("div",{className:`${Xh}__wrapper`,children:[(0,t.jsx)("div",{className:`${Xh}__content`,children:(0,t.jsxs)("ul",{className:`${Xh}__meta`,children:[g&&!d&&!u&&(0,t.jsx)("li",{className:`${Xh}__list-item`,children:(0,t.jsx)("p",{className:`${Xh}__value`,children:p.t("general:creatingNewLabel",{label:(0,a.sC)(g?.labels?.singular??p.t("general:document"),p)})})}),(g?.versions?.drafts||v?.versions?.drafts)&&(0,t.jsxs)(o.Fragment,{children:[(v||g&&d)&&(0,t.jsx)("li",{className:[`${Xh}__status`,`${Xh}__list-item`].filter(Boolean).join(" "),children:(0,t.jsx)(Kh,{})}),(g?.versions?.drafts&&g?.versions?.drafts?.autosave&&!_||v?.versions?.drafts&&v?.versions?.drafts?.autosave)&&c&&(0,t.jsx)("li",{className:`${Xh}__list-item`,children:(0,t.jsx)(_h,{collection:g,global:v,id:n,publishedDocUpdatedAt:s?.createdAt})})]}),g?.timestamps&&(d||u)&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)("li",{className:[`${Xh}__list-item`,`${Xh}__value-wrap`].filter(Boolean).join(" "),title:s?.updatedAt?x:"",children:[(0,t.jsxs)("p",{className:`${Xh}__label`,children:[p.t("general:lastModified"),": "]}),s?.updatedAt&&(0,t.jsx)("p",{className:`${Xh}__value`,children:x})]}),(0,t.jsxs)("li",{className:[`${Xh}__list-item`,`${Xh}__value-wrap`].filter(Boolean).join(" "),title:s?.createdAt?j:"",children:[(0,t.jsxs)("p",{className:`${Xh}__label`,children:[p.t("general:created"),": "]}),s?.createdAt&&(0,t.jsx)("p",{className:`${Xh}__value`,children:j})]})]})]})}),(0,t.jsxs)("div",{className:`${Xh}__controls-wrapper`,children:[(0,t.jsxs)("div",{className:`${Xh}__controls`,children:[b?.isPreviewEnabled&&(0,t.jsx)(Ih,{CustomComponent:b.PreviewButton}),c&&(0,t.jsx)(i().Fragment,{children:g?.versions?.drafts||v?.versions?.drafts?(0,t.jsxs)(i().Fragment,{children:[(g?.versions?.drafts&&!g?.versions?.drafts?.autosave||_||v?.versions?.drafts&&!v?.versions?.drafts?.autosave)&&(0,t.jsx)(Uh,{CustomComponent:b.SaveDraftButton}),(0,t.jsx)(Wh,{CustomComponent:b.PublishButton})]}):(0,t.jsx)(Vh,{CustomComponent:b.SaveButton})})]}),M&&(0,t.jsx)(Ys,{button:(0,t.jsxs)("div",{className:`${Xh}__dots`,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]}),className:`${Xh}__popup`,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:(0,t.jsxs)(Us,{children:[S&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Gs,{href:`${w}/collections/${g?.slug}/create`,id:"action-create",children:p.t("general:createNew")}),!g.disableDuplicate&&d&&(0,t.jsx)(Th,{id:n.toString(),singularLabel:g?.labels?.singular,slug:g?.slug})]}),C&&(0,t.jsx)(Nh,{buttonId:"action-delete",collectionSlug:g?.slug,id:n.toString(),singularLabel:g?.labels?.singular,useAsTitle:g?.admin?.useAsTitle})]})})]})]}),(0,t.jsx)("div",{className:`${Xh}__divider`})]})},Jh="document-fields",Zh=({AfterFields:e,BeforeFields:n,description:r,docPermissions:a,fieldMap:o,forceSidebarWrap:s,readOnly:l,schemaPath:c})=>{const u=o.filter((({isSidebar:e})=>!e)),d=o.filter((({isSidebar:e})=>e)),f=d&&d.length>0;return(0,t.jsx)(i().Fragment,{children:(0,t.jsxs)("div",{className:[Jh,f?`${Jh}--has-sidebar`:`${Jh}--no-sidebar`,s&&`${Jh}--force-sidebar-wrap`].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${Jh}__main`,children:(0,t.jsxs)(bl,{className:`${Jh}__edit`,children:[(0,t.jsx)("header",{className:`${Jh}__header`,children:r&&(0,t.jsx)("div",{className:`${Jh}__sub-header`})}),n,(0,t.jsx)(ll,{className:`${Jh}__fields`,fieldMap:u,forceRender:10,path:"",permissions:a?.fields,readOnly:l,schemaPath:c}),e]})}),f&&(0,t.jsx)("div",{className:`${Jh}__sidebar-wrap`,children:(0,t.jsx)("div",{className:`${Jh}__sidebar`,children:(0,t.jsx)("div",{className:`${Jh}__sidebar-fields`,children:(0,t.jsx)(ll,{fieldMap:d,forceRender:10,path:"",permissions:a?.fields,readOnly:l,schemaPath:c})})})})]})})};var eg=n(20344);const tg=({hasAccepted:e=!1,message:t="Are you sure want to leave this page?",onPrevent:n,prevent:r=!0})=>{((e=!0,t)=>{const n=(0,o.useCallback)((n=>{if("function"!=typeof e||e())return n.preventDefault(),t&&(n.returnValue=t),t}),[e,t]);(0,o.useEffect)((()=>{if(e)return function(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}(window,"beforeunload",n),()=>function(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}(window,"beforeunload",n)}),[e,n])})(r,t);const a=(0,eg.useRouter)(),i=(0,o.useRef)("");(0,o.useEffect)((()=>{function e(e){try{const a=function(e){for(;e&&"a"!==e.tagName.toLowerCase();)e=e.parentElement;return e}(e.target);if(a){const o=window.location.href,s=a.href,l=function(e,t){const n=new URL(e),r=new URL(t);if(n.hostname===r.hostname&&n.pathname===r.pathname&&n.search===r.search){const e=n.hash,t=r.hash;return e!==t&&n.href.replace(e,"")===r.href.replace(t,"")}return!1}(o,s),c=""!==a.download;!(s===o||l||c)&&r&&(n||!window.confirm(t))&&(i.current=s,e.preventDefault(),e.stopPropagation(),"function"==typeof n&&n())}}catch(e){alert(e)}}return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}}),[n,r,t]),(0,o.useEffect)((()=>{e&&i.current&&a.push(i.current)}),[e,a])},ng="leave-without-saving",rg="leave-without-saving",ag=({isActive:e,onCancel:n,onConfirm:r})=>{const{closeModal:a,modalState:i,openModal:s}=O(),{t:l}=(0,Be.B)();return(0,o.useEffect)((()=>{e?s(ng):a(ng)}),[e,s,a]),(0,t.jsx)(ce,{className:rg,onClose:n,slug:ng,children:(0,t.jsxs)("div",{className:`${rg}__wrapper`,children:[(0,t.jsxs)("div",{className:`${rg}__content`,children:[(0,t.jsx)("h1",{children:l("general:leaveWithoutSaving")}),(0,t.jsx)("p",{children:l("general:changesNotSaved")})]}),(0,t.jsxs)("div",{className:`${rg}__controls`,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:n,children:l("general:stayOnThisPage")}),(0,t.jsx)(Yt,{onClick:r,children:l("general:leaveAnyway")})]})]})})},og=()=>{const e=Fo(),{user:n}=sn(),[r,a]=i().useState(!1),[s,l]=i().useState(!1),c=Boolean(e&&n),u=(0,o.useCallback)((()=>{a(!0)}),[]);return tg({hasAccepted:s,onPrevent:u,prevent:c}),(0,t.jsx)(ag,{isActive:r,onCancel:()=>{a(!1)},onConfirm:()=>{l(!0)}})},ig="generate-confirmation",sg=e=>{const{highlightField:n,setKey:r}=e,{id:a}=us(),{toggleModal:o}=O(),{t:s}=(0,Be.B)(),l=`generate-confirmation-${a}`;return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:()=>{o(l)},size:"small",children:s("authentication:generateNewAPIKey")}),(0,t.jsx)(ce,{className:ig,slug:l,children:(0,t.jsxs)("div",{className:`${ig}__template`,children:[(0,t.jsx)("h1",{children:s("authentication:confirmGeneration")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{1:({children:e})=>(0,t.jsx)("strong",{children:e})},i18nKey:"authentication:generatingNewAPIKeyWillInvalidate",t:s})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:()=>{o(l)},type:"button",children:s("general:cancel")}),(0,t.jsx)(Yt,{onClick:()=>{r(),o(l),Ct.success(s("authentication:newAPIKeyGenerated")),n(!0)},children:s("authentication:generate")})]})})]})},lg="apiKey",cg="field-type",ug=({enabled:e,readOnly:n})=>{const[r]=(0,o.useState)(Ll()),[a,s]=(0,o.useState)(!1),{t:l}=(0,Be.B)(),c=Ut(),u=Bo((([e])=>e&&e[lg]||null)),d=u?.value,f=(0,o.useMemo)((()=>(0,t.jsxs)("div",{className:"api-key__label",children:[(0,t.jsx)("span",{children:"API Key"}),(0,t.jsx)(Dp,{value:d})]})),[d]),p=hs({path:"apiKey",validate:e=>(0,jc.text)(e,{name:"apiKey",type:"text",data:{},maxLength:48,minLength:24,preferences:{fields:{}},req:{payload:{config:c},t:l},siblingData:{}})}),{setValue:m,value:h}=p;return(0,o.useEffect)((()=>{!d&&e&&m(r),e||m(null)}),[d,e,m,r]),(0,o.useEffect)((()=>{a&&setTimeout((()=>{s(!1)}),1e4)}),[a]),e?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)("div",{className:[cg,"api-key","read-only"].filter(Boolean).join(" "),children:[(0,t.jsx)(Ns,{CustomLabel:f,htmlFor:lg}),(0,t.jsx)("input",{className:a?"highlight":void 0,disabled:!0,id:"apiKey",name:"apiKey",type:"text",value:h||""})]}),!n&&(0,t.jsx)(sg,{highlightField:()=>{a&&s(!1),setTimeout((()=>{s(!0)}),1)},setKey:()=>m(Ll())})]}):null},dg="auth-fields",fg=e=>{const{className:n,collectionSlug:r,disableLocalStrategy:a,email:s,operation:l,readOnly:c,requirePassword:u,useAPIKey:d,verify:f}=e,[p,m]=(0,o.useState)(u),h=Bo((([e])=>e&&e?.enableAPIKey||null)),g=Bo((e=>e[1])),v=Fo(),{i18n:b,t:y}=(0,Be.B)(),{isInitializing:w}=us(),{routes:{api:x},serverURL:P}=Ut(),j=(0,o.useCallback)((e=>{e||(g({type:"REMOVE",path:"password"}),g({type:"REMOVE",path:"confirm-password"})),m(e)}),[g]),k=(0,o.useCallback)((async()=>{const e=`${P}${x}/${r}/unlock`;200===(await fetch(e,{body:JSON.stringify({email:s}),credentials:"include",headers:{"Accept-Language":b.language,"Content-Type":"application/json"},method:"post"})).status?Ct.success(y("authentication:successfullyUnlocked")):Ct.error(y("authentication:failedToUnlock"))}),[b,P,x,r,s,y]);if((0,o.useEffect)((()=>{v||m(!1)}),[v]),a&&!d)return null;const S=c||w;return(0,t.jsxs)("div",{className:[dg,n].filter(Boolean).join(" "),children:[!a&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(fc,{autoComplete:"email",disabled:S,label:y("general:email"),name:"email",readOnly:c,required:!0}),(p||u)&&(0,t.jsxs)("div",{className:`${dg}__changing-password`,children:[(0,t.jsx)(Ef,{autoComplete:"off",disabled:S,label:y("authentication:newPassword"),name:"password",required:!0}),(0,t.jsx)(sc,{disabled:c})]}),(0,t.jsxs)("div",{className:`${dg}__controls`,children:[p&&!u&&(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:S,onClick:()=>j(!1),size:"small",children:y("general:cancel")}),!p&&!u&&(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:S,id:"change-password",onClick:()=>j(!0),size:"small",children:y("authentication:changePassword")}),"update"===l&&(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:S,onClick:()=>k(),size:"small",children:y("authentication:forceUnlock")})]})]}),d&&(0,t.jsxs)("div",{className:`${dg}__api-key`,children:[(0,t.jsx)(Is,{disabled:S,label:y("authentication:enableAPIKey"),name:"enableAPIKey",readOnly:c}),(0,t.jsx)(ug,{enabled:!!h?.value,readOnly:c})]}),f&&(0,t.jsx)(Is,{disabled:S,label:y("authentication:verified"),name:"_verified",readOnly:c})]})},pg=(0,o.createContext)({}),mg=({children:e,visibleEntities:n})=>{const r=(0,o.useCallback)((({collectionSlug:e,globalSlug:t})=>e?n.collections.includes(e):!!t&&n.globals.includes(t)),[n]);return(0,t.jsx)(pg.Provider,{value:{isEntityVisible:r,visibleEntities:n},children:e})},hg=()=>(0,o.useContext)(pg),gg=e=>{const{id:t,collectionSlug:n,globalSlug:r,pluralLabel:i,useAsTitle:s}=e,l=e?.view||void 0,{isEditing:c,isInitializing:u,title:d}=us(),{isEntityVisible:f}=hg(),p=f({collectionSlug:n,globalSlug:r}),{setStepNav:m}=hn(),{i18n:h,t:g}=(0,Be.B)(),{routes:{admin:v}}=Ut(),b=ws();return(0,o.useEffect)((()=>{const e=[];u||(n?(e.push({label:(0,a.sC)(i,h),url:p?`${v}/collections/${n}`:void 0}),c?e.push({label:s&&"id"!==s&&d||`${t}`,url:p?`${v}/collections/${n}/${t}`:void 0}):e.push({label:g("general:createNew")})):r&&e.push({label:d,url:p?`${v}/globals/${r}`:void 0}),l&&e.push({label:l}),b<=1&&m(e))}),[m,u,c,i,t,s,v,g,h,d,n,r,l,b,p]),null},vg=e=>{const{collectionConfig:t,config:n,fallback:r,globalConfig:a}=e,i=t?.admin?.useAsTitle,s=Bo((([e])=>i&&e&&e?.[i]||null)),l=(0,o.useRef)(!1),{i18n:c}=(0,Be.B)(),{setDocumentTitle:u}=us(),d=n?.admin?.dateFormat,f=Qi({collectionConfig:t,data:{id:""},dateFormat:d,fallback:"string"==typeof s?s:"number"==typeof s?String(s):s?.value||r,globalConfig:a,i18n:c});return(0,o.useEffect)((()=>{l.current?u(f):l.current=!0}),[u,f]),null},bg="collection-edit",yg=()=>{const{id:e,AfterDocument:n,AfterFields:r,BeforeDocument:a,BeforeFields:s,action:l,apiURL:c,collectionSlug:u,disableActions:d,disableLeaveWithoutSaving:f,docPermissions:p,getDocPreferences:m,getVersions:h,globalSlug:g,hasPublishPermission:v,hasSavePermission:b,initialData:y,initialState:w,isEditing:x,isInitializing:P,onSave:j}=us(),{refreshCookieAsync:k,user:S}=sn(),C=Ut(),M=(0,eg.useRouter)(),{dispatchFormQueryParams:_}=Ff(),{getComponentMap:O,getFieldMap:E}=wn(),D=(0,eg.useSearchParams)(),N=ws(),{reportUpdate:A}=On(),{admin:{user:T},collections:R,globals:I,routes:{admin:L,api:$},serverURL:W}=C,F=D.get("locale"),z=u&&R.find((e=>e.slug===u)),B=g&&I.find((e=>e.slug===g)),H=z?.slug||B?.slug,Y=O({collectionSlug:z?.slug,globalSlug:B?.slug}),V=E({collectionSlug:z?.slug,globalSlug:B?.slug}),q=u&&!e?"create":"update",U=z?z.auth:void 0,G=z?z.upload:void 0,K=!(z?.versions?.drafts&&z?.versions?.drafts?.autosave&&B?.versions?.drafts&&B?.versions?.drafts?.autosave||f),X=[bg,e&&`${bg}--is-editing`].filter(Boolean).join(" "),Q=(0,o.useCallback)((t=>{if(A({id:e,entitySlug:H,updatedAt:t?.result?.updatedAt||(new Date).toISOString()}),S&&u===T&&e===S.id&&k(),h(),"function"==typeof j&&j({...t,operation:e?"update":"create"}),!x&&N<2){const e=`${L}/collections/${u}/${t?.doc?.id}${F?`?locale=${F}`:""}`;M.push(e)}else _({type:"SET",params:{uploadEdits:null}})}),[j,T,A,e,H,S,N,u,h,x,k,L,F,M,_]),J=(0,o.useCallback)((async({formState:t})=>{const n=await m();return Ji({apiRoute:$,body:{id:e,collectionSlug:u,docPreferences:n,formState:t,globalSlug:g,operation:q,schemaPath:H},serverURL:W})}),[W,$,e,q,H,u,g,m]);return(0,t.jsx)("main",{className:X,children:(0,t.jsx)(ps,{operation:q,children:(0,t.jsxs)(Ch,{action:l,className:`${bg}__form`,disableValidationOnSubmit:!0,disabled:P||!b,initialState:!P&&w,isInitializing:P,method:e?"PATCH":"POST",onChange:[J],onSuccess:Q,children:[a,K&&(0,t.jsx)(og,{}),(0,t.jsx)(gg,{collectionSlug:z?.slug,globalSlug:B?.slug,id:e,pluralLabel:z?.labels?.plural,useAsTitle:z?.admin?.useAsTitle}),(0,t.jsx)(vg,{collectionConfig:z,config:C,fallback:N<=1?e?.toString():void 0,globalConfig:B}),(0,t.jsx)(Qh,{apiURL:c,data:y,disableActions:d,hasPublishPermission:v,hasSavePermission:b,id:e,isEditing:x,permissions:p,slug:z?.slug||B?.slug}),(0,t.jsx)(Zh,{AfterFields:r,BeforeFields:s||(0,t.jsxs)(o.Fragment,{children:[U&&(0,t.jsx)(fg,{className:`${bg}__auth`,collectionSlug:z.slug,disableLocalStrategy:z.auth?.disableLocalStrategy,email:y?.email,operation:q,readOnly:!b,requirePassword:!e,useAPIKey:U.useAPIKey,verify:U.verify}),G&&(0,t.jsx)(i().Fragment,{children:void 0!==Y.Upload?Y.Upload:(0,t.jsx)(qp,{collectionSlug:z.slug,initialState:w,uploadConfig:G})})]}),docPermissions:p,fieldMap:V,readOnly:!b,schemaPath:H}),n]})})})},{WindowInfoProvider:wg}=e||{WindowInfoProvider:void 0},{useWindowInfo:xg}=e||{useWindowInfo:void 0},Pg=({actions:e})=>{const{setViewActions:t}=Pn();return(0,o.useEffect)((()=>(t(e),()=>{t([])})),[t,e]),null},jg="list-selection",kg=({label:e})=>{const{count:n,selectAll:r,toggleAll:a,totalDocs:i}=om(),{t:s}=(0,Be.B)();return 0===n?null:(0,t.jsxs)("div",{className:jg,children:[(0,t.jsx)("span",{children:s("general:selectedCount",{count:n,label:e})}),r!==nm.AllAvailable&&(0,t.jsxs)(o.Fragment,{children:[" ","—",(0,t.jsx)("button",{"aria-label":s("general:selectAll",{count:n,label:e}),className:`${jg}__button`,onClick:()=>a(!0),type:"button",children:s("general:selectAll",{count:i,label:e})})]})]})},Sg="column-selector",Cg=({collectionSlug:e})=>{const{columns:n,moveColumn:r,toggleColumn:a}=Dm(),i=(0,o.useId)(),s=ws();if(!n)return null;const l=(e=>e.filter((e=>!e.admin?.disableListColumn)))(n);return(0,t.jsx)(vo,{className:Sg,ids:l.map((e=>e?.accessor)),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>{r({fromIndex:e,toIndex:t})},children:l.map(((n,r)=>{if(!n)return null;const{Label:o,accessor:l,active:c}=n;return"_select"===n.accessor?null:(0,t.jsx)(Ml,{alignIcon:"left","aria-checked":c,className:[`${Sg}__column`,c&&`${Sg}__column--active`].filter(Boolean).join(" "),draggable:!0,icon:c?(0,t.jsx)($t.u,{}):(0,t.jsx)(Lt,{}),id:l,onClick:()=>{a(l)},children:o},`${e}-${n.name||r}${s?`-${s}-`:""}${i}`)}))})},Mg="delete-documents",_g=e=>{const{collection:{slug:n,labels:{plural:r}}={}}=e,{permissions:s}=sn(),{routes:{api:l},serverURL:c}=Ut(),{toggleModal:u}=O(),{count:d,getQueryParams:f,selectAll:p,toggleAll:m}=om(),{i18n:h,t:g}=(0,Be.B)(),[v,b]=(0,o.useState)(!1),y=(0,ht.useRouter)(),{stringifyParams:w}=nn(),{clearRouteCache:x}=(0,Km.P)(),P=s?.collections?.[n],j=P?.delete?.permission,k=`delete-${n}`,S=(0,o.useCallback)((()=>{Ct.error(g("error:unknown"))}),[g]),C=(0,o.useCallback)((async()=>{b(!0),await mt.delete(`${c}${l}/${n}${f()}`,{headers:{"Accept-Language":h.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return u(k),e.status<400?(Ct.success(t.message||g("general:deletedSuccessfully")),m(),y.replace(w({params:{page:p?"1":void 0},replace:!0})),x(),null):(t.errors?Ct.error(t.message):S(),!1)}catch(e){return S()}}))}),[S,l,f,h.language,k,y,p,c,n,w,g,m,u,x]);return p!==nm.None&&j?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{className:`${Mg}__toggle`,onClick:()=>{b(!1),u(k)},children:g("general:delete")}),(0,t.jsx)(ce,{className:Mg,slug:k,children:(0,t.jsxs)("div",{className:`${Mg}__template`,children:[(0,t.jsx)("h1",{children:g("general:confirmDeletion")}),(0,t.jsx)("p",{children:g("general:aboutToDeleteCount",{count:d,label:(0,a.sC)(r,h)})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:v?void 0:()=>u(k),type:"button",children:g("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-delete",onClick:v?void 0:C,children:g(v?"general:deleting":"general:confirm")})]})})]}):null},Og=(e,t)=>e&&t.isFieldAffectingData?`${e}.${t.name}`:(t.isFieldAffectingData,t.name),Eg=({customLabel:e,field:n,prefix:r})=>{const a=n&&"CustomLabel"in n.fieldComponentProps&&void 0!==n.fieldComponentProps.CustomLabel?n.fieldComponentProps.CustomLabel:null,i=n&&"label"in n.fieldComponentProps&&n.fieldComponentProps.label?(0,t.jsx)(Ns,{label:n.fieldComponentProps.label,...n.fieldComponentProps.labelProps||{}}):null,s=a||i||e;return s?(0,t.jsxs)(o.Fragment,{children:[r&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("span",{style:{display:"inline-block"},children:r})," > "]}),(0,t.jsx)("span",{style:{display:"inline-block"},children:s})]}):null},Dg=({fieldMap:e,labelPrefix:t=null,path:n=""})=>e?e?.reduce(((e,r)=>{const{isFieldAffectingData:a}=r;if(a&&(r.disableBulkEdit||r.unique||r.isHidden||"readOnly"in r.fieldComponentProps&&r.fieldComponentProps.readOnly))return e;if("array"!==r.type&&"blocks"!==r.type&&"fieldMap"in r.fieldComponentProps)return[...e,...Dg({fieldMap:r.fieldComponentProps.fieldMap,labelPrefix:Eg({field:r,prefix:t}),path:Og(n,r)})];if("tabs"===r.type&&"tabs"in r.fieldComponentProps)return[...e,...r.fieldComponentProps.tabs.reduce(((e,a)=>{if("fieldMap"in a){const o="name"in a&&a.name;return[...e,...Dg({fieldMap:a.fieldMap,labelPrefix:t,path:o?Og(n,r):n})]}}),[])];const o={label:Eg({field:r,prefix:t}),value:{...r,path:Og(n,r)}};return[...e,o]}),[]):[],Ng=({fieldMap:e,setSelected:n})=>{const{t:r}=(0,Be.B)(),[a]=(0,o.useState)((()=>Dg({fieldMap:e}))),{dispatchFields:i,getFields:s}=Lo();return(0,t.jsxs)("div",{className:"field-select",children:[(0,t.jsx)(Ns,{label:r("fields:selectFieldsToEdit")}),(0,t.jsx)(_f,{getOptionValue:e=>"object"==typeof e.value&&"path"in e.value?String(e.value.path):String(e.value),isMulti:!0,onChange:e=>{const t=s();n(null===e?[]:e.map((({value:e})=>e))),(null===e||Object.keys(t||[]).length>e.length)&&Object.keys(t).forEach((t=>{null!==e&&e.find((e=>e.value.path===t))||i({type:"REMOVE",path:t})}))},options:a})]})},Ag="edit-many",Tg=({action:e,disabled:n})=>{const{submit:r}=Lo(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((()=>{r({action:e,method:"PATCH",skipValidation:!0})}),[e,r]);return(0,t.jsx)(Lh,{className:`${Ag}__save`,disabled:n,onClick:i,children:a("general:save")})},Rg=({action:e,disabled:n})=>{const{submit:r}=Lo(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((()=>{r({action:e,method:"PATCH",overrides:{_status:"published"},skipValidation:!0})}),[e,r]);return(0,t.jsx)(Lh,{className:`${Ag}__publish`,disabled:n,onClick:i,children:a("version:publishChanges")})},Ig=({action:e,disabled:n})=>{const{submit:r}=Lo(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((()=>{r({action:e,method:"PATCH",overrides:{_status:"draft"},skipValidation:!0})}),[e,r]);return(0,t.jsx)(Lh,{className:`${Ag}__draft`,disabled:n,onClick:i,children:a("version:saveDraft")})},Lg=e=>{const{collection:{slug:n,labels:{plural:r}}={},collection:s,fieldMap:l}=e,{permissions:c}=sn(),{closeModal:u}=O(),{routes:{api:d},serverURL:f}=Ut(),{count:p,getQueryParams:m,selectAll:h}=om(),{i18n:g,t:v}=(0,Be.B)(),[b,y]=(0,o.useState)([]),{stringifyParams:w}=nn(),x=(0,ht.useRouter)(),[P,j]=(0,o.useState)(),k=i().useRef(!1),{clearRouteCache:S}=(0,Km.P)(),C=c?.collections?.[n],M=C?.update?.permission,_=`edit-${n}`;i().useEffect((()=>{if(!k.current){(async()=>{const e=await Ji({apiRoute:d,body:{collectionSlug:n,data:{},operation:"update",schemaPath:n},serverURL:f});j(e),k.current=!0})()}}),[d,k,f,n]);const E=(0,o.useCallback)((({formState:e})=>Ji({apiRoute:d,body:{collectionSlug:n,formState:e,operation:"update",schemaPath:n},serverURL:f})),[f,d,n]);if(h===nm.None||!M)return null;return(0,t.jsxs)("div",{className:Ag,children:[(0,t.jsx)(wl,{"aria-label":v("general:edit"),className:`${Ag}__toggle`,onClick:()=>{y([])},slug:_,children:v("general:edit")}),(0,t.jsx)(xl,{Header:null,slug:_,children:(0,t.jsx)(ds,{collectionSlug:n,id:null,children:(0,t.jsx)(fs.Provider,{value:"update",children:(0,t.jsxs)("div",{className:`${Ag}__main`,children:[(0,t.jsxs)("div",{className:`${Ag}__header`,children:[(0,t.jsx)("h2",{className:`${Ag}__header__title`,children:v("general:editingLabel",{count:p,label:(0,a.sC)(r,g)})}),(0,t.jsx)("button",{"aria-label":v("general:close"),className:`${Ag}__header__close`,id:`close-drawer__${_}`,onClick:()=>u(_),type:"button",children:(0,t.jsx)($t.u,{})})]}),(0,t.jsxs)(Ch,{className:`${Ag}__form`,initialState:P,onChange:[E],onSuccess:()=>{x.replace(w({params:{page:h===nm.AllAvailable?"1":void 0}})),S(),u(_)},children:[(0,t.jsx)(Ng,{fieldMap:l,setSelected:y}),0===b.length?null:(0,t.jsx)(ll,{fieldMap:b,path:"",readOnly:!1,schemaPath:n}),(0,t.jsx)("div",{className:`${Ag}__sidebar-wrap`,children:(0,t.jsx)("div",{className:`${Ag}__sidebar`,children:(0,t.jsx)("div",{className:`${Ag}__sidebar-sticky-wrap`,children:(0,t.jsx)("div",{className:`${Ag}__document-actions`,children:s?.versions?.drafts?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Rg,{action:`${f}${d}/${n}${m()}&draft=true`,disabled:0===b.length}),(0,t.jsx)(Ig,{action:`${f}${d}/${n}${m()}&draft=true`,disabled:0===b.length})]}):(0,t.jsx)(Tg,{action:`${f}${d}/${n}${m()}`,disabled:0===b.length})})})})})]})]})})})})]})},$g="publish-many",Wg=e=>{const{clearRouteCache:n}=(0,Km.P)(),{collection:{slug:r,labels:{plural:s},versions:l}={}}=e,{routes:{api:c},serverURL:u}=Ut(),{permissions:d}=sn(),{toggleModal:f}=O(),{i18n:p,t:m}=(0,Be.B)(),{getQueryParams:h,selectAll:g}=om(),[v,b]=(0,o.useState)(!1),y=(0,ht.useRouter)(),{stringifyParams:w}=nn(),x=d?.collections?.[r],P=x?.update?.permission,j=`publish-${r}`,k=(0,o.useCallback)((()=>{Ct.error(m("error:unknown"))}),[m]),S=(0,o.useCallback)((async()=>{b(!0),await mt.patch(`${u}${c}/${r}${h({_status:{not_equals:"published"}})}&draft=true`,{body:JSON.stringify({_status:"published"}),headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return f(j),e.status<400?(Ct.success(m("general:updatedSuccessfully")),y.replace(w({params:{page:g?"1":void 0}})),n(),null):(t.errors?t.errors.forEach((e=>Ct.error(e.message))):k(),!1)}catch(e){return k()}}))}),[k,c,h,p.language,j,g,u,r,m,f,y,w,n]);return l?.drafts&&g!==nm.None&&P?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{className:`${$g}__toggle`,onClick:()=>{b(!1),f(j)},children:m("version:publish")}),(0,t.jsx)(ce,{className:$g,slug:j,children:(0,t.jsxs)("div",{className:`${$g}__template`,children:[(0,t.jsx)("h1",{children:m("version:confirmPublish")}),(0,t.jsx)("p",{children:m("version:aboutToPublishSelection",{label:(0,a.sC)(s,p)})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:v?void 0:()=>f(j),type:"button",children:m("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-publish",onClick:v?void 0:S,children:m(v?"version:publishing":"general:confirm")})]})})]}):null},Fg="search-filter",zg=e=>{const{fieldLabel:n="ID",fieldName:r="id",handleChange:i,listSearchableFields:s}=e,{searchParams:l}=nn(),c=(0,ht.useRouter)(),u=(0,ht.usePathname)(),{i18n:d,t:f}=(0,Be.B)(),[p,m]=(0,o.useState)("string"==typeof l?.search?l?.search:""),[h,g]=(0,o.useState)(""),v=(0,o.useRef)(f("general:searchBy",{label:(0,a.sC)(n,d)})),b=Qt(p,300);return(0,o.useEffect)((()=>{b!==h&&(i&&i(b),g(b))}),[b,h,c,r,l,i,s,u]),(0,o.useEffect)((()=>{v.current=s?.length>0?s.reduce(((e,t,n)=>{const r="fieldComponentProps"in t&&"label"in t.fieldComponentProps&&t.fieldComponentProps.label?t.fieldComponentProps.label:t.name;return 0===n?`${f("general:searchBy",{label:(0,a.sC)(r,d)})}`:n===s.length-1?`${e} ${f("general:or")} ${(0,a.sC)(r,d)}`:`${e}, ${(0,a.sC)(r,d)}`}),""):f("general:searchBy",{label:(0,a.sC)(n,d)})}),[f,s,d,n]),(0,t.jsxs)("div",{className:Fg,children:[(0,t.jsx)("input",{className:`${Fg}__input`,onChange:e=>m(e.target.value),placeholder:v.current,type:"text",value:p||""}),(0,t.jsx)(Wl,{})]})},Bg="unpublish-many",Hg=e=>{const{collection:{slug:n,labels:{plural:r},versions:s}={}}=e,{routes:{api:l},serverURL:c}=Ut(),{permissions:u}=sn(),{toggleModal:d}=O(),{i18n:f,t:p}=(0,Be.B)(),{getQueryParams:m,selectAll:h}=om(),[g,v]=(0,o.useState)(!1),{stringifyParams:b}=nn(),y=(0,ht.useRouter)(),{clearRouteCache:w}=(0,Km.P)(),x=u?.collections?.[n],P=x?.update?.permission,j=`unpublish-${n}`,k=(0,o.useCallback)((()=>{Ct.error(p("error:unknown"))}),[p]),S=(0,o.useCallback)((async()=>{v(!0),await mt.patch(`${c}${l}/${n}${m({_status:{not_equals:"draft"}})}`,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":f.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return d(j),e.status<400?(Ct.success(p("general:updatedSuccessfully")),y.replace(b({params:{page:h?"1":void 0}})),w(),null):(t.errors?t.errors.forEach((e=>Ct.error(e.message))):k(),!1)}catch(e){return k()}}))}),[k,l,m,f.language,j,h,c,n,p,d,y,w,b]);return s?.drafts&&h!==nm.None&&P?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{className:`${Bg}__toggle`,onClick:()=>{v(!1),d(j)},children:p("version:unpublish")}),(0,t.jsx)(ce,{className:Bg,slug:j,children:(0,t.jsxs)("div",{className:`${Bg}__template`,children:[(0,t.jsx)("h1",{children:p("version:confirmUnpublish")}),(0,t.jsx)("p",{children:p("version:aboutToUnpublishSelection",{label:(0,a.sC)(r,f)})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:g?void 0:()=>d(j),type:"button",children:p("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-unpublish",onClick:g?void 0:S,children:p(g?"version:unpublishing":"general:confirm")})]})})]}):null},Yg=e=>{const{CustomComponent:n,DefaultComponent:r,componentProps:a={}}=e;return n?(0,t.jsx)(n,{...a}):r?(0,t.jsx)(r,{...a}):null},Vg=e=>e.reduce(((e,t)=>t.options?[...e,...Vg(t.options)]:[...e,t.id]),[]),qg=(e,t)=>{switch(t.type){case"CLEAR":return t.required?[]:[{label:t.i18n.t("general:none"),value:"null"}];case"ADD":{const{collection:n,data:r,hasMultipleRelations:o,i18n:i,relation:s}=t,l=n.admin.useAsTitle||"id",c=Vg(e);if(!o)return[...e,...r.docs.reduce(((e,t)=>-1===c.indexOf(t.id)?(c.push(t.id),[...e,{label:t[l],value:t.id}]):e),[])];const u=[...e],d=u.find((e=>e.label===(0,a.sC)(n.labels.plural,i))),f=r.docs.reduce(((e,t)=>-1===c.indexOf(t.id)?(c.push(t.id),[...e,{label:t[l],relationTo:s,value:t.id}]):e),[]);return d?d.options=[...d.options,...f]:u.push({label:(0,a.sC)(n.labels.plural,i),options:f,value:void 0}),u}default:return e}},Ug="condition-value-relationship",Gg=e=>e.map((e=>"object"!=typeof e||!e.value&&""!==e.value?{label:e,value:e}:e)),Kg=({disabled:e,onChange:n,operator:r,options:o,value:s})=>{const{i18n:l}=(0,Be.B)(),[c,u]=i().useState(Gg(o)),d=["in","not_in"].includes(r);let f;if(d&&Array.isArray(s))f=s.map((e=>{const t=c.find((t=>t.value===e));return{label:t?(0,a.sC)(t.label,l):e,value:t?.value??e}}));else if(s){const e=c.find((e=>e.value===s));f={label:e?(0,a.sC)(e.label,l):s,value:e?.value??s}}const p=i().useCallback((e=>{let t;t=e?d?Array.isArray(e)?e.map((e=>e.value)):[]:e.value:null,n(t)}),[d,n]);return i().useEffect((()=>{u(Gg(o))}),[o]),i().useEffect((()=>{!d&&Array.isArray(s)&&n(s[0])}),[d,n,s]),(0,t.jsx)(_f,{disabled:e,isMulti:d,onChange:p,options:c.map((e=>({...e,label:(0,a.sC)(e.label,l)}))),value:f})},Xg={Date:({admin:e,disabled:n,onChange:r,value:a})=>{const{date:o}=e||{};return(0,t.jsx)("div",{className:"condition-value-date",children:(0,t.jsx)(cc,{...o,onChange:r,readOnly:n,value:a})})},Number:({disabled:e,onChange:n,value:r})=>{const{t:a}=(0,Be.B)();return(0,t.jsx)("input",{className:"condition-value-number",disabled:e,onChange:e=>n(e.target.value),placeholder:a("general:enterAValue"),type:"number",value:r})},Relationship:e=>{const{admin:{isSortable:n}={},disabled:r,hasMany:a,onChange:s,relationTo:l,value:c}=e,{collections:u,routes:{api:d},serverURL:f}=Ut(),p=Array.isArray(l),[m,h]=(0,o.useReducer)(qg,[]),[g,v]=(0,o.useState)(""),[b,y]=(0,o.useState)(""),[w,x]=(0,o.useState)(!1),P=Qt(g,300),{i18n:j,t:k}=(0,Be.B)(),S=p?l:[l],C=i().useRef((()=>{const e=new Map;return S.forEach((t=>{e.set(t,1)})),e})()),M=i().useRef(S),_=(0,o.useCallback)(((e,t)=>{const n=u.find((e=>e.slug===t));h({type:"ADD",collection:n,data:e,hasMultipleRelations:p,i18n:j,relation:t})}),[u,p,j]),O=i().useCallback((async({abortController:e,relationSlug:t})=>{const n=u.find((e=>e.slug===t)),r=n?.admin?.useAsTitle||"id",a=C.current.get(t);if(M.current.includes(t)){const n={depth:0,limit:10,page:a,where:{and:[]}};P&&n.where.and.push({[r]:{like:P}});try{const r=await fetch(`${f}${d}/${t}${ge().stringify(n,{addQueryPrefix:!0})}`,{credentials:"include",headers:{"Accept-Language":j.language},signal:e.signal});if(r.ok){const e=await r.json();e.docs.length>0&&(_(e,t),P||(e.nextPage?C.current.set(t,e.nextPage):M.current=M.current.filter((e=>e!==t))))}else y(k("error:unspecific"))}catch(t){e.signal.aborted||console.error(t)}}x(!0)}),[_,d,u,P,j.language,f,k]),E=i().useCallback((()=>{if(M.current.length>0){const e=new AbortController;O({abortController:e,relationSlug:M.current[0]})}}),[O]),D=(0,o.useCallback)((()=>{if(c){if(a)return Array.isArray(c)?c.map((e=>{if(p){let t;return m.forEach((n=>{n.options&&n.options.some((n=>n?.value===e.value&&(t=n,!0)))})),t}return m.find((t=>t.value===e))})):void 0;if(p){let e;const t=c;return m.forEach((n=>{n?.options&&n.options.some((n=>n?.value===t.value&&(e=n,!0)))})),e}return m.find((e=>e.value===c))}}),[a,p,c,m]),N=(0,o.useCallback)((e=>{g!==e&&v(e)}),[g]),A=(0,o.useCallback)((async(e,t)=>{if(!b&&"null"!==e&&e&&t){const n=await fetch(`${f}${d}/${t}/${e}?depth=0`,{credentials:"include",headers:{"Accept-Language":j.language}});if(n.ok){const e=await n.json();_({docs:[e]},t)}else console.error(k("error:loadingDocument",{id:e}))}}),[j,_,d,b,f,k]);(0,o.useEffect)((()=>{const e=Array.isArray(l)?l:[l],t=[];return e.forEach((e=>{const n=new AbortController;O({abortController:n,relationSlug:e}),t.push(n)})),()=>{t.forEach((e=>{e.signal&&e.abort()}))}}),[j,O,l]),(0,o.useEffect)((()=>{if(c&&w)if(a){(D()||[]).forEach(((e,t)=>{e||(p?A(c[t].value,c[t].relationTo):A(c[t],l))}))}else{if(!D())if(p){const e=c;A(e.value,e.relationTo)}else A(c,l)}}),[A,D,a,p,l,c,w]);const T=["field-type",Ug,b&&"error-loading"].filter(Boolean).join(" "),R=D()||c;return(0,t.jsxs)("div",{className:T,children:[!b&&(0,t.jsx)(_f,{disabled:r,isMulti:a,isSortable:n,onChange:e=>{e?a&&Array.isArray(e)?s(e?e.map((e=>p?{relationTo:e?.relationTo,value:e?.value}:e?.value)):null):p&&!Array.isArray(e)?s({relationTo:e?.relationTo,value:e?.value}):Array.isArray(e)||s(e?.value):s(null)},onInputChange:N,onMenuScrollToBottom:E,options:m,placeholder:k("general:selectValue"),value:R}),b&&(0,t.jsx)("div",{className:`${Ug}__error-loading`,children:b})]})},Select:Kg,Text:({disabled:e,onChange:n,value:r})=>{const{t:a}=(0,Be.B)();return(0,t.jsx)("input",{className:"condition-value-text",disabled:e,onChange:e=>n(e.target.value),placeholder:a("general:enterAValue"),type:"text",value:r||""})}},Qg="condition",Jg=e=>{const{addCondition:n,andIndex:r,fieldName:a,fields:i,initialValue:s,operator:l,orIndex:c,removeCondition:u,updateCondition:d}=e,[f,p]=(0,o.useState)((()=>i.find((e=>a===e.value)))),[m,h]=(0,o.useState)(l),[g,v]=(0,o.useState)(s),b=Qt(g,300);(0,o.useEffect)((()=>{!f?.value&&"number"!=typeof f?.value||!m||[null,void 0].includes(b)||d({andIndex:r,fieldName:f.value,operator:m,orIndex:c,value:b})}),[b,r,f?.value,m,c,d,l]);const y=["exists"].includes(m)||"checkbox"===f?.props?.type,w=y?Kg:Xg[f?.component]||Xg.Text;let x;return y?x=["true","false"]:f?.props&&"options"in f.props&&(x=f.props.options),(0,t.jsx)("div",{className:Qg,children:(0,t.jsxs)("div",{className:`${Qg}__wrap`,children:[(0,t.jsxs)("div",{className:`${Qg}__inputs`,children:[(0,t.jsx)("div",{className:`${Qg}__field`,children:(0,t.jsx)(_f,{isClearable:!1,onChange:e=>{p(i.find((t=>t.value===e.value))),h(void 0),v(void 0)},options:i,value:i.find((e=>f?.value===e.value))||i[0]})}),(0,t.jsx)("div",{className:`${Qg}__operator`,children:(0,t.jsx)(_f,{disabled:!f?.value&&"number"!=typeof f?.value,isClearable:!1,onChange:e=>{h(e.value)},options:f?.operators,value:f?.operators.find((e=>m===e.value))||null})}),(0,t.jsx)("div",{className:`${Qg}__value`,children:(0,t.jsx)(Yg,{CustomComponent:f?.props?.admin?.components?.Filter,DefaultComponent:w,componentProps:{...f?.props,disabled:!m,onChange:v,operator:m,options:x,relationTo:"relationship"===f?.props?.type&&"cellProps"in f.props&&"object"==typeof f.props.cellProps&&"relationTo"in f.props.cellProps?f.props.cellProps?.relationTo:void 0,value:g??""}})})]}),(0,t.jsxs)("div",{className:`${Qg}__actions`,children:[(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${Qg}__actions-remove`,icon:"x",iconStyle:"with-border",onClick:()=>u({andIndex:r,orIndex:c}),round:!0}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${Qg}__actions-add`,icon:"plus",iconStyle:"with-border",onClick:()=>n({andIndex:r+1,fieldName:i[0].value,orIndex:c,relation:"and"}),round:!0})]})]})})},Zg=[{label:"equals",value:"equals"},{label:"isNotEqualTo",value:"not_equals"}],ev=[...Zg,{label:"isIn",value:"in"},{label:"isNotIn",value:"not_in"},{label:"exists",value:"exists"}],tv=[...ev,{label:"isGreaterThan",value:"greater_than"},{label:"isLessThan",value:"less_than"},{label:"isLessThanOrEqualTo",value:"less_than_equal"},{label:"isGreaterThanOrEqualTo",value:"greater_than_equal"}],nv=[...Zg,{label:"exists",value:"exists"},{label:"near",value:"near"}],rv={label:"within",value:"within"},av={label:"intersects",value:"intersects"},ov={label:"isLike",value:"like"},iv={label:"contains",value:"contains"},sv={checkbox:{component:"Text",operators:Zg},code:{component:"Text",operators:[...ev,ov,iv]},date:{component:"Date",operators:[...ev,...tv]},email:{component:"Text",operators:[...ev,iv]},json:{component:"Text",operators:[...ev,ov,iv,rv,av]},number:{component:"Number",operators:[...ev,...tv]},point:{component:"Point",operators:[...nv,rv,av]},radio:{component:"Select",operators:[...ev]},relationship:{component:"Relationship",operators:[...ev]},richText:{component:"Text",operators:[...ev,ov,iv]},select:{component:"Select",operators:[...ev]},text:{component:"Text",operators:[...ev,ov,iv]},textarea:{component:"Text",operators:[...ev,ov,iv]},upload:{component:"Text",operators:[...ev]}},lv=(e,t)=>e.reduce(((e,n)=>{if("object"==typeof sv[n.type]){const r=new Set,a=sv[n.type].operators.reduce(((e,n)=>r.has(n.value)?e:(r.add(n.value),[...e,{...n,label:t.t(`operators:${n.label}`)}])),[]),o={label:n.Label,value:n.name,...sv[n.type],operators:a,props:{...n,...n?.cellProps||{}}};return n.admin?.disableListFilter?e:[...e,o]}return e}),[]),cv=e=>{if(e?.or?.length>0&&e?.or?.[0]?.and&&e?.or?.[0]?.and?.length>0){const t=e.or.every((e=>!(!e.and||!Array.isArray(e.and))&&e.and.every((e=>{if("object"!=typeof e)return!1;const t=Object.keys(e);if(0===t.length)return!1;for(const n of t){const t=Object.keys(e[n])[0];if(!t||!jc.validOperators.includes(t))return!1}return!0}))));return t}return!1},uv="where-builder",dv=e=>{const{collectionPluralLabel:n}=e,{i18n:r,t:s}=(0,Be.B)(),{columns:l}=Dm(),[c,u]=(0,o.useState)((()=>lv(l,r)));(0,o.useEffect)((()=>{u(lv(l,r))}),[l,r]);const{searchParams:d}=nn(),{handleWhereChange:f}=Zp(),[p,m]=i().useState(!1),[h,g]=i().useState((()=>{const e=d.where;if(e){if(cv(e))return e.or;const n=(t=e)?t.or&&!t.and?{or:t.or.map((e=>e.and?e:{and:[e]}))}:t.and&&!t.or?{or:[{and:t.and}]}:t.or||t.and?t:{or:[{and:[t]}]}:{};if(cv(n))return n.or;console.warn(`Invalid where query in URL: ${JSON.stringify(e)}`)}var t;return[]})),v=i().useCallback((({andIndex:e,fieldName:t,orIndex:n,relation:r})=>{const a=[...h];"and"===r?a[n].and.splice(e,0,{[t]:{}}):a.push({and:[{[t]:{}}]}),g(a)}),[h]),b=i().useCallback((({andIndex:e,fieldName:t,operator:n,orIndex:r,value:a})=>{const o=h[r].and[e];if("object"==typeof o&&t&&n){const i=a??(n?o[n]:""),s={[t]:n?{[n]:i}:{}};JSON.stringify(o)!==JSON.stringify(s)&&(h[r].and[e]=s,g(h),[null,void 0].includes(i)||m(!0))}}),[h]),y=i().useCallback((({andIndex:e,orIndex:t})=>{const n=[...h];n[t].and.splice(e,1),0===n[t].and.length&&n.splice(t,1),g(n),m(!0)}),[h]);return i().useEffect((()=>{p&&(f({or:h}),m(!1))}),[h,f,p]),(0,t.jsxs)("div",{className:uv,children:[h.length>0&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${uv}__label`,children:s("general:filterWhere",{label:(0,a.sC)(n,r)})}),(0,t.jsx)("ul",{className:`${uv}__or-filters`,children:h.map(((e,n)=>{const r=`${n}_${Array.isArray(e?.and)?e.and.length:""}`;return(0,t.jsxs)("li",{children:[0!==n&&(0,t.jsx)("div",{className:`${uv}__label`,children:s("general:or")}),(0,t.jsx)("ul",{className:`${uv}__and-filters`,children:Array.isArray(e?.and)&&e.and.map(((e,r)=>{const a=Object.keys(h[n].and[r])[0],o=Object.keys(h[n].and[r]?.[a]||{})?.[0]||void 0,i=h[n].and[r]?.[a]?.[o]||"";return(0,t.jsxs)("li",{children:[0!==r&&(0,t.jsx)("div",{className:`${uv}__label`,children:s("general:and")}),(0,t.jsx)(Jg,{addCondition:v,andIndex:r,fieldName:a,fields:c,initialValue:i,operator:o,orIndex:n,removeCondition:y,updateCondition:b})]},r)}))})]},r)}))}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${uv}__add-or`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{v({andIndex:0,fieldName:c[0].value,orIndex:h.length,relation:"or"})},children:s("general:or")})]}),0===h.length&&(0,t.jsxs)("div",{className:`${uv}__no-filters`,children:[(0,t.jsx)("div",{className:`${uv}__label`,children:s("general:noFiltersSet")}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${uv}__add-first-filter`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{c.length>0&&v({andIndex:0,fieldName:c[0].value,orIndex:h.length,relation:"or"})},children:s("general:addFilter")})]})]})},fv=(e,t)=>{if(e){return tm(t).filter((t=>t.isFieldAffectingData&&e.includes(t.name)))}return null},pv=Qs.A.default||Qs.A,mv="list-controls",hv=e=>{const{collectionConfig:n,enableColumns:r=!0,enableSort:s=!1,fieldMap:l}=e,{handleSearchChange:c}=Zp(),{searchParams:u}=nn(),d=((e,t)=>{const{admin:{useAsTitle:n}}=e;return tm(t).find((e=>e.name===n))})(n,l),{i18n:f,t:p}=(0,Be.B)(),{breakpoints:{s:m}}=Le(),h=(0,o.useRef)(Boolean(u?.where)),g=cv(u?.where),[v,b]=(0,o.useState)(g?"where":void 0);return(0,o.useEffect)((()=>{h.current&&!u?.where?(b(void 0),h.current=!1):u?.where&&(h.current=!0)}),[b,u?.where]),(0,t.jsxs)("div",{className:mv,children:[(0,t.jsxs)("div",{className:`${mv}__wrap`,children:[(0,t.jsx)(zg,{fieldLabel:(d&&(0,a.sC)("label"in d.fieldComponentProps&&"string"==typeof d.fieldComponentProps.label?d.fieldComponentProps.label:d.name,f))??void 0,fieldName:d?.name,handleChange:c,listSearchableFields:fv(n.admin.listSearchableFields,l)}),(0,t.jsx)("div",{className:`${mv}__buttons`,children:(0,t.jsxs)("div",{className:`${mv}__buttons-wrap`,children:[!m&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Lg,{collection:n,fieldMap:l}),(0,t.jsx)(Wg,{collection:n}),(0,t.jsx)(Hg,{collection:n}),(0,t.jsx)(_g,{collection:n})]}),r&&(0,t.jsx)(Ml,{"aria-controls":`${mv}-columns`,"aria-expanded":"columns"===v,className:`${mv}__toggle-columns ${"columns"===v?`${mv}__buttons-active`:""}`,icon:(0,t.jsx)(Tt,{}),onClick:()=>b("columns"!==v?"columns":void 0),pillStyle:"light",children:p("general:columns")}),(0,t.jsx)(Ml,{"aria-controls":`${mv}-where`,"aria-expanded":"where"===v,className:`${mv}__toggle-where ${"where"===v?`${mv}__buttons-active`:""}`,icon:(0,t.jsx)(Tt,{}),onClick:()=>b("where"!==v?"where":void 0),pillStyle:"light",children:p("general:filters")}),s&&(0,t.jsx)(Ml,{"aria-controls":`${mv}-sort`,"aria-expanded":"sort"===v,className:`${mv}__toggle-sort`,icon:(0,t.jsx)(Tt,{}),onClick:()=>b("sort"!==v?"sort":void 0),pillStyle:"light",children:p("general:sort")})]})})]}),r&&(0,t.jsx)(pv,{className:`${mv}__columns`,height:"columns"===v?"auto":0,id:`${mv}-columns`,children:(0,t.jsx)(Cg,{collectionSlug:n.slug})}),(0,t.jsx)(pv,{className:`${mv}__where`,height:"where"===v?"auto":0,id:`${mv}-where`,children:(0,t.jsx)(dv,{collectionPluralLabel:n?.labels?.plural,collectionSlug:n.slug},String(h.current&&!u?.where))}),s&&(0,t.jsx)(pv,{className:`${mv}__sort`,height:"sort"===v?"auto":0,id:`${mv}-sort`,children:(0,t.jsx)("p",{children:"Sort Complex"})})]})},gv=({columns:e,customCellContext:n,data:r})=>{const{columns:a}=Dm(),o=e||a,i=o?.filter((e=>e?.active));return i&&0!==i.length?(0,t.jsx)("div",{className:"table",children:(0,t.jsxs)("table",{cellPadding:"0",cellSpacing:"0",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:i.map(((e,n)=>(0,t.jsx)("th",{id:`heading-${e.accessor}`,children:e.components.Heading},n)))})}),(0,t.jsx)("tbody",{children:r&&r.map(((e,r)=>(0,t.jsx)("tr",{className:`row-${r+1}`,children:i.map(((r,a)=>(0,t.jsx)("td",{className:`cell-${r.accessor}`,children:(0,t.jsx)(cm,{cellData:e[r.accessor],cellProps:r?.cellProps,columnIndex:a,customCellContext:n,rowData:e,children:r.components.Cell})},a)))},r)))})]})}):(0,t.jsx)("div",{children:"No columns selected"})},vv="clickable-arrow",bv="paginator__page",yv=({isCurrent:e,isFirstPage:n=!1,isLastPage:r=!1,page:a=1,updatePage:o})=>{const i=[bv,e&&`${bv}--is-current`,n&&`${bv}--is-first-page`,r&&`${bv}--is-last-page`].filter(Boolean).join(" ");return(0,t.jsx)("button",{className:i,onClick:()=>o(a),type:"button",children:a})},wv={ClickableArrow:e=>{const{direction:n="right",isDisabled:r=!1,updatePage:a}=e,o=[vv,r&&`${vv}--is-disabled`,n&&`${vv}--${n}`].filter(Boolean).join(" ");return(0,t.jsx)("button",{className:o,disabled:r,onClick:r?void 0:a,type:"button",children:(0,t.jsx)(Tt,{})})},Page:yv,Separator:()=>(0,t.jsx)("span",{className:"paginator__separator",children:"—"})},xv=e=>{const{hasNextPage:n=!1,hasPrevPage:r=!1,nextPage:a=null,numberOfNeighbors:o=1,onChange:i,page:s,prevPage:l=null,totalPages:c=null}=e;if(!c||c<=1)return null;const u=e=>{"function"==typeof i&&i(e)},d=Array.from({length:c},((e,t)=>t+1));let f=s-1-o;f<=0&&(f=0);const p=s-1+o+1,m=d.slice(f,p);return s-o-1>=2&&m.unshift({type:"Separator"}),s>o+1&&m.unshift({type:"Page",props:{isFirstPage:!0,page:1,updatePage:u}}),s+o+1<c&&m.push({type:"Separator"}),p<c&&m.push({type:"Page",props:{isLastPage:!0,page:c,updatePage:u}}),m.unshift({type:"ClickableArrow",props:{direction:"right",isDisabled:!n,updatePage:()=>u(a)}}),m.unshift({type:"ClickableArrow",props:{direction:"left",isDisabled:!r,updatePage:()=>u(l)}}),(0,t.jsx)("div",{className:"paginator",children:m.map(((e,n)=>{if("number"==typeof e)return(0,t.jsx)(yv,{isCurrent:s===e,page:e,updatePage:u},n);const r=wv[e.type];return(0,t.jsx)(r,{...e.props},n)}))})},Pv="per-page",jv=jc.collectionDefaults.admin.pagination.limits,kv=({defaultLimit:e=10,handleChange:n,limit:r,limits:a=jv})=>{const{t:o}=(0,Be.B)(),i=(0,jc.isNumber)(r)?r:e;return(0,t.jsx)("div",{className:Pv,children:(0,t.jsx)(Ys,{button:(0,t.jsxs)("div",{className:`${Pv}__base-button`,children:[(0,t.jsx)("span",{children:o("general:perPage",{limit:i})})," ",(0,t.jsx)(Tt,{className:`${Pv}__icon`})]}),horizontalAlign:"right",render:({close:e})=>(0,t.jsx)(Us,{children:a.map(((r,a)=>(0,t.jsxs)(Gs,{className:[`${Pv}__button`,r===i&&`${Pv}__button-active`].filter(Boolean).join(" "),onClick:()=>{e(),n&&n(r)},children:[r===i&&(0,t.jsx)("div",{className:`${Pv}__chevron`,children:(0,t.jsx)(Tt,{direction:"right"})})," ",(0,t.jsx)("span",{children:r})]},a)))}),size:"small"})})};var Sv=n(40978),Cv=n.n(Sv);const Mv="collection-list",_v=Cv().default||Cv(),Ov=()=>{const{Header:e,collectionSlug:n,hasCreatePermission:r,newDocumentURL:i}=(0,o.useContext)(Xp),{data:s,defaultLimit:l,handlePageChange:c,handlePerPageChange:u}=Zp(),{searchParams:d}=nn(),f=Ut(),{getComponentMap:p}=wn(),m=p({collectionSlug:n}),{AfterList:h,AfterListTable:g,BeforeList:v,BeforeListTable:b,Description:y,actionsMap:w,fieldMap:x}=m||{},P=f.collections.find((e=>e.slug===n)),{labels:j}=P,{i18n:k}=(0,Be.B)(),S=ws(),{setStepNav:C}=hn(),{breakpoints:{s:M}}=xg();let _=s.docs||[];return P.upload&&(_=_?.map((e=>({...e,filesize:(0,jc.formatFilesize)(e.filesize)})))),(0,o.useEffect)((()=>{S<=1&&C([{label:j?.plural}])}),[C,j,S]),(0,t.jsxs)("div",{className:Mv,children:[(0,t.jsx)(Pg,{actions:w?.List}),v,(0,t.jsx)(am,{docs:s.docs,totalDocs:s.totalDocs,children:(0,t.jsxs)(bl,{className:`${Mv}__wrap`,children:[(0,t.jsx)("header",{className:`${Mv}__header`,children:e||(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("h1",{children:(0,a.sC)(j?.plural,k)}),r&&(0,t.jsx)(Ml,{"aria-label":k.t("general:createNewLabel",{label:(0,a.sC)(j?.singular,k)}),to:i,children:k.t("general:createNew")}),!M&&(0,t.jsx)(kg,{label:(0,a.sC)(P.labels.plural,k)}),y&&(0,t.jsx)("div",{className:`${Mv}__sub-header`,children:y})]})}),(0,t.jsx)(hv,{collectionConfig:P,fieldMap:x}),b,!s.docs&&(0,t.jsx)(Ql.E,{className:[`${Mv}__shimmer`,`${Mv}__shimmer--rows`].join(" "),count:6}),s.docs&&s.docs.length>0&&(0,t.jsx)(wm,{children:(0,t.jsx)(gv,{customCellContext:{collectionSlug:n,uploadConfig:P.upload},data:_,fieldMap:x})}),s.docs&&0===s.docs.length&&(0,t.jsxs)("div",{className:`${Mv}__no-results`,children:[(0,t.jsx)("p",{children:k.t("general:noResults",{label:(0,a.sC)(j?.plural,k)})}),r&&i&&(0,t.jsx)(Yt,{Link:_v,el:"link",to:i,children:k.t("general:createNewLabel",{label:(0,a.sC)(j?.singular,k)})})]}),g,s.docs&&s.docs.length>0&&(0,t.jsxs)("div",{className:`${Mv}__page-controls`,children:[(0,t.jsx)(xv,{hasNextPage:s.hasNextPage,hasPrevPage:s.hasPrevPage,limit:s.limit,nextPage:s.nextPage,numberOfNeighbors:1,onChange:c,page:s.page,prevPage:s.prevPage,totalPages:s.totalPages}),s?.totalDocs>0&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)("div",{className:`${Mv}__page-info`,children:[s.page*s.limit-(s.limit-1),"-",s.totalPages>1&&s.totalPages!==s.page?s.limit*s.page:s.totalDocs," ",k.t("general:of")," ",s.totalDocs]}),(0,t.jsx)(kv,{handleChange:u,limit:(0,jc.isNumber)(d?.limit)?Number(d.limit):l,limits:P?.admin?.pagination?.limits,resetPage:s.totalDocs<=s.pagingCounter}),M&&(0,t.jsx)("div",{className:`${Mv}__list-selection`,children:(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(kg,{label:(0,a.sC)(P.labels.plural,k)}),(0,t.jsxs)("div",{className:`${Mv}__list-selection-actions`,children:[(0,t.jsx)(Lg,{collection:P,fieldMap:x}),(0,t.jsx)(Wg,{collection:P}),(0,t.jsx)(Hg,{collection:P}),(0,t.jsx)(_g,{collection:P})]})]})})]})]})]})}),h]})},Ev=(0,lh.Merriweather)({display:"swap",style:["normal","italic"],subsets:["latin"],variable:"--font-serif",weight:["400","900"]}),Dv=async({children:e,config:n})=>{const r=await n,o=(0,ch.headers)(),i=(0,oh.parseCookies)(o),s=fh({config:r,cookies:i,headers:o}),l=(({config:e,cookies:t,headers:n})=>{const r=t.get(`${e.cookiePrefix||"payload"}-theme`),a="string"==typeof r?r:r?.value;if(a&&ph.includes(a))return a;const o=n.get("Sec-CH-Prefers-Color-Scheme");return o&&ph.includes(o)?o:Xm.zQ})({config:r,cookies:i,headers:o}),c=await dh({config:r}),u=await(0,a.LE)({config:r.i18n,context:"client",language:s}),d=await(0,oh.createClientConfig)({config:r,t:u.t}),f=a.aG.includes(s)?"RTL":"LTR",p=Object.entries(r.i18n.supportedLanguages||{}).reduce(((e,[t,n])=>(Object.keys(r.i18n.supportedLanguages).includes(t)&&e.push({label:n.translations.general.thisLanguage,value:t}),e)),[]);const{componentMap:m,wrappedChildren:h}=sh({DefaultEditView:yg,DefaultListView:Ov,children:e,i18n:u,payload:c});return(0,t.jsx)("html",{className:Ev.variable,"data-theme":l,dir:f,lang:s,children:(0,t.jsxs)("body",{children:[(0,t.jsx)(nh,{componentMap:m,config:d,dateFNSKey:u.dateFNSKey,fallbackLang:d.i18n.fallbackLanguage,languageCode:s,languageOptions:p,switchLanguageServerAction:async function(e){(0,ch.cookies)().set({name:`${r.cookiePrefix||"payload"}-lng`,path:"/",value:e})},theme:l,translations:u.translations,children:h}),(0,t.jsx)("div",{id:"portal"})]})})},Nv=({permissions:e,user:t})=>{const{setPermissions:n,setUser:r}=sn();return(0,o.useEffect)((()=>{r(t),n(e)}),[t,e,r,n]),null};var Av;function Tv(e,t,n){return e.reduce(((e,r)=>{if(t?.[r.type.toLowerCase()]?.[r.entity.slug]?.read.permission){const t=(0,a.sC)(r.entity.admin.group,n);if(r.entity.admin.group){const o=e.find((e=>(0,a.sC)(e.label,n)===t));let i=o;o||(i={entities:[],label:t},e.push(i)),i.entities.push(r)}else{e.find((e=>(0,a.sC)(e.label,n)===n.t(`general:${r.type}`))).entities.push(r)}}return e}),[{entities:[],label:n.t("general:collections")},{entities:[],label:n.t("general:globals")}]).filter((e=>e.entities.length>0))}!function(e){e.collection="collections",e.global="globals"}(Av||(Av={}));const Rv=e=>{const{CustomComponent:n,DefaultComponent:r,componentProps:a,serverOnlyProps:o}=e;return n?(0,t.jsx)(rh,{Component:n,serverOnlyProps:o,...a}):r?(0,t.jsx)(rh,{Component:r,serverOnlyProps:o,...a}):null},Iv=({nav:e})=>{const{setStepNav:t}=hn();return(0,o.useEffect)((()=>{t(e)}),[t,e]),null},Lv="card",$v=e=>{const{id:n,Link:r,actions:a,buttonAriaLabel:o,href:i,onClick:s,title:l,titleAs:c}=e,u=[Lv,n,(s||i)&&`${Lv}--has-onclick`].filter(Boolean).join(" "),d=c??"div";return(0,t.jsxs)("div",{className:u,id:n,children:[(0,t.jsx)(d,{className:`${Lv}__title`,children:l}),a&&(0,t.jsx)("div",{className:`${Lv}__actions`,children:a}),(s||i)&&(0,t.jsx)(Yt,{Link:r,"aria-label":o,buttonStyle:"none",className:`${Lv}__click`,el:"link",onClick:s,to:i})]})},Wv="dashboard",Fv=e=>{const{Link:n,i18n:r,i18n:{t:i},locale:s,navGroups:l,params:c,payload:{config:{admin:{components:{afterDashboard:u,beforeDashboard:d}},routes:{admin:f}}},payload:p,permissions:m,searchParams:h,user:g}=e,v=Array.isArray(d)?d.map(((e,n)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:r,locale:s,params:c,payload:p,permissions:m,searchParams:h,user:g}},n))):null,b=Array.isArray(u)?u.map(((e,n)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:r,locale:s,params:c,payload:p,permissions:m,searchParams:h,user:g}},n))):null;return(0,t.jsxs)("div",{className:Wv,children:[(0,t.jsx)(Iv,{nav:[]}),(0,t.jsx)(Pg,{actions:[]}),(0,t.jsxs)(bl,{className:`${Wv}__wrap`,children:[Array.isArray(v)&&v.map((e=>e)),(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Pg,{actions:[]}),l&&0!==l?.length?l.map((({entities:e,label:o},s)=>(0,t.jsxs)("div",{className:`${Wv}__group`,children:[(0,t.jsx)("h2",{className:`${Wv}__label`,children:o}),(0,t.jsx)("ul",{className:`${Wv}__card-list`,children:e.map((({type:e,entity:o},s)=>{let l,c,u,d,p;return e===Av.collection&&(l=(0,a.sC)(o.labels.plural,r),c=i("general:showAllLabel",{label:l}),d=`${f}/collections/${o.slug}`,u=`${f}/collections/${o.slug}/create`,p=m?.collections?.[o.slug]?.create?.permission),e===Av.global&&(l=(0,a.sC)(o.label,r),c=i("general:editLabel",{label:(0,a.sC)(o.label,r)}),d=`${f}/globals/${o.slug}`),(0,t.jsx)("li",{children:(0,t.jsx)($v,{Link:n,actions:p&&e===Av.collection?(0,t.jsx)(Yt,{Link:n,"aria-label":i("general:createNewLabel",{label:(0,a.sC)(o.labels.singular,r)}),buttonStyle:"icon-label",el:"link",icon:"plus",iconStyle:"with-border",round:!0,to:u}):void 0,buttonAriaLabel:c,href:d,id:`card-${o.slug}`,title:l,titleAs:"h3"})},s)}))})]},s))):(0,t.jsx)("p",{children:"no nav groups...."})]}),Array.isArray(b)&&b.map((e=>e))]})]})},zv=(n.p,n.p,n.p,Cv().default||Cv()),Bv=({initPageResult:e,params:n,searchParams:r})=>{const{locale:a,permissions:i,req:{i18n:s,payload:{config:l},payload:c,user:u},visibleEntities:d}=e,f=l.admin.components?.views?.Dashboard,p=l.collections.filter((e=>i?.collections?.[e.slug]?.read?.permission&&d.collections.includes(e.slug))),m=l.globals.filter((e=>i?.globals?.[e.slug]?.read?.permission&&d.globals.includes(e.slug))),h=Tv([...p.map((e=>({type:Av.collection,entity:e})))??[],...m.map((e=>({type:Av.global,entity:e})))??[]],i,s),g={Link:zv,i18n:s,locale:a,navGroups:h,params:n,payload:c,permissions:i,searchParams:r,user:u,visibleEntities:d};return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Nv,{permissions:i,user:u}),(0,t.jsx)(Rv,{CustomComponent:"function"==typeof f?f:void 0,DefaultComponent:Fv,componentProps:g,serverOnlyProps:{i18n:s,locale:a,params:n,payload:c,permissions:i,searchParams:r,user:u}})]})},Hv=()=>(0,t.jsxs)("svg",{className:"graphic-logo",fill:"none",height:"50",viewBox:"0 0 180 50",width:"180",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("style",{children:"\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n"}),(0,t.jsx)("path",{d:"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z"}),(0,t.jsx)("path",{d:"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z"}),(0,t.jsx)("path",{d:"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z"}),(0,t.jsx)("path",{d:"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z"}),(0,t.jsx)("path",{d:"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z"}),(0,t.jsx)("path",{d:"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z"}),(0,t.jsx)("path",{d:"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z"}),(0,t.jsx)("path",{d:"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z"}),(0,t.jsx)("path",{d:"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"})]}),Yv=e=>{const{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}=e,{admin:{components:{graphics:{Logo:c}={Logo:void 0}}={}}={}}=o.config;return(0,t.jsx)(Rv,{CustomComponent:c,DefaultComponent:Hv,serverOnlyProps:{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}})},Vv="login__form",qv=Cv().default||Cv(),Uv=({searchParams:e})=>{const n=Ut(),{admin:{autoLogin:r,routes:{forgot:a},user:o},routes:{admin:i,api:s}}=n,{t:l}=(0,Be.B)(),c=r&&r.prefillOnly,u={email:{initialValue:c?r.email:void 0,valid:!0,value:c?r.email:void 0},password:{initialValue:c?r.password:void 0,valid:!0,value:c?r.password:void 0}};return(0,t.jsxs)(Ch,{action:`${s}/${o}/login`,className:Vv,disableSuccessStatus:!0,initialState:u,method:"POST",redirect:"string"==typeof e?.redirect?e.redirect:i,waitForAutocomplete:!0,children:[(0,t.jsxs)("div",{className:`${Vv}__inputWrap`,children:[(0,t.jsx)(fc,{autoComplete:"email",label:l("general:email"),name:"email",required:!0,validate:e=>(0,jc.email)(e,{name:"email",type:"email",data:{},preferences:{fields:{}},req:{t:l},required:!0,siblingData:{}})}),(0,t.jsx)(Ef,{autoComplete:"off",label:l("general:password"),name:"password",required:!0,validate:e=>(0,jc.password)(e,{name:"password",type:"text",data:{},preferences:{fields:{}},req:{payload:{config:n},t:l},required:!0,siblingData:{}})})]}),(0,t.jsx)(qv,{href:`${i}${a}`,children:l("authentication:forgotPasswordQuestion")}),(0,t.jsx)(Lh,{children:l("authentication:login")})]})},Gv="login",Kv=({initPageResult:e,params:n,searchParams:r})=>{const{locale:a,permissions:i,req:s}=e,{i18n:l,payload:{config:c},payload:u,user:d}=s,{admin:{components:{afterLogin:f,beforeLogin:p}={},user:m},collections:h,routes:{admin:g}}=c,v=Array.isArray(p)?p.map(((e,o)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:l,locale:a,params:n,payload:u,permissions:i,searchParams:r,user:d}},o))):null,b=Array.isArray(f)?f.map(((e,o)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:l,locale:a,params:n,payload:u,permissions:i,searchParams:r,user:d}},o))):null;d&&(0,eg.redirect)(g);const y=h.find((({slug:e})=>e===m));return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("div",{className:`${Gv}__brand`,children:(0,t.jsx)(Yv,{i18n:l,locale:a,params:n,payload:u,permissions:i,searchParams:r,user:d})}),Array.isArray(v)&&v.map((e=>e)),!y?.auth?.disableLocalStrategy&&(0,t.jsx)(Uv,{searchParams:r}),Array.isArray(b)&&b.map((e=>e))]})},Xv="nav-toggler",Qv=e=>{const{id:n,children:r,className:a,tabIndex:o=0}=e,{t:i}=(0,Be.B)(),{setPreference:s}=dn(),{navOpen:l,setNavOpen:c}=pn(),{breakpoints:{l:u}}=Le();return(0,t.jsx)("button",{"aria-label":`${i(l?"general:close":"general:open")} ${i("general:menu")}`,className:[Xv,l&&`${Xv}--is-open`,a].filter(Boolean).join(" "),id:n,onClick:async()=>{c(!l),u||await s("nav",{open:!l})},tabIndex:o,type:"button",children:r})},Jv="graphic-account",Zv=e=>(0,t.jsxs)("svg",{className:[Jv,e?.active&&`${Jv}--active`].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:`${Jv}__bg`,cx:"12.5",cy:"12.5",r:"11.5"}),(0,t.jsx)("circle",{className:`${Jv}__head`,cx:"12.5",cy:"10.73",r:"3.98"}),(0,t.jsx)("path",{className:`${Jv}__body`,d:"M12.5,24a11.44,11.44,0,0,0,7.66-2.94c-.5-2.71-3.73-4.8-7.66-4.8s-7.16,2.09-7.66,4.8A11.44,11.44,0,0,0,12.5,24Z"})]});var eb=n(41361),tb=n.n(eb);const nb=()=>{const{user:e}=sn(),n=tb()(e.email.trim().toLowerCase()),r=`?${new URLSearchParams({default:"mp",r:"g",s:"50"}).toString()}`;return(0,t.jsx)("img",{alt:"yas",className:"gravatar-account",height:25,src:`https://www.gravatar.com/avatar/${n}?${r}`,style:{borderRadius:"50%"},width:25})},rb=()=>{const{admin:{avatar:e},admin:{routes:{account:n}},routes:{admin:r}}=Ut(),{user:a}=sn(),o=(0,ht.usePathname)()===`${r}${n}`;return a?.email&&"default"!==e?"gravatar"===e?(0,t.jsx)(nb,{}):e?(0,t.jsx)(e,{active:o}):void 0:(0,t.jsx)(Zv,{active:o})},ab="hamburger",ob=e=>{const{t:n}=(0,Be.B)(),{closeIcon:r="x",isActive:a=!1}=e;return(0,t.jsx)("div",{className:ab,children:(0,t.jsx)("div",{className:`${ab}__wrapper`,children:(0,t.jsxs)("div",{className:`${ab}__icon`,children:[!a&&(0,t.jsxs)("div",{className:`${ab}__lines`,title:n("general:open"),children:[(0,t.jsx)("div",{className:`${ab}__line ${ab}__top`}),(0,t.jsx)("div",{className:`${ab}__line ${ab}__middle`}),(0,t.jsx)("div",{className:`${ab}__line ${ab}__bottom`})]}),a&&(0,t.jsxs)("div",{"aria-label":n("collapse"===r?"general:collapse":"general:close"),className:`${ab}__close-icon`,title:n("collapse"===r?"general:collapse":"general:close"),children:["x"===r&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${ab}__line ${ab}__x-left`}),(0,t.jsx)("div",{className:`${ab}__line ${ab}__x-right`})]}),"collapse"===r&&(0,t.jsx)(Tt,{className:`${ab}__collapse-chevron`,direction:"left"})]})]})})})},ib="localizer-button",sb=e=>{const{ariaLabel:n,className:r}=e,o=ls(),{i18n:i,t:s}=(0,Be.B)();return(0,t.jsxs)("div",{"aria-label":n||s("general:locale"),className:[ib,r].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${ib}__label`,children:`${s("general:locale")}:`})," ",(0,t.jsx)("span",{className:`${ib}__current-label`,children:`${(0,a.sC)(o.label,i)}`})," ",(0,t.jsx)(Tt,{className:`${ib}__chevron`})]})},lb="localizer",cb=e=>{const{className:n}=e,r=Ut(),{localization:o}=r,{i18n:i}=(0,Be.B)(),s=ls(),{stringifyParams:l}=nn(),c=(0,ht.useRouter)(),{clearRouteCache:u}=(0,Km.P)();if(o){const{locales:e}=o;return(0,t.jsx)("div",{className:[lb,n].filter(Boolean).join(" "),children:(0,t.jsx)(Ys,{button:(0,t.jsx)(sb,{}),horizontalAlign:"right",render:({close:n})=>(0,t.jsx)(Us,{children:e.map((e=>{const r=(0,a.sC)(e.label,i);return(0,t.jsxs)(Gs,{active:s.code===e.code,onClick:()=>{c.replace(l({params:{locale:e.code}})),u(),n()},children:[r,r!==e.code&&` (${e.code})`]},e.code)}))}),showScrollbar:!0,size:"large"})})}return null},ub=({fill:e})=>{const n=e||"var(--theme-elevation-1000)";return(0,t.jsxs)("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z",fill:n}),(0,t.jsx)("path",{d:"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z",fill:n})]})},db="step-nav",fb=({Link:e,className:n})=>{const{i18n:r}=(0,Be.B)(),{stepNav:i}=hn(),s=Ut(),{routes:{admin:l}}=s,{componentMap:c}=wn(),{t:u}=(0,Be.B)(),d=c?.Icon||(0,t.jsx)(ub,{}),f=e||"a";return(0,t.jsx)(o.Fragment,{children:i.length>0?(0,t.jsxs)("nav",{className:[db,n].filter(Boolean).join(" "),children:[(0,t.jsx)(f,{className:`${db}__home`,href:l,tabIndex:0,children:(0,t.jsx)("span",{title:u("general:dashboard"),children:d})}),(0,t.jsx)("span",{children:"/"}),i.map(((e,n)=>{const s=(0,a.sC)(e.label,r);return i.length===n+1?(0,t.jsx)("span",{className:`${db}__last`,children:s},n):(0,t.jsxs)(o.Fragment,{children:[e.url?(0,t.jsx)(f,{href:e.url,children:(0,t.jsx)("span",{children:s},n)}):(0,t.jsx)("span",{children:s},n),(0,t.jsx)("span",{children:"/"})]},n)}))]}):(0,t.jsx)("div",{className:[db,n].filter(Boolean).join(" "),children:(0,t.jsx)("div",{className:`${db}__home`,children:(0,t.jsx)("span",{title:u("general:dashboard"),children:d})})})})},pb="app-header",mb=()=>{const{t:e}=(0,Be.B)(),{admin:{routes:{account:n}},localization:r,routes:{admin:a}}=Ut(),{actions:i}=Pn(),{navOpen:s}=pn(),l=(0,o.useRef)(null),[c,u]=(0,o.useState)(!1);(0,o.useEffect)((()=>{const e=()=>{const e=l.current;if(e){const t=e.scrollWidth>e.clientWidth;u(t)}};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[i]);const d=Dn().default,f=d||"a";return(0,t.jsxs)("header",{className:[pb,s&&`${pb}--nav-open`].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${pb}__bg`}),(0,t.jsx)("div",{className:`${pb}__content`,children:(0,t.jsxs)("div",{className:`${pb}__wrapper`,children:[(0,t.jsx)(Qv,{className:`${pb}__mobile-nav-toggler`,tabIndex:-1,children:(0,t.jsx)(ob,{})}),(0,t.jsxs)("div",{className:`${pb}__controls-wrapper`,children:[(0,t.jsx)("div",{className:`${pb}__step-nav-wrapper`,children:(0,t.jsx)(fb,{Link:d,className:`${pb}__step-nav`})}),(0,t.jsxs)("div",{className:`${pb}__actions-wrapper`,children:[(0,t.jsx)("div",{className:`${pb}__actions`,ref:l,children:Array.isArray(i)&&i.map(((e,n)=>(0,t.jsx)("div",{className:c&&n===i.length-1?`${pb}__last-action`:"",children:e},n)))}),c&&(0,t.jsx)("div",{className:`${pb}__gradient-placeholder`})]}),r&&(0,t.jsx)(sb,{ariaLabel:"invisible",className:`${pb}__localizer-spacing`}),(0,t.jsx)(f,{"aria-label":e("authentication:account"),className:`${pb}__account`,href:`${a}${n}`,tabIndex:0,children:(0,t.jsx)(rb,{})})]})]})}),(0,t.jsx)(cb,{className:`${pb}__localizer`})]})},hb=()=>(0,t.jsxs)("svg",{className:"icon icon--logout",fill:"none",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{className:"stroke",d:"M10 5H18V19H10"}),(0,t.jsxs)("g",{children:[(0,t.jsx)("path",{className:"stroke",d:"M8 8.5L4.46447 12.0355L8 15.5711"}),(0,t.jsx)("line",{className:"stroke",x1:"5",x2:"13",y1:"12",y2:"12"})]})]}),gb=({Link:e,tabIndex:n})=>{const{t:r}=(0,Be.B)(),a=Ut(),{admin:{routes:{logout:o}},routes:{admin:i}}=a,s=process.env.NEXT_BASE_PATH??"",l=e||"a";return(0,t.jsx)(l,{"aria-label":r("authentication:logOut"),className:"nav__log-out",href:`${s}${i}${o}`,tabIndex:n,children:(0,t.jsx)(hb,{})})},vb=({Link:e,tabIndex:n=0})=>{const{componentMap:{LogoutButton:r}}=wn();return r?(0,t.jsx)(o.Fragment,{children:r}):(0,t.jsx)(gb,{Link:e,tabIndex:n})},bb=({baseClass:e})=>{const{navOpen:n,setNavOpen:r}=pn();return(0,t.jsx)("button",{className:`${e}__mobile-close`,onClick:()=>{r(!1)},tabIndex:n?void 0:-1,type:"button",children:(0,t.jsx)(ob,{isActive:!0})})},yb=e=>{const{baseClass:n,children:r}=e,{navOpen:a,navRef:o}=pn();return(0,t.jsx)("aside",{className:[n,a&&`${n}--nav-open`].filter(Boolean).join(" "),children:(0,t.jsx)("div",{className:`${n}__scroll`,ref:o,children:r})})},wb=Qs.A.default||Qs.A,xb="nav-group",Pb=({children:e,label:n})=>{const[r,a]=(0,o.useState)(!0),[s,l]=(0,o.useState)(!1),{getPreference:c,setPreference:u}=dn(),{navOpen:d}=pn(),f=`collapsed-${n}-groups`;if((0,o.useEffect)((()=>{if(n){(async()=>{const e=await c(f)||[];a(-1!==e.indexOf(n))})()}}),[c,n,f]),n){const o=async()=>{l(!0);let e=await c(f)||[];r?e=e.filter((e=>n!==e)):e.push(n),u(f,e),a(!r)};return(0,t.jsxs)("div",{className:[`${xb}`,`${n}`,r&&`${xb}--collapsed`].filter(Boolean).join(" "),id:`nav-group-${n}`,children:[(0,t.jsxs)("button",{className:[`${xb}__toggle`,`${xb}__toggle--${r?"collapsed":"open"}`].filter(Boolean).join(" "),onClick:o,tabIndex:d?0:-1,type:"button",children:[(0,t.jsx)("div",{className:`${xb}__label`,children:n}),(0,t.jsx)("div",{className:`${xb}__indicator`,children:(0,t.jsx)(Tt,{className:`${xb}__indicator`,direction:r?void 0:"up"})})]}),(0,t.jsx)(wb,{duration:s?200:0,height:r?0:"auto",children:(0,t.jsx)("div",{className:`${xb}__content`,children:e})})]})}return(0,t.jsx)(i().Fragment,{children:e})},jb="nav",kb=()=>{const{permissions:e}=sn(),{isEntityVisible:n}=hg(),{collections:r,globals:i,routes:{admin:s}}=Ut(),{i18n:l}=(0,Be.B)(),{navOpen:c}=pn(),u=Tv([...r.filter((({slug:e})=>n({collectionSlug:e}))).map((e=>({type:Av.collection,entity:e}))),...i.filter((({slug:e})=>n({globalSlug:e}))).map((e=>({type:Av.global,entity:e})))],e,l);return(0,t.jsx)(o.Fragment,{children:u.map((({entities:e,label:n},r)=>(0,t.jsx)(Pb,{label:n,children:e.map((({type:e,entity:n},r)=>{let o,i,u;e===Av.collection&&(i=`${s}/collections/${n.slug}`,o=(0,a.sC)(n.labels.plural,l),u=`nav-${n.slug}`),e===Av.global&&(i=`${s}/globals/${n.slug}`,o=(0,a.sC)(n.label,l),u=`nav-global-${n.slug}`);const d=Cv().default||Cv()||"a";return(0,t.jsxs)(d,{className:`${jb}__link`,href:i,id:u,tabIndex:c?void 0:-1,children:[(0,t.jsx)("span",{className:`${jb}__link-icon`,children:(0,t.jsx)(Tt,{direction:"right"})}),(0,t.jsx)("span",{className:`${jb}__link-label`,children:o})]},r)}))},r)))})},Sb="nav",Cb=e=>{const{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}=e;if(!o?.config)return null;const{admin:{components:{afterNavLinks:c,beforeNavLinks:u}}}=o.config,d=Array.isArray(u)?u.map(((e,c)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}},c))):null,f=Array.isArray(c)?c.map(((e,c)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}},c))):null;return(0,t.jsxs)(yb,{baseClass:Sb,children:[(0,t.jsxs)("nav",{className:`${Sb}__wrap`,children:[Array.isArray(d)&&d.map((e=>e)),(0,t.jsx)(kb,{}),Array.isArray(f)&&f.map((e=>e)),(0,t.jsx)("div",{className:`${Sb}__controls`,children:(0,t.jsx)(vb,{})})]}),(0,t.jsx)("div",{className:`${Sb}__header`,children:(0,t.jsx)("div",{className:`${Sb}__header-content`,children:(0,t.jsx)(bb,{baseClass:Sb})})})]})},Mb=()=>{const{navOpen:e}=pn();return(0,t.jsx)(ob,{closeIcon:"collapse",isActive:e})},_b=e=>{const{baseClass:n,children:r,className:a}=e,{navOpen:o}=pn();return(0,t.jsx)("div",{className:[n,a,o&&`${n}--nav-open`].filter(Boolean).join(" "),children:r})},Ob="template-default",Eb=({children:e,className:n,i18n:r,locale:a,params:o,payload:i,permissions:s,searchParams:l,user:c,visibleEntities:u})=>{const{admin:{components:{Nav:d}={Nav:void 0}}={}}=i.config||{},f={i18n:r,locale:a,params:o,payload:i,permissions:s,searchParams:l,user:c};return(0,t.jsx)(mg,{visibleEntities:u,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:`${Ob}__nav-toggler-wrapper`,id:"nav-toggler",children:(0,t.jsx)(Qv,{className:`${Ob}__nav-toggler`,children:(0,t.jsx)(Mb,{})})}),(0,t.jsxs)(_b,{baseClass:Ob,className:n,children:[(0,t.jsx)(Rv,{CustomComponent:d,DefaultComponent:Cb,componentProps:f,serverOnlyProps:{i18n:r,locale:a,params:o,payload:i,permissions:s,searchParams:l,user:c}}),(0,t.jsxs)("div",{className:`${Ob}__wrap`,children:[(0,t.jsx)(mb,{}),e]})]})]})})},Db="template-minimal",Nb=e=>{const{children:n,className:r,style:a={},width:o="normal"}=e,i=[r,Db,`${Db}--width-${o}`].filter(Boolean).join(" ");return(0,t.jsx)("section",{className:i,style:a,children:(0,t.jsx)("div",{className:`${Db}__wrap`,children:n})})},Ab=["createFirstUser","forgot","login","logout","forgot","inactivity","unauthorized","reset"],Tb=(e,t)=>e.startsWith(t),Rb=(e,t,n)=>{const r=e.admin?.routes?Object.entries(e.admin.routes).filter((([e])=>Ab.includes(e))).map((([e,t])=>t)):[];return r.some((e=>t.replace(n,"").startsWith(e)))},Ib=async({config:e,redirectUnauthenticatedUser:t=!1,route:n,searchParams:r})=>{const o=(0,ch.headers)(),i=await dh({config:e}),{collections:s,globals:l,i18n:c,localization:u,routes:{admin:d}}=i.config,f=`${ge().stringify(r??{},{addQueryPrefix:!0})}`,p=(0,oh.parseCookies)(o),m=fh({config:i.config,cookies:p,headers:o}),h=await(0,a.LE)({config:c,context:"client",language:m}),g=Object.entries(i.config.i18n.supportedLanguages||{}).reduce(((e,[t,n])=>(Object.keys(i.config.i18n.supportedLanguages).includes(t)&&e.push({label:n.translations.general.thisLanguage,value:t}),e)),[]),v=await(0,oh.createLocalReq)({fallbackLocale:null,req:{host:o.get("host"),i18n:h,query:ge().parse(f,{depth:10,ignoreQueryPrefix:!0}),url:`${i.config.serverURL}${n}${r?f:""}`}},i),{permissions:b,user:y}=await i.auth({headers:o,req:v});v.user=y;const w=r?.locale;let x;if(u){const e=u.defaultLocale?u.defaultLocale:"en";let t=w;if(!t)try{t=await(i.find({collection:"payload-preferences",depth:0,limit:1,user:y,where:{and:[{"user.relationTo":{equals:i.config.admin.user}},{"user.value":{equals:y.id}},{key:{equals:"locale"}}]}})?.then((e=>e.docs?.[0]?.value)))}catch(e){}x=os(u,t),x||(x=os(u,e)),v.locale=x.code}const P={collections:s.map((({slug:e,admin:{hidden:t}})=>(0,oh.isEntityHidden)({hidden:t,user:y})?null:e)).filter(Boolean),globals:l.map((({slug:e,admin:{hidden:t}})=>(0,oh.isEntityHidden)({hidden:t,user:y})?null:e)).filter(Boolean)};t&&!y&&(({config:e,redirectUnauthenticatedUser:t,route:n,searchParams:r})=>{const{admin:{routes:{login:a}},routes:{admin:o}}=e;if(!Rb(e,n,o)){r&&"redirect"in r&&delete r.redirect;const e=encodeURIComponent(n+Object.keys(r??{}).length?`${ge().stringify(r,{addQueryPrefix:!0})}`:void 0),i=`${o}${a}`,s="string"==typeof t?t:void 0,l=Tb(n,o)?i:s||a,c=ge().parse(l.split("?")[1]??""),u=`${ge().stringify({...c,...e?{redirect:e}:{}},{addQueryPrefix:!0})}`;(0,eg.redirect)(`${l.split("?")[0]}${u}`)}})({config:i.config,redirectUnauthenticatedUser:t,route:n,searchParams:r});const{collectionConfig:j,docID:k,globalConfig:S}=(({adminRoute:e,config:t,permissions:n,route:r})=>{if(Tb(r,e)){const a=r.replace(e,"").split("/").filter(Boolean),[o,i,s]=a,l="collections"===o?i:void 0,c="globals"===o?i:void 0,u=l&&"create"!==s?s:void 0;let d,f;return l&&(d=t.collections.find((e=>e.slug===l)),d||(0,eg.notFound)()),c&&(f=t.globals.find((e=>e.slug===c)),f||(0,eg.notFound)()),n.canAccessAdmin||Rb(t,r,e)||(0,eg.notFound)(),{collectionConfig:d,docID:u,globalConfig:f}}})({adminRoute:d,config:i.config,permissions:b,route:n});return{collectionConfig:j,cookies:p,docID:k,globalConfig:S,languageOptions:g,locale:x,permissions:b,req:v,translations:h.translations,visibleEntities:P}},Lb=({children:e})=>{const{id:t,collectionSlug:n,globalSlug:r}=us();return n&&("create"!==t?t:null)||r?e:null},$b=Cv().default||Cv(),Wb=({adminRoute:e,ariaLabel:n,baseClass:r,children:a,href:o,isActive:i,newTab:s})=>{const l=(0,eg.usePathname)(),c=(0,eg.useParams)(),{searchParams:u}=nn(),d="locale"in u&&"string"==typeof u.locale?u.locale:void 0,[f,p,m,h,...g]=c.segments||[],v="collections"===f;let b=`${e}/${v?"collections":"globals"}/${p}`;v&&m&&(b+=`/${m}`);const y=`${b}${o}`,w=`${y}${d?`?locale=${d}`:""}`,x=y===b&&l===b||y!==b&&l.startsWith(y)||i;return(0,t.jsx)("li",{"aria-label":n,className:[r,x&&`${r}--active`].filter(Boolean).join(" "),children:(0,t.jsx)($b,{className:`${r}__link`,href:x&&y===l?"":w,...s&&{rel:"noopener noreferrer",target:"_blank"},tabIndex:x?-1:0,children:a})})},Fb="doc-tab",zb=e=>{const{Pill:n,apiURL:r,collectionConfig:a,condition:i,config:s,globalConfig:l,href:c,i18n:u,isActive:d,label:f,newTab:p,permissions:m}=e,{routes:h}=s;let g="string"==typeof c?c:"",v="boolean"==typeof d&&d;"function"==typeof c&&(g=c({apiURL:r,collection:a,global:l,routes:h})),"function"==typeof d&&(v=d({href:g}));if(!i||i&&Boolean(i({collectionConfig:a,config:s,globalConfig:l,permissions:m}))){const e="function"==typeof f?f({t:u.t}):f;return(0,t.jsx)(Wb,{adminRoute:h.admin,ariaLabel:e,baseClass:Fb,href:g,isActive:v,isCollection:!!a&&!l,newTab:p,children:(0,t.jsxs)("span",{className:`${Fb}__label`,children:[e,n&&(0,t.jsxs)(o.Fragment,{children:[" ",(0,t.jsx)(n,{})]})]})})}return null},Bb=["API","Default","LivePreview","References","Relationships","Version","Versions"],Hb={API:{condition:({collectionConfig:e,globalConfig:t})=>e&&!e?.admin?.hideAPIURL||t&&!t?.admin?.hideAPIURL,href:"/api",label:"API",order:1e3},Default:{href:"",label:({t:e})=>e("general:edit"),order:0},LivePreview:{condition:({collectionConfig:e,config:t,globalConfig:n})=>e?Boolean(t?.admin?.livePreview?.collections?.includes(e.slug)||e?.admin?.livePreview):!!n&&Boolean(t?.admin?.livePreview?.globals?.includes(n.slug)||n?.admin?.livePreview),href:"/preview",label:({t:e})=>e("general:livePreview"),order:100},References:{condition:()=>!1},Relationships:{condition:()=>!1},Version:{condition:()=>!1},Versions:{Pill:()=>{const{versions:e}=us(),n=e?.totalDocs>0;return(0,t.jsx)("span",{className:[`${Fb}__count`,n?`${Fb}__count--has-count`:""].filter(Boolean).join(" "),children:n?e.totalDocs.toString():(0,t.jsx)(o.Fragment,{children:" "})})},condition:({collectionConfig:e,globalConfig:t,permissions:n})=>Boolean(e?.versions&&n?.collections?.[e?.slug]?.readVersions?.permission||t?.versions&&n?.globals?.[t?.slug]?.readVersions?.permission),href:"/versions",label:({t:e})=>e("version:versions"),order:200}},Yb="doc-tabs",Vb=e=>{const{collectionConfig:n,config:r,globalConfig:a,permissions:i}=e,s=(e=>{const{collectionConfig:t,globalConfig:n}=e;let r;if(t){const e="object"==typeof t?.admin?.components?.views?.Edit&&"function"!=typeof t?.admin?.components?.views?.Edit?t?.admin?.components?.views?.Edit:void 0;r=Object.entries(e||{}).reduce(((e,[t,n])=>Bb.includes(t)?e:[...e,{...n,key:t}]),[])}if(n){const e="object"==typeof n?.admin?.components?.views?.Edit&&"function"!=typeof n?.admin?.components?.views?.Edit?n?.admin?.components?.views?.Edit:void 0;r=Object.entries(e||{}).reduce(((e,[t,n])=>Bb.includes(t)?e:[...e,{...n,key:t}]),[])}return r})({collectionConfig:n,globalConfig:a});return(0,t.jsx)(Lb,{children:(0,t.jsx)("div",{className:Yb,children:(0,t.jsx)("div",{className:`${Yb}__tabs-container`,children:(0,t.jsxs)("ul",{className:`${Yb}__tabs`,children:[Object.entries(Hb)?.sort((([,e],[,t])=>void 0===e.order&&void 0===t.order?0:void 0===e.order?1:void 0===t.order?-1:e.order-t.order))?.map((([o,s],l)=>{const c=(e=>{const{name:t,collectionConfig:n,globalConfig:r}=e;if(n){const e="object"==typeof n?.admin?.components?.views?.Edit&&"function"!=typeof n?.admin?.components?.views?.Edit?n?.admin?.components?.views?.Edit:void 0;return e?.[t]}if(r){const e="object"==typeof r?.admin?.components?.views?.Edit&&"function"!=typeof r?.admin?.components?.views?.Edit?r?.admin?.components?.views?.Edit:void 0;return e?.[t]}return null})({name:o,collectionConfig:n,globalConfig:a}),u=c&&"Tab"in c?c.Tab:void 0,d="object"==typeof u?u:void 0,{condition:f}=d||{};return!f||f&&Boolean(f({collectionConfig:n,config:r,globalConfig:a,permissions:i}))?(0,t.jsx)(zb,{...e,...s||{},...u||{}},`tab-${l}`):null})),s?.map(((n,r)=>{if("Tab"in n){const{Tab:a,path:i}=n;if("object"==typeof a&&!(0,oh.isPlainObject)(a))throw new Error(`Custom 'Tab' Component for path: "${i}" must be a React Server Component. To use client-side functionality, render your Client Component within a Server Component and pass it only props that are serializable. More info: https://react.dev/reference/react/use-server#serializable-parameters-and-return-values`);return"function"==typeof a?(0,o.createElement)(a,{path:i,...e,key:`tab-custom-${r}`}):(0,t.jsx)(zb,{...e,...a},`tab-custom-${r}`)}return null}))]})})})})},qb="doc-header",Ub=e=>{const{collectionConfig:n,config:r,customHeader:a,globalConfig:i,hideTabs:s,i18n:l,permissions:c}=e;return(0,t.jsxs)(bl,{className:qb,children:[a&&a,!a&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Yf,{className:`${qb}__title`}),!s&&(0,t.jsx)(Vb,{collectionConfig:n,config:r,globalConfig:i,i18n:l,permissions:c})]})]})},Gb=async({id:e,data:t,fields:n,locale:r,siblingData:a,user:o})=>{const i=[];n.forEach((n=>{i.push((async({id:e,data:t,field:n,locale:r,siblingData:a,user:o})=>{switch((0,jc.fieldAffectsData)(n)&&void 0===a[n.name]&&void 0!==n.defaultValue&&(a[n.name]=await(0,oh.getDefaultValue)({defaultValue:n.defaultValue,locale:r,user:o,value:a[n.name]})),n.type){case"group":{"object"!=typeof a[n.name]&&(a[n.name]={});const i=a[n.name];await Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:i,user:o});break}case"array":{const i=a[n.name];if(Array.isArray(i)){const a=[];i.forEach((i=>{a.push(Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:i,user:o}))})),await Promise.all(a)}break}case"blocks":{const i=a[n.name];if(Array.isArray(i)){const a=[];i.forEach((i=>{const s=i.blockType,l=n.blocks.find((e=>e.slug===s));l&&(i.blockType=s,a.push(Gb({id:e,data:t,fields:l.fields,locale:r,siblingData:i,user:o})))})),await Promise.all(a)}break}case"row":case"collapsible":await Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:a,user:o});break;case"tab":{let i;(0,jc.tabHasName)(n)?("object"!=typeof a[n.name]&&(a[n.name]={}),i=a[n.name]):i=a,await Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:i,user:o});break}case"tabs":await Gb({id:e,data:t,fields:n.tabs.map((e=>({...e,type:"tab"}))),locale:r,siblingData:a,user:o})}})({id:e,data:t,field:n,locale:r,siblingData:a,user:o}))})),await Promise.all(i)},Kb=async(e,t)=>{const{relationTo:n}=t,r=Array.isArray(n)?n:[n],a={};return void 0!==e&&await Promise.all(r.map((async n=>{a[n]="function"==typeof e?await e({...t,relationTo:n}):e,!0===a[n]&&(a[n]={}),!1===a[n]&&(a[n]={id:{exists:!1}})}))),a},Xb=vh().default||vh(),Qb=async({id:e,addErrorPathToParent:t,anyParentLocalized:n=!1,data:r,fields:a,filter:o,forceFullValue:i=!1,fullData:s,includeSchema:l=!1,omitParents:c=!1,operation:u,parentPassesCondition:d=!0,path:f="",preferences:p,req:m,skipConditionChecks:h=!1,skipValidation:g=!1,state:v={}})=>{const b=[];a.forEach(((a,y)=>{if(!(0,jc.fieldIsPresentationalOnly)(a)&&!a?.admin?.disabled){let w=!0;h||(w=Boolean((!a?.admin?.condition||Boolean(a.admin.condition(s||{},r||{},{user:m.user})))&&d)),b.push((async e=>{const{id:t,addErrorPathToParent:n,anyParentLocalized:r=!1,data:a,field:o,fieldIndex:i,filter:s,forceFullValue:l=!1,fullData:c,includeSchema:u=!1,omitParents:d=!1,operation:f,passesCondition:p,path:m,preferences:h,req:g,skipConditionChecks:v=!1,skipValidation:b=!1,state:y}=e;if((0,jc.fieldAffectsData)(o)){const i=o.validate,w={errorPaths:[],fieldSchema:u?o:void 0,initialValue:void 0,passesCondition:p,valid:!0,value:void 0};let x=!0;if("function"==typeof i&&!b&&p){let e;if("json"===o.type&&"string"==typeof a[o.name])try{JSON.parse(a[o.name])}catch(t){e=t}x=await i(a?.[o.name],{...o,id:t,data:c,operation:f,req:g,siblingData:a,jsonError:e,preferences:h})}const P=e=>{"function"==typeof n&&n(e),w.errorPaths.includes(e)||(w.errorPaths.push(e),w.valid=!1)};switch("string"==typeof x?(w.errorMessage=x,w.valid=!1,P(`${m}${o.name}`)):w.valid=!0,o.type){case"array":{const n=Array.isArray(a[o.name])?a[o.name]:[],{promises:i,rowMetadata:x}=n.reduce(((n,a,i)=>{const w=`${m}${o.name}.${i}.`;a.id=a?.id||(new Xb).toHexString(),d||s&&!s(e)||(y[`${w}id`]={fieldSchema:u?o.fields.find((e=>"name"in e&&"id"===e.name)):void 0,initialValue:a.id,valid:!0,value:a.id}),n.promises.push(Qb({id:t,addErrorPathToParent:P,anyParentLocalized:o.localized||r,data:a,fields:o.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:w,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y}));const x=h?.fields?.[`${m}${o.name}`]?.collapsed;return n.rowMetadata.push({id:a.id,collapsed:void 0===x?o.admin.initCollapsed:x.includes(a.id)}),n}),{promises:[],rowMetadata:[]});await Promise.all(i),null===a[o.name]?(w.value=null,w.initialValue=null):(w.value=l?n:n.length,w.initialValue=l?n:n.length,n.length>0&&(w.disableFormData=!0)),w.rows=x,d||s&&!s(e)||(y[`${m}${o.name}`]=w);break}case"blocks":{const n=Array.isArray(a[o.name])?a[o.name]:[],{promises:i,rowMetadata:x}=n.reduce(((n,a,i)=>{const w=o.blocks.find((e=>e.slug===a.blockType)),x=`${m}${o.name}.${i}.`;if(w){a.id=a?.id||(new Xb).toHexString(),d||s&&!s(e)||(y[`${x}id`]={fieldSchema:u?w.fields.find((e=>"name"in e&&"id"===e.name)):void 0,initialValue:a.id,valid:!0,value:a.id},y[`${x}blockType`]={fieldSchema:u?w.fields.find((e=>"name"in e&&"blockType"===e.name)):void 0,initialValue:a.blockType,valid:!0,value:a.blockType},y[`${x}blockName`]={fieldSchema:u?w.fields.find((e=>"name"in e&&"blockName"===e.name)):void 0,initialValue:a.blockName,valid:!0,value:a.blockName}),n.promises.push(Qb({id:t,addErrorPathToParent:P,anyParentLocalized:o.localized||r,data:a,fields:w.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:x,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y}));const i=h?.fields?.[`${m}${o.name}`]?.collapsed;n.rowMetadata.push({id:a.id,blockType:a.blockType,collapsed:void 0===i?o.admin.initCollapsed:i.includes(a.id)})}return n}),{promises:[],rowMetadata:[]});await Promise.all(i),null===a[o.name]?(w.value=null,w.initialValue=null):(w.value=l?n:n.length,w.initialValue=l?n:n.length,n.length>0&&(w.disableFormData=!0)),w.rows=x,d||s&&!s(e)||(y[`${m}${o.name}`]=w);break}case"group":s&&!s(e)||(w.disableFormData=!0,y[`${m}${o.name}`]=w),await Qb({id:t,addErrorPathToParent:P,anyParentLocalized:o.localized||r,data:a?.[o.name]||{},fields:o.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:`${m}${o.name}.`,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y});break;case"relationship":if("function"==typeof o.filterOptions){const e=await Kb(o.filterOptions,{id:t,data:c,relationTo:o.relationTo,siblingData:a,user:g.user});w.filterOptions=e}if(o.hasMany){const e=Array.isArray(a[o.name])?a[o.name].map((e=>Array.isArray(o.relationTo)?{relationTo:e.relationTo,value:e.value&&"object"==typeof e.value?e.value?.id:e.value}:"object"==typeof e&&null!==e?e.id:e)):void 0;w.value=e,w.initialValue=e}else if(Array.isArray(o.relationTo)){if(a[o.name]&&"object"==typeof a[o.name]&&"relationTo"in a[o.name]&&"value"in a[o.name]){const e="object"==typeof a[o.name]?.value&&a[o.name]?.value&&"id"in a[o.name].value?a[o.name].value.id:a[o.name].value,t={relationTo:a[o.name]?.relationTo,value:e};w.value=t,w.initialValue=t}}else{const e=a[o.name]&&"object"==typeof a[o.name]&&"id"in a[o.name]?a[o.name].id:a[o.name];w.value=e,w.initialValue=e}s&&!s(e)||(y[`${m}${o.name}`]=w);break;case"upload":{if("function"==typeof o.filterOptions){const e=await Kb(o.filterOptions,{id:t,data:c,relationTo:o.relationTo,siblingData:a,user:g.user});w.filterOptions=e}const n=a[o.name]&&"object"==typeof a[o.name]&&"id"in a[o.name]?a[o.name].id:a[o.name];w.value=n,w.initialValue=n,s&&!s(e)||(y[`${m}${o.name}`]=w);break}default:w.value=a[o.name],w.initialValue=a[o.name],s&&!s(e)||(y[`${m}${o.name}`]=w)}}else if((0,jc.fieldHasSubFields)(o))s&&!s(e)||(y[`${m}_index-${i}`]={disableFormData:!0,errorPaths:[],initialValue:void 0,passesCondition:p,valid:!0,value:void 0}),await Qb({id:t,addErrorPathToParent:n,anyParentLocalized:o.localized||r,data:a,fields:o.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:m,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y});else if("tabs"===o.type){const e=o.tabs.map((e=>{const o=(0,jc.tabHasName)(e);return Qb({id:t,addErrorPathToParent:n,anyParentLocalized:e.localized||r,data:o?a?.[e.name]||{}:a,fields:e.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:o?`${m}${e.name}.`:m,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y})}));await Promise.all(e)}else"ui"===o.type&&(s&&!s(e)||(y[`${m}_index-${i}`]={disableFormData:!0,errorPaths:[],initialValue:void 0,passesCondition:p,valid:!0,value:void 0}))})({id:e,addErrorPathToParent:t,anyParentLocalized:n,data:r,field:a,fieldIndex:y,filter:o,forceFullValue:i,fullData:s,includeSchema:l,omitParents:c,operation:u,passesCondition:w,path:f,preferences:p,req:m,skipConditionChecks:h,skipValidation:g,state:v}))}})),await Promise.all(b)},Jb=async e=>{const{id:t,data:n={},fieldSchema:r,operation:a,preferences:o,req:i}=e;if(r){const e={},s=await(async({id:e,data:t,fields:n,locale:r,user:a})=>(await Gb({id:e,data:t,fields:n,locale:r,siblingData:t,user:a}),t))({id:t,data:n,fields:r,locale:i.locale,siblingData:n,user:i.user});return await Qb({id:t,addErrorPathToParent:null,data:s,fields:r,fullData:n,operation:a,parentPassesCondition:!0,path:"",preferences:o,req:i,state:e}),e}return{}},Zb=({config:e,fields:t,i18n:n,schemaMap:r,schemaPath:a})=>{for(const o of t)switch(o.type){case"group":case"array":r.set(`${a}.${o.name}`,o.fields),Zb({config:e,fields:o.fields,i18n:n,schemaMap:r,schemaPath:`${a}.${o.name}`});break;case"collapsible":case"row":Zb({config:e,fields:o.fields,i18n:n,schemaMap:r,schemaPath:a});break;case"blocks":o.blocks.map((t=>{const i=`${a}.${o.name}.${t.slug}`;r.set(i,t.fields),Zb({config:e,fields:t.fields,i18n:n,schemaMap:r,schemaPath:i})}));break;case"richText":if(!o?.editor)throw new oh.MissingEditorProp(o);if("function"==typeof o.editor)throw new Error("Attempted to access unsanitized rich text editor.");"function"==typeof o.editor.generateSchemaMap&&o.editor.generateSchemaMap({config:e,i18n:n,schemaMap:r,schemaPath:`${a}.${o.name}`});break;case"tabs":o.tabs.map((t=>{const o=(0,jc.tabHasName)(t)?`${a}.${t.name}`:a;(0,jc.tabHasName)(t)&&r.set(o,t.fields),Zb({config:e,fields:t.fields,i18n:n,schemaMap:r,schemaPath:o})}))}};let ey=n.g._payload_fieldSchemaMap;ey||(ey=n.g._payload_fieldSchemaMap=null);const ty=e=>ey||(ey=(e=>{const{config:t,i18n:n}=e,r=new Map;return t.collections.forEach((e=>{Zb({config:t,fields:e.fields,i18n:n,schemaMap:r,schemaPath:e.slug})})),t.globals.forEach((e=>{Zb({config:t,fields:e.fields,i18n:n,schemaMap:r,schemaPath:e.slug})})),r})({config:e.payload.config,i18n:e.i18n}),ey),ny=async e=>{const{id:t,collectionConfig:n,globalConfig:r,locale:a,req:o}=e;try{const e=await(async({req:e})=>{const t=e.data,{collectionSlug:n,formState:r,globalSlug:a,locale:o,operation:i,schemaPath:s}=t,l=e.user?.collection,c=e.payload.config.admin.user;if(l){const t=e.payload.collections[l].config.access?.admin;if(t){if(!await t({req:e}))throw new Error("Unauthorized")}else if(c!==l)throw new Error("Unauthorized")}else if((await e.payload.find({collection:c,depth:0,limit:1,pagination:!1})).docs.length)throw new Error("Unauthorized");const u=ty(e),d=n?t.id:void 0;let f;if(1===s.split(".").length?f=e.payload.collections[s]?e.payload.collections[s].config.fields:e.payload.config.globals.find((e=>e.slug===s))?.fields:u.has(s)&&(f=u.get(s)),!f)throw new Error("Could not find field schema for given path");let p=t.docPreferences,m=t.data;const h={};if(!p){let t;if(n&&d&&(t=`collection-${n}-${d}`),a&&(t=`global-${a}`),t){const n=async()=>{const n=await e.payload.find({collection:"payload-preferences",depth:0,limit:1,where:{key:{equals:t}}});n?.docs?.[0]?.value&&(p=n.docs[0].value)};h.preferences=n()}}if(r&&(m=as(r,!0)),!m){const t=async()=>{let t;n&&d&&(t=await e.payload.findByID({id:d,collection:n,depth:0,draft:!0,fallbackLocale:null,locale:o,overrideAccess:!1,user:e.user})),a&&s===a&&(t=await e.payload.findGlobal({slug:a,depth:0,draft:!0,fallbackLocale:null,locale:o,overrideAccess:!1,user:e.user})),m=t};h.data=t()}Object.keys(h).length>0&&await Promise.all(Object.values(h));const g=await Jb({id:d,data:m,fieldSchema:f,operation:i,preferences:p||{fields:{}},req:e});return n&&r&&(e.payload.collections[n]?.config?.upload&&r.file&&(g.file=r.file),e.payload.collections[n]?.config?.auth&&!e.payload.collections[n].config.auth.disableLocalStrategy&&(r.password&&(g.password=r.password),r["confirm-password"]&&(g["confirm-password"]=r["confirm-password"]),r.email&&(g.email=r.email))),g})({req:{...o,data:{id:t,collectionSlug:n?.slug,globalSlug:r?.slug,locale:a?.code,operation:n&&t||r?"update":"create",schemaPath:n?.slug||r?.slug}}});return{data:as(e,!0),formState:e}}catch(e){return console.error("Error getting document data",e),{}}},ry=async e=>{const{id:t,collectionConfig:n,data:r={},globalConfig:a,req:o}=e;let i,s=!1;if(n)try{i=await(0,oh.docAccessOperation)({id:t?.toString(),collection:{config:n},req:{...o,data:r}}),n.versions?.drafts&&(s=await(0,oh.docAccessOperation)({id:t?.toString(),collection:{config:n},req:{...o,data:{...r,_status:"published"}}}).then((({update:e})=>e?.permission)))}catch(e){console.error(e)}if(a)try{i=await(0,oh.docAccessOperationGlobal)({globalConfig:a,req:{...o,data:r}}),a.versions?.drafts&&(s=await(0,oh.docAccessOperationGlobal)({globalConfig:a,req:{...o,data:{...r,_status:"published"}}}).then((({update:e})=>e?.permission)))}catch(e){console.error(e)}return{docPermissions:i,hasPublishPermission:s,hasSavePermission:Zi({collectionSlug:n?.slug,docPermissions:i,globalSlug:a?.slug,isEditing:es({id:t,collectionSlug:n?.slug,globalSlug:a?.slug})})}},ay=()=>{const{collectionSlug:e,globalSlug:n}=us(),{getComponentMap:r}=wn(),{Edit:a,actionsMap:i}=r({collectionSlug:e,globalSlug:n});return a?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Pg,{actions:i?.Edit?.Default}),a]}):null},oy=()=>(0,t.jsx)(ay,{}),iy=()=>{const{autoMode:e,setTheme:n,theme:r}=(0,Xm.DP)(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((e=>{n(e)}),[n]);return(0,t.jsx)(If,{label:a("general:adminTheme"),name:"theme",onChange:i,options:[{label:a("general:automatic"),value:"auto"},{label:a("general:light"),value:"light"},{label:a("general:dark"),value:"dark"}],value:e?"auto":r})},sy=e=>{const{languageOptions:n}=e,{i18n:r,switchLanguage:a}=(0,Be.B)();return(0,t.jsx)(_f,{inputId:"language-select",isClearable:!1,onChange:async e=>{await a(e.value)},options:n,value:n.find((e=>e.value===r.language))})},ly="payload-settings",cy=e=>{const{className:n,i18n:r,languageOptions:a}=e;return(0,t.jsxs)("div",{className:[ly,n].filter(Boolean).join(" "),children:[(0,t.jsx)("h3",{children:r.t("general:payloadSettings")}),(0,t.jsxs)("div",{className:`${ly}__language`,children:[(0,t.jsx)(Ns,{htmlFor:"language-select",label:r.t("general:language")}),(0,t.jsx)(sy,{languageOptions:a})]}),(0,t.jsx)(iy,{})]})},uy=({initialState:e,userSlug:n})=>{const{getFieldMap:r}=wn(),{routes:{admin:a,api:o},serverURL:s}=Ut(),{t:l}=(0,Be.B)(),c=r({collectionSlug:n}),u=i().useCallback((async({formState:e})=>Ji({apiRoute:o,body:{collectionSlug:n,formState:e,operation:"create",schemaPath:n},serverURL:s})),[o,n,s]);return(0,t.jsxs)(Ch,{action:`${s}${o}/${n}/first-register`,initialState:e,method:"POST",onChange:[u],redirect:a,validationOperation:"create",children:[(0,t.jsx)(fc,{autoComplete:"email",label:l("general:email"),name:"email",required:!0}),(0,t.jsx)(Ef,{autoComplete:"off",label:l("authentication:newPassword"),name:"password",required:!0}),(0,t.jsx)(sc,{}),(0,t.jsx)(ll,{fieldMap:c,operation:"create",path:"",readOnly:!1,schemaPath:n}),(0,t.jsx)(Lh,{children:l("general:create")})]})},dy="not-found",fy=Cv().default||Cv(),py=e=>{const{marginTop:n="large"}=e,{setStepNav:r}=hn(),{t:a}=(0,Be.B)(),{routes:{admin:i}}=Ut();return(0,o.useEffect)((()=>{r([{label:a("general:notFound")}])}),[r,a]),(0,t.jsx)("div",{className:[dy,n&&`${dy}--margin-top-${n}`].filter(Boolean).join(" "),children:(0,t.jsxs)(bl,{className:`${dy}__wrap`,children:[(0,t.jsx)("h1",{children:a("general:nothingFound")}),(0,t.jsx)("p",{children:a("general:sorryNotFound")}),(0,t.jsx)(Yt,{Link:fy,className:`${dy}__button`,el:"link",to:`${i}`,children:a("general:backToDashboard")})]})})},my=()=>(0,t.jsx)(py,{marginTop:"large"}),hy="minimize-maximize",gy=({className:e,isMinimized:n})=>{const r=[hy,n?`${hy}--minimized`:`${hy}--maximized`,e].filter(Boolean).join(" ");return(0,t.jsx)("svg",{className:r,height:"24",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:n?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),(0,t.jsx)("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),(0,t.jsx)("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),(0,t.jsx)("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]}):(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),(0,t.jsx)("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),(0,t.jsx)("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),(0,t.jsx)("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]})})},vy=({localeOptions:e,onChange:n})=>{const{t:r}=(0,Be.B)();return(0,t.jsx)(fp,{label:r("general:locale"),name:"locale",onChange:e=>n(e),options:e,path:"locale"})},by="{",yy="[",wy="}",xy="]",Py="query-inspector",jy=({type:e,comma:n=!1,position:r})=>{const a="end"===r?"object"===e?wy:xy:"object"===e?by:yy;return(0,t.jsxs)("span",{className:`${Py}__bracket ${Py}__bracket--position-${r}`,children:[a,"end"===r&&n?",":null]})},ky=({isEmpty:e=!1,object:n,objectKey:r,parentType:a="object",trailingComma:i=!1})=>{const s=n?Object.keys(n):[],l=s.length,[c,u]=o.useState(!0),d=e&&("object"===a||"array"===a);return(0,t.jsxs)("li",{className:d?`${Py}__row-line--nested`:"",children:[(0,t.jsxs)("button",{"aria-label":"toggle",className:`${Py}__list-toggle ${e?`${Py}__list-toggle--empty`:""}`,onClick:()=>u(!c),type:"button",children:[e?null:(0,t.jsx)(Tt,{className:`${Py}__toggle-row-icon ${Py}__toggle-row-icon--${c?"open":"closed"}`}),(0,t.jsxs)("span",{children:[r&&`"${r}": `,(0,t.jsx)(jy,{position:"start",type:a}),e?(0,t.jsx)(jy,{comma:i,position:"end",type:a}):null]})]}),(0,t.jsx)("ul",{className:`${Py}__json-children`,children:c&&s.map(((e,o)=>{let i=n[e],s="string";const c=o===l-1;if(null===i?s="null":i instanceof Date?(s="date",i=i.toISOString()):s=Array.isArray(i)?"array":"object"==typeof i?"object":"number"==typeof i?"number":"boolean"==typeof i?"boolean":"string","object"===s||"array"===s)return(0,t.jsx)(ky,{isEmpty:0===i.length||0===Object.keys(i).length,object:i,objectKey:"object"===a?e:void 0,parentType:s,trailingComma:!c},`${e}-${o}`);if("date"===s||"string"===s||"null"===s||"number"===s||"boolean"===s){const n=Boolean("object"===a&&e),l=[`${Py}__row-line`,`${Py}__value-type--${s}`,`${Py}__row-line--${r?"nested":"top"}`].filter(Boolean).join(" ");return(0,t.jsxs)("li",{className:l,children:[n?(0,t.jsx)("span",{children:`"${e}": `}):null,(0,t.jsx)("span",{className:`${Py}__value`,children:JSON.stringify(i)}),c?"":","]},`${e}-${o}`)}}))}),!e&&(0,t.jsx)("span",{children:(0,t.jsx)(jy,{comma:i,position:"end",type:a})})]})},Sy="query-inspector",Cy=()=>{const{id:e,collectionSlug:n,globalSlug:r,initialData:a}=us(),i=(0,eg.useSearchParams)(),{i18n:s,t:l}=(0,Be.B)(),{code:c}=ls(),{getComponentMap:u}=wn(),d=u({collectionSlug:n,globalSlug:r}),{collections:f,globals:p,localization:m,routes:{api:h},serverURL:g}=Ut(),v=n&&f.find((e=>e.slug===n)),b=r&&p.find((e=>e.slug===r)),y=m&&m.locales.map((e=>({label:e.label,value:e.code})));let w=!1,x="";v&&(w=Boolean(v.versions?.drafts),x=`/${n}/${e}`),b&&(w=Boolean(b.versions?.drafts),x=`/globals/${r}`);const[P,j]=o.useState(a),[k,S]=o.useState("true"===i.get("draft")),[C,M]=o.useState(i?.get("locale")||c),[_,O]=o.useState(i.get("depth")||"1"),[E,D]=o.useState(!0),[N,A]=o.useState(!1),T=`${g}${h}${x}?${new URLSearchParams({depth:_,draft:String(k),locale:C}).toString()}`;return o.useEffect((()=>{(async()=>{try{const e=await fetch(T,{credentials:E?"include":"omit",headers:{"Accept-Language":s.language},method:"GET"});try{const t=await e.json();j(t)}catch(e){Ct.error("Error parsing response"),console.error(e)}}catch(e){Ct.error("Error making request"),console.error(e)}})()}),[s.language,T,E]),(0,t.jsxs)(bl,{className:[Sy,N&&`${Sy}--fullscreen`].filter(Boolean).join(" "),right:!1,children:[(0,t.jsx)(gg,{collectionSlug:n,globalLabel:b?.label,globalSlug:r,id:e,pluralLabel:v?v?.labels?.plural:void 0,useAsTitle:v?v?.admin?.useAsTitle:void 0,view:"API"}),(0,t.jsx)(Pg,{actions:d?.actionsMap?.Edit?.API}),(0,t.jsxs)("div",{className:`${Sy}__configuration`,children:[(0,t.jsxs)("div",{className:`${Sy}__api-url`,children:[(0,t.jsxs)("span",{className:`${Sy}__label`,children:["API URL ",(0,t.jsx)(Dp,{value:T})]}),(0,t.jsx)("a",{href:T,rel:"noopener noreferrer",target:"_blank",children:T})]}),(0,t.jsx)(Ch,{initialState:{authenticated:{initialValue:E||!1,valid:!0,value:E||!1},depth:{initialValue:Number(_||0),valid:!0,value:Number(_||0)},draft:{initialValue:k||!1,valid:!0,value:k||!1},locale:{initialValue:C,valid:!0,value:C}},children:(0,t.jsxs)("div",{className:`${Sy}__form-fields`,children:[(0,t.jsxs)("div",{className:`${Sy}__filter-query-checkboxes`,children:[w&&(0,t.jsx)(Is,{label:l("version:draft"),name:"draft",onChange:()=>S(!k),path:"draft"}),(0,t.jsx)(Is,{label:l("authentication:authenticated"),name:"authenticated",onChange:()=>D(!E),path:"authenticated"})]}),y&&(0,t.jsx)(vy,{localeOptions:y,onChange:M}),(0,t.jsx)(Of,{label:l("general:depth"),max:10,min:0,name:"depth",onChange:e=>O(e?.toString()),path:"depth",step:1})]})})]}),(0,t.jsxs)("div",{className:`${Sy}__results-wrapper`,children:[(0,t.jsx)("div",{className:`${Sy}__toggle-fullscreen-button-container`,children:(0,t.jsx)("button",{"aria-label":"toggle fullscreen",className:`${Sy}__toggle-fullscreen-button`,onClick:()=>A(!N),type:"button",children:(0,t.jsx)(gy,{isMinimized:!N})})}),(0,t.jsx)("div",{className:`${Sy}__results`,children:(0,t.jsx)(ky,{object:P})})]})]})},My=()=>(0,t.jsx)(Cy,{}),_y=(0,o.createContext)({appIsReady:!1,breakpoint:void 0,breakpoints:void 0,fieldSchemaJSON:void 0,iframeHasLoaded:!1,iframeRef:void 0,isPopupOpen:!1,measuredDeviceSize:{height:0,width:0},openPopupWindow:()=>{},popupRef:void 0,previewWindowType:"iframe",setAppIsReady:()=>{},setBreakpoint:()=>{},setHeight:()=>{},setIframeHasLoaded:()=>{},setMeasuredDeviceSize:()=>{},setPreviewWindowType:()=>{},setSize:()=>{},setToolbarPosition:()=>{},setWidth:()=>{},setZoom:()=>{},size:{height:0,width:0},toolbarPosition:{x:0,y:0},url:void 0,zoom:1}),Oy=()=>(0,o.useContext)(_y),Ey=({collisionRect:e,droppableContainers:t,...n})=>{const r=t.find((({id:e})=>"live-preview-area"===e)),a=kr({...n,collisionRect:e,droppableContainers:[r]});if(0===a.length)return a;const o=r?.rect?.current;return e.top>=o.top&&e.left>=o.left&&e.bottom<=o.bottom&&e.right<=o.right?a:void 0},Dy=(e,t)=>{switch(t.type){case"width":return{...e,width:t.value};case"height":return{...e,height:t.value};default:return{...e,...t?.value||{}}}},Ny=({breakpoints:e,children:n,fieldSchema:r,isPopupOpen:a,openPopupWindow:s,popupRef:l,url:c})=>{const[u,d]=(0,o.useState)("iframe"),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(!1),g=i().useRef(null),[v,b]=(0,o.useState)(!1),[y,w]=(0,o.useState)(1),[x,P]=(0,o.useState)({x:0,y:0}),[j,k]=i().useReducer(Dy,{height:0,width:0}),[S,C]=(0,o.useState)({height:0,width:0}),[M,_]=i().useState("responsive"),[O]=(0,o.useState)((()=>(0,jc.fieldSchemaToJSON)(r))),E=(0,o.useCallback)((e=>{k({type:"width",value:e})}),[k]),D=(0,o.useCallback)((e=>{k({type:"height",value:e})}),[k]);(0,o.useEffect)((()=>{const t=e?.find((e=>e.name===M));t&&"responsive"!==M&&"custom"!==M&&"number"==typeof t?.width&&"number"==typeof t?.height&&k({type:"reset",value:{height:t.height,width:t.width}})}),[M,e]),(0,o.useEffect)((()=>{const e=e=>{c?.startsWith(e.origin)&&e.data&&"object"==typeof e.data&&"payload-live-preview"===e.data.type&&e.data.ready&&p(!0)};return window.addEventListener("message",e),h(!0),()=>{window.removeEventListener("message",e)}}),[c,m]);const N=(0,o.useCallback)((e=>{p(!1),d(e),"popup"===e&&s()}),[s]);return(0,o.useEffect)((()=>{(a?"popup":"iframe")!==u&&N("iframe")}),[u,a,N]),(0,t.jsx)(_y.Provider,{value:{appIsReady:f,breakpoint:M,breakpoints:e,fieldSchemaJSON:O,iframeHasLoaded:v,iframeRef:g,isPopupOpen:a,measuredDeviceSize:S,openPopupWindow:s,popupRef:l,previewWindowType:u,setAppIsReady:p,setBreakpoint:_,setHeight:D,setIframeHasLoaded:b,setMeasuredDeviceSize:C,setPreviewWindowType:N,setSize:k,setToolbarPosition:P,setWidth:E,setZoom:w,size:j,toolbarPosition:x,url:c,zoom:y},children:(0,t.jsx)(za,{collisionDetection:Ey,onDragEnd:e=>{if(e.over&&"live-preview-area"===e.over.id){const t={x:x.x+e.delta.x,y:x.y+e.delta.y};P(t)}},children:m&&n})})},Ay=e=>{const[t,n]=(0,o.useState)();return(0,o.useEffect)((()=>{let t;return e&&(t=new ResizeObserver((e=>{e.forEach((e=>{const{contentBoxSize:t,contentRect:r}=e;let a=0,o=0;if(t){const e=Array.isArray(t)?t[0]:t;if(e){const{blockSize:t,inlineSize:n}=e;a=n,o=t}}else if(r){const{height:e,width:t}=r;a=t,o=e}n({height:o,width:a})}))})),t.observe(e)),()=>{t&&t.unobserve(e)}}),[e]),{size:t}},Ty=e=>{const{children:n}=e,r=i().useRef(null),a=i().useRef(null),{breakpoint:s,setMeasuredDeviceSize:l,size:c,zoom:u}=Oy(),{size:d}=Ay(r.current),{size:f}=Ay(a.current);let p=!1;(0,o.useEffect)((()=>{d&&l(d)}),[d,l]);let m="0",h="0";if(s&&"responsive"!==s&&(m="-50%","number"==typeof u&&"number"==typeof c.width&&"number"==typeof c.height&&"number"==typeof d.width&&"number"==typeof d.height)){h="0 auto";const e=c.width/u,t=d.width*u,n=e-c.width;if(p=t>f.width,p)if(u>1){const e=d.width-f.width;m=e<0?e/2+"px":"0"}else m="0";else if(u>=1)m=n/2+"px";else{m=(f.width-t)/2+"px",h="0"}}let g=u?100/u+"%":"100%",v=u?100/u+"%":"100%";return"responsive"!==s&&(g=c?.width/("number"==typeof u?u:1)+"px",v=c?.height/("number"==typeof u?u:1)+"px"),(0,t.jsx)("div",{ref:a,style:{height:"100%",width:"100%"},children:(0,t.jsx)("div",{ref:r,style:{height:v,margin:h,transform:`translate3d(${m}, 0, 0)`,width:g},children:n})})},Ry=(0,o.forwardRef)(((e,n)=>{const{setIframeHasLoaded:r,url:a}=e,{zoom:o}=Oy();return(0,t.jsx)("iframe",{className:"live-preview-iframe",onLoad:()=>{r(!0)},ref:n,src:a,style:{transform:"number"==typeof o?`scale(${o}) `:void 0},title:a})})),Iy=e=>{const{axis:n}=e,{breakpoint:r,measuredDeviceSize:a,setBreakpoint:s,setSize:l,size:c,zoom:u}=Oy(),[d,f]=i().useState(("x"===n?a?.width:a?.height)||0),p=(0,o.useCallback)((e=>{let t=Number(e.target.value);t<0&&(t=0),f(t),s("custom"),l({type:"reset",value:{height:"y"===n?t:Number(a?.height.toFixed(0))*u,width:"x"===n?t:Number(a?.width.toFixed(0))*u}})}),[n,s,a,l,u]);return(0,o.useEffect)((()=>{"responsive"===r&&a&&f("x"===n?Number(a.width.toFixed(0))*u:Number(a.height.toFixed(0))*u),"responsive"!==r&&c&&f("x"===n?c.width:c.height)}),[r,n,a,c,u]),(0,t.jsx)("input",{className:"toolbar-input",min:0,name:"x"===n?"live-preview-width":"live-preview-height",onChange:p,step:1,type:"number",value:d||0})},Ly="live-preview-toolbar-controls",$y=[50,75,100,125,150,200],Wy=()=>{const{breakpoint:e,breakpoints:n,setBreakpoint:r,setPreviewWindowType:a,setZoom:o,url:s,zoom:l}=Oy(),{t:c}=(0,Be.B)(),u={label:c("general:custom"),value:"custom"};return(0,t.jsxs)("div",{className:Ly,children:[n?.length>0&&(0,t.jsx)(Ys,{button:(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("span",{children:n.find((t=>t.name==e))?.label??u.label})," ",(0,t.jsx)(Tt,{className:`${Ly}__chevron`})]}),className:`${Ly}__breakpoint`,horizontalAlign:"right",render:({close:a})=>(0,t.jsx)(Us,{children:(0,t.jsxs)(i().Fragment,{children:[n.map((n=>(0,t.jsx)(Gs,{active:n.name==e,onClick:()=>{r(n.name),a()},children:n.label},n.name))),"custom"===e&&(0,t.jsx)(Gs,{active:e==u.value,onClick:()=>{r(u.value),a()},children:u.label})]})}),showScrollbar:!0,verticalAlign:"bottom"}),(0,t.jsxs)("div",{className:`${Ly}__device-size`,children:[(0,t.jsx)(Iy,{axis:"x"}),(0,t.jsx)("span",{className:`${Ly}__size-divider`,children:(0,t.jsx)($t.u,{})}),(0,t.jsx)(Iy,{axis:"y"})]}),(0,t.jsx)(Ys,{button:(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)("span",{children:[100*l,"%"]})," ",(0,t.jsx)(Tt,{className:`${Ly}__chevron`})]}),className:`${Ly}__zoom`,horizontalAlign:"right",render:({close:e})=>(0,t.jsx)(Us,{children:(0,t.jsx)(i().Fragment,{children:$y.map((n=>(0,t.jsxs)(Gs,{active:100*l==n,onClick:()=>{o(n/100),e()},children:[n,"%"]},n)))})}),showScrollbar:!0,verticalAlign:"bottom"}),(0,t.jsx)("a",{className:`${Ly}__external`,href:s,onClick:e=>{e.preventDefault(),a("popup")},type:"button",children:(0,t.jsx)(It,{})})]})},Fy="live-preview-toolbar",zy=e=>{const{toolbarPosition:n}=Oy(),{attributes:r,listeners:a,setNodeRef:o,transform:i}=Va({id:"live-preview-toolbar"});return(0,t.jsxs)("div",{className:[Fy,`${Fy}--draggable`].join(" "),style:{left:`${n.x}px`,top:`${n.y}px`,...i?{transform:i?`translate3d(${i?.x||0}px, ${i?.y||0}px, 0)`:void 0}:{}},children:[(0,t.jsx)("button",{...a,...r,className:`${Fy}__drag-handle`,ref:o,type:"button",children:(0,t.jsx)(Js,{})}),(0,t.jsx)(Wy,{...e})]})},By=e=>(0,t.jsx)("div",{className:[Fy,`${Fy}--static`].join(" "),children:(0,t.jsx)(Wy,{...e})}),Hy=e=>{const{draggable:n}=e;return n?(0,t.jsx)(zy,{...e}):(0,t.jsx)(By,{...e})},Yy="live-preview-window",Vy=e=>{const{appIsReady:n,iframeHasLoaded:r,iframeRef:a,popupRef:s,previewWindowType:l,setIframeHasLoaded:c,url:u}=Oy(),{mostRecentUpdate:d}=On(),{breakpoint:f,fieldSchemaJSON:p}=Oy(),m=i().useRef(void 0),[h]=Ho();if((0,o.useEffect)((()=>{if(h&&window&&"postMessage"in window&&n){const e=as(h,!0),t=!m.current||m.current!==l;m.current=l;const n={type:"payload-live-preview",data:e,externallyUpdatedRelationship:d,fieldSchemaJSON:t?p:void 0};"popup"===l&&s.current&&s.current.postMessage(n,u),"iframe"===l&&a.current&&a.current.contentWindow?.postMessage(n,u)}}),[h,u,r,l,s,n,a,c,p,d]),(0,o.useEffect)((()=>{const e={type:"payload-document-event"};"popup"===l&&s.current&&s.current.postMessage(e,u),"iframe"===l&&a.current&&a.current.contentWindow?.postMessage(e,u)}),[d,a,s,l,u]),"iframe"===l)return(0,t.jsx)("div",{className:[Yy,f&&"responsive"!==f&&`${Yy}--has-breakpoint`].filter(Boolean).join(" "),children:(0,t.jsxs)("div",{className:`${Yy}__wrapper`,children:[(0,t.jsx)(Hy,{...e}),(0,t.jsx)("div",{className:`${Yy}__main`,children:(0,t.jsx)(Ty,{children:u?(0,t.jsx)(Ry,{ref:a,setIframeHasLoaded:c,url:u}):(0,t.jsx)(Ql.l,{height:"100%"})})})]})})},qy="live-preview",Uy=({apiRoute:e,collectionConfig:n,config:r,fieldMap:a,globalConfig:i,schemaPath:s,serverURL:l})=>{const{id:c,AfterDocument:u,AfterFields:d,BeforeDocument:f,BeforeFields:p,action:m,apiURL:h,collectionSlug:g,disableActions:v,disableLeaveWithoutSaving:b,docPermissions:y,getDocPreferences:w,globalSlug:x,hasPublishPermission:P,hasSavePermission:j,initialData:k,initialState:S,isEditing:C,isInitializing:M,onSave:_}=us(),O=c?"update":"create",{admin:{user:E}}=Ut(),{t:D}=(0,Be.B)(),{previewWindowType:N}=Oy(),{refreshCookieAsync:A,user:T}=sn(),{reportUpdate:R}=On(),I=(0,o.useCallback)((e=>{R({id:c,entitySlug:g,updatedAt:e?.result?.updatedAt||(new Date).toISOString()}),T&&g===E&&c===T.id&&A(),"function"==typeof _&&_({...e,operation:c?"update":"create"})}),[g,c,_,A,R,T,E]),L=(0,o.useCallback)((async({formState:t})=>{const n=await w();return Ji({apiRoute:e,body:{id:c,docPreferences:n,formState:t,operation:O,schemaPath:s},serverURL:l})}),[l,e,c,O,s,w]);return(0,t.jsx)(o.Fragment,{children:(0,t.jsx)(ps,{operation:O,children:(0,t.jsxs)(Ch,{action:m,className:`${qy}__form`,disabled:!j,initialState:S,isInitializing:M,method:c?"PATCH":"POST",onChange:[L],onSuccess:I,children:[(n&&!(n.versions?.drafts&&n.versions?.drafts?.autosave)||i&&!(i.versions?.drafts&&i.versions?.drafts?.autosave))&&!b&&(0,t.jsx)(og,{}),(0,t.jsx)(gg,{collectionSlug:g,globalLabel:i?.label,globalSlug:x,id:c,pluralLabel:n?n?.labels?.plural:void 0,useAsTitle:n?n?.admin?.useAsTitle:void 0,view:D("general:livePreview")}),(0,t.jsx)(vg,{collectionConfig:n,config:r,fallback:c?.toString()||"",globalConfig:i}),(0,t.jsx)(Qh,{apiURL:h,data:k,disableActions:v,hasPublishPermission:P,hasSavePermission:j,id:c,isEditing:C,permissions:y,slug:n?.slug||i?.slug}),(0,t.jsxs)("div",{className:[qy,"popup"===N&&`${qy}--detached`].filter(Boolean).join(" "),children:[(0,t.jsxs)("div",{className:[`${qy}__main`,"popup"===N&&`${qy}__main--popup-open`].filter(Boolean).join(" "),children:[f,(0,t.jsx)(Zh,{AfterFields:d,BeforeFields:p,docPermissions:y,fieldMap:a,forceSidebarWrap:!0,readOnly:!j,schemaPath:g||x}),u]}),(0,t.jsx)(Vy,{collectionSlug:g,globalSlug:x})]})]})})})},Gy=e=>{const{breakpoints:n,url:r}=e,{collectionSlug:a,globalSlug:i}=us(),s=Ut(),{isPopupOpen:l,openPopupWindow:c,popupRef:u}=(e=>{const{eventType:t,onMessage:n,url:r}=e,a=(0,o.useRef)(!1),[i,s]=(0,o.useState)(!1),{serverURL:l}=Ut(),c=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=async e=>{e.origin===window.location.origin&&e.origin===r&&e.origin===l&&("function"!=typeof n||e.data?.type!==t||a.current||(a.current=!0,await n(e.data?.searchParams),a.current=!1))};return i&&c.current&&window.addEventListener("message",e,!1),()=>{window.removeEventListener("message",e)}}),[n,t,r,l,i]);const u=(0,o.useCallback)((e=>{e&&e.preventDefault();const t={height:700,left:"auto",menubar:"no",popup:"yes",toolbar:"no",top:"auto",width:800},n=Object.entries(t).reduce(((e,[n,r])=>{let a=e;return"auto"===r?("top"===n?a+=`top=${Math.round(window.innerHeight/2-t.height/2)},`:"left"===n&&(a+=`left=${Math.round(window.innerWidth/2-t.width/2)},`),a):(a+=`${n}=${r},`,a)}),"").slice(0,-1),a=window.open(r,"_blank",n);c.current=a,s(!0)}),[r]);return(0,o.useEffect)((()=>{let e;return i?e=setInterval((function(){c.current.closed&&(clearInterval(e),s(!1))}),1e3):clearInterval(e),()=>{e&&clearInterval(e)}}),[i,c]),{isPopupOpen:i,openPopupWindow:u,popupRef:c}})({eventType:"payload-live-preview",url:r}),{collections:d,globals:f,routes:{api:p},serverURL:m}=s,h=a&&d.find((e=>e.slug===a)),g=i&&f.find((e=>e.slug===i)),v=a||i,{getComponentMap:b}=wn(),y=b({collectionSlug:a,globalSlug:i}),{getFieldMap:w}=wn(),x=w({collectionSlug:h?.slug,globalSlug:g?.slug});return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Pg,{actions:y?.actionsMap?.Edit?.LivePreview}),(0,t.jsx)(Ny,{breakpoints:n,fieldSchema:h?.fields||g?.fields,isPopupOpen:l,openPopupWindow:c,popupRef:u,url:r,children:(0,t.jsx)(Uy,{apiRoute:p,collectionConfig:h,config:s,fieldMap:x,globalConfig:g,schemaPath:v,serverURL:m})})]})},Ky=async e=>{const{initPageResult:n}=e,{collectionConfig:r,docID:a,globalConfig:o,locale:i,req:{payload:{config:{admin:{livePreview:s}}}={}}={}}=n;let l;try{r&&(l=await n.req.payload.findByID({id:a,collection:r.slug,depth:0,draft:!0,fallbackLocale:null})),o&&(l=await n.req.payload.findGlobal({slug:o.slug,depth:0,draft:!0,fallbackLocale:null}))}catch(e){(0,eg.notFound)()}let c=s;r&&(c={...c||{},...r.admin.livePreview||{}}),o&&(c={...c||{},...o.admin.livePreview||{}});const u=[...c?.breakpoints||[],{name:"responsive",height:"100%",label:"Responsive",width:"100%"}],d="function"==typeof c?.url?await c.url({collectionConfig:r,data:l,globalConfig:o,locale:i,payload:n.req.payload}):c?.url;return(0,t.jsx)(Gy,{breakpoints:u,initialData:l,url:d})},Xy=Cv().default||Cv(),Qy="unauthorized",Jy=({initPageResult:e})=>{const{req:{i18n:n,payload:{config:{admin:{routes:{logout:r}}}}}}=e;return(0,t.jsxs)(bl,{className:Qy,children:[(0,t.jsx)("h2",{children:n.t("error:unauthorized")}),(0,t.jsx)("p",{children:n.t("error:notAllowedToAccessPage")}),(0,t.jsx)(Yt,{Link:Xy,className:`${Qy}__button`,el:"link",to:r,children:n.t("authentication:logOut")})]})},Zy=({children:e})=>(0,t.jsx)("div",{className:"field-diff-label",children:e}),ew="nested-diff",tw=({comparison:e,diffComponents:n,disableGutter:r=!1,field:o,fieldMap:i,i18n:s,locale:l,locales:c,permissions:u,version:d})=>(0,t.jsxs)("div",{className:ew,children:["label"in o.fieldComponentProps&&o.fieldComponentProps.label&&"function"!=typeof o.fieldComponentProps.label&&(0,t.jsxs)(Zy,{children:[l&&(0,t.jsx)("span",{className:`${ew}__locale-label`,children:l}),(0,a.sC)(o.fieldComponentProps.label,s)]}),(0,t.jsx)("div",{className:[`${ew}__wrap`,!r&&`${ew}__wrap--gutter`].filter(Boolean).join(" "),children:(0,t.jsx)(aw,{comparison:e,diffComponents:n,fieldMap:i,fieldPermissions:u,i18n:s,locales:c,version:d})})]}),nw={radio:"WORDS_WITH_SPACE",relationship:"WORDS_WITH_SPACE",select:"WORDS_WITH_SPACE",upload:"WORDS_WITH_SPACE"},rw="render-field-diffs",aw=({comparison:e,diffComponents:n,fieldMap:r,fieldPermissions:a,i18n:o,locales:i,version:s})=>(0,t.jsx)("div",{className:rw,children:r?.map(((l,c)=>{if("name"in l&&"id"===l.name)return null;const u=n[l.type],d="richText"===l.type,f=nw[l.type]||"CHARS";if(u){if(l.isFieldAffectingData&&"name"in l){const p=l.name,m="code"===l.type||"json"===l.type,h=m?JSON.stringify(s?.[p]):s?.[p],g=m?JSON.stringify(e?.[p]):e?.[p],v=a?.[p]?.read?.permission,b=a?.[p]?.fields;if(!1===v)return null;const y={comparison:g,diffComponents:n,diffMethod:f,field:l,fieldMap:"fieldMap"in l.fieldComponentProps?l.fieldComponentProps?.fieldMap:r,fieldPermissions:b,i18n:o,isRichText:d,locales:i,version:h};return l.localized?(0,t.jsx)("div",{className:`${rw}__field`,children:i.map(((e,n)=>{const r=h?.[e],a=g?.[e],o={...y,comparison:a,version:r};return(0,t.jsx)("div",{className:`${rw}__locale`,children:(0,t.jsx)("div",{className:`${rw}__locale-value`,children:(0,t.jsx)(u,{...o,locale:e})})},[e,n].join("-"))}))},c):(0,t.jsx)("div",{className:`${rw}__field`,children:(0,t.jsx)(u,{...y})},c)}if("tabs"===l.type&&"fieldMap"in l.fieldComponentProps){const r=n.tabs;return(0,t.jsx)(r,{comparison:e,diffComponents:n,field:l,fieldMap:l.fieldComponentProps.fieldMap,i18n:o,locales:i,version:s},c)}if("fieldMap"in l.fieldComponentProps)return(0,t.jsx)(tw,{comparison:e,diffComponents:n,disableGutter:!0,field:l,fieldMap:l.fieldComponentProps.fieldMap,i18n:o,locales:i,permissions:a,version:s},c)}return null}))}),ow="iterable-diff",iw=({comparison:e,diffComponents:n,field:r,i18n:o,locale:s,locales:l,permissions:c,version:u})=>{const d=Array.isArray(u)?u.length:0,f=Array.isArray(e)?e.length:0,p=Math.max(d,f);return(0,t.jsxs)("div",{className:ow,children:["label"in r.fieldComponentProps&&r.fieldComponentProps.label&&"function"!=typeof r.fieldComponentProps.label&&(0,t.jsxs)(Zy,{children:[s&&(0,t.jsx)("span",{className:`${ow}__locale-label`,children:s}),(0,a.sC)(r.fieldComponentProps.label,o)]}),p>0&&(0,t.jsx)(i().Fragment,{children:Array.from(Array(p).keys()).map(((a,i)=>{const s=u?.[i]||{},d=e?.[i]||{};let f=[];if("array"===r.type&&"fieldMap"in r.fieldComponentProps&&(f=r.fieldComponentProps.fieldMap),"blocks"===r.type)if(f=[],s?.blockType===d?.blockType){const e="blocks"in r.fieldComponentProps&&r.fieldComponentProps.blocks?.find((e=>e.slug===s?.blockType))||{fieldMap:[]};f=[...f,...e.fieldMap]}else{const e="blocks"in r.fieldComponentProps&&r.fieldComponentProps.blocks?.find((e=>e.slug===s?.blockType))||{fieldMap:[]},t="blocks"in r.fieldComponentProps&&r.fieldComponentProps.blocks?.find((e=>e.slug===d?.blockType))||{fieldMap:[]};f=(0,jc.getUniqueListBy)([...f,...e.fieldMap,...t.fieldMap],"name")}return(0,t.jsx)("div",{className:`${ow}__wrap`,children:(0,t.jsx)(aw,{comparison:d,diffComponents:n,fieldMap:f,fieldPermissions:c,i18n:o,locales:l,version:s})},i)}))}),0===p&&(0,t.jsx)("div",{className:`${ow}__no-rows`,children:o.t("version:noRowsFound",{label:"labels"in r.fieldComponentProps&&r.fieldComponentProps.labels?.plural?(0,a.sC)(r.fieldComponentProps.labels.plural,o):o.t("general:rows")})})]})},sw={variables:{dark:{addedBackground:"var(--theme-success-900)",addedColor:"var(--theme-success-100)",diffViewerBackground:"transparent",diffViewerColor:"var(--theme-text)",emptyLineBackground:"var(--theme-elevation-50)",removedBackground:"var(--theme-error-900)",removedColor:"var(--theme-error-100)",wordAddedBackground:"var(--theme-success-800)",wordRemovedBackground:"var(--theme-error-800)"},light:{addedBackground:"var(--theme-success-100)",addedColor:"var(--theme-success-900)",diffViewerBackground:"transparent",diffViewerColor:"var(--theme-text)",emptyLineBackground:"var(--theme-elevation-50)",removedBackground:"var(--theme-error-100)",removedColor:"var(--theme-error-900)",wordAddedBackground:"var(--theme-success-200)",wordRemovedBackground:"var(--theme-error-200)"}}};var lw=n(42552);const cw=lw.Ay.default||lw.Ay,uw=({comparisonToRender:e,diffMethod:n,diffStyles:r,placeholder:a,versionToRender:o})=>(0,t.jsx)(cw,{compareMethod:lw.J7[n],hideLineNumbers:!0,newValue:void 0!==o?o:a,oldValue:e,showDiffOnly:!1,splitView:!0,styles:r}),dw="select-diff",fw=(e,t,n)=>n&&Array.isArray(e)?e.map((e=>t.find((t=>("string"==typeof t?t:t.value)===e))||String(e))):t.find((t=>("string"==typeof t?t:t.value)===e))||String(e),pw=(e,t)=>Array.isArray(e)?e.map((e=>"string"==typeof e?e:(0,a.sC)(e.label,t))).join(", "):"string"==typeof e?e:(0,a.sC)(e.label,t),mw=({comparison:e,diffMethod:n,field:r,i18n:o,locale:i,version:s})=>{let l="";s===e&&(l=`[${o.t("general:noValue")}]`);const c="options"in r.fieldComponentProps&&r.fieldComponentProps.options,u=void 0!==e?pw(fw(e,c,r.hasMany),o):l,d=void 0!==s?pw(fw(s,c,r.hasMany),o):l;return(0,t.jsxs)("div",{className:dw,children:[(0,t.jsxs)(Zy,{children:[i&&(0,t.jsx)("span",{className:`${dw}__locale-label`,children:i}),"label"in r&&(0,a.sC)(r.label||"",o)]}),(0,t.jsx)(uw,{comparisonToRender:u,diffMethod:n,diffStyles:sw,placeholder:l,versionToRender:d})]})},hw="tabs-diff",gw=({comparison:e,diffComponents:n,field:r,i18n:a,locale:o,locales:i,permissions:s,version:l})=>(0,t.jsx)("div",{className:hw,children:(0,t.jsx)("div",{className:`${hw}__wrap`,children:r.tabs.map(((c,u)=>"name"in c?(0,t.jsx)(tw,{comparison:e?.[c.name],diffComponents:n,field:r,fieldMap:c.fieldMap,i18n:a,locale:o,locales:i,permissions:s,version:l?.[c.name]},u):(0,t.jsx)(aw,{comparison:e,diffComponents:n,fieldMap:c.fieldMap,fieldPermissions:s,i18n:a,locales:i,version:l},u)))})}),vw=lw.Ay.default||lw.Ay,bw=({comparisonToRender:e,diffMethod:n,diffStyles:r,placeholder:a,versionToRender:o})=>(0,t.jsx)(vw,{compareMethod:lw.J7[n],hideLineNumbers:!0,newValue:void 0!==o?String(o):a,oldValue:void 0!==e?String(e):a,showDiffOnly:!1,splitView:!0,styles:r}),yw="text-diff",ww=({comparison:e,diffMethod:n,field:r,i18n:o,isRichText:i=!1,locale:s,version:l})=>{let c="";l===e&&(c=`[${o.t("general:noValue")}]`);let u=l,d=e;return i&&("object"==typeof l&&(u=JSON.stringify(l,null,2)),"object"==typeof e&&(d=JSON.stringify(e,null,2))),(0,t.jsxs)("div",{className:yw,children:[(0,t.jsxs)(Zy,{children:[s&&(0,t.jsx)("span",{className:`${yw}__locale-label`,children:s}),"label"in r.fieldComponentProps&&"function"!=typeof r.fieldComponentProps.label&&(0,a.sC)(r.fieldComponentProps.label||"",o)]}),(0,t.jsx)(bw,{comparisonToRender:d,diffMethod:n,diffStyles:sw,placeholder:c,versionToRender:u})]})},xw={array:iw,blocks:iw,checkbox:ww,code:ww,collapsible:tw,date:ww,email:ww,group:tw,json:ww,number:ww,point:ww,radio:mw,relationship:null,richText:ww,row:tw,select:mw,tabs:gw,text:ww,textarea:ww,upload:null},Pw="restore-version",jw="restore-version",kw=({className:e,collectionSlug:n,globalSlug:r,label:i,originalDocID:s,versionDate:l,versionID:c})=>{const{routes:{admin:u,api:d},serverURL:f}=Ut(),{toggleModal:p}=O(),[m,h]=(0,o.useState)(!1),g=(0,eg.useRouter)(),{i18n:v,t:b}=(0,Be.B)(),y=b("version:aboutToRestoreGlobal",{label:(0,a.sC)(i,v),versionDate:l});let w,x=`${f}${d}`;n&&(x=`${x}/${n}/versions/${c}`,w=`${u}/collections/${n}/${s}`),r&&(x=`${x}/globals/${r}/versions/${c}`,w=`${u}/globals/${r}`);const P=(0,o.useCallback)((async()=>{h(!0);const e=await mt.post(x,{headers:{"Accept-Language":v.language}});if(200===e.status){const t=await e.json();Ct.success(t.message),g.push(w)}else Ct.error(b("version:problemRestoringVersion"))}),[x,w,b,v,g]);return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Ml,{className:[Pw,e].filter(Boolean).join(" "),onClick:()=>p(jw),children:b("version:restoreThisVersion")}),(0,t.jsx)(ce,{className:`${Pw}__modal`,slug:jw,children:(0,t.jsxs)(Nb,{className:`${Pw}__modal-template`,children:[(0,t.jsx)("h1",{children:b("version:confirmVersionRestoration")}),(0,t.jsx)("p",{children:y}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:m?void 0:()=>p(jw),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{onClick:m?void 0:P,children:b(m?"version:restoring":"general:confirm")})]})})]})},Sw={label:"Most recent",value:"mostRecent"},Cw={label:"Most recently published",value:"published"},Mw="compare-version",_w=[Sw],Ow=e=>{const{baseURL:n,onChange:r,parentID:a,publishedDoc:s,value:l,versionID:c}=e,{admin:{dateFormat:u}}=Ut(),{docConfig:d}=us(),[f,p]=(0,o.useState)(_w),[m,h]=(0,o.useState)(1),[g,v]=(0,o.useState)(""),{i18n:b,t:y}=(0,Be.B)(),w=i().useRef(!1),x=(0,o.useCallback)((async({lastLoadedPage:e})=>{if(w.current)return;const t={depth:0,limit:10,page:e,where:{and:[{id:{not_equals:c}}]}};d.versions?.drafts&&t.where.and.push({latest:{not_equals:!0}}),a&&t.where.and.push({parent:{equals:a}});const r=ge().stringify(t),o=await fetch(`${n}?${r}`,{credentials:"include",headers:{"Accept-Language":b.language}});if(o.ok){const e=await o.json();e.docs.length>0&&(p((t=>[...t,...e.docs.map((e=>({label:Ki({date:e.updatedAt,i18n:b,pattern:u}),value:e.id})))])),e.hasNextPage||(w.current=!0),h(e.page))}else v(y("error:unspecific"))}),[u,n,a,c,y,b,d.versions?.drafts]);return(0,o.useEffect)((()=>{x({lastLoadedPage:1})}),[x]),(0,t.jsxs)("div",{className:[Ms,Mw,g&&"error-loading"].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${Mw}__label`,children:y("version:compareVersion")}),!g&&(0,t.jsx)(_f,{isClearable:!1,isSearchable:!1,onChange:r,onMenuScrollToBottom:()=>{x({lastLoadedPage:m+1})},options:[..."published"===s?._status?[Cw]:[],...f],placeholder:y("version:selectVersionToCompare"),value:l}),g&&(0,t.jsx)("div",{className:`${Mw}__error-loading`,children:g})]})},Ew="select-version-locales",Dw=({onChange:e,options:n,value:r})=>{const{t:a}=(0,Be.B)(),{code:o}=ls(),i=e=>e.map((e=>"string"==typeof e.label?e:"string"!=typeof e.label&&e.label[o]?{label:e.label[o],value:e.value}:void 0));return(0,t.jsxs)("div",{className:Ew,children:[(0,t.jsx)("div",{className:`${Ew}__label`,children:a("version:showLocales")}),(0,t.jsx)(_f,{isMulti:!0,onChange:e,options:i(n),placeholder:a("version:selectLocales"),value:i(r)})]})},Nw=({id:e,collectionConfig:t,collectionSlug:n,doc:r,fieldMap:i,globalConfig:s,globalSlug:l,mostRecentDoc:c})=>{const u=Ut(),{setStepNav:d}=hn(),{i18n:f,t:p}=(0,Be.B)(),m=ls();return(0,o.useEffect)((()=>{let o=[];const{admin:{dateFormat:h},routes:{admin:g}}=u;if(n){let s="";const l=t?.admin?.useAsTitle||"id",u=t?.labels?.plural;if(c)if("id"!==l){const e=i.find((e=>{const{isFieldAffectingData:t}=e,n="name"in e?e.name:void 0;return Boolean(t&&n===l)}));s=e&&c[l]?e.localized?c[l]?.[m.code]:c[l]:`[${p("general:untitled")}]`}else s=c.id;o=[{label:(0,a.sC)(u,f),url:`${g}/collections/${n}`},{label:s,url:`${g}/collections/${n}/${e}`},{label:"Versions",url:`${g}/collections/${n}/${e}/versions`},{label:r?.createdAt?Ki({date:r.createdAt,i18n:f,pattern:h}):""}]}l&&(o=[{label:s.label,url:`${g}/globals/${s.slug}`},{label:"Versions",url:`${g}/globals/${s.slug}/versions`},{label:r?.createdAt?Ki({date:r.createdAt,i18n:f,pattern:h}):""}]),d(o)}),[u,d,n,l,r,c,e,m,p,f,t,i,s]),null},Aw="view-version",Tw=({doc:e,docPermissions:n,initialComparisonDoc:r,localeOptions:a,mostRecentDoc:i,publishedDoc:s,versionID:l})=>{const c=Ut(),{i18n:u}=(0,Be.B)(),{id:d,collectionSlug:f,globalSlug:p}=us(),{getComponentMap:m,getFieldMap:h}=wn(),g=m({collectionSlug:f,globalSlug:p}),[v]=(0,o.useState)((()=>h({collectionSlug:f,globalSlug:p}))),[b]=(0,o.useState)((()=>c.collections.find((e=>e.slug===f)))),[y]=(0,o.useState)((()=>c.globals.find((e=>e.slug===p)))),[w,x]=(0,o.useState)(a),[P,j]=(0,o.useState)(Sw),{admin:{dateFormat:k},localization:S,routes:{api:C},serverURL:M}=c,_=e?.createdAt?Ki({date:e.createdAt,i18n:u,pattern:k}):"",O=`${M}${C}/${p?"globals/":""}${f||p}${f?`/${d}`:""}`,E=`${M}${C}/${p?"globals/":""}${f||p}/versions`,D="mostRecent"===P?.value||"published"===P?.value?O:`${E}/${P.value}`,[{data:N}]=Kp(D,{initialData:r,initialParams:{depth:1,draft:"true",locale:"*"}}),A="mostRecent"===P?.value?i:"published"===P?.value?s:N?.version,T=n?.update?.permission;return(0,t.jsxs)("main",{className:Aw,children:[(0,t.jsx)(Pg,{actions:g?.actionsMap?.Edit?.Version}),(0,t.jsx)(Nw,{collectionConfig:b,collectionSlug:f,doc:e,fieldMap:v,globalConfig:y,globalSlug:p,id:d,mostRecentDoc:i}),(0,t.jsxs)(bl,{className:`${Aw}__wrap`,children:[(0,t.jsxs)("div",{className:`${Aw}__header-wrap`,children:[(0,t.jsx)("p",{className:`${Aw}__created-at`,children:u.t("version:versionCreatedOn",{version:u.t(e?.autosave?"version:autosavedVersion":"version:version")})}),(0,t.jsxs)("header",{className:`${Aw}__header`,children:[(0,t.jsx)("h2",{children:_}),T&&(0,t.jsx)(kw,{className:`${Aw}__restore`,collectionSlug:f,globalSlug:p,label:b?.labels.singular||y?.label,originalDocID:d,versionDate:_,versionID:l})]})]}),(0,t.jsxs)("div",{className:`${Aw}__controls`,children:[(0,t.jsx)(Ow,{baseURL:E,onChange:j,parentID:d,publishedDoc:s,value:P,versionID:l}),S&&(0,t.jsx)(Dw,{onChange:x,options:a,value:w})]}),e?.version&&(0,t.jsx)(aw,{comparison:A,diffComponents:xw,fieldMap:v,fieldPermissions:n?.fields,i18n:u,locales:w?w.map((({label:e})=>"string"==typeof e?e:void 0)):[],version:y?{...e?.version,createdAt:e?.version?.createdAt||e.createdAt,updatedAt:e?.version?.updatedAt||e.updatedAt}:e?.version})]})]})},Rw=async e=>{const{initPageResult:n,routeSegments:r}=e,{collectionConfig:a,docID:o,globalConfig:i,permissions:s,req:{payload:l,payload:{config:c}={},user:u}={}}=n,d=r[r.length-1],f=a?.slug,p=i?.slug,{localization:m}=c;let h,g,v,b,y;if(f){g=f,h=s.collections[f];try{v=await l.findVersionByID({id:d,collection:g,depth:1,locale:"*",overrideAccess:!1,user:u}),b=await l.findByID({id:o,collection:g,depth:1,draft:!1,locale:"*",overrideAccess:!1,user:u}),y=await l.findByID({id:o,collection:g,depth:1,draft:!0,locale:"*",overrideAccess:!1,user:u})}catch(e){return(0,eg.notFound)()}}if(p){g=p,h=s.globals[p];try{v=await l.findGlobalVersionByID({id:d,slug:g,depth:1,locale:"*",overrideAccess:!1,user:u}),b=await l.findGlobal({slug:g,depth:1,draft:!1,locale:"*",overrideAccess:!1,user:u}),y=await l.findGlobal({slug:g,depth:1,draft:!0,locale:"*",overrideAccess:!1,user:u})}catch(e){return(0,eg.notFound)()}}const w=m&&m?.locales&&m.locales.map((({code:e,label:t})=>({label:"string"==typeof t?t:"",value:e})));return v?(0,t.jsx)(Tw,{doc:v,docPermissions:h,initialComparisonDoc:y,localeOptions:w,mostRecentDoc:y,publishedDoc:b,versionID:d}):(0,eg.notFound)()},Iw=()=>{const{t:e}=(0,Be.B)(),{rowData:n}=um();return(0,t.jsxs)(o.Fragment,{children:[n?.autosave&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{children:e("version:autosave")})," "]}),"published"===n?.version._status&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{pillStyle:"success",children:e("version:published")})," "]}),"draft"===n?.version._status&&(0,t.jsx)(Ml,{children:e("version:draft")})]})},Lw=Cv().default||Cv(),$w=({collectionSlug:e,docID:n,globalSlug:r})=>{const{admin:{dateFormat:a},routes:{admin:o}}=Ut(),{i18n:i}=(0,Be.B)(),{cellData:s,rowData:l}=um(),c=l.id;let u;return e&&(u=`${o}/collections/${e}/${n}/versions/${c}`),r&&(u=`${o}/globals/${r}/versions/${c}`),(0,t.jsx)(Lw,{href:u,children:s&&Ki({date:s,i18n:i,pattern:a})})},Ww=()=>{const{cellData:e}=um();return(0,t.jsx)(o.Fragment,{children:e})},Fw=e=>{const{baseClass:n,columns:r,paginationLimits:a}=e,{getComponentMap:o}=wn(),{collectionSlug:s,globalSlug:l}=us(),{data:c,handlePerPageChange:u}=Zp(),d=o({collectionSlug:s,globalSlug:l}),f=(0,eg.useSearchParams)().get("limit"),{i18n:p}=(0,Be.B)(),m=c?.totalDocs||0;return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Pg,{actions:d?.actionsMap?.Edit?.Versions}),(0,t.jsx)(Ve,{name:"versions",show:!c}),0===m&&(0,t.jsx)("div",{className:`${n}__no-versions`,children:p.t("version:noFurtherVersionsFound")}),m>0&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(gv,{columns:r,data:c?.docs,fieldMap:d?.fieldMap}),(0,t.jsxs)("div",{className:`${n}__page-controls`,children:[(0,t.jsx)(xv,{hasNextPage:c.hasNextPage,hasPrevPage:c.hasPrevPage,limit:c.limit,nextPage:c.nextPage,numberOfNeighbors:1,page:c.page,prevPage:c.prevPage,totalPages:c.totalPages}),c?.totalDocs>0&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)("div",{className:`${n}__page-info`,children:[c.page*c.limit-(c.limit-1),"-",c.totalPages>1&&c.totalPages!==c.page?c.limit*c.page:c.totalDocs," ",p.t("general:of")," ",c.totalDocs]}),(0,t.jsx)(kv,{handleChange:u,limit:f?Number(f):10,limits:a})]})]})]})]})},zw="versions",Bw=async e=>{const{initPageResult:n,searchParams:r}=e,{collectionConfig:a,docID:o,globalConfig:s,req:{i18n:l,payload:c,payload:{config:u},user:d}}=n,f=a?.slug,p=s?.slug,{limit:m,page:h,sort:g}=r,{routes:{api:v},serverURL:b}=u;let y,w=(0,jc.isNumber)(m)?Number(m):void 0;if(f){w=w||a.admin.pagination.defaultLimit;try{y=await c.findVersions({collection:f,depth:0,limit:w,overrideAccess:!1,page:h?parseInt(h.toString(),10):void 0,sort:g,user:d,where:{parent:{equals:o}}})}catch(e){console.error(e)}}if(p){w=w||10;try{y=await c.findGlobalVersions({slug:p,depth:0,limit:w,overrideAccess:!1,page:h?parseInt(h,10):void 0,sort:g,user:d})}catch(e){console.error(e)}if(!y)return(0,eg.notFound)()}const x=(({collectionConfig:e,docID:n,globalConfig:r,i18n:{t:a}})=>{const o=e||r,i=[{name:"",type:"date",Label:"",accessor:"updatedAt",active:!0,components:{Cell:(0,t.jsx)($w,{collectionSlug:e?.slug,docID:n,globalSlug:r?.slug}),Heading:(0,t.jsx)(mm,{Label:a("general:updatedAt"),name:"updatedAt"})}},{name:"",type:"text",Label:"",accessor:"id",active:!0,components:{Cell:(0,t.jsx)(Ww,{}),Heading:(0,t.jsx)(mm,{Label:a("version:versionID"),disable:!0,name:"id"})}}];return(o?.versions?.drafts||o?.versions?.drafts&&o.versions.drafts?.autosave)&&i.push({name:"",type:"checkbox",Label:"",accessor:"_status",active:!0,components:{Cell:(0,t.jsx)(Iw,{}),Heading:(0,t.jsx)(mm,{Label:a("version:type"),disable:!0,name:"autosave"})}}),i})({collectionConfig:a,config:u,docID:o,globalConfig:s,i18n:l}),P=f?`${b}${v}/${f}/versions`:p?`${b}${v}/globals/${p}/versions`:"";return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(gg,{collectionSlug:a?.slug,globalSlug:s?.slug,id:o,pluralLabel:a?.labels?.plural||s?.label,useAsTitle:a?.admin?.useAsTitle||s?.slug,view:l.t("version:versions")}),(0,t.jsx)("main",{className:zw,children:(0,t.jsx)(bl,{className:`${zw}__wrap`,children:(0,t.jsx)(em,{data:y,defaultLimit:w,defaultSort:g,modifySearchParams:!0,children:(0,t.jsx)(Fw,{baseClass:zw,columns:x,fetchURL:P,paginationLimits:a?.admin?.pagination?.limits})})})})]})},Hw=(e,t)=>"function"==typeof e?.Edit?e?.Edit:"object"==typeof e?.Edit&&e?.Edit?.[t]&&"function"==typeof e?.Edit?.[t]?e?.Edit?.[t]:e?.Edit?.[t]?"object"==typeof e?.Edit?.[t]&&"Component"in e.Edit[t]&&(0,jc.isReactComponentOrFunction)(e?.Edit?.[t].Component)&&e?.Edit?.[t].Component:null;function Yw(e,t){void 0===t&&(t={});for(var n=function(e){for(var t=[],n=0;n<e.length;){var r=e[n];if("*"!==r&&"+"!==r&&"?"!==r)if("\\"!==r)if("{"!==r)if("}"!==r)if(":"!==r)if("("!==r)t.push({type:"CHAR",index:n,value:e[n++]});else{var a=1,o="";if("?"===e[s=n+1])throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<e.length;)if("\\"!==e[s]){if(")"===e[s]){if(0==--a){s++;break}}else if("("===e[s]&&(a++,"?"!==e[s+1]))throw new TypeError("Capturing groups are not allowed at ".concat(s));o+=e[s++]}else o+=e[s++]+e[s++];if(a)throw new TypeError("Unbalanced pattern at ".concat(n));if(!o)throw new TypeError("Missing pattern at ".concat(n));t.push({type:"PATTERN",index:n,value:o}),n=s}else{for(var i="",s=n+1;s<e.length;){var l=e.charCodeAt(s);if(!(l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||95===l))break;i+=e[s++]}if(!i)throw new TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:i}),n=s}else t.push({type:"CLOSE",index:n,value:e[n++]});else t.push({type:"OPEN",index:n,value:e[n++]});else t.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});else t.push({type:"MODIFIER",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),t}(e),r=t.prefixes,a=void 0===r?"./":r,o="[^".concat(Vw(t.delimiter||"/#?"),"]+?"),i=[],s=0,l=0,c="",u=function(e){if(l<n.length&&n[l].type===e)return n[l++].value},d=function(e){var t=u(e);if(void 0!==t)return t;var r=n[l],a=r.type,o=r.index;throw new TypeError("Unexpected ".concat(a," at ").concat(o,", expected ").concat(e))},f=function(){for(var e,t="";e=u("CHAR")||u("ESCAPED_CHAR");)t+=e;return t};l<n.length;){var p=u("CHAR"),m=u("NAME"),h=u("PATTERN");if(m||h){var g=p||"";-1===a.indexOf(g)&&(c+=g,g=""),c&&(i.push(c),c=""),i.push({name:m||s++,prefix:g,suffix:"",pattern:h||o,modifier:u("MODIFIER")||""})}else{var v=p||u("ESCAPED_CHAR");if(v)c+=v;else if(c&&(i.push(c),c=""),u("OPEN")){g=f();var b=u("NAME")||"",y=u("PATTERN")||"",w=f();d("CLOSE"),i.push({name:b||(y?s++:""),pattern:b&&!y?o:y,prefix:g,suffix:w,modifier:u("MODIFIER")||""})}else d("END")}}return i}function Vw(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function qw(e){return e&&e.sensitive?"":"i"}function Uw(e,t,n){return function(e,t,n){void 0===n&&(n={});for(var r=n.strict,a=void 0!==r&&r,o=n.start,i=void 0===o||o,s=n.end,l=void 0===s||s,c=n.encode,u=void 0===c?function(e){return e}:c,d=n.delimiter,f=void 0===d?"/#?":d,p=n.endsWith,m="[".concat(Vw(void 0===p?"":p),"]|$"),h="[".concat(Vw(f),"]"),g=i?"^":"",v=0,b=e;v<b.length;v++){var y=b[v];if("string"==typeof y)g+=Vw(u(y));else{var w=Vw(u(y.prefix)),x=Vw(u(y.suffix));if(y.pattern)if(t&&t.push(y),w||x)if("+"===y.modifier||"*"===y.modifier){var P="*"===y.modifier?"?":"";g+="(?:".concat(w,"((?:").concat(y.pattern,")(?:").concat(x).concat(w,"(?:").concat(y.pattern,"))*)").concat(x,")").concat(P)}else g+="(?:".concat(w,"(").concat(y.pattern,")").concat(x,")").concat(y.modifier);else"+"===y.modifier||"*"===y.modifier?g+="((?:".concat(y.pattern,")").concat(y.modifier,")"):g+="(".concat(y.pattern,")").concat(y.modifier);else g+="(?:".concat(w).concat(x,")").concat(y.modifier)}}if(l)a||(g+="".concat(h,"?")),g+=n.endsWith?"(?=".concat(m,")"):"$";else{var j=e[e.length-1],k="string"==typeof j?h.indexOf(j[j.length-1])>-1:void 0===j;a||(g+="(?:".concat(h,"(?=").concat(m,"))?")),k||(g+="(?=".concat(h,"|").concat(m,")"))}return new RegExp(g,qw(n))}(Yw(e,n),t,n)}function Gw(e,t,n){return e instanceof RegExp?function(e,t){if(!t)return e;for(var n=/\((?:\?<(.*?)>)?(?!\?)/g,r=0,a=n.exec(e.source);a;)t.push({name:a[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),a=n.exec(e.source);return e}(e,t):Array.isArray(e)?function(e,t,n){var r=e.map((function(e){return Gw(e,t,n).source}));return new RegExp("(?:".concat(r.join("|"),")"),qw(n))}(e,t,n):Uw(e,t,n)}const Kw=({currentRoute:e,exact:t,path:n,sensitive:r,strict:a})=>{const o=Gw(n,[],{sensitive:r,strict:a}).exec(e),i=o?.[0]||n;return t?e===i:t?void 0:i.startsWith(e)},Xw=({baseRoute:e,currentRoute:t,views:n})=>{if("object"==typeof n?.Edit&&"function"!=typeof n?.Edit){const r=Object.entries(n.Edit).find((([,n])=>{if("object"==typeof n&&"function"!=typeof n&&"path"in n){const r=`${e}${n.path}`;return Kw({currentRoute:t,exact:!0,path:r})}return!1}))?.[1];if(r&&"Component"in r)return r.Component}return null},Qw=({collectionConfig:e,config:t,docPermissions:n,globalConfig:r,routeSegments:a})=>{let o=null,i=null,s=null;const{routes:{admin:l}}=t,c=e&&e?.admin?.components?.views||r&&r?.admin?.components?.views,u=e&&e?.admin?.livePreview||t?.admin?.livePreview?.collections?.includes(e?.slug)||r&&r?.admin?.livePreview||t?.admin?.livePreview?.globals?.includes(r?.slug);if(e){const t=e?.admin?.components?.views?.Edit,r="function"==typeof t?t:null;if(r&&(i=r),!r){const[t,r,d,f,p,...m]=a;if(n?.read?.permission)switch(a.length){case 3:if("create"===d)"create"in n&&n?.create?.permission?(i=Hw(c,"Default"),o=oy):s=Jy;else i=Hw(c,"Default"),o=oy;break;case 4:switch(f){case"api":!0!==e?.admin?.hideAPIURL&&(i=Hw(c,"API"),o=My);break;case"preview":u&&(o=Ky);break;case"versions":n?.readVersions?.permission?(i=Hw(c,"Versions"),o=Bw):s=Jy;break;default:{const e=[l,"collections",r,d].filter(Boolean).join("/"),t=[e,f,p,...m].filter(Boolean).join("/");i=Xw({baseRoute:e,currentRoute:t,views:c});break}}break;default:if("versions"===f)n?.readVersions?.permission?(i=Hw(c,"Version"),o=Rw):s=Jy;else{const e=[l,t,r,d].filter(Boolean).join("/"),n=[e,f,p,...m].filter(Boolean).join("/");i=Xw({baseRoute:e,currentRoute:n,views:c})}}else(0,eg.notFound)()}}if(r){const e=r?.admin?.components?.views?.Edit,t="function"==typeof e?e:null;if(t&&(i=t),!t){const[e,t,d,...f]=a;if(n?.read?.permission)switch(a.length){case 2:i=Hw(c,"Default"),o=oy;break;case 3:switch(d){case"api":!0!==r?.admin?.hideAPIURL&&(i=Hw(c,"API"),o=My);break;case"preview":u&&(o=Ky);break;case"versions":n?.readVersions?.permission?(i=Hw(c,"Versions"),o=Bw):s=Jy;break;default:n?.read?.permission?(i=Hw(c,"Default"),o=oy):s=Jy}break;default:if("versions"===d)n?.readVersions?.permission?(i=Hw(c,"Version"),o=Rw):s=Jy;else{const e=[l,"globals",t].filter(Boolean).join("/"),n=[e,d,...f].filter(Boolean).join("/");i=Xw({baseRoute:e,currentRoute:n,views:c})}}else(0,eg.notFound)()}}return{CustomView:i,DefaultView:o,ErrorView:s}},Jw=async({initPageResult:e,params:n,searchParams:r})=>{const{collectionConfig:a,docID:o,globalConfig:i,locale:s,permissions:l,req:c,req:{i18n:u,payload:d,payload:{config:f,config:{routes:{admin:p,api:m},serverURL:h}},user:g},visibleEntities:v}=e,b=Array.isArray(n?.segments)?n.segments:[],y=a?.slug||void 0,w=i?.slug||void 0,x=es({id:o,collectionSlug:y,globalSlug:w});let P,j,k,S,C,M;const{data:_,formState:O}=await ny({id:o,collectionConfig:a,globalConfig:i,locale:s,req:c}),{docPermissions:E,hasPublishPermission:D,hasSavePermission:N}=await ry({id:o,collectionConfig:a,data:_,globalConfig:i,req:c});if(a){v?.collections?.find((e=>e===y))||(0,eg.notFound)(),M=`${h}${m}/${y}${x?`/${o}`:""}`;const e=new URLSearchParams;a.versions?.drafts&&e.append("draft","true"),s?.code&&e.append("locale",s.code);const t=`?${e.toString()}`;C=`${h}${m}/${y}/${o}${t}`;const n=a?.admin?.components?.views?.Edit;if(P="function"==typeof n?n:null,!P){const e=Qw({collectionConfig:a,config:f,docPermissions:E,routeSegments:b});j=e?.CustomView,k=e?.DefaultView,S=e?.ErrorView}j||k||P||S||(S=my)}if(i){v?.globals?.find((e=>e===w))||(0,eg.notFound)(),M=`${h}${m}/globals/${w}`;const e=new URLSearchParams({locale:s?.code});i.versions?.drafts&&e.append("draft","true"),s?.code&&e.append("locale",s.code);const t=`?${e.toString()}`;C=`${h}${m}/${w}${t}`;const n=i?.admin?.components?.views?.Edit;if(P="function"==typeof n?n:null,!P){const e=Qw({config:f,docPermissions:E,globalConfig:i,routeSegments:b});j=e?.CustomView,k=e?.DefaultView,S=e?.ErrorView,j||k||P||S||(S=my)}}if(N&&(a?.versions?.drafts&&a?.versions?.drafts?.autosave||i?.versions?.drafts&&i?.versions?.drafts?.autosave)&&!(a?.versions?.drafts&&a?.versions?.drafts?.validate)&&!o&&y){const e=await d.create({collection:y,data:{},depth:0,draft:!0,fallbackLocale:null,locale:s?.code,req:c,user:g});if(e?.id){const t=`${h}${p}/collections/${y}/${e.id}`;(0,eg.redirect)(t)}else(0,eg.notFound)()}const A={initPageResult:e,params:n,routeSegments:b,searchParams:r};return(0,t.jsxs)(ds,{action:M,apiURL:C,collectionSlug:a?.slug,disableActions:!1,docPermissions:E,globalSlug:i?.slug,hasPublishPermission:D,hasSavePermission:N,id:o,initialData:_,initialState:O,isEditing:x,children:[!P&&(0,t.jsx)(Ub,{collectionConfig:a,config:d.config,globalConfig:i,i18n:u,permissions:l}),(0,t.jsx)(Nv,{permissions:l,user:g}),(0,t.jsx)(ys,{depth:1,children:(0,t.jsx)(Wf,{initialParams:{depth:0,"fallback-locale":"null",locale:s?.code,uploadEdits:void 0},children:S?(0,t.jsx)(S,{initPageResult:e,searchParams:r}):(0,t.jsx)(Rv,{CustomComponent:P||j,DefaultComponent:k,componentProps:A,serverOnlyProps:{i18n:u,locale:s,params:n,payload:d,permissions:l,searchParams:r,user:g}})})},`${y||w}${s?.code?`-${s?.code}`:""}`)]})},Zw=()=>{const e=Ut(),{admin:{user:n},routes:{api:r}}=e,{t:a}=(0,Be.B)(),[i,s]=(0,o.useState)(!1),l={email:{initialValue:"",valid:!0,value:void 0}};return i?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("h1",{children:a("authentication:emailSent")}),(0,t.jsx)("p",{children:a("authentication:checkYourEmailForPasswordReset")})]}):(0,t.jsxs)(Ch,{action:`${r}/${n}/forgot-password`,handleResponse:(e,t,n)=>{e.json().then((()=>{s(!0),t(a("general:submissionSuccessful"))})).catch((()=>{n(a("authentication:emailNotValid"))}))},initialState:l,method:"POST",children:[(0,t.jsx)("h1",{children:a("authentication:forgotPassword")}),(0,t.jsx)("p",{children:a("authentication:forgotPasswordEmailInstructions")}),(0,t.jsx)(fc,{autoComplete:"email",label:a("general:email"),name:"email",required:!0,validate:e=>(0,jc.email)(e,{name:"email",type:"email",data:{},preferences:{fields:{}},req:{t:a},required:!0,siblingData:{}})}),(0,t.jsx)(Lh,{children:a("general:submit")})]})},ex=Cv().default||Cv(),tx=async({initPageResult:e,params:n,searchParams:r})=>{const{collectionConfig:a,locale:i,permissions:s,req:{i18n:l,locale:c,payload:u,payload:{config:d},query:f,user:p},visibleEntities:m}=e,h=a?.slug;let g;s?.collections?.[h]?.read?.permission||(0,eg.notFound)();const v=`${h}-list`;try{g=await(u.find({collection:"payload-preferences",depth:0,limit:1,user:p,where:{key:{equals:v}}})?.then((e=>e?.docs?.[0]?.value)))}catch(e){}const{routes:{admin:b}}=d;if(a){const{admin:{components:{views:{List:d}={}}={}}}=a;if(!m.collections.includes(h))return(0,eg.notFound)();let y=null;d&&"function"==typeof d?y=d:"object"==typeof d&&(0,jc.isReactComponentOrFunction)(d.Component)&&(y=d.Component);const w=(0,jc.isNumber)(f?.page)?Number(f.page):0,x=(0,oh.mergeListSearchAndWhere)({collectionConfig:a,query:{search:"string"==typeof f?.search?f.search:void 0,where:f?.where||void 0}}),P=(0,jc.isNumber)(f?.limit)?Number(f.limit):g?.limit||a.admin.pagination.defaultLimit,j=f?.sort&&"string"==typeof f.sort?f.sort:g?.sort||a.defaultSort||void 0,k=await u.find({collection:h,depth:0,draft:!0,fallbackLocale:null,limit:P,locale:c,overrideAccess:!1,page:w,sort:j,user:p,where:x||{}}),S={collectionSlug:h,listSearchableFields:a.admin.listSearchableFields};return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Nv,{permissions:s,user:p}),(0,t.jsx)(Qp,{collectionConfig:(0,oh.createClientCollectionConfig)({collection:a,t:e.req.i18n.t}),collectionSlug:h,hasCreatePermission:s?.collections?.[h]?.create?.permission,newDocumentURL:`${b}/collections/${h}/create`,children:(0,t.jsx)(em,{data:k,defaultLimit:P||a?.admin?.pagination?.defaultLimit,defaultSort:j,modifySearchParams:!0,preferenceKey:v,children:(0,t.jsx)(Nm,{collectionSlug:h,enableRowSelections:!0,listPreferences:g,preferenceKey:v,children:(0,t.jsx)(Rv,{CustomComponent:y,DefaultComponent:Ov,componentProps:S,serverOnlyProps:{collectionConfig:a,data:k,hasCreatePermission:s?.collections?.[h]?.create?.permission,i18n:l,limit:P,listPreferences:g,locale:i,newDocumentURL:`${b}/collections/${h}/create`,params:n,payload:u,permissions:s,searchParams:r,user:p}})})})})]})}return(0,eg.notFound)()},nx=Cv().default||Cv(),rx=e=>{const{adminRoute:n,inactivity:r,redirect:a}=e,[s,l]=i().useState(void 0),{logOut:c}=sn(),{t:u}=(0,Be.B)();return(0,o.useEffect)((()=>{s||(l(!0),c())}),[s,c]),s?(0,t.jsxs)(o.Fragment,{children:[r&&(0,t.jsx)("h2",{children:u("authentication:loggedOutInactivity")}),!r&&(0,t.jsx)("h2",{children:u("authentication:loggedOutSuccessfully")}),(0,t.jsx)(Yt,{Link:nx,buttonStyle:"secondary",el:"link",url:`${n}/login${a&&a.length>0?`?redirect=${encodeURIComponent(a)}`:""}`,children:u("authentication:logBackIn")})]}):(0,t.jsx)(o.Fragment,{children:u("authentication:loggingOut")})},ax=({inactivity:e,initPageResult:n,searchParams:r})=>{const{req:{payload:{config:{routes:{admin:a}}}}}=n;return(0,t.jsx)("div",{className:"logout__wrap",children:(0,t.jsx)(rx,{adminRoute:a,inactivity:e,redirect:r.redirect})})},ox={"confirm-password":{initialValue:"",valid:!1,value:""},password:{initialValue:"",valid:!1,value:""}},ix=({token:e})=>{const n=(0,Be.B)(),{admin:{user:r},routes:{admin:a,api:o},serverURL:s}=Ut(),l=(0,eg.useRouter)(),{fetchFullUser:c}=sn(),u=i().useCallback((async e=>{e.token?(await c(),l.push(`${a}`)):(l.push(`${a}/login`),Ct.success(n.t("general:updatedSuccessfully")))}),[c,l,a,n]);return(0,t.jsxs)(Ch,{action:`${s}${o}/${r}/reset-password`,initialState:ox,method:"POST",onSuccess:u,children:[(0,t.jsx)(sx,{}),(0,t.jsx)(sc,{}),(0,t.jsx)(ol,{forceUsePathFromProps:!0,name:"token",value:e}),(0,t.jsx)(Lh,{children:n.t("authentication:resetPassword")})]})},sx=()=>{const{t:e}=(0,Be.B)(),{value:n}=Bo((([e])=>e&&e?.["confirm-password"]||null)),r=i().useCallback((t=>t?t===n||e("fields:passwordsDoNotMatch"):e("validation:required")),[n,e]);return(0,t.jsx)(Ef,{autoComplete:"off",label:e("authentication:newPassword"),name:"password",required:!0,validate:r})},lx="reset-password",cx=Cv().default||Cv(),ux=({initPageResult:e,params:n})=>{const{req:r}=e,{segments:[a,o]}=n,{i18n:i,payload:{config:s},user:l}=r,{admin:{routes:{account:c}},routes:{admin:u}}=s;return l?(0,t.jsx)(Nb,{className:lx,children:(0,t.jsxs)("div",{className:`${lx}__wrap`,children:[(0,t.jsx)("h1",{children:i.t("authentication:alreadyLoggedIn")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{0:({children:e})=>(0,t.jsx)(cx,{href:`${u}${c}`,children:e})},i18nKey:"authentication:loggedInChangePassword",t:i.t})}),(0,t.jsx)("br",{}),(0,t.jsx)(Yt,{Link:cx,buttonStyle:"secondary",el:"link",to:u,children:i.t("general:backToDashboard")})]})}):(0,t.jsx)(Nb,{className:lx,children:(0,t.jsxs)("div",{className:`${lx}__wrap`,children:[(0,t.jsx)("h1",{children:i.t("authentication:resetPassword")}),(0,t.jsx)(ix,{token:o})]})})},dx="verify",fx=async({initPageResult:e,params:n,searchParams:r})=>{const[a,o,s]=n.segments,{locale:l,permissions:c,req:u}=e,{i18n:d,payload:{config:f},payload:p,user:m}=u,{routes:{admin:h}}=f;let g;try{return await u.payload.verifyEmail({collection:a,token:s}),(0,eg.redirect)(`${h}/login`)}catch(e){202===e?.status&&(0,eg.redirect)(`${h}/login`),g=u.t("authentication:unableToVerify")}return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${dx}__brand`,children:(0,t.jsx)(Yv,{i18n:d,locale:l,params:n,payload:p,permissions:c,searchParams:r,user:m})}),(0,t.jsx)("h2",{children:g})]})},px={account:"account",forgot:"forgot-password",login:Gv,reset:lx,verify:dx},mx={account:async({initPageResult:e,params:n,searchParams:r})=>{const{languageOptions:a,locale:o,permissions:i,req:s,req:{i18n:l,payload:c,payload:{config:u},user:d}}=e,{admin:{components:{views:{Account:f}={}}={},user:p},routes:{api:m},serverURL:h}=u,g=u.collections.find((e=>e.slug===p));if(g&&d?.id){const{docPermissions:u,hasPublishPermission:v,hasSavePermission:b}=await ry({id:d.id,collectionConfig:g,data:d,req:s}),{data:y,formState:w}=await ny({id:d.id,collectionConfig:g,locale:o,req:s}),x={initPageResult:e,params:n,routeSegments:[],searchParams:r};return(0,t.jsxs)(ds,{AfterFields:(0,t.jsx)(cy,{i18n:l,languageOptions:a}),action:`${h}${m}/${p}${d?.id?`/${d.id}`:""}`,apiURL:`${h}${m}/${p}${d?.id?`/${d.id}`:""}`,collectionSlug:p,docPermissions:u,hasPublishPermission:v,hasSavePermission:b,id:d?.id.toString(),initialData:y,initialState:w,isEditing:!0,children:[(0,t.jsx)(Ub,{collectionConfig:g,config:c.config,hideTabs:!0,i18n:l,permissions:i}),(0,t.jsx)(Nv,{permissions:i,user:d}),(0,t.jsx)(Wf,{initialParams:{depth:0,"fallback-locale":"null",locale:o?.code,uploadEdits:void 0},children:(0,t.jsx)(Rv,{CustomComponent:"function"==typeof f?f:void 0,DefaultComponent:oy,componentProps:x,serverOnlyProps:{i18n:l,locale:o,params:n,payload:c,permissions:i,searchParams:r,user:d}})})]})}return(0,eg.notFound)()},createFirstUser:async({initPageResult:e})=>{const{req:n,req:{payload:{config:{admin:{user:r}}}}}=e,a=[{name:"email",type:"email",label:n.t("general:emailAddress"),required:!0},{name:"password",type:"text",label:n.t("general:password"),required:!0},{name:"confirm-password",type:"text",label:n.t("authentication:confirmPassword"),required:!0}],o=await Jb({fieldSchema:a,operation:"create",preferences:{fields:{}},req:n});return(0,t.jsxs)("div",{className:"create-first-user",children:[(0,t.jsx)("h1",{children:n.t("general:welcome")}),(0,t.jsx)("p",{children:n.t("authentication:beginCreateFirstUser")}),(0,t.jsx)(uy,{initialState:o,userSlug:r})]})},forgot:({initPageResult:e})=>{const{req:{i18n:n,payload:{config:r},user:a}}=e,{admin:{routes:{account:i}},routes:{admin:s}}=r;return a?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("h1",{children:n.t("authentication:alreadyLoggedIn")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{0:({children:e})=>(0,t.jsx)(ex,{href:`${s}${i}`,children:e})},i18nKey:"authentication:loggedInChangePassword",t:n.t})}),(0,t.jsx)("br",{}),(0,t.jsx)(Yt,{Link:ex,buttonStyle:"secondary",el:"link",to:s,children:n.t("general:backToDashboard")})]}):(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Zw,{}),(0,t.jsx)(ex,{href:`${s}/login`,children:n.t("authentication:backToLogin")})]})},inactivity:e=>(0,t.jsx)(ax,{inactivity:!0,...e}),login:Kv,logout:ax,unauthorized:Jy},hx=({adminRoute:e,config:t,currentRoute:n,searchParams:r,segments:a})=>{let o,i,s=null;const l={config:t,route:n,searchParams:r},[c,u]=a,d="globals"===c,f="collections"===c;switch(a.length){case 0:n===e&&(s=Bv,o="dashboard",i="default",l.redirectUnauthenticatedUser=!0);break;case 1:{let r;if(t.admin.routes){const a=Object.entries(t.admin.routes).find((([,t])=>Kw({currentRoute:n,exact:!0,path:`${e}${t}`})));a&&(r=a[0])}mx[r]&&(s=mx[r],o=px[r],i="minimal","account"===r&&(l.redirectUnauthenticatedUser=!0,i="default"));break}case 2:"reset"===c&&(s=ux,o=px[u],i="minimal"),f?(l.redirectUnauthenticatedUser=!0,s=tx,o=`${u}-list`,i="default"):d&&(l.redirectUnauthenticatedUser=!0,s=Jw,o="global-edit",i="default");break;default:"verify"===u?(s=fx,o="verify",i="minimal"):f?(l.redirectUnauthenticatedUser=!0,s=Jw,o="collection-default-edit",i="default"):d&&(l.redirectUnauthenticatedUser=!0,s=Jw,o="global-edit",i="default")}return s||(s=(({config:e,currentRoute:t})=>{const{admin:{components:{views:n}},routes:{admin:r}}=e,a=t.replace(r,""),o=n&&"object"==typeof n&&Object.entries(n).find((([,e])=>{if("object"==typeof e)return Kw({currentRoute:a,exact:e.exact,path:e.path,sensitive:e.sensitive,strict:e.strict})}))?.[1];return"object"==typeof o?o.Component:null})({config:t,currentRoute:n})),{DefaultView:s,initPageOptions:l,templateClassName:o,templateType:i}},gx=async({config:e,params:n,searchParams:r})=>{const a=await e,{admin:{routes:{createFirstUser:i},user:s},routes:{admin:l}}=a,c=`${l}${Array.isArray(n.segments)?`/${n.segments.join("/")}`:""}`,u=Array.isArray(n.segments)?n.segments:[],{DefaultView:d,initPageOptions:f,templateClassName:p,templateType:m}=hx({adminRoute:l,config:a,currentRoute:c,searchParams:r,segments:u});let h=!1;d||(0,eg.notFound)();const g=await Ib(f);if(g){h=await(g?.req.payload.db.findOne({collection:s,req:g?.req})?.then((e=>!!e)));const e=`${l}${i}`,t=a.collections.find((({slug:e})=>e===s)),n=t?.auth?.disableLocalStrategy;n&&c===e&&(0,eg.redirect)(l),h||c===e||n||(0,eg.redirect)(e),h&&c===e&&(0,eg.redirect)(l)}const v=(0,t.jsx)(rh,{Component:d,serverOnlyProps:{initPageResult:g,params:n,searchParams:r}});return(0,t.jsxs)(o.Fragment,{children:[!m&&(0,t.jsx)(o.Fragment,{children:v}),"minimal"===m&&(0,t.jsx)(Nb,{className:p,children:v}),"default"===m&&(0,t.jsx)(Eb,{i18n:g?.req.i18n,locale:g?.locale,params:n,payload:g?.req.payload,permissions:g?.permissions,searchParams:r,user:g?.req.user,visibleEntities:{collections:g.visibleEntities?.collections,globals:g.visibleEntities?.globals},children:v})]})}})(),module.exports=r})();
|
|
62
|
+
function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){Z(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ee,te=(ee=[],{activateTrap:function(e){if(ee.length>0){var t=ee[ee.length-1];t!==e&&t.pause()}var n=ee.indexOf(e);-1===n||ee.splice(n,1),ee.push(e)},deactivateTrap:function(e){var t=ee.indexOf(e);-1!==t&&ee.splice(t,1),ee.length>0&&ee[ee.length-1].unpause()}}),ne=function(e){return setTimeout(e,0)},re=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},ae=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},oe=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},ie=function(e,t){var n,r=(null==t?void 0:t.document)||document,a=J({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},i=function(e,t,n){return e&&void 0!==e[t]?e[t]:a[n||t]},s=function(e){return o.containerGroups.findIndex((function(t){var n=t.container,r=t.tabbableNodes;return n.contains(e)||r.find((function(t){return t===e}))}))},l=function(e){var t=a[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];t=t.apply(void 0,o)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var s=t;if("string"==typeof t&&!(s=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return s},c=function(){var e=l("initialFocus");if(!1===e)return!1;if(void 0===e)if(s(r.activeElement)>=0)e=r.activeElement;else{var t=o.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},u=function(){if(o.containerGroups=o.containers.map((function(e){var t=U(e,a.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?L([e],t.includeContainer,{filter:H.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):I(e,t.includeContainer,H.bind(null,t))}(e,a.tabbableOptions);return{container:e,tabbableNodes:t,focusableNodes:n,firstTabbableNode:t.length>0?t[0]:null,lastTabbableNode:t.length>0?t[t.length-1]:null,nextTabbableNode:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=n.findIndex((function(t){return t===e}));if(!(r<0))return t?n.slice(r+1).find((function(e){return G(e,a.tabbableOptions)})):n.slice(0,r).reverse().find((function(e){return G(e,a.tabbableOptions)}))}}})),o.tabbableGroups=o.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),o.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},d=function e(t){!1!==t&&t!==r.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!a.preventScroll}),o.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(c()))},f=function(e){var t=l("setReturnFocus",e);return t||!1!==t&&e},p=function(e){var t=oe(e);s(t)>=0||(ae(a.clickOutsideDeactivates,e)?n.deactivate({returnFocus:a.returnFocusOnDeactivate&&!X(t,a.tabbableOptions)}):ae(a.allowOutsideClick,e)||e.preventDefault())},m=function(e){var t=oe(e),n=s(t)>=0;n||t instanceof Document?n&&(o.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),d(o.mostRecentlyFocusedNode||c()))},h=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==ae(a.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=oe(e);u();var n=null;if(o.tabbableGroups.length>0){var r=s(t),i=r>=0?o.containerGroups[r]:void 0;if(r<0)n=e.shiftKey?o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:o.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var c=re(o.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(c<0&&(i.container===t||X(t,a.tabbableOptions)&&!G(t,a.tabbableOptions)&&!i.nextTabbableNode(t,!1))&&(c=r),c>=0){var f=0===c?o.tabbableGroups.length-1:c-1;n=o.tabbableGroups[f].lastTabbableNode}}else{var p=re(o.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(p<0&&(i.container===t||X(t,a.tabbableOptions)&&!G(t,a.tabbableOptions)&&!i.nextTabbableNode(t))&&(p=r),p>=0){var m=p===o.tabbableGroups.length-1?0:p+1;n=o.tabbableGroups[m].firstTabbableNode}}}else n=l("fallbackFocus");n&&(e.preventDefault(),d(n))}(e)},g=function(e){var t=oe(e);s(t)>=0||ae(a.clickOutsideDeactivates,e)||ae(a.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},v=function(){if(o.active)return te.activateTrap(n),o.delayInitialFocusTimer=a.delayInitialFocus?ne((function(){d(c())})):d(c()),r.addEventListener("focusin",m,!0),r.addEventListener("mousedown",p,{capture:!0,passive:!1}),r.addEventListener("touchstart",p,{capture:!0,passive:!1}),r.addEventListener("click",g,{capture:!0,passive:!1}),r.addEventListener("keydown",h,{capture:!0,passive:!1}),n},b=function(){if(o.active)return r.removeEventListener("focusin",m,!0),r.removeEventListener("mousedown",p,!0),r.removeEventListener("touchstart",p,!0),r.removeEventListener("click",g,!0),r.removeEventListener("keydown",h,!0),n};return n={get active(){return o.active},get paused(){return o.paused},activate:function(e){if(o.active)return this;var t=i(e,"onActivate"),n=i(e,"onPostActivate"),a=i(e,"checkCanFocusTrap");a||u(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,t&&t();var s=function(){a&&u(),v(),n&&n()};return a?(a(o.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!o.active)return this;var t=J({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},e);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,b(),o.active=!1,o.paused=!1,te.deactivateTrap(n);var r=i(t,"onDeactivate"),s=i(t,"onPostDeactivate"),l=i(t,"checkCanReturnFocus"),c=i(t,"returnFocus","returnFocusOnDeactivate");r&&r();var u=function(){ne((function(){c&&d(f(o.nodeFocusedBeforeActivation)),s&&s()}))};return c&&l?(l(f(o.nodeFocusedBeforeActivation)).then(u,u),this):(u(),this)},pause:function(){return o.paused||!o.active||(o.paused=!0,b()),this},unpause:function(){return o.paused&&o.active?(o.paused=!1,u(),v(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return o.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),o.active&&u(),this}},n.updateContainerElements(e),n},se=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};const le="modal-item",ce=(ue=e=>{const{children:t}=e;return t?"function"==typeof t?o.createElement(o.Fragment,null,t(e)):o.createElement(o.Fragment,null,t):null},e=>{const t=O(),n=(0,o.useRef)(null),[r,a]=(0,o.useState)(!1),i=(0,o.useRef)(!1),[l,c]=(0,o.useState)(null),{modalState:u,classPrefix:d,containerRef:f,transTime:p,setCloseOnBlur:m,setBodyScrollLock:h,openModal:g}=t,{className:v,htmlElement:b="dialog",slug:y="",closeOnBlur:w=!0,lockBodyScroll:x=!0,classPrefix:P,onEnter:j,onEntering:k,onEntered:S,onExit:C,onExiting:_,onExited:D,openOnInit:N,trapFocus:A=!0,focusTrapOptions:T={}}=e,R=se(e,["className","htmlElement","slug","closeOnBlur","lockBodyScroll","classPrefix","onEnter","onEntering","onEntered","onExit","onExiting","onExited","openOnInit","trapFocus","focusTrapOptions"]),I=P||d,L=de||y,$=u[L]&&u[L].isOpen;(0,o.useEffect)((()=>{if(A){const e=n.current;if(!1===i.current&&e){const t=ie(e,Object.assign(Object.assign({},T),{fallbackFocus:(null==T?void 0:T.fallbackFocus)||e,allowOutsideClick:void 0===T.allowOutsideClick||T.allowOutsideClick}));c(t),i.current=!0}}}),[A,r,T]),(0,o.useEffect)((()=>{a(!0)}),[]),(0,o.useEffect)((()=>(l&&($?l.activate():l.deactivate()),()=>{l&&l.deactivate()})),[$,l]),(0,o.useEffect)((()=>{$&&m(w)}),[$,w,m]),(0,o.useEffect)((()=>{const e=n.current;return e&&h(!(!$||!x),e),()=>{e&&h(!1,e)}}),[$,x,h]);const[W,F]=(0,o.useState)($);if((0,o.useEffect)((()=>{$?F($):setTimeout((()=>F(!1)),p)}),[$,p]),(0,o.useEffect)((()=>{N&&g(L)}),[L,N,g]),f.current){const r=I?`${I}__${le}`:le,a=[r,`${r}--slug-${L}`,v].filter(Boolean).join(" "),i=Object.assign({role:"dialog"!==b?"dialog":void 0,open:"dialog"===b?W||$:void 0,"aria-modal":!0,"aria-label":R["aria-labelledby"]?void 0:L},R);return s.createPortal(o.createElement(M,{nodeRef:n,timeout:p,in:$,classNames:E(r),appear:!0,onEnter:j,onEntering:k,onEntered:S,onExit:C,onExiting:_,onExited:D},o.createElement(b,Object.assign({ref:n,id:(null==R?void 0:R.id)||L,className:a},i),o.createElement(ue,Object.assign({},e,{isOpen:$,modal:t})))),f.current)}return null});var ue,de,fe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};const pe="modal-container",me=e=>{const{oneModalIsOpen:t,classPrefix:n,transTime:r,setContainerRef:a,containerRef:i,closeAllModals:s,closeOnBlur:l}=O(),{className:c,htmlElement:u="div",children:d,onClick:f}=e,p=fe(e,["className","htmlElement","children","onClick"]),m=n?`${n}__${pe}`:pe,h=[m,c].filter(Boolean).join(" "),g=Object.assign(Object.assign({},p),{onClick:e=>{l&&s(),"function"==typeof f&&f(e)}});return o.createElement(M,{nodeRef:i,in:t,timeout:r,classNames:E(m),appear:!0},o.createElement(u,Object.assign({className:h,ref:a},g),d&&d))};var he=n(27526),ge=n.n(he);var ve=!1;if("undefined"!=typeof window){var be={get passive(){ve=!0}};window.addEventListener("testPassive",null,be),window.removeEventListener("testPassive",null,be)}var ye="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),we=[],xe=!1,Pe=-1,je=void 0,ke=void 0,Se=function(e){return we.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ce=function(e){var t=e||window.event;return!!Se(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},Me=function(){void 0!==ke&&(document.body.style.paddingRight=ke,ke=void 0),void 0!==je&&(document.body.style.overflow=je,je=void 0)},_e=function(e,t){if(e){if(!we.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};we=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(we),[n]),ye?(e.ontouchstart=function(e){1===e.targetTouches.length&&(Pe=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-Pe;!Se(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?Ce(e):e.stopPropagation())}(t,e)},xe||(document.addEventListener("touchmove",Ce,ve?{passive:!1}:void 0),xe=!0)):function(e){if(void 0===ke){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;t&&n>0&&(ke=document.body.style.paddingRight,document.body.style.paddingRight=n+"px")}void 0===je&&(je=document.body.style.overflow,document.body.style.overflow="hidden")}(t)}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")};const Oe=({classPrefix:e,zIndex:t})=>{const n=e?`${e}__`:"";return`\n .${n}${pe} {\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 .${n}${pe}--appear,\n .${n}${pe}--appearDone,\n .${n}${pe}--enter,\n .${n}${pe}--enterDone,\n .${n}${pe}--exit {\n pointer-events: all;\n visibility: visible;\n z-index: ${t};\n }\n\n .${n}${le} {\n position: absolute;\n visibility: hidden;\n }\n\n .${n}${le}--appear,\n .${n}${le}--appearDone,\n .${n}${le}--enter,\n .${n}${le}--enterDone,\n .${n}${le}--exit {\n visibility: visible;\n }\n `},Ee=(e,t)=>{let n=Object.assign({},e);const{type:r,payload:a}=t;switch(r){case"UPDATE_MODAL":{const{slug:e}=a;e&&(n[e]=Object.assign(Object.assign({},n[e]),a));break}case"OPEN_MODAL":{const{slug:e}=a;if(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":{const{slug:e}=a;if(e){const 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":{const{slug:e}=a;e&&(n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:void 0,isOpen:!1}));break}case"REMOVE_MODAL":{const{slug:e}=a;e&&e in n&&delete n[e];break}case"CLOSE_LATEST_MODAL":{const e=Object.keys(n).reduce(((e,t)=>{const r=n[t];return r.isOpen&&"number"==typeof r.openedOn&&(!e||"number"==typeof e.openedOn&&r.openedOn>e.openedOn)?r: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,n])=>(e[t]=Object.assign(Object.assign({},n),{isOpen:!1,openedOn:void 0}),e)),{})}return n},De=()=>{const e=(()=>{if("undefined"!=typeof window)return he.parse(window.location.search,{ignoreQueryPrefix:!0})})();let t=[];return e&&e.modal&&("string"==typeof e.modal?t=[e.modal]:Array.isArray(e.modal)&&(t=e.modal)),t},Ne=e=>{const{classPrefix:t,minifyCSS:n=!0,generateCSS:r=!0,zIndex:a=9999,handleParamChange:i,children:s,transTime:l=250}=e,c=(0,o.useRef)(null),[u,d]=(0,o.useReducer)(Ee,{},(()=>De().reduce(((e,t)=>(e[t]={slug:t,isOpen:!0,openedOn:Date.now()},e)),{}))),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(!1),[g,v]=(0,o.useState)(!1),[b,y]=(0,o.useState)(""),w=(0,o.useRef)(!1),x=(0,o.useCallback)((e=>{27===e.keyCode&&d({type:"CLOSE_LATEST_MODAL"})}),[]);(0,o.useEffect)((()=>(w.current||(document.addEventListener("keydown",(e=>x(e)),!1),w.current=!0),()=>{w.current&&document.removeEventListener("keydown",(e=>x(e)),!1)})),[x]),(0,o.useEffect)((()=>{if(r){let e="";e=Oe({classPrefix:t,zIndex:a}),n&&(e=e.replace(/\n/g,"").replace(/\s\s+/g," ")),y(e)}}),[r,n,a,t]),(0,o.useEffect)((()=>{if("function"==typeof i&&i(u),"boolean"==typeof i&&i){const e=Object.keys(u).filter((e=>u[e].isOpen)),t=he.stringify({modal:e},{addQueryPrefix:!0,encode:!1}),n=`${window.location.pathname}${t}`;window.history.pushState({},"",n)}}),[u,i]),(0,o.useEffect)((()=>{const e=Object.keys(u).some((e=>u[e].isOpen));p(e)}),[u]);const P=(0,o.useCallback)(((e,t)=>{var n;t&&(e?(_e(t),v(!0)):((n=t)?(we=we.filter((function(e){return e.targetElement!==n})),ye?(n.ontouchstart=null,n.ontouchmove=null,xe&&0===we.length&&(document.removeEventListener("touchmove",Ce,ve?{passive:!1}:void 0),xe=!1)):we.length||Me()):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices."),v(!1)))}),[]),j=(0,o.useCallback)((e=>{c.current=e}),[]),k=(0,o.useCallback)((e=>{d({type:"OPEN_MODAL",payload:{slug:e}})}),[]),S=(0,o.useCallback)((e=>{d({type:"CLOSE_MODAL",payload:{slug:e}})}),[]),C=(0,o.useCallback)((()=>{d({type:"CLOSE_ALL_MODALS"})}),[]),M=(0,o.useCallback)((e=>{d({type:"TOGGLE_MODAL",payload:{slug:e}})}),[]),O=(0,o.useCallback)((e=>u[e]&&u[e].isOpen),[u]),E=Object.assign({},e);return delete E.children,o.createElement(o.Fragment,null,r&&o.createElement("style",{dangerouslySetInnerHTML:{__html:b}}),o.createElement(_.Provider,{value:Object.assign(Object.assign({},E),{transTime:l,containerRef:c,modalState:u,oneModalIsOpen:f,isModalOpen:O,closeOnBlur:m,bodyScrollIsLocked:g,classPrefix:t,closeAllModals:C,setCloseOnBlur:h,openModal:k,closeModal:S,toggleModal:M,setBodyScrollLock:P,setContainerRef:j})},s))};const Ae=(0,o.createContext)({}),Te=(e,t)=>{const{timestamp:n,animationRef:r}=t;r.current=null;const{x:a,y:o,xDirection:i,yDirection:s,eventsFired:l,hasScrolled:c}=e,u=c||Boolean(n),d=u?window.pageXOffset:0,f=u?window.pageYOffset:0,p=u?l+1:l,m=d-a,h=f-o,g=d/(document.body.scrollWidth-window.innerWidth)*100,v=f/(document.body.scrollHeight-window.innerHeight)*100;return{x:d,y:f,xDifference:m,yDifference:h,xDirection:m>0?"right":m<0?"left":i,yDirection:h>0?"down":h<0?"up":s,xPercentage:g,yPercentage:v,totalPercentage:(g+v)/2,eventsFired:p,hasScrolled:u}},Re=e=>{const{children:t}=e,n=(0,o.useRef)(null),[r,a]=(0,o.useReducer)(Te,{x:0,y:0,xDifference:0,yDifference:0,xDirection:void 0,yDirection:void 0,xPercentage:0,yPercentage:0,totalPercentage:0,eventsFired:0,hasScrolled:!1}),i=(0,o.useCallback)((e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame((t=>{a({e,timestamp:t,animationRef:n})}))}),[]);return(0,o.useEffect)((()=>(window.addEventListener("scroll",i),()=>{window.removeEventListener("scroll",i)})),[i]),o.createElement(Ae.Provider,{value:Object.assign({},r)},t&&t)},Ie=(0,o.createContext)({}),Le=()=>(0,o.useContext)(Ie),$e=e=>{const{children:t}=e,n=Le();return t?"function"==typeof t?o.createElement(o.Fragment,null,t(n)):o.createElement(o.Fragment,null,t):null},We=(e,t)=>{const{payload:{breakpoints:n,animationRef:r}}=t;r.current=null;const{eventsFired:a}=e,{documentElement:{style:o,clientWidth:i,clientHeight:s}}=document,{innerWidth:l,innerHeight:c}=window,u=i/100+"px",d=s/100+"px",f=n?Object.keys(n).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:window.matchMedia(n[t]).matches})),{}):{},p={width:l,height:c,"--vw":u,"--vh":d,breakpoints:f,eventsFired:a+1};return o.setProperty("--vw",u),o.setProperty("--vh",d),p},Fe=e=>{const{breakpoints:t,children:n}=e,r=(0,o.useRef)(null),[a,i]=(0,o.useReducer)(We,{width:void 0,height:void 0,"--vw":"","--vh":"",breakpoints:{},eventsFired:0}),s=(0,o.useCallback)((()=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame((()=>i({type:"UPDATE",payload:{breakpoints:t,animationRef:r}})))}),[t]),l=(0,o.useCallback)((()=>{setTimeout((()=>{s()}),500)}),[s]);return(0,o.useEffect)((()=>(window.addEventListener("resize",s),window.addEventListener("orientationchange",l),()=>{window.removeEventListener("resize",s),window.removeEventListener("orientationchange",l)})),[s,l]),(0,o.useEffect)((()=>{0===a.eventsFired&&i({type:"UPDATE",payload:{breakpoints:t,animationRef:r}})}),[t,a]),o.createElement(Ie.Provider,{value:Object.assign({},a)},n&&n)},ze=e=>t=>{const n=Le();return o.createElement(e,Object.assign({},t,{windowInfo:n}))};var Be=n(19236);const He="loading-overlay",Ye=({animationDuration:e,loadingText:n,overlayType:r,show:a=!0})=>{const{t:o}=(0,Be.B)();return(0,t.jsxs)("div",{className:[He,a?`${He}--entering`:`${He}--exiting`,r?`${He}--${r}`:""].filter(Boolean).join(" "),style:{animationDuration:e||"500ms"},children:[(0,t.jsxs)("div",{className:`${He}__bars`,children:[(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`}),(0,t.jsx)("div",{className:`${He}__bar`})]}),(0,t.jsx)("span",{className:`${He}__text`,children:n||o("general:loading")})]})},Ve=({name:e,type:t="fullscreen",loadingText:n,show:r})=>{const{toggleLoadingOverlay:a}=Qe();return i().useEffect((()=>(a({type:t,isLoading:r,key:e,loadingText:n||void 0}),()=>{a({type:t,isLoading:!1,key:e})})),[r,a,e,t,n]),null};var qe=n(55674);const Ue={isLoading:!1,loaders:[],loadingText:"",overlayType:null},Ge=(e,t)=>{const n=[...e.loaders],{type:r="fullscreen",key:a="user",loadingText:o}=t.payload;if("add"===t.type)n.push({type:r,key:a,loadingText:o});else if("remove"===t.type){const e=n.findIndex((e=>e.key===a&&e.type===r));n.splice(e,1)}const i=n?.length>0?n[n.length-1]:null;return{isLoading:Boolean(i),loaders:n,loadingText:i?.loadingText||e?.loadingText,overlayType:i?.type||e?.overlayType}},Ke=(0,o.createContext)({isOnScreen:!1,toggleLoadingOverlay:void 0}),Xe=({children:e})=>{const{t:n}=(0,Be.B)(),r=n("general:loading"),[a,s]=i().useReducer(Ge,Ue),{isMounted:l,isUnmounting:c,triggerDelayedRender:u}=(({delayBeforeShow:e,inTimeout:t,minShowTime:n,outTimeout:r,show:a})=>{const i=t+n+r,[s,l]=(0,qe.Z)(e),[c,u]=o.useState(!1),[d,f]=o.useState(!1),p=o.useRef(0),m=o.useRef(void 0),h=o.useCallback((()=>{f(!0),m.current=setTimeout((()=>{u(!1),f(!1)}),r)}),[f,r]);return o.useEffect((()=>{const e=c&&!a;if(s&&!c&&a)p.current=Date.now(),u(!0);else if(e){const e=Date.now()-p.current,t=i-e;clearTimeout(m.current),m.current=setTimeout(h,Math.max(0,t))}}),[c,a,h,i,s]),{isMounted:c,isUnmounting:d,triggerDelayedRender:l}})({delayBeforeShow:1e3,inTimeout:250,minShowTime:500,outTimeout:250,show:a.isLoading}),d=i().useCallback((({type:e,isLoading:t,key:n,loadingText:a=r})=>{t?(u(),s({type:"add",payload:{type:e,key:n,loadingText:a}})):s({type:"remove",payload:{type:e,key:n}})}),[u,r]);return(0,t.jsxs)(Ke.Provider,{value:{isOnScreen:l,toggleLoadingOverlay:d},children:[l&&(0,t.jsx)(Ye,{animationDuration:"250ms",loadingText:a.loadingText||r,overlayType:a.overlayType,show:!c}),e]})},Qe=()=>{const e=i().useContext(Ke);if(void 0===e)throw new Error("useLoadingOverlay must be used within a LoadingOverlayProvider");return e};var Je=!1;if("undefined"!=typeof window){var Ze={get passive(){Je=!0}};window.addEventListener("testPassive",null,Ze),window.removeEventListener("testPassive",null,Ze)}var et="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),tt=[],nt=!1,rt=-1,at=void 0,ot=void 0,it=void 0,st=function(e){return tt.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},lt=function(e){var t=e||window.event;return!!st(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},ct=function(){void 0!==it&&(document.body.style.paddingRight=it,it=void 0),void 0!==at&&(document.body.style.overflow=at,at=void 0)},ut=function(){if(void 0!==ot){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=ot.position,document.body.style.top=ot.top,document.body.style.left=ot.left,window.scrollTo(t,e),ot=void 0}},dt=function(e,t){if(e){if(!tt.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};tt=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(tt),[n]),et?window.requestAnimationFrame((function(){if(void 0===ot){ot={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,r=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=r-window.innerHeight;e&&t>=r&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===it){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);it=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===at&&(at=document.body.style.overflow,document.body.style.overflow="hidden")}(t),et&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(rt=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-rt;!st(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?lt(e):e.stopPropagation())}(t,e)},nt||(document.addEventListener("touchmove",lt,Je?{passive:!1}:void 0),nt=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},ft=Object.prototype.hasOwnProperty;function pt(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&pt(e[r],t[r]););return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(ft.call(e,n)&&++r&&!ft.call(t,n))return!1;if(!(n in t)||!pt(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}const mt={delete:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"delete"};return fetch(e,r)},get:(e,t={headers:{}})=>{let n="";return t.params&&(n=ge().stringify(t.params,{addQueryPrefix:!0})),fetch(`${e}${n}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"PATCH"};return fetch(e,r)},post:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"post"};return fetch(`${e}`,r)},put:(e,t={headers:{}})=>{const n=t&&t.headers?{...t.headers}:{},r={...t,credentials:"include",headers:{...n},method:"put"};return fetch(e,r)}};var ht=n(72659),gt=Array(12).fill(0),vt=({visible:e})=>o.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},o.createElement("div",{className:"sonner-spinner"},gt.map(((e,t)=>o.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`}))))),bt=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"})),yt=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"})),wt=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"})),xt=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"})),Pt=1,jt=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{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,...r}=e,a="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:Pt++,o=this.toasts.find((e=>e.id===a)),i=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:i,title:n}):t)):this.addToast({title:n,...r,dismissible:i,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)=>{if(!t)return;let n;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 r=e instanceof Promise?e:e(),a=void 0!==n;return r.then((async e=>{if(kt(e)&&!e.ok){a=!1;let r="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,o="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:"error",message:r,description:o})}else if(void 0!==t.success){a=!1;let r="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:r,description:o})}})).catch((async e=>{if(void 0!==t.error){a=!1;let r="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:r,description:o})}})).finally((()=>{var e;a&&(this.dismiss(n),n=void 0),null==(e=t.finally)||e.call(t)})),n},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||Pt++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},kt=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,St=(e,t)=>{let n=(null==t?void 0:t.id)||Pt++;return jt.addToast({title:e,...t,id:n}),n},Ct=Object.assign(St,{success:jt.success,info:jt.info,warning:jt.warning,error:jt.error,custom:jt.custom,message:jt.message,promise:jt.promise,dismiss:jt.dismiss,loading:jt.loading},{getHistory:()=>jt.toasts});function Mt(e){return void 0!==e.label}!function(e,{insertAt:t}={}){if(!e||"undefined"==typeof document)return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.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}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-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;left: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;background:var(--gray1);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}: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:0;right:0;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}: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, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);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-border: hsl(0, 0%, 20%);--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%);--error-text: hsl(358, 100%, 81%)}[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 _t=3,Ot=14;function Et(...e){return e.filter(Boolean).join(" ")}var Dt=e=>{var t,n,r,a,i,s,l,c,u,d;let{invert:f,toast:p,unstyled:m,interacting:h,setHeights:g,visibleToasts:v,heights:b,index:y,toasts:w,expanded:x,removeToast:P,defaultRichColors:j,closeButton:k,style:S,cancelButtonStyle:C,actionButtonStyle:M,className:_="",descriptionClassName:O="",duration:E,position:D,gap:N,loadingIcon:A,expandByDefault:T,classNames:R,icons:I,closeButtonAriaLabel:L="Close toast",pauseWhenPageIsHidden:$,cn:W}=e,[F,z]=o.useState(!1),[B,H]=o.useState(!1),[Y,V]=o.useState(!1),[q,U]=o.useState(!1),[G,K]=o.useState(0),[X,Q]=o.useState(0),J=o.useRef(null),Z=o.useRef(null),ee=0===y,te=y+1<=v,ne=p.type,re=!1!==p.dismissible,ae=p.className||"",oe=p.descriptionClassName||"",ie=o.useMemo((()=>b.findIndex((e=>e.toastId===p.id))||0),[b,p.id]),se=o.useMemo((()=>{var e;return null!=(e=p.closeButton)?e:k}),[p.closeButton,k]),le=o.useMemo((()=>p.duration||E||4e3),[p.duration,E]),ce=o.useRef(0),ue=o.useRef(0),de=o.useRef(0),fe=o.useRef(null),[pe,me]=D.split("-"),he=o.useMemo((()=>b.reduce(((e,t,n)=>n>=ie?e:e+t.height),0)),[b,ie]),ge=(()=>{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})(),ve=p.invert||f,be="loading"===ne;ue.current=o.useMemo((()=>ie*N+he),[ie,he]),o.useEffect((()=>{z(!0)}),[]),o.useLayoutEffect((()=>{if(!F)return;let e=Z.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,Q(n),g((e=>e.find((e=>e.toastId===p.id))?e.map((e=>e.toastId===p.id?{...e,height:n}:e)):[{toastId:p.id,height:n,position:p.position},...e]))}),[F,p.title,p.description,g,p.id]);let ye=o.useCallback((()=>{H(!0),K(ue.current),g((e=>e.filter((e=>e.toastId!==p.id)))),setTimeout((()=>{P(p)}),200)}),[p,P,g,ue]);return o.useEffect((()=>{if(p.promise&&"loading"===ne||p.duration===1/0||"loading"===p.type)return;let e,t=le;return x||h||$&&ge?(()=>{if(de.current<ce.current){let e=(new Date).getTime()-ce.current;t-=e}de.current=(new Date).getTime()})():t!==1/0&&(ce.current=(new Date).getTime(),e=setTimeout((()=>{var e;null==(e=p.onAutoClose)||e.call(p,p),ye()}),t)),()=>clearTimeout(e)}),[x,h,T,p,le,ye,p.promise,ne,$,ge]),o.useEffect((()=>{let e=Z.current;if(e){let t=e.getBoundingClientRect().height;return Q(t),g((e=>[{toastId:p.id,height:t,position:p.position},...e])),()=>g((e=>e.filter((e=>e.toastId!==p.id))))}}),[g,p.id]),o.useEffect((()=>{p.delete&&ye()}),[ye,p.delete]),o.createElement("li",{"aria-live":p.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Z,className:W(_,ae,null==R?void 0:R.toast,null==(t=null==p?void 0:p.classNames)?void 0:t.toast,null==R?void 0:R.default,null==R?void 0:R[ne],null==(n=null==p?void 0:p.classNames)?void 0:n[ne]),"data-sonner-toast":"","data-rich-colors":null!=(r=p.richColors)?r:j,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":F,"data-promise":!!p.promise,"data-removed":B,"data-visible":te,"data-y-position":pe,"data-x-position":me,"data-index":y,"data-front":ee,"data-swiping":Y,"data-dismissible":re,"data-type":ne,"data-invert":ve,"data-swipe-out":q,"data-expanded":!!(x||T&&F),style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${B?G:ue.current}px`,"--initial-height":T?"auto":`${X}px`,...S,...p.style},onPointerDown:e=>{be||!re||(J.current=new Date,K(ue.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(V(!0),fe.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,r;if(q||!re)return;fe.current=null;let a=Number((null==(e=Z.current)?void 0:e.style.getPropertyValue("--swipe-amount").replace("px",""))||0),o=(new Date).getTime()-(null==(t=J.current)?void 0:t.getTime()),i=Math.abs(a)/o;if(Math.abs(a)>=20||i>.11)return K(ue.current),null==(n=p.onDismiss)||n.call(p,p),ye(),void U(!0);null==(r=Z.current)||r.style.setProperty("--swipe-amount","0px"),V(!1)},onPointerMove:e=>{var t;if(!fe.current||!re)return;let n=e.clientY-fe.current.y,r=e.clientX-fe.current.x,a=("top"===pe?Math.min:Math.max)(0,n),o="touch"===e.pointerType?10:2;Math.abs(a)>o?null==(t=Z.current)||t.style.setProperty("--swipe-amount",`${n}px`):Math.abs(r)>o&&(fe.current=null)}},se&&!p.jsx?o.createElement("button",{"aria-label":L,"data-disabled":be,"data-close-button":!0,onClick:be||!re?()=>{}:()=>{var e;ye(),null==(e=p.onDismiss)||e.call(p,p)},className:W(null==R?void 0:R.closeButton,null==(a=null==p?void 0:p.classNames)?void 0:a.closeButton)},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"}))):null,p.jsx||o.isValidElement(p.title)?p.jsx||p.title:o.createElement(o.Fragment,null,ne||p.icon||p.promise?o.createElement("div",{"data-icon":"",className:W(null==R?void 0:R.icon,null==(i=null==p?void 0:p.classNames)?void 0:i.icon)},p.promise||"loading"===p.type&&!p.icon?p.icon||(null!=I&&I.loading?o.createElement("div",{className:"sonner-loader","data-visible":"loading"===ne},I.loading):A?o.createElement("div",{className:"sonner-loader","data-visible":"loading"===ne},A):o.createElement(vt,{visible:"loading"===ne})):null,"loading"!==p.type?p.icon||(null==I?void 0:I[ne])||(e=>{switch(e){case"success":return bt;case"info":return wt;case"warning":return yt;case"error":return xt;default:return null}})(ne):null):null,o.createElement("div",{"data-content":"",className:W(null==R?void 0:R.content,null==(s=null==p?void 0:p.classNames)?void 0:s.content)},o.createElement("div",{"data-title":"",className:W(null==R?void 0:R.title,null==(l=null==p?void 0:p.classNames)?void 0:l.title)},p.title),p.description?o.createElement("div",{"data-description":"",className:W(O,oe,null==R?void 0:R.description,null==(c=null==p?void 0:p.classNames)?void 0:c.description)},p.description):null),o.isValidElement(p.cancel)?p.cancel:p.cancel&&Mt(p.cancel)?o.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||C,onClick:e=>{var t,n;Mt(p.cancel)&&re&&(null==(n=(t=p.cancel).onClick)||n.call(t,e),ye())},className:W(null==R?void 0:R.cancelButton,null==(u=null==p?void 0:p.classNames)?void 0:u.cancelButton)},p.cancel.label):null,o.isValidElement(p.action)?p.action:p.action&&Mt(p.action)?o.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||M,onClick:e=>{var t,n;Mt(p.action)&&(e.defaultPrevented||(null==(n=(t=p.action).onClick)||n.call(t,e),ye()))},className:W(null==R?void 0:R.actionButton,null==(d=null==p?void 0:p.classNames)?void 0:d.actionButton)},p.action.label):null))};function Nt(){if("undefined"==typeof window||"undefined"==typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}var At=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:a,closeButton:i,className:l,offset:c,theme:u="light",richColors:d,duration:f,style:p,visibleToasts:m=_t,toastOptions:h,dir:g=Nt(),gap:v=Ot,loadingIcon:b,icons:y,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:x,cn:P=Et}=e,[j,k]=o.useState([]),S=o.useMemo((()=>Array.from(new Set([n].concat(j.filter((e=>e.position)).map((e=>e.position)))))),[j,n]),[C,M]=o.useState([]),[_,O]=o.useState(!1),[E,D]=o.useState(!1),[N,A]=o.useState("system"!==u?u:"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=o.useRef(null),R=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),I=o.useRef(null),L=o.useRef(!1),$=o.useCallback((e=>{var t;null!=(t=j.find((t=>t.id===e.id)))&&t.delete||jt.dismiss(e.id),k((t=>t.filter((({id:t})=>t!==e.id))))}),[j]);return o.useEffect((()=>jt.subscribe((e=>{e.dismiss?k((t=>t.map((t=>t.id===e.id?{...t,delete:!0}:t)))):setTimeout((()=>{s.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((()=>{"system"===u?("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?A("dark"):A("light")),"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>{A(e?"dark":"light")}))):A(u)}),[u]),o.useEffect((()=>{j.length<=1&&O(!1)}),[j]),o.useEffect((()=>{let e=e=>{var t,n;r.every((t=>e[t]||e.code===t))&&(O(!0),null==(t=T.current)||t.focus()),"Escape"===e.code&&(document.activeElement===T.current||null!=(n=T.current)&&n.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[r]),o.useEffect((()=>{if(T.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}}),[T.current]),j.length?o.createElement("section",{"aria-label":`${w} ${R}`,tabIndex:-1},S.map(((e,n)=>{var r;let[s,u]=e.split("-");return o.createElement("ol",{key:e,dir:"auto"===g?Nt():g,tabIndex:-1,ref:T,className:l,"data-sonner-toaster":!0,"data-theme":N,"data-y-position":s,"data-x-position":u,style:{"--front-toast-height":`${(null==(r=C[0])?void 0:r.height)||0}px`,"--offset":"number"==typeof c?`${c}px`:c||"32px","--width":"356px","--gap":`${v}px`,...p},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&(I.current.focus({preventScroll:!0}),I.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{E||O(!1)},onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||D(!0)},onPointerUp:()=>D(!1)},j.filter((t=>!t.position&&0===n||t.position===e)).map(((n,r)=>{var s,l;return o.createElement(Dt,{key:n.id,icons:y,index:r,toast:n,defaultRichColors:d,duration:null!=(s=null==h?void 0:h.duration)?s:f,className:null==h?void 0:h.className,descriptionClassName:null==h?void 0:h.descriptionClassName,invert:t,visibleToasts:m,closeButton:null!=(l=null==h?void 0:h.closeButton)?l:i,interacting:E,position:e,style:null==h?void 0:h.style,unstyled:null==h?void 0:h.unstyled,classNames:null==h?void 0:h.classNames,cancelButtonStyle:null==h?void 0:h.cancelButtonStyle,actionButtonStyle:null==h?void 0:h.actionButtonStyle,removeToast:$,toasts:j.filter((e=>e.position==n.position)),heights:C.filter((e=>e.position==n.position)),setHeights:M,expandByDefault:a,gap:v,loadingIcon:b,expanded:_,pauseWhenPageIsHidden:x,cn:P})})))}))):null};const Tt=({className:e,direction:n,size:r})=>(0,t.jsx)("svg",{className:["icon icon--chevron",e,r&&`icon--size-${r}`].filter(Boolean).join(" "),height:"100%",style:{transform:"left"===n?"rotate(90deg)":"right"===n?"rotate(-90deg)":"up"===n?"rotate(180deg)":void 0},viewBox:"0 0 9 7",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{className:"stroke",d:"M1.42871 1.5332L4.42707 4.96177L7.42543 1.5332"})}),Rt=({className:e})=>(0,t.jsxs)("svg",{className:[e,"icon icon--edit"].filter(Boolean).join(" "),viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("polygon",{className:"fill",points:"16.92 16.86 8.25 16.86 8.25 8.21 12.54 8.21 12.54 6.63 6.68 6.63 6.68 18.43 18.5 18.43 18.5 12.53 16.92 12.53 16.92 16.86"}),(0,t.jsx)("polygon",{className:"fill",points:"16.31 7.33 17.42 8.44 12.66 13.2 11.51 13.24 11.55 12.09 16.31 7.33"}),(0,t.jsx)("rect",{className:"fill",height:"1.15",transform:"translate(10.16 -10.48) rotate(45)",width:"1.58",x:"16.94",y:"6.44"})]}),It=()=>(0,t.jsxs)("svg",{"aria-hidden":"true",className:"graphic link icon icon--link",fill:"currentColor",focusable:"false",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,t.jsx)("path",{className:"fill",d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})]}),Lt=()=>(0,t.jsxs)("svg",{className:"icon icon--plus",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("line",{className:"stroke",x1:"12.4589",x2:"12.4589",y1:"16.9175",y2:"8.50115"}),(0,t.jsx)("line",{className:"stroke",x1:"8.05164",x2:"16.468",y1:"12.594",y2:"12.594"})]});var $t=n(64526);const Wt=({root:e=null,rootMargin:t="0px",threshold:n=0}={},r)=>{const[a,i]=(0,o.useState)(),[s,l]=(0,o.useState)(null),c=(0,o.useRef)("undefined"!=typeof window&&"IntersectionObserver"in window&&!r?new window.IntersectionObserver((([e])=>i(e)),{root:e,rootMargin:t,threshold:n}):null);return(0,o.useEffect)((()=>{if(r)return;const{current:e}=c;return e.disconnect(),s&&e.observe(s),()=>e.disconnect()}),[s,r]),[l,a,s]},Ft=e=>{const{alignCaret:n="center",boundingRef:r,children:a,className:s,delay:l=350,show:c=!0,staticPositioning:u=!1}=e,[d,f]=i().useState(c),[p,m]=i().useState("top"),[h,g]=Wt({root:r?.current||null,rootMargin:"-145px 0px 0px 100px",threshold:0},u);return(0,o.useEffect)((()=>{let e;return l&&c?e=setTimeout((()=>{f(c)}),l):f(c),()=>{e&&clearTimeout(e)}}),[c,l]),(0,o.useEffect)((()=>{u||m(g?.isIntersecting?"top":"bottom")}),[g,u]),(0,t.jsxs)(i().Fragment,{children:[!u&&(0,t.jsx)("aside",{"aria-hidden":"true",className:["tooltip",s,`tooltip--caret-${n}`,"tooltip--position-top"].filter(Boolean).join(" "),ref:h,style:{opacity:"0"},children:(0,t.jsx)("div",{className:"tooltip-content",children:a})}),(0,t.jsx)("aside",{className:["tooltip",s,d&&"tooltip--show",`tooltip--caret-${n}`,`tooltip--position-${p}`].filter(Boolean).join(" "),title:(v=a,"string"==typeof v?v:""),children:(0,t.jsx)("div",{className:"tooltip-content",children:a})})]});var v},zt={chevron:Tt,edit:Rt,link:It,plus:Lt,swap:()=>(0,t.jsxs)("svg",{className:"icon icon--swap",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{className:"stroke",d:"M9.84631 4.78679L6.00004 8.63306L9.84631 12.4793"}),(0,t.jsx)("path",{className:"stroke",d:"M15.1537 20.1059L19 16.2596L15.1537 12.4133"}),(0,t.jsx)("line",{className:"stroke",stroke:"#333333",x1:"7",x2:"15",y1:"8.7013",y2:"8.7013"}),(0,t.jsx)("line",{className:"stroke",x1:"18",x2:"10",y1:"16.1195",y2:"16.1195"})]}),x:$t.u},Bt="btn",Ht=({children:e,icon:n,showTooltip:r,tooltip:a})=>{const i=zt[n];return(0,t.jsxs)(o.Fragment,{children:[a&&(0,t.jsx)(Ft,{className:`${Bt}__tooltip`,show:r,children:a}),(0,t.jsxs)("span",{className:`${Bt}__content`,children:[e&&(0,t.jsx)("span",{className:`${Bt}__label`,children:e}),n&&(0,t.jsxs)("span",{className:`${Bt}__icon`,children:[(0,o.isValidElement)(n)&&n,i&&(0,t.jsx)(i,{})]})]})]})},Yt=(0,o.forwardRef)(((e,n)=>{const{id:r,type:a="button",Link:o,"aria-label":s,buttonStyle:l="primary",children:c,className:u,disabled:d,el:f="button",icon:p,iconPosition:m="right",iconStyle:h="without-border",newTab:g,onClick:v,round:b,size:y="medium",to:w,tooltip:x,url:P}=e,[j,k]=i().useState(!1),S=[Bt,u&&u,l&&`${Bt}--style-${l}`,p&&`${Bt}--icon`,h&&`${Bt}--icon-style-${h}`,p&&!c&&`${Bt}--icon-only`,d&&`${Bt}--disabled`,b&&`${Bt}--round`,y&&`${Bt}--size-${y}`,m&&`${Bt}--icon-position-${m}`,x&&`${Bt}--has-tooltip`].filter(Boolean).join(" ");const C={id:r,type:a,"aria-disabled":d,"aria-label":s,className:S,disabled:d,onClick:d?void 0:function(e){k(!1),"submit"!==a&&v&&e.preventDefault(),v&&v(e)},onMouseEnter:x?()=>k(!0):void 0,onMouseLeave:x?()=>k(!1):void 0,rel:g?"noopener noreferrer":void 0,target:g?"_blank":void 0};switch(f){case"link":return o?(0,t.jsx)(o,{...C,href:w||P,to:w||P,children:(0,t.jsx)(Ht,{icon:p,showTooltip:j,tooltip:x,children:c})}):(console.error('Link is required when using el="link"',c),null);case"anchor":return(0,t.jsx)("a",{...C,href:P,ref:n,children:(0,t.jsx)(Ht,{icon:p,showTooltip:j,tooltip:x,children:c})});default:const e=f;return(0,t.jsx)(e,{ref:n,type:"submit",...C,children:(0,t.jsx)(Ht,{icon:p,showTooltip:j,tooltip:x,children:c})})}})),Vt=(0,o.createContext)({}),qt=({children:e,config:n})=>(0,t.jsx)(Vt.Provider,{value:n,children:e}),Ut=()=>(0,o.useContext)(Vt),Gt="stay-logged-in",Kt="stay-logged-in",Xt=()=>{const{refreshCookie:e}=sn(),n=(0,ht.useRouter)(),r=Ut(),{admin:{routes:{logout:a}},routes:{admin:o}}=r,{toggleModal:i}=O(),{t:s}=(0,Be.B)();return(0,t.jsx)(ce,{className:Gt,slug:Kt,children:(0,t.jsxs)("div",{className:`${Gt}__wrapper`,children:[(0,t.jsxs)("div",{className:`${Gt}__content`,children:[(0,t.jsx)("h1",{children:s("authentication:stayLoggedIn")}),(0,t.jsx)("p",{children:s("authentication:youAreInactive")})]}),(0,t.jsxs)("div",{className:`${Gt}__controls`,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:()=>{i(Kt),n.push(`${o}${a}`)},children:s("authentication:logOut")}),(0,t.jsx)(Yt,{onClick:()=>{e(),i(Kt)},children:s("authentication:stayLoggedIn")})]})]})})};function Qt(e,t){const[n,r]=(0,o.useState)(e);return(0,o.useEffect)((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n}const Jt={searchParams:{},stringifyParams:()=>""},Zt=(0,o.createContext)(Jt);function en(e){return ge().parse(e,{depth:10,ignoreQueryPrefix:!0})}const tn=({children:e})=>{const n=(0,ht.useSearchParams)().toString(),r=en(n),[a,o]=i().useState(r),s=i().useCallback((({params:e,replace:t=!1})=>ge().stringify({...t?{}:a,...e},{addQueryPrefix:!0})),[a]);return i().useEffect((()=>{o(en(n))}),[n]),(0,t.jsx)(Zt.Provider,{value:{searchParams:a,stringifyParams:s},children:e})},nn=()=>(0,o.useContext)(Zt),rn=(0,o.createContext)({}),an=2147483647,on=({children:e})=>{const{searchParams:n}=nn(),[r,a]=(0,o.useState)(),[s,l]=(0,o.useState)(),[c,u]=(0,o.useState)(),[d,f]=(0,o.useState)(),p=(0,ht.usePathname)(),m=(0,ht.useRouter)(),h=Ut(),{admin:{autoLogin:g,routes:{inactivity:v},routes:{login:b},user:y},routes:{admin:w,api:x},serverURL:P}=h,[j,k]=(0,o.useState)(),{i18n:S}=(0,Be.B)(),{closeAllModals:C,openModal:M}=O(),[_,E]=(0,o.useState)(0),D=Qt(_,1e4),N=r?.id,A=(0,o.useCallback)((()=>{if(window.location.pathname.startsWith(w)){const e=`?redirect=${encodeURIComponent(window.location.pathname)}`;m.replace(`${w}${v}${e}`)}else m.replace(`${w}${v}`);C()}),[m,w,v,C]),T=(0,o.useCallback)((()=>{l(void 0),u(void 0),f(void 0)}),[]),R=(0,o.useCallback)((e=>{const t=e?.token||e?.refreshedToken;t&&e?.exp?(l(t),u(e.exp),e.strategy&&f(e.strategy)):T()}),[T]),I=(0,o.useCallback)((e=>{const t=Math.round((new Date).getTime()/1e3);(e||c&&("number"==typeof c?c:0)-t<120)&&setTimeout((async()=>{try{const e=await mt.post(`${P}${x}/${y}/refresh-token`,{headers:{"Accept-Language":S.language}});if(200===e.status){const t=await e.json();a(t.user),R(t)}else a(null),A()}catch(e){Ct.error(e.message)}}),1e3)}),[c,P,x,y,S,A,R]),L=(0,o.useCallback)((async e=>{try{const t=await mt.post(`${P}${x}/${y}/refresh-token`,{headers:{"Accept-Language":S.language}});if(200===t.status){const n=await t.json();return e||(a(n.user),R(n)),n.user}return a(null),A(),null}catch(e){return Ct.error(`Refreshing token failed: ${e.message}`),null}}),[P,x,y,S,A,R]),$=(0,o.useCallback)((async()=>{a(null),T();try{await mt.post(`${P}${x}/${y}/logout`)}catch(e){Ct.error(`Logging out failed: ${e.message}`)}}),[P,x,y,T]),W=(0,o.useCallback)((async()=>{const e={locale:"en"};try{const t=await mt.get(`${P}${x}/access?${ge().stringify(e)}`,{headers:{"Accept-Language":S.language}});if(200!==t.status)throw new Error(`Fetching permissions failed with status code ${t.status}`);{const e=await t.json();k(e)}}catch(e){Ct.error(`Refreshing permissions failed: ${e.message}`)}}),[P,x,S,"en"]),F=i().useCallback((async()=>{try{const e=await mt.get(`${P}${x}/${y}/me`,{headers:{"Accept-Language":S.language}});if(200===e.status){const t=await e.json();if(t?.user)a(t.user),t?.token&&R(t);else if(g&&!0!==g.prefillOnly){const e=await mt.post(`${P}${x}/${y}${b}`,{body:JSON.stringify({email:g.email,password:g.password,username:g.username}),headers:{"Accept-Language":S.language,"Content-Type":"application/json"}});if(200===e.status){const t=await e.json();a(t.user),t?.token&&R(t),m.replace("string"==typeof n.redirect?n.redirect:w)}else a(null),T()}else a(null),T()}}catch(e){Ct.error(`Fetching user failed: ${e.message}`)}}),[P,x,y,S.language,g,R,m,n,w,T,d,c,b]);return(0,o.useEffect)((()=>{F()}),[F]),(0,o.useEffect)((()=>{N&&I()}),[D,I,N]),(0,o.useEffect)((()=>{E(Date.now())}),[p]),(0,o.useEffect)((()=>{let e;const t=Math.round((new Date).getTime()/1e3),n="number"==typeof c?c-t:0;return n>0&&(e=setTimeout((()=>{M(Kt)}),Math.max(Math.min(1e3*(n-60),an)))),()=>{e&&clearTimeout(e)}}),[c,M]),(0,o.useEffect)((()=>{let e;const t=Math.round((new Date).getTime()/1e3),n="number"==typeof c?c-t:0;return n>0&&(e=setTimeout((()=>{a(null),T(),A()}),Math.max(Math.min(1e3*n,an),0))),()=>{e&&clearTimeout(e)}}),[c,C,S,A,T]),(0,t.jsx)(rn.Provider,{value:{fetchFullUser:F,logOut:$,permissions:j,refreshCookie:I,refreshCookieAsync:L,refreshPermissions:W,setPermissions:k,setUser:a,token:s,user:r},children:e})},sn=()=>(0,o.useContext)(rn),ln=(0,o.createContext)({}),cn=(e,t)=>({body:JSON.stringify({value:e}),headers:{"Accept-Language":t,"Content-Type":"application/json"}}),un=({children:e})=>{const n=(0,o.useRef)({}),r=(0,o.useRef)({}),a=(0,o.useRef)({}),i=Ut(),{user:s}=sn(),{i18n:l}=(0,Be.B)(),{routes:{api:c},serverURL:u}=i;(0,o.useEffect)((()=>{s||(r.current={})}),[s]);const d=(0,o.useCallback)((async e=>{const t=r.current;if(void 0!==t[e])return t[e];const n=new Promise((t=>{(async()=>{const n=await mt.get(`${u}${c}/payload-preferences/${e}`,{headers:{"Accept-Language":l.language}});let a=null;if(200===n.status){a=(await n.json()).value}r.current[e]=a,t(a)})()}));return t[e]=n,n}),[l.language,c,r,u]),f=(0,o.useCallback)((async(e,t,n=!1)=>{if(!1===n)return r.current[e]=t,void await mt.post(`${u}${c}/payload-preferences/${e}`,cn(t,l.language));let o=t;const i=await d(e);if("object"==typeof t&&"object"==typeof i&&"object"==typeof o){if(o={...i||{},...t},pt(o,i))return;a.current[e]={...a.current[e],...o}}else{if(o===i)return;a.current[e]=o}setTimeout((()=>{(async()=>{pt(a.current[e],r.current[e])||(r.current[e]=a.current[e],await mt.post(`${u}${c}/payload-preferences/${e}`,cn(r.current[e],l.language)),delete a.current[e])})()}))}),[c,d,l.language,a,u]);return n.current.getPreference=d,n.current.setPreference=f,(0,t.jsx)(ln.Provider,{value:n.current,children:e})},dn=()=>(0,o.useContext)(ln),fn=i().createContext({navOpen:!0,navRef:null,setNavOpen:()=>{}}),pn=()=>i().useContext(fn),mn=({children:e})=>{const{breakpoints:{l:n,m:r,s:a}}=Le(),{getPreference:s}=dn(),l=(0,o.useRef)(null),[c,u]=i().useState(!1);return(0,o.useEffect)((()=>{if(!1===n){const e=async()=>{const e=await(async e=>{const t=await e("nav"),n=t?.open;return"boolean"!=typeof n||n})(s);u(e)};e()}}),[n,s,u]),(0,o.useEffect)((()=>{var e;l.current&&(c&&r?dt(l.current):(e=l.current)?(tt=tt.filter((function(t){return t.targetElement!==e})),et&&(e.ontouchstart=null,e.ontouchmove=null,nt&&0===tt.length&&(document.removeEventListener("touchmove",lt,Je?{passive:!1}:void 0),nt=!1)),et?ut():ct()):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices."))}),[c,r]),(0,o.useEffect)((()=>{!1!==n&&!1!==r&&!1!==a||u(!1)}),[n,r,a]),(0,o.useEffect)((()=>()=>{et&&(tt.forEach((function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null})),nt&&(document.removeEventListener("touchmove",lt,Je?{passive:!1}:void 0),nt=!1),rt=-1),et?ut():ct(),tt=[]}),[]),(0,t.jsx)(fn.Provider,{value:{navOpen:c,navRef:l,setNavOpen:u},children:e})},hn=()=>(0,o.useContext)(gn),gn=(0,o.createContext)({}),vn=({children:e})=>{const[n,r]=(0,o.useState)([]);return(0,t.jsx)(gn.Provider,{value:{setStepNav:r,stepNav:n},children:e})},bn=(0,o.createContext)({}),yn=({children:e,componentMap:n})=>{const r=(0,o.useCallback)((({collectionSlug:e,globalSlug:t,path:r})=>{let a;return e&&(a=n.collections[e].fieldMap),t&&(a=n.globals[t].fieldMap),a.find((e=>"name"in e&&e.name===r))}),[n]),a=(0,o.useCallback)((({collectionSlug:e,globalSlug:t})=>e?n.collections[e].fieldMap:t?n.globals[t].fieldMap:[]),[n]),i=(0,o.useCallback)((({collectionSlug:e,globalSlug:t})=>e?n.collections[e]:t?n.globals[t]:{}),[n]);return(0,t.jsx)(bn.Provider,{value:{componentMap:n,getComponentMap:i,getFieldMap:a,getMappedFieldByPath:r},children:e})},wn=()=>(0,o.useContext)(bn),xn=(0,o.createContext)({actions:[],setViewActions:()=>{}}),Pn=()=>(0,o.useContext)(xn),jn=({children:e})=>{const[n,r]=(0,o.useState)([]),[a,i]=(0,o.useState)([]),{componentMap:{actions:s}}=wn();(0,o.useEffect)((()=>{i(s||[])}),[s]);const l=[...n||[],...a||[]];return(0,t.jsx)(xn.Provider,{value:{actions:l,setViewActions:r},children:e})},kn=i().createContext({addClientFunction:()=>null,removeClientFunction:()=>null}),Sn=i().createContext({}),Cn=({children:e})=>{const[n,r]=i().useState({}),a=i().useCallback((e=>{r((t=>{const n={...t};return n[e.key]=e.func,n}))}),[]),o=i().useCallback((e=>{r((t=>{const n={...t};return delete n[e.key],n}))}),[]);return(0,t.jsx)(kn.Provider,{value:{addClientFunction:a,removeClientFunction:o},children:(0,t.jsx)(Sn.Provider,{value:n,children:e})})},Mn=(0,o.createContext)({mostRecentUpdate:null,reportUpdate:e=>null}),_n=({children:e})=>{const[n,r]=(0,o.useState)(null);return(0,t.jsx)(Mn.Provider,{value:{mostRecentUpdate:n,reportUpdate:r},children:e})},On=()=>(0,o.useContext)(Mn);var En=n(49529),Dn=n.n(En);const Nn=Dn().default||Dn(),An="banner",Tn=({type:e="default",alignIcon:n="right",children:r,className:a,icon:o,onClick:s,to:l})=>{const c=[An,`${An}--type-${e}`,a&&a,l&&`${An}--has-link`,(l||s)&&`${An}--has-action`,o&&`${An}--has-icon`,o&&`${An}--align-icon-${n}`].filter(Boolean).join(" ");let u="div";return s&&!l&&(u="button"),l&&(u=Nn),(0,t.jsxs)(u,{className:c,href:l||null,onClick:s,children:[o&&"left"===n&&(0,t.jsx)(i().Fragment,{children:o}),(0,t.jsx)("span",{className:`${An}__content`,children:r}),o&&"right"===n&&(0,t.jsx)(i().Fragment,{children:o})]})};const Rn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function In(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Ln(e){return"nodeType"in e}function $n(e){var t,n;return e?In(e)?e:Ln(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Wn(e){const{Document:t}=$n(e);return e instanceof t}function Fn(e){return!In(e)&&e instanceof $n(e).HTMLElement}function zn(e){return e instanceof $n(e).SVGElement}function Bn(e){return e?In(e)?e.document:Ln(e)?Wn(e)?e:Fn(e)||zn(e)?e.ownerDocument:document:document:document}const Hn=Rn?o.useLayoutEffect:o.useEffect;function Yn(e){const t=(0,o.useRef)(e);return Hn((()=>{t.current=e})),(0,o.useCallback)((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Vn(e,t){void 0===t&&(t=[e]);const n=(0,o.useRef)(e);return Hn((()=>{n.current!==e&&(n.current=e)}),t),n}function qn(e,t){const n=(0,o.useRef)();return(0,o.useMemo)((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function Un(e){const t=Yn(e),n=(0,o.useRef)(null),r=(0,o.useCallback)((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function Gn(e){const t=(0,o.useRef)();return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}let Kn={};function Xn(e,t){return(0,o.useMemo)((()=>{if(t)return t;const n=null==Kn[e]?0:Kn[e]+1;return Kn[e]=n,e+"-"+n}),[e,t])}function Qn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,a]of r){const r=t[n];null!=r&&(t[n]=r+e*a)}return t}),{...t})}}const Jn=Qn(1),Zn=Qn(-1);function er(e){if(!e)return!1;const{KeyboardEvent:t}=$n(e.target);return t&&e instanceof t}function tr(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=$n(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const nr=Object.freeze({Translate:{toString(e){if(!e)return;const{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;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[nr.Translate.toString(e),nr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),rr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ar(e){return e.matches(rr)?e:e.querySelector(rr)}const or={display:"none"};function ir(e){let{id:t,value:n}=e;return i().createElement("div",{id:t,style:or},n)}function sr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return i().createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const lr=(0,o.createContext)(null);const cr={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ur={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function dr(e){let{announcements:t=ur,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=cr}=e;const{announce:l,announcement:c}=function(){const[e,t]=(0,o.useState)("");return{announce:(0,o.useCallback)((e=>{null!=e&&t(e)}),[]),announcement:e}}(),u=Xn("DndLiveRegion"),[d,f]=(0,o.useState)(!1);if((0,o.useEffect)((()=>{f(!0)}),[]),function(e){const t=(0,o.useContext)(lr);(0,o.useEffect)((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}((0,o.useMemo)((()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}})),[l,t])),!d)return null;const p=i().createElement(i().Fragment,null,i().createElement(ir,{id:r,value:a.draggable}),i().createElement(sr,{id:u,announcement:c}));return n?(0,s.createPortal)(p,n):p}var fr;function pr(){}function mr(e,t){return(0,o.useMemo)((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(fr||(fr={}));const hr=Object.freeze({x:0,y:0});function gr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function br(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function yr(e){let{left:t,top:n,height:r,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+r},{x:t+a,y:n+r}]}function wr(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function xr(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Pr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=xr(t,t.left,t.top),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=gr(xr(r),a);o.push({id:t,data:{droppableContainer:e,value:n}})}}return o.sort(vr)};function jr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=a-r,s=o-n;if(r<a&&n<o){const n=t.width*t.height,r=e.width*e.height,a=i*s;return Number((a/(n+r-a)).toFixed(4))}return 0}const kr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const e of r){const{id:r}=e,o=n.get(r);if(o){const n=jr(o,t);n>0&&a.push({id:r,data:{droppableContainer:e,value:n}})}}return a.sort(br)};function Sr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:hr}function Cr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Mr=Cr(1);function _r(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const Or={ignoreTransform:!1};function Er(e,t){void 0===t&&(t=Or);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=$n(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=_r(t);if(!r)return e;const{scaleX:a,scaleY:o,x:i,y:s}=r,l=e.left-i-(1-a)*parseFloat(n),c=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?e.width/a:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}(n,t,r))}const{top:r,left:a,width:o,height:i,bottom:s,right:l}=n;return{top:r,left:a,width:o,height:i,bottom:s,right:l}}function Dr(e){return Er(e,{ignoreTransform:!0})}function Nr(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(Wn(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Fn(a)||zn(a))return n;if(n.includes(a))return n;const o=$n(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=$n(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(a,o)&&n.push(a),function(e,t){return void 0===t&&(t=$n(e).getComputedStyle(e)),"fixed"===t.position}(a,o)?n:r(a.parentNode)}(e):n}function Ar(e){const[t]=Nr(e,1);return null!=t?t:null}function Tr(e){return Rn&&e?In(e)?e:Ln(e)?Wn(e)||e===Bn(e).scrollingElement?window:Fn(e)?e:null:null:null}function Rr(e){return In(e)?e.scrollX:e.scrollLeft}function Ir(e){return In(e)?e.scrollY:e.scrollTop}function Lr(e){return{x:Rr(e),y:Ir(e)}}var $r;function Wr(e){return!(!Rn||!e)&&e===document.scrollingElement}function Fr(e){const t={x:0,y:0},n=Wr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}($r||($r={}));const zr={x:.2,y:.2};function Br(e,t,n,r,a){let{top:o,left:i,right:s,bottom:l}=n;void 0===r&&(r=10),void 0===a&&(a=zr);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=Fr(e),p={x:0,y:0},m={x:0,y:0},h=t.height*a.y,g=t.width*a.x;return!c&&o<=t.top+h?(p.y=$r.Backward,m.y=r*Math.abs((t.top+h-o)/h)):!u&&l>=t.bottom-h&&(p.y=$r.Forward,m.y=r*Math.abs((t.bottom-h-l)/h)),!f&&s>=t.right-g?(p.x=$r.Forward,m.x=r*Math.abs((t.right-g-s)/g)):!d&&i<=t.left+g&&(p.x=$r.Backward,m.x=r*Math.abs((t.left+g-i)/g)),{direction:p,speed:m}}function Hr(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Yr(e){return e.reduce(((e,t)=>Jn(e,Lr(t))),hr)}function Vr(e,t){if(void 0===t&&(t=Er),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);Ar(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const qr=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Rr(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Ir(t)),0)}]];class Ur{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Nr(t),r=Yr(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,a]of qr)for(const o of t)Object.defineProperty(this,o,{get:()=>{const t=a(n),i=r[e]-t;return this.rect[o]+i},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Kr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Xr,Qr;function Jr(e){e.preventDefault()}function Zr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Xr||(Xr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(Qr||(Qr={}));const ea={start:[Qr.Space,Qr.Enter],cancel:[Qr.Esc],end:[Qr.Space,Qr.Enter]},ta=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Qr.Right:return{...n,x:n.x+25};case Qr.Left:return{...n,x:n.x-25};case Qr.Down:return{...n,y:n.y+25};case Qr.Up:return{...n,y:n.y-25}}};class na{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Gr(Bn(t)),this.windowListeners=new Gr($n(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Xr.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Vr(n),t(hr)}handleKeyDown(e){if(er(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=ea,coordinateGetter:o=ta,scrollBehavior:i="smooth"}=r,{code:s}=e;if(a.end.includes(s))return void this.handleEnd(e);if(a.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:hr;this.referenceCoordinates||(this.referenceCoordinates=c);const u=o(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=Zn(u,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:o,isRight:s,isLeft:l,isBottom:c,maxScroll:d,minScroll:f}=Fr(n),p=Hr(n),m={x:Math.min(a===Qr.Right?p.right-p.width/2:p.right,Math.max(a===Qr.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(a===Qr.Down?p.bottom-p.height/2:p.bottom,Math.max(a===Qr.Down?p.top:p.top+p.height/2,u.y))},h=a===Qr.Right&&!s||a===Qr.Left&&!l,g=a===Qr.Down&&!c||a===Qr.Up&&!o;if(h&&m.x!==u.x){const e=n.scrollLeft+t.x,o=a===Qr.Right&&e<=d.x||a===Qr.Left&&e>=f.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:i});r.x=o?n.scrollLeft-e:a===Qr.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:i});break}if(g&&m.y!==u.y){const e=n.scrollTop+t.y,o=a===Qr.Down&&e<=d.y||a===Qr.Up&&e>=f.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:i});r.y=o?n.scrollTop-e:a===Qr.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:i});break}}this.handleMove(e,Jn(Zn(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ra(e){return Boolean(e&&"distance"in e)}function aa(e){return Boolean(e&&"delay"in e)}na.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ea,onActivation:a}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class oa{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=$n(e);return e instanceof t?e:Bn(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:o}=a;this.props=e,this.events=t,this.document=Bn(o),this.documentListeners=new Gr(this.document),this.listeners=new Gr(n),this.windowListeners=new Gr($n(o)),this.initialCoordinates=null!=(r=tr(a))?r:hr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.DragStart,Jr),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),this.windowListeners.add(Xr.ContextMenu,Jr),this.documentListeners.add(Xr.Keydown,this.handleKeydown),t){if(ra(t))return;if(aa(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Xr.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:o,options:{activationConstraint:i}}=a;if(!r)return;const s=null!=(t=tr(e))?t:hr,l=Zn(r,s);if(!n&&i){if(aa(i))return Kr(l,i.tolerance)?this.handleCancel():void 0;if(ra(i))return null!=i.tolerance&&Kr(l,i.tolerance)?this.handleCancel():Kr(l,i.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),o(s)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Qr.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const ia={move:{name:"pointermove"},end:{name:"pointerup"}};class sa extends oa{constructor(e){const{event:t}=e,n=Bn(t.target);super(e,ia,n)}}sa.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const la={move:{name:"mousemove"},end:{name:"mouseup"}};var ca;!function(e){e[e.RightClick=2]="RightClick"}(ca||(ca={}));(class extends oa{constructor(e){super(e,la,Bn(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==ca.RightClick&&(null==r||r({event:n}),!0)}}];const ua={move:{name:"touchmove"},end:{name:"touchend"}};var da,fa;function pa(e){let{acceleration:t,activator:n=da.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:s=5,order:l=fa.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=Gn(t);return qn((e=>{if(n||!r||!e)return ma;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[$r.Backward]:e.x[$r.Backward]||-1===a.x,[$r.Forward]:e.x[$r.Forward]||1===a.x},y:{[$r.Backward]:e.y[$r.Backward]||-1===a.y,[$r.Forward]:e.y[$r.Forward]||1===a.y}}}),[n,t,r])}({delta:f,disabled:!i}),[h,g]=function(){const e=(0,o.useRef)(null);return[(0,o.useCallback)(((t,n)=>{e.current=setInterval(t,n)}),[]),(0,o.useCallback)((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),v=(0,o.useRef)({x:0,y:0}),b=(0,o.useRef)({x:0,y:0}),y=(0,o.useMemo)((()=>{switch(n){case da.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case da.DraggableRect:return a}}),[n,a,c]),w=(0,o.useRef)(null),x=(0,o.useCallback)((()=>{const e=w.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)}),[]),P=(0,o.useMemo)((()=>l===fa.TreeOrder?[...u].reverse():u),[l,u]);(0,o.useEffect)((()=>{if(i&&u.length&&y){for(const e of P){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),a=d[n];if(!a)continue;const{direction:o,speed:i}=Br(e,a,y,t,p);for(const e of["x","y"])m[e][o[e]]||(i[e]=0,o[e]=0);if(i.x>0||i.y>0)return g(),w.current=e,h(x,s),v.current=i,void(b.current=o)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()}),[t,x,r,g,i,s,JSON.stringify(y),JSON.stringify(m),h,u,P,d,JSON.stringify(p)])}(class extends oa{constructor(e){super(e,ua)}static setup(){return window.addEventListener(ua.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ua.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(da||(da={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(fa||(fa={}));const ma={x:{[$r.Backward]:!1,[$r.Forward]:!1},y:{[$r.Backward]:!1,[$r.Forward]:!1}};var ha,ga;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(ha||(ha={})),function(e){e.Optimized="optimized"}(ga||(ga={}));const va=new Map;function ba(e,t){return qn((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function ya(e){let{callback:t,disabled:n}=e;const r=Yn(t),a=(0,o.useMemo)((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return(0,o.useEffect)((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function wa(e){return new Ur(Er(e),e)}function xa(e,t,n){void 0===t&&(t=wa);const[r,a]=(0,o.useReducer)((function(r){if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=r?r:n)?a:null;const o=t(e);if(JSON.stringify(r)===JSON.stringify(o))return r;return o}),null),i=function(e){let{callback:t,disabled:n}=e;const r=Yn(t),a=(0,o.useMemo)((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return(0,o.useEffect)((()=>()=>null==a?void 0:a.disconnect()),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ya({callback:a});return Hn((()=>{a(),e?(null==s||s.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==i||i.disconnect())}),[e]),r}const Pa=[];function ja(e,t){void 0===t&&(t=[]);const n=(0,o.useRef)(null);return(0,o.useEffect)((()=>{n.current=null}),t),(0,o.useEffect)((()=>{const t=e!==hr;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?Zn(e,n.current):hr}function ka(e){return(0,o.useMemo)((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Sa=[];function Ca(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Fn(t)?t:e}const Ma=[{sensor:sa,options:{}},{sensor:na,options:{}}],_a={current:{}},Oa={draggable:{measure:Dr},droppable:{measure:Dr,strategy:ha.WhileDragging,frequency:ga.Optimized},dragOverlay:{measure:Er}};class Ea extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Da={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ea,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Oa,measureDroppableContainers:pr,windowRect:null,measuringScheduled:!1},Na={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pr,draggableNodes:new Map,over:null,measureDroppableContainers:pr},Aa=(0,o.createContext)(Na),Ta=(0,o.createContext)(Da);function Ra(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ea}}}function Ia(e,t){switch(t.type){case fr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case fr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case fr.DragEnd:case fr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case fr.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new Ea(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case fr.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ea(e.droppable.containers);return i.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case fr.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new Ea(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function La(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=(0,o.useContext)(Aa),i=Gn(r),s=Gn(null==n?void 0:n.id);return(0,o.useEffect)((()=>{if(!t&&!r&&i&&null!=s){if(!er(i))return;if(document.activeElement===i.target)return;const e=a.get(s);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=ar(e);if(t){t.focus();break}}}))}}),[r,t,a,s,i]),null}function $a(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}const Wa=(0,o.createContext)({...hr,scaleX:1,scaleY:1});var Fa;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Fa||(Fa={}));const za=(0,o.memo)((function(e){var t,n,r,a;let{id:l,accessibility:c,autoScroll:u=!0,children:d,sensors:f=Ma,collisionDetection:p=kr,measuring:m,modifiers:h,...g}=e;const v=(0,o.useReducer)(Ia,void 0,Ra),[b,y]=v,[w,x]=function(){const[e]=(0,o.useState)((()=>new Set)),t=(0,o.useCallback)((t=>(e.add(t),()=>e.delete(t))),[e]),n=(0,o.useCallback)((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]);return[n,t]}(),[P,j]=(0,o.useState)(Fa.Uninitialized),k=P===Fa.Initialized,{draggable:{active:S,nodes:C,translate:M},droppable:{containers:_}}=b,O=S?C.get(S):null,E=(0,o.useRef)({initial:null,translated:null}),D=(0,o.useMemo)((()=>{var e;return null!=S?{id:S,data:null!=(e=null==O?void 0:O.data)?e:_a,rect:E}:null}),[S,O]),N=(0,o.useRef)(null),[A,T]=(0,o.useState)(null),[R,I]=(0,o.useState)(null),L=Vn(g,Object.values(g)),$=Xn("DndDescribedBy",l),W=(0,o.useMemo)((()=>_.getEnabled()),[_]),F=function(e){return(0,o.useMemo)((()=>({draggable:{...Oa.draggable,...null==e?void 0:e.draggable},droppable:{...Oa.droppable,...null==e?void 0:e.droppable},dragOverlay:{...Oa.dragOverlay,...null==e?void 0:e.dragOverlay}})),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}(m),{droppableRects:z,measureDroppableContainers:B,measuringScheduled:H}=function(e,t){let{dragging:n,dependencies:r,config:a}=t;const[i,s]=(0,o.useState)(null),{frequency:l,measure:c,strategy:u}=a,d=(0,o.useRef)(e),f=function(){switch(u){case ha.Always:return!1;case ha.BeforeDragging:return n;default:return!n}}(),p=Vn(f),m=(0,o.useCallback)((function(e){void 0===e&&(e=[]),p.current||s((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[p]),h=(0,o.useRef)(null),g=qn((t=>{if(f&&!n)return va;if(!t||t===va||d.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Ur(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,f,c]);return(0,o.useEffect)((()=>{d.current=e}),[e]),(0,o.useEffect)((()=>{f||m()}),[n,f]),(0,o.useEffect)((()=>{i&&i.length>0&&s(null)}),[JSON.stringify(i)]),(0,o.useEffect)((()=>{f||"number"!=typeof l||null!==h.current||(h.current=setTimeout((()=>{m(),h.current=null}),l))}),[l,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:null!=i}}(W,{dragging:k,dependencies:[M.x,M.y],config:F.droppable}),Y=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return qn((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(C,S),V=(0,o.useMemo)((()=>R?tr(R):null),[R]),q=function(){const e=!1===(null==A?void 0:A.autoScrollEnabled),t="object"==typeof u?!1===u.enabled:!1===u,n=k&&!e&&!t;if("object"==typeof u)return{...u,enabled:n};return{enabled:n}}(),U=function(e,t){return ba(e,t)}(Y,F.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const i=(0,o.useRef)(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;Hn((()=>{if(!s&&!l||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const a=Sr(n(e),r);if(s||(a.x=0),l||(a.y=0),i.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){const t=Ar(e);t&&t.scrollBy({top:a.y,left:a.x})}}),[t,s,l,r,n])}({activeNode:S?C.get(S):null,config:q.layoutShiftCompensation,initialRect:U,measure:F.draggable.measure});const G=xa(Y,F.draggable.measure,U),K=xa(Y?Y.parentElement:null),X=(0,o.useRef)({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Q=_.getNodeFor(null==(t=X.current.over)?void 0:t.id),J=function(e){let{measure:t}=e;const[n,r]=(0,o.useState)(null),a=ya({callback:(0,o.useCallback)((e=>{for(const{target:n}of e)if(Fn(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t])}),i=(0,o.useCallback)((e=>{const n=Ca(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),r(n?t(n):null)}),[t,a]),[s,l]=Un(i);return(0,o.useMemo)((()=>({nodeRef:s,rect:n,setRef:l})),[n,s,l])}({measure:F.dragOverlay.measure}),Z=null!=(n=J.nodeRef.current)?n:Y,ee=k?null!=(r=J.rect)?r:G:null,te=Boolean(J.nodeRef.current&&J.rect),ne=Sr(re=te?null:G,ba(re));var re;const ae=ka(Z?$n(Z):null),oe=function(e){const t=(0,o.useRef)(e),n=qn((n=>e?n&&n!==Pa&&e&&t.current&&e.parentNode===t.current.parentNode?n:Nr(e):Pa),[e]);return(0,o.useEffect)((()=>{t.current=e}),[e]),n}(k?null!=Q?Q:Y:null),ie=function(e,t){void 0===t&&(t=Er);const[n]=e,r=ka(n?$n(n):null),[a,i]=(0,o.useReducer)((function(){return e.length?e.map((e=>Wr(e)?r:new Ur(t(e),e))):Sa}),Sa),s=ya({callback:i});return e.length>0&&a===Sa&&i(),Hn((()=>{e.length?e.forEach((e=>null==s?void 0:s.observe(e))):(null==s||s.disconnect(),i())}),[e]),a}(oe),se=$a(h,{transform:{x:M.x-ne.x,y:M.y-ne.y,scaleX:1,scaleY:1},activatorEvent:R,active:D,activeNodeRect:G,containerNodeRect:K,draggingNodeRect:ee,over:X.current.over,overlayNodeRect:J.rect,scrollableAncestors:oe,scrollableAncestorRects:ie,windowRect:ae}),le=V?Jn(V,M):null,ce=function(e){const[t,n]=(0,o.useState)(null),r=(0,o.useRef)(e),a=(0,o.useCallback)((e=>{const t=Tr(e.target);t&&n((e=>e?(e.set(t,Lr(t)),new Map(e)):null))}),[]);return(0,o.useEffect)((()=>{const t=r.current;if(e!==t){o(t);const i=e.map((e=>{const t=Tr(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Lr(t)]):null})).filter((e=>null!=e));n(i.length?new Map(i):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach((e=>{const t=Tr(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),(0,o.useMemo)((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>Jn(e,t)),hr):Yr(e):hr),[e,t])}(oe),ue=ja(ce),de=ja(ce,[G]),fe=Jn(se,ue),pe=ee?Mr(ee,se):null,me=D&&pe?p({active:D,collisionRect:pe,droppableRects:z,droppableContainers:W,pointerCoordinates:le}):null,he=wr(me,"id"),[ge,ve]=(0,o.useState)(null),be=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?se:Jn(se,de),null!=(a=null==ge?void 0:ge.rect)?a:null,G),ye=(0,o.useCallback)(((e,t)=>{let{sensor:n,options:r}=t;if(null==N.current)return;const a=C.get(N.current);if(!a)return;const o=e.nativeEvent,i=new n({active:N.current,activeNode:a,event:o,options:r,context:X,onStart(e){const t=N.current;if(null==t)return;const n=C.get(t);if(!n)return;const{onDragStart:r}=L.current,a={active:{id:t,data:n.data,rect:E}};(0,s.unstable_batchedUpdates)((()=>{null==r||r(a),j(Fa.Initializing),y({type:fr.DragStart,initialCoordinates:e,active:t}),w({type:"onDragStart",event:a})}))},onMove(e){y({type:fr.DragMove,coordinates:e})},onEnd:l(fr.DragEnd),onCancel:l(fr.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:a}=X.current;let i=null;if(t&&a){const{cancelDrop:s}=L.current;if(i={activatorEvent:o,active:t,collisions:n,delta:a,over:r},e===fr.DragEnd&&"function"==typeof s){await Promise.resolve(s(i))&&(e=fr.DragCancel)}}N.current=null,(0,s.unstable_batchedUpdates)((()=>{y({type:e}),j(Fa.Uninitialized),ve(null),T(null),I(null);const t=e===fr.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=L.current[t];null==e||e(i),w({type:t,event:i})}}))}}(0,s.unstable_batchedUpdates)((()=>{T(i),I(e.nativeEvent)}))}),[C]),we=(0,o.useCallback)(((e,t)=>(n,r)=>{const a=n.nativeEvent,o=C.get(r);if(null!==N.current||!o||a.dndKit||a.defaultPrevented)return;const i={active:o};!0===e(n,t.options,i)&&(a.dndKit={capturedBy:t.sensor},N.current=r,ye(n,t))}),[C,ye]),xe=function(e,t){return(0,o.useMemo)((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(f,we);!function(e){(0,o.useEffect)((()=>{if(!Rn)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(f),Hn((()=>{G&&P===Fa.Initializing&&j(Fa.Initialized)}),[G,P]),(0,o.useEffect)((()=>{const{onDragMove:e}=L.current,{active:t,activatorEvent:n,collisions:r,over:a}=X.current;if(!t||!n)return;const o={active:t,activatorEvent:n,collisions:r,delta:{x:fe.x,y:fe.y},over:a};(0,s.unstable_batchedUpdates)((()=>{null==e||e(o),w({type:"onDragMove",event:o})}))}),[fe.x,fe.y]),(0,o.useEffect)((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:a}=X.current;if(!e||null==N.current||!t||!a)return;const{onDragOver:o}=L.current,i=r.get(he),l=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:l};(0,s.unstable_batchedUpdates)((()=>{ve(l),null==o||o(c),w({type:"onDragOver",event:c})}))}),[he]),Hn((()=>{X.current={activatorEvent:R,active:D,activeNode:Y,collisionRect:pe,collisions:me,droppableRects:z,draggableNodes:C,draggingNode:Z,draggingNodeRect:ee,droppableContainers:_,over:ge,scrollableAncestors:oe,scrollAdjustedTranslate:fe},E.current={initial:ee,translated:pe}}),[D,Y,me,pe,C,Z,ee,z,_,ge,oe,fe]),pa({...q,delta:M,draggingRect:pe,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:ie});const Pe=(0,o.useMemo)((()=>({active:D,activeNode:Y,activeNodeRect:G,activatorEvent:R,collisions:me,containerNodeRect:K,dragOverlay:J,draggableNodes:C,droppableContainers:_,droppableRects:z,over:ge,measureDroppableContainers:B,scrollableAncestors:oe,scrollableAncestorRects:ie,measuringConfiguration:F,measuringScheduled:H,windowRect:ae})),[D,Y,G,R,me,K,J,C,_,z,ge,B,oe,ie,F,H,ae]),je=(0,o.useMemo)((()=>({activatorEvent:R,activators:xe,active:D,activeNodeRect:G,ariaDescribedById:{draggable:$},dispatch:y,draggableNodes:C,over:ge,measureDroppableContainers:B})),[R,xe,D,G,y,$,C,ge,B]);return i().createElement(lr.Provider,{value:x},i().createElement(Aa.Provider,{value:je},i().createElement(Ta.Provider,{value:Pe},i().createElement(Wa.Provider,{value:be},d)),i().createElement(La,{disabled:!1===(null==c?void 0:c.restoreFocus)})),i().createElement(dr,{...c,hiddenTextDescribedById:$}))})),Ba=(0,o.createContext)(null),Ha="button",Ya="Droppable";function Va(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const i=Xn(Ya),{activators:s,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,o.useContext)(Aa),{role:m=Ha,roleDescription:h="draggable",tabIndex:g=0}=null!=a?a:{},v=(null==c?void 0:c.id)===t,b=(0,o.useContext)(v?Wa:Ba),[y,w]=Un(),[x,P]=Un(),j=function(e,t){return(0,o.useMemo)((()=>e.reduce(((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e}),{})),[e,t])}(s,t),k=Vn(n);Hn((()=>(f.set(t,{id:t,key:i,node:y,activatorNode:x,data:k}),()=>{const e=f.get(t);e&&e.key===i&&f.delete(t)})),[f,t]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:(0,o.useMemo)((()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":!(!v||m!==Ha)||void 0,"aria-roledescription":h,"aria-describedby":d.draggable})),[r,m,g,v,h,d.draggable]),isDragging:v,listeners:r?void 0:j,node:y,over:p,setNodeRef:w,setActivatorNodeRef:P,transform:b}}function qa(){return(0,o.useContext)(Ta)}const Ua="Droppable",Ga={timeout:25};function Ka(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const i=Xn(Ua),{active:s,dispatch:l,over:c,measureDroppableContainers:u}=(0,o.useContext)(Aa),d=(0,o.useRef)({disabled:n}),f=(0,o.useRef)(!1),p=(0,o.useRef)(null),m=(0,o.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Ga,...a},b=Vn(null!=g?g:r),y=ya({callback:(0,o.useCallback)((()=>{f.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null}),v)):f.current=!0}),[v]),disabled:h||!s}),w=(0,o.useCallback)(((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))}),[y]),[x,P]=Un(w),j=Vn(t);return(0,o.useEffect)((()=>{y&&x.current&&(y.disconnect(),f.current=!1,y.observe(x.current))}),[x,y]),Hn((()=>(l({type:fr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:x,rect:p,data:j}}),()=>l({type:fr.UnregisterDroppable,key:i,id:r}))),[r]),(0,o.useEffect)((()=>{n!==d.current.disabled&&(l({type:fr.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)}),[r,i,n,l]),{active:s,rect:p,isOver:(null==c?void 0:c.id)===r,node:x,over:c,setNodeRef:P}}function Xa(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Qa(e,t){return e.reduce(((e,n,r)=>{const a=t.get(n);return a&&(e[r]=a),e}),Array(e.length))}function Ja(e){return null!==e&&e>=0}const Za=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=Xa(t,r,n),i=t[a],s=o[a];return s&&i?{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}:null};const eo="Sortable",to=i().createContext({activeIndex:-1,containerId:eo,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Za,disabled:{draggable:!1,droppable:!1}});function no(e){let{children:t,id:n,items:r,strategy:a=Za,disabled:s=!1}=e;const{active:l,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:f}=qa(),p=Xn(eo,n),m=Boolean(null!==c.rect),h=(0,o.useMemo)((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),g=null!=l,v=l?h.indexOf(l.id):-1,b=d?h.indexOf(d.id):-1,y=(0,o.useRef)(h),w=!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}(h,y.current),x=-1!==b&&-1===v||w,P=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(s);Hn((()=>{w&&g&&f(h)}),[w,h,g,f]),(0,o.useEffect)((()=>{y.current=h}),[h]);const j=(0,o.useMemo)((()=>({activeIndex:v,containerId:p,disabled:P,disableTransforms:x,items:h,overIndex:b,useDragOverlay:m,sortedRects:Qa(h,u),strategy:a})),[v,p,P.draggable,P.droppable,x,h,b,u,m,a]);return i().createElement(to.Provider,{value:j},t)}const ro=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return Xa(n,r,a).indexOf(t)},ao=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:i,previousItems:s,previousContainerId:l,transition:c}=e;return!(!c||!r)&&((s===o||a!==i)&&(!!n||i!==a&&t===l))},oo={duration:200,easing:"ease"},io="transform",so=nr.Transition.toString({property:io,duration:0,easing:"linear"}),lo={roleDescription:"sortable"};function co(e){let{animateLayoutChanges:t=ao,attributes:n,disabled:r,data:a,getNewIndex:i=ro,id:s,strategy:l,resizeObserverConfig:c,transition:u=oo}=e;const{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:b,strategy:y}=(0,o.useContext)(to),w=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,m),x=d.indexOf(s),P=(0,o.useMemo)((()=>({sortable:{containerId:f,index:x,items:d},...a})),[f,a,x,d]),j=(0,o.useMemo)((()=>d.slice(d.indexOf(s))),[d,s]),{rect:k,node:S,isOver:C,setNodeRef:M}=Ka({id:s,data:P,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:_,activatorEvent:O,activeNodeRect:E,attributes:D,setNodeRef:N,listeners:A,isDragging:T,over:R,setActivatorNodeRef:I,transform:L}=Va({id:s,data:P,attributes:{...lo,...n},disabled:w.draggable}),$=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.useMemo)((()=>e=>{t.forEach((t=>t(e)))}),t)}(M,N),W=Boolean(_),F=W&&!h&&Ja(p)&&Ja(v),z=!b&&T,B=z&&F?L:null,H=F?null!=B?B:(null!=l?l:y)({rects:g,activeNodeRect:E,activeIndex:p,overIndex:v,index:x}):null,Y=Ja(p)&&Ja(v)?i({id:s,items:d,activeIndex:p,overIndex:v}):x,V=null==_?void 0:_.id,q=(0,o.useRef)({activeId:V,items:d,newIndex:Y,containerId:f}),U=d!==q.current.items,G=t({active:_,containerId:f,isDragging:T,isSorting:W,id:s,index:x,items:d,newIndex:q.current.newIndex,previousItems:q.current.items,previousContainerId:q.current.containerId,transition:u,wasDragging:null!=q.current.activeId}),K=function(e){let{disabled:t,index:n,node:r,rect:a}=e;const[i,s]=(0,o.useState)(null),l=(0,o.useRef)(n);return Hn((()=>{if(!t&&n!==l.current&&r.current){const e=a.current;if(e){const t=Er(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==l.current&&(l.current=n)}),[t,n,r,a]),(0,o.useEffect)((()=>{i&&s(null)}),[i]),i}({disabled:!G,index:x,node:S,rect:k});return(0,o.useEffect)((()=>{W&&q.current.newIndex!==Y&&(q.current.newIndex=Y),f!==q.current.containerId&&(q.current.containerId=f),d!==q.current.items&&(q.current.items=d)}),[W,Y,f,d]),(0,o.useEffect)((()=>{if(V===q.current.activeId)return;if(V&&!q.current.activeId)return void(q.current.activeId=V);const e=setTimeout((()=>{q.current.activeId=V}),50);return()=>clearTimeout(e)}),[V]),{active:_,activeIndex:p,attributes:D,data:P,rect:k,index:x,newIndex:Y,items:d,isOver:C,isSorting:W,isDragging:T,listeners:A,node:S,overIndex:v,over:R,setNodeRef:$,setActivatorNodeRef:I,setDroppableNodeRef:M,setDraggableNodeRef:N,transform:null!=K?K:H,transition:function(){if(K||U&&q.current.newIndex===x)return so;if(z&&!er(O)||!u)return;if(W||G)return nr.Transition.toString({...u,property:io});return}()}}function uo(e){if(!e)return!1;const 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)}const fo=[Qr.Down,Qr.Right,Qr.Up,Qr.Left],po=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:o,over:i,scrollableAncestors:s}}=t;if(fo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];o.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const o=a.get(n.id);if(o)switch(e.code){case Qr.Down:r.top<o.top&&t.push(n);break;case Qr.Up:r.top>o.top&&t.push(n);break;case Qr.Left:r.left>o.left&&t.push(n);break;case Qr.Right:r.left<o.left&&t.push(n)}}));const l=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=yr(t),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=yr(r),i=a.reduce(((e,t,r)=>e+gr(n[r],t)),0),s=Number((i/4).toFixed(4));o.push({id:t,data:{droppableContainer:e,value:s}})}}return o.sort(vr)})({active:n,collisionRect:r,droppableRects:a,droppableContainers:t,pointerCoordinates:null});let c=wr(l,"id");if(c===(null==i?void 0:i.id)&&l.length>1&&(c=l[1].id),null!=c){const e=o.get(n.id),t=o.get(c),i=t?a.get(t.id):null,l=null==t?void 0:t.node.current;if(l&&i&&e&&t){const n=Nr(l).some(((e,t)=>s[t]!==e)),a=mo(e,t),o=function(e,t){if(!uo(e)||!uo(t))return!1;if(!mo(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!a?{x:0,y:0}:{x:o?r.width-i.width:0,y:o?r.height-i.height:0},u={x:i.left,y:i.top};return c.x&&c.y?u:Zn(u,c)}}}};function mo(e,t){return!(!uo(e)||!uo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const ho=e=>{const{id:t,disabled:n}=e,{attributes:r,isDragging:a,listeners:o,setNodeRef:i,transform:s}=co({id:t,disabled:n});return{attributes:{...r,style:{cursor:a?"grabbing":"grab"}},isDragging:a,listeners:o,setNodeRef:i,transform:s&&`translate3d(${s.x}px, ${s.y}px, 0)`}},go=e=>{const{id:n,children:r,disabled:a}=e,{attributes:i,isDragging:s,listeners:l,setNodeRef:c,transform:u}=ho({id:n,disabled:a});return(0,t.jsx)(o.Fragment,{children:r({attributes:{...i,style:{cursor:s?"grabbing":"grab"}},listeners:l,setNodeRef:c,transform:u})})},vo=e=>{const{children:n,className:r,ids:a,onDragEnd:i}=e,s=(0,o.useId)(),{setNodeRef:l}=Ka({id:s}),c=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.useMemo)((()=>[...t].filter((e=>null!=e))),[...t])}(mr(sa,{activationConstraint:{distance:5}}),mr(na,{coordinateGetter:po})),u=(0,o.useCallback)((e=>{const{active:t,over:n}=e;t&&n&&"function"==typeof i&&i({event:e,moveFromIndex:a.findIndex((e=>e===t.id)),moveToIndex:a.findIndex((e=>e===n.id))})}),[i,a]);return(0,t.jsx)(za,{collisionDetection:Pr,id:s,onDragEnd:u,sensors:c,children:(0,t.jsx)(no,{items:a,children:(0,t.jsx)("div",{className:r,ref:l,children:n})})})},bo="error-pill",yo=e=>{const{className:n,count:r,i18n:a,withMessage:o}=e,i=[bo,!o&&r<99&&`${bo}--fixed-width`,n&&n].filter(Boolean).join(" ");return 0===r?null:(0,t.jsx)("div",{className:i,children:(0,t.jsxs)("div",{className:`${bo}__content`,children:[(0,t.jsx)("span",{className:`${bo}__count`,children:r}),o&&` ${r>1?a.t("general:errors"):a.t("general:error")}`]})})},wo=i().createContext({type:void 0,custom:{},indexPath:void 0,path:void 0,permissions:{},readOnly:!1,schemaPath:void 0,siblingPermissions:{}}),xo=({type:e,children:n,custom:r,indexPath:a,path:o,permissions:i,readOnly:s,schemaPath:l,siblingPermissions:c})=>(0,t.jsx)(wo.Provider,{value:{type:e,custom:r,indexPath:a,path:o,permissions:i,readOnly:s,schemaPath:l,siblingPermissions:c},children:n}),Po=()=>i().useContext(wo);var jo=n(61060);const ko=Symbol(),So=Symbol(),Co="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?o.useEffect:o.useLayoutEffect,Mo=jo.unstable_runWithPriority?e=>{try{(0,jo.unstable_runWithPriority)(jo.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e(),_o=e=>e;function Oo(e,t){const n=(0,o.useContext)(e)[ko];const{v:{current:r},n:{current:a},l:i}=n,s=t(r),[l,c]=(0,o.useReducer)(((e,n)=>{if(!n)return[r,s];if("p"in n)throw n.p;if(n.n===a)return Object.is(e[1],s)?e:[r,s];try{if("v"in n){if(Object.is(e[0],n.v))return e;const r=t(n.v);return Object.is(e[1],r)?e:[n.v,r]}}catch(e){}return[...e]}),[r,s]);return Object.is(l[1],s)||c(),Co((()=>(i.add(c),()=>{i.delete(c)})),[i]),l[1]}const Eo=(0,o.createContext)({}),Do=(0,o.createContext)({}),No=(0,o.createContext)(!1),Ao=(0,o.createContext)(!1),To=(0,o.createContext)(!1),Ro=(0,o.createContext)(!1),Io=function(e){const t=(0,o.createContext)({[ko]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[So]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=(0,o.useRef)(e),a=(0,o.useRef)(0),[i,s]=(0,o.useState)(null);i&&(i(e),s(null));const l=(0,o.useRef)();if(!l.current){const e=new Set,t=(t,n)=>{a.current+=1;const r={n:a.current};(null==n?void 0:n.suspense)&&(r.n*=-1,r.p=new Promise((e=>{s((()=>t=>{r.v=t,delete r.p,e(t)}))}))),e.forEach((e=>e(r))),t()};l.current={[ko]:{v:r,n:a,l:e,u:t}}}return Co((()=>{r.current=e,a.current+=1,Mo((()=>{l.current[ko].l.forEach((t=>{t({n:a.current,v:e})}))}))}),[e]),(0,o.createElement)(n,{value:l.current},t)}),delete t.Consumer,t}([{},()=>null]),Lo=()=>(0,o.useContext)(Eo),$o=()=>(0,o.useContext)(No),Wo=()=>(0,o.useContext)(Ao),Fo=()=>(0,o.useContext)(To),zo=()=>(0,o.useContext)(Ro),Bo=e=>Oo(Io,e),Ho=()=>function(e){return Oo(e,_o)}(Io),Yo=(e,t,n=[])=>{const r=(0,o.useRef)(Date.now());(0,o.useEffect)((()=>{const n=setTimeout((()=>{Date.now()-r.current>=t&&(e(),r.current=Date.now())}),t-(Date.now()-r.current));return()=>{clearTimeout(n)}}),[t,...n])};var Vo=n(69441),qo=n(10719);Math.pow(10,8);const Uo=6048e5,Go=864e5,Ko=43200,Xo=1440;var Qo=n(3002);function Jo(e){const t=(0,Qo.a)(e);return t.setHours(0,0,0,0),t}function Zo(e){const t=(0,Qo.a)(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 ei(e,t){const n=Jo(e),r=Jo(t),a=+n-Zo(n),o=+r-Zo(r);return Math.round((a-o)/Go)}function ti(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function ni(e){const t=(0,Qo.a)(e),n=ti(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ri(e){const t=(0,Qo.a)(e);return ei(t,ni(t))+1}var ai=n(88632);function oi(e){return(0,ai.k)(e,{weekStartsOn:1})}function ii(e){const t=(0,Qo.a)(e),n=t.getFullYear(),r=ti(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=oi(r),o=ti(e,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const i=oi(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function si(e){const t=ii(e),n=ti(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),oi(n)}function li(e){const t=(0,Qo.a)(e),n=+oi(t)-+si(t);return Math.round(n/Uo)+1}function ci(e,t){const n=(0,Qo.a)(e),r=n.getFullYear(),a=(0,qo.q)(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=ti(e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const s=(0,ai.k)(i,t),l=ti(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=(0,ai.k)(l,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function ui(e,t){const n=(0,qo.q)(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=ci(e,t),o=ti(e,0);o.setFullYear(a,0,r),o.setHours(0,0,0,0);return(0,ai.k)(o,t)}function di(e,t){const n=(0,Qo.a)(e),r=+(0,ai.k)(n,t)-+ui(n,t);return Math.round(r/Uo)+1}function fi(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const pi={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return fi("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):fi(n+1,2)},d:(e,t)=>fi(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>fi(e.getHours()%12||12,t.length),H:(e,t)=>fi(e.getHours(),t.length),m:(e,t)=>fi(e.getMinutes(),t.length),s:(e,t)=>fi(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return fi(Math.trunc(r*Math.pow(10,n-3)),t.length)}},mi="midnight",hi="noon",gi="morning",vi="afternoon",bi="evening",yi="night",wi={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:"year"})}return pi.y(e,t)},Y:function(e,t,n,r){const a=ci(e,r),o=a>0?a:1-a;if("YY"===t){return fi(o%100,2)}return"Yo"===t?n.ordinalNumber(o,{unit:"year"}):fi(o,t.length)},R:function(e,t){return fi(ii(e),t.length)},u:function(e,t){return fi(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return fi(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return fi(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return pi.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return fi(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=di(e,r);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):fi(a,t.length)},I:function(e,t,n){const r=li(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):fi(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):pi.d(e,t)},D:function(e,t,n){const r=ri(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):fi(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return fi(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,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return fi(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){const r=e.getDay(),a=0===r?7:r;switch(t){case"i":return String(a);case"ii":return fi(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(a=12===r?hi:0===r?mi:r/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){const r=e.getHours();let a;switch(a=r>=17?bi:r>=12?vi:r>=4?gi:yi,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 pi.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):pi.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):fi(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):fi(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):pi.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):pi.s(e,t)},S:function(e,t){return pi.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Pi(r);case"XXXX":case"XX":return ji(r);default:return ji(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Pi(r);case"xxxx":case"xx":return ji(r);default:return ji(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+xi(r,":");default:return"GMT"+ji(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+xi(r,":");default:return"GMT"+ji(r,":")}},t:function(e,t,n){return fi(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return fi(e.getTime(),t.length)}};function xi(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return 0===o?n+String(a):n+String(a)+t+fi(o,2)}function Pi(e,t){if(e%60==0){return(e>0?"-":"+")+fi(Math.abs(e)/60,2)}return ji(e,t)}function ji(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+fi(Math.trunc(r/60),2)+t+fi(r%60,2)}const ki=(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"})}},Si=(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"})}},Ci={p:Si,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return ki(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"})}return o.replace("{{date}}",ki(r,t)).replace("{{time}}",Si(a,t))}},Mi=/^D+$/,_i=/^Y+$/,Oi=["D","DD","YY","YYYY"];function Ei(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function Di(e){if(!Ei(e)&&"number"!=typeof e)return!1;const t=(0,Qo.a)(e);return!isNaN(Number(t))}const Ni=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ai=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ti=/^'([^]*?)'?$/,Ri=/''/g,Ii=/[a-zA-Z]/;function Li(e,t,n){const r=(0,qo.q)(),a=n?.locale??r.locale??Vo.enUS,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=(0,Qo.a)(e);if(!Di(s))throw new RangeError("Invalid time value");let l=t.match(Ai).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ci[t])(e,a.formatLong)}return e})).join("").match(Ni).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:$i(e)};if(wi[t])return{isToken:!0,value:e};if(t.match(Ii))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));a.localize.preprocessor&&(l=a.localize.preprocessor(s,l));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return l.map((r=>{if(!r.isToken)return r.value;const o=r.value;(!n?.useAdditionalWeekYearTokens&&function(e){return _i.test(e)}(o)||!n?.useAdditionalDayOfYearTokens&&function(e){return Mi.test(e)}(o))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(r),Oi.includes(e))throw new RangeError(r)}(o,t,String(e));return(0,wi[o[0]])(s,o,a.localize,c)})).join("")}function $i(e){const t=e.match(Ti);return t?t[1].replace(Ri,"'"):e}function Wi(e,t){const n=(0,Qo.a)(e),r=(0,Qo.a)(t),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function Fi(e,t){const n=(0,Qo.a)(e),r=(0,Qo.a)(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function zi(e){const t=(0,Qo.a)(e);return t.setHours(23,59,59,999),t}function Bi(e){const t=(0,Qo.a)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Hi(e){const t=(0,Qo.a)(e);return+zi(t)==+Bi(t)}function Yi(e,t){const n=(0,Qo.a)(e),r=(0,Qo.a)(t),a=Wi(n,r),o=Math.abs(Fi(n,r));let i;if(o<1)i=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*o);let t=Wi(n,r)===-a;Hi((0,Qo.a)(e))&&1===o&&1===Wi(e,r)&&(t=!1),i=a*(o-Number(t))}return 0===i?0:i}function Vi(e,t){return+(0,Qo.a)(e)-+(0,Qo.a)(t)}function qi(e,t,n){const r=Vi(e,t)/1e3;return(a=n?.roundingMethod,e=>{const t=(a?Math[a]:Math.trunc)(e);return 0===t?0:t})(r);var a}function Ui(e,t,n){const r=(0,qo.q)(),a=n?.locale??r.locale??Vo.enUS,o=Wi(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:o});let s,l;o>0?(s=(0,Qo.a)(t),l=(0,Qo.a)(e)):(s=(0,Qo.a)(e),l=(0,Qo.a)(t));const c=qi(l,s),u=(Zo(l)-Zo(s))/1e3,d=Math.round((c-u)/60);let f;if(d<2)return n?.includeSeconds?c<5?a.formatDistance("lessThanXSeconds",5,i):c<10?a.formatDistance("lessThanXSeconds",10,i):c<20?a.formatDistance("lessThanXSeconds",20,i):c<40?a.formatDistance("halfAMinute",0,i):c<60?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",1,i):0===d?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",d,i);if(d<45)return a.formatDistance("xMinutes",d,i);if(d<90)return a.formatDistance("aboutXHours",1,i);if(d<Xo){const e=Math.round(d/60);return a.formatDistance("aboutXHours",e,i)}if(d<2520)return a.formatDistance("xDays",1,i);if(d<Ko){const e=Math.round(d/Xo);return a.formatDistance("xDays",e,i)}if(d<2*Ko)return f=Math.round(d/Ko),a.formatDistance("aboutXMonths",f,i);if(f=Yi(l,s),f<12){const e=Math.round(d/Ko);return a.formatDistance("xMonths",e,i)}{const e=f%12,t=Math.trunc(f/12);return e<3?a.formatDistance("aboutXYears",t,i):e<9?a.formatDistance("overXYears",t,i):a.formatDistance("almostXYears",t+1,i)}}function Gi(e,t){return Ui(e,Date.now(),t)}const Ki=({date:e,i18n:t,pattern:n})=>Li(new Date(e),n,{locale:t.dateFNS}),Xi=({date:e,i18n:t})=>Gi(new Date(e),{locale:t.dateFNS}),Qi=({collectionConfig:e,data:t,dateFormat:n,fallback:r,globalConfig:o,i18n:i})=>{let s;if(e){const r=e?.admin?.useAsTitle;if(r&&(s=t?.[r]||s,s)){const t=e.fields.find((e=>"name"in e&&e.name===r));if("date"===t?.type){const e="date"in t.admin&&t?.admin?.date?.displayFormat||n;s=Ki({date:s,i18n:i,pattern:e})||s}}}return o&&(s=(0,a.sC)(o?.label,i)||o?.slug),s||(s=r||`[${i.t("general:untitled")}]`),s},Ji=async e=>{const{apiRoute:t,body:n,onError:r,serverURL:a,signal:o,token:i}=e,s=await fetch(`${a}${t}/form-state`,{body:JSON.stringify(n),credentials:"include",headers:{"Content-Type":"application/json",...i?{Authorization:`JWT ${i}`}:{}},method:"POST",signal:o}),l=await s.json();return s.ok?l:("function"==typeof r&&r(l),n?.formState)},Zi=e=>{const{collectionSlug:t,docPermissions:n,globalSlug:r,isEditing:a}=e;return t?Boolean(a&&n?.update?.permission||!a&&n?.create?.permission):!!r&&Boolean(n?.update?.permission)},es=({id:e,collectionSlug:t,globalSlug:n})=>Boolean(n||t&&!!e);var ts=n(80437),ns=n.n(ts);const rs=(e,t)=>{const n=(t=t||{}).delimiter||".",r=t.overwrite||!1,a=t.recursive||!1,o={};if(ns()(e)||"[object Object]"!==Object.prototype.toString.call(e))return e;const i=e=>{const n=Number(e);return isNaN(n)||-1!==e.indexOf(".")||t.object?e:n};return Object.keys(e).sort(((e,t)=>e.length-t.length)).forEach((s=>{const l=s.split(n);let c=i(l.shift()),u=i(l[0]),d=o;for(;void 0!==u;){if("__proto__"===c)return;const e=Object.prototype.toString.call(d[c]),n="[object Object]"===e||"[object Array]"===e;if(!r&&!n&&void 0!==d[c])return;(r&&!n||!r&&null==d[c])&&(d[c]="number"!=typeof u||t.object?{}:[]),d=d[c],l.length>0&&(c=i(l.shift()),u=i(l[0]))}d[c]=a?rs(e[s],t):e[s]})),o},as=(e,t,n)=>{let r={};return e?(Object.keys(e).forEach((t=>{!0!==n&&e[t]?.disableFormData||(r[t]=e[t]?.value)})),t&&(r=rs(r)),r):r},os=(e,t)=>e?.locales&&0!==e.locales.length?e.locales.find((e=>e?.code===t)):null,is=(0,o.createContext)({}),ss=({children:e})=>{const{localization:n}=Ut(),{user:r}=sn(),a=n&&n.defaultLocale?n.defaultLocale:"en",{searchParams:s}=nn(),l=s?.locale,[c,u]=(0,o.useState)(l||a),[d,f]=(0,o.useState)(n&&os(n,c)),{getPreference:p,setPreference:m}=dn(),h=i().useCallback((async e=>{if(!n)return;const t=n.localeCodes.indexOf(e)>-1?e:a;if(t!==c){u(t),f(os(n,t));try{r&&await m("locale",t)}catch(e){}}}),[n,m,r,a,c]);return(0,o.useEffect)((()=>{!async function(){let e=a;if("string"==typeof l)e=l;else if(r)try{e=await p("locale")}catch(e){}await h(e)}()}),[a,p,n,l,m,r,h]),(0,t.jsx)(is.Provider,{value:d,children:e})},ls=()=>(0,o.useContext)(is),cs=(0,o.createContext)({}),us=()=>(0,o.useContext)(cs),ds=({children:e,...n})=>{const{id:r,collectionSlug:a,docPermissions:s,globalSlug:l,hasPublishPermission:c,hasSavePermission:u,initialData:d,initialState:f,onLoadError:p,onSave:m}=n,{admin:{dateFormat:h},collections:g,globals:v,routes:{api:b},serverURL:y}=Ut(),w=g.find((e=>e.slug===a)),x=v.find((e=>e.slug===l)),P=w||x,{i18n:j}=(0,Be.B)(),[k,S]=(0,o.useState)((()=>d?Qi({collectionConfig:w,data:{...d,id:r},dateFormat:h,fallback:r?.toString(),globalConfig:x,i18n:j}):"")),[C,M]=(0,o.useState)(!1),[_,O]=(0,o.useState)(!1),[E,D]=(0,o.useState)(d),[N,A]=(0,o.useState)(f),[T,R]=(0,o.useState)(null),[I,L]=(0,o.useState)(null),[$,W]=(0,o.useState)(s),[F,z]=(0,o.useState)(u),[B,H]=(0,o.useState)(c),Y=void 0===N||void 0===E,V=(0,o.useRef)(!1),[q,U]=(0,o.useState)(null),{getPreference:G,setPreference:K}=dn(),{permissions:X}=sn(),{code:Q}=ls(),J=(0,o.useRef)(Q),Z=P?.versions,ee=`${y}${b}`;let te,ne;l&&(te=l,ne=`global-${te}`),a&&(te=a,r&&(ne=`collection-${te}-${r}`));const re=es({id:r,collectionSlug:a,globalSlug:l})?"update":"create",ae=Boolean(Z&&$?.readVersions?.permission),oe=(0,o.useCallback)((async()=>{let e,t,n=null,o=null,i=!0;const s={depth:0,where:{and:[]}},c={depth:0,locale:Q||void 0,where:{and:[{or:[{_status:{equals:"published"}},{_status:{exists:!1}}]}]}};if(l&&(e=`${ee}/globals/${l}/versions`,t=`${ee}/globals/${l}?${ge().stringify(c)}`),a&&(e=`${ee}/${a}/versions`,c.where.and.push({id:{equals:r}}),t=`${ee}/${a}?${ge().stringify(c)}`,r||(i=!1),s.where.and.push({parent:{equals:r}})),i){let r;if(Z?.drafts&&(r=await fetch(t,{credentials:"include",headers:{"Accept-Language":j.language}}).then((e=>e.json())),a&&(r=r?.docs?.[0])),ae&&(o=await fetch(`${e}?${ge().stringify(s)}`,{credentials:"include",headers:{"Accept-Language":j.language}}).then((e=>e.json())),r?.updatedAt)){const t={...s,where:{...s.where,and:[...s.where.and,{updatedAt:{greater_than:r?.updatedAt}}]}},a=await fetch(`${e}?${ge().stringify(t)}`,{credentials:"include",headers:{"Accept-Language":j.language}});200===a.status&&(n=await a.json())}R(r),L(o),U(n)}}),[j,l,a,r,ee,Q,Z,ae]),ie=i().useCallback((async e=>{const t={locale:Q||void 0},n=es({id:e?.id,collectionSlug:a,globalSlug:l});if(n){const r=a?`/${a}/access/${e.id}`:l?`/globals/${l}/access`:null;if(r){const o=await fetch(`${y}${b}${r}?${ge().stringify(t)}`,{credentials:"include",headers:{"Accept-Language":j.language}}),i=await o.json(),s=await fetch(`${y}${b}${r}?${ge().stringify(t)}`,{body:JSON.stringify({data:{...e||{},_status:"published"}}),credentials:"include",headers:{"Accept-Language":j.language},method:"POST"}).then((e=>e.json()));W(i),z(Zi({collectionSlug:a,docPermissions:i,globalSlug:l,isEditing:n})),H(s?.update?.permission)}}else{const e=a?X?.collections?.[a]:X?.globals?.[l];W(e),z(Zi({collectionSlug:a,docPermissions:e,globalSlug:l,isEditing:n}))}}),[y,b,X,j.language,Q,a,l]),se=(0,o.useCallback)((()=>G(ne)),[G,ne]),le=(0,o.useCallback)((async(e,t)=>{const n=await se();if(ne)try{await K(ne,{...n,fields:{...n?.fields||{},[e]:{...n?.fields?.[e],...t}}})}catch(e){console.error(e)}}),[K,ne,se]),ce=i().useCallback((async e=>{"function"==typeof m&&m(e);const t=await se(),n=a?e.doc:e.result,o=await Ji({apiRoute:b,body:{id:r,collectionSlug:a,data:n,docPreferences:t,globalSlug:l,locale:Q,operation:re,schemaPath:a||l},serverURL:y});A(o),D(n),await ie(n)}),[b,a,se,l,r,re,Q,m,y,ie]);(0,o.useEffect)((()=>{const e=new AbortController,t=Q!==J.current;if(void 0===f||void 0===d||t){t&&(J.current=Q);(async()=>{O(!1),M(!0);try{const t=await Ji({apiRoute:b,body:{id:r,collectionSlug:a,globalSlug:l,locale:Q,operation:re,schemaPath:a||l},onError:p,serverURL:y,signal:e.signal});D(as(t,!0)),A(t)}catch(t){e.signal.aborted||("function"==typeof p&&p(),O(!0),M(!1))}M(!1)})()}return()=>{e.abort()}}),[b,re,a,y,r,l,Q,p,d,f]),(0,o.useEffect)((()=>{oe()}),[oe]),(0,o.useEffect)((()=>{S(Qi({collectionConfig:w,data:{...E,id:r},dateFormat:h,fallback:r?.toString(),globalConfig:x,i18n:j}))}),[w,E,h,j,r,x]),(0,o.useEffect)((()=>{!V.current&&E&&(a||l)&&(V.current=!0,(async()=>{const e=u,t=c;s&&null!=e&&null!=t||await ie(E)})())}),[ie,s,u,c,W,a,l,E]),_&&(0,ht.notFound)();const ue={...n,docConfig:P,docPermissions:$,getDocPermissions:ie,getDocPreferences:se,getVersions:oe,hasPublishPermission:B,hasSavePermission:F,initialData:E,initialState:N,isInitializing:Y,isLoading:C,onSave:ce,publishedDoc:T,setDocFieldPreferences:le,setDocumentTitle:S,title:k,unpublishedVersions:q,versions:I};return(0,t.jsx)(cs.Provider,{value:ue,children:e})},fs=(0,o.createContext)(""),ps=({children:e,operation:n})=>(0,t.jsx)(fs.Provider,{value:n,children:e}),ms=()=>(0,o.useContext)(fs),hs=e=>{const{disableFormData:t=!1,hasRows:n,validate:r}=e,{path:a,permissions:i,readOnly:s,schemaPath:l}=Po(),c=e.path||a,u=$o(),d=Wo(),f=zo(),{user:p}=sn(),{id:m}=us(),h=ms(),{dispatchField:g,field:v}=Bo((([e,t])=>({dispatchField:t,field:e&&e?.[c]||null}))),{t:b}=(0,Be.B)(),y=Ut(),{getData:w,getDataByPath:x,getSiblingData:P,setModified:j}=Lo(),k=Fo(),S=v?.filterOptions,C=v?.value,M=v?.initialValue,_="boolean"!=typeof v?.valid||v.valid,O=!1===_&&u,E=(0,o.useRef)(_),D=(0,o.useRef)(v?.errorMessage),N=(0,o.useCallback)(((e,r=!1)=>{const a=e&&e.target?e.target.value:e;g({type:"UPDATE",disableFormData:t||n&&a>0,path:c,value:a}),r||"function"==typeof j&&!1===k&&setTimeout((()=>{j(!0)}),10)}),[j,c,g,t,n,k]),A=(0,o.useMemo)((()=>({errorMessage:v?.errorMessage,errorPaths:v?.errorPaths||[],filterOptions:S,formInitializing:f,formProcessing:d,formSubmitted:u,initialValue:M,path:c,permissions:i,readOnly:s||!1,rows:v?.rows,schemaPath:l,setValue:N,showError:O,valid:v?.valid,value:C})),[v?.errorMessage,v?.rows,v?.valid,v?.errorPaths,d,N,O,u,C,M,c,l,s,i,S,f]);return Yo((()=>{(async()=>{let e,a=C;v?.rows&&Array.isArray(v.rows)&&(a=x(c));let o=E.current;const i="function"!=typeof r||await r(a,{id:m,config:y,data:w(),operation:h,siblingData:P(c),t:b,user:p});if("string"==typeof i?(o=!1,e=i):"boolean"==typeof i&&(o=i,e=void 0),o!==E.current||e!==D.current){E.current=o,D.current=e;const r={type:"UPDATE",errorMessage:e,path:c,rows:v?.rows,valid:o,value:C};(t||n&&("number"==typeof C&&C>0))&&(r.disableFormData=!0),"function"==typeof g&&g(r)}})()}),150,[C,t,g,w,P,x,m,h,c,p,r,v?.rows]),A},gs=e=>{const{name:n,type:r,children:a,indexPath:i,path:s}=e,l="string"==typeof s?s:n;let c=l;if(["collapsible","row"].includes(r)){const e=i.split(".").pop();c=`${l?`${l}.`:""}_index-${e}`}const u=Bo((([e])=>e&&e?.[c]||null)),{passesCondition:d}=u||{};return!1===d?null:(0,t.jsx)(o.Fragment,{children:a})},vs=e=>n=>{const{name:r}=n,{type:a,indexPath:o,path:i}=Po(),s=i??r;return(0,t.jsx)(gs,{indexPath:o,name:r,path:s,type:a,children:(0,t.jsx)(e,{...n})})},bs=(0,o.createContext)(0),ys=({children:e,depth:n})=>(0,t.jsx)(bs.Provider,{value:n,children:e}),ws=()=>(0,o.useContext)(bs),xs=(e,t,n)=>`field-${e?.replace(/\./g,"__")}${t>1?`-${t}`:""}${n?`-${n}`:""}`,Ps="field-description",js=e=>{const{className:n,description:r,marginPlacement:o}=e,{path:i}=Po(),{i18n:s}=(0,Be.B)();return r?(0,t.jsx)("div",{className:[Ps,n,`field-description-${i.replace(/\./g,"__")}`,o&&`${Ps}--margin-${o}`].filter(Boolean).join(" "),children:(0,a.sC)(r,s)}):null},ks=e=>{const{CustomDescription:n}=e;return void 0!==n?n:(0,t.jsx)(js,{...e})},Ss=e=>{const{alignCaret:n="right",message:r,path:a,showError:o}=e,{path:i}=Po(),s=i??a,l=$o(),c=Bo((([e])=>e&&e?.[s]||null)),{errorMessage:u,valid:d}=c||{},f=r||u;return(o||l&&!1===d)&&f?.length?(0,t.jsx)(Ft,{alignCaret:n,className:"field-error",delay:0,staticPositioning:!0,children:f}):null},Cs=e=>{const{CustomError:n}=e;return void 0!==n?n:(0,t.jsx)(Ss,{...e})},Ms="field-type";function _s({fieldLocalized:e,fieldRTL:t,locale:n,localizationConfig:r}){const a=n&&r&&r.locales&&r.locales.length>1,o=n?.code===r?.defaultLocale;return!1!==t&&!0===n?.rtl&&(e||!e&&!a||!e&&o)||!0===t}const Os=()=>(0,t.jsxs)("svg",{className:"icon icon--check",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{className:"stroke",d:"M10.6092 16.0192L17.6477 8.98076",strokeLinecap:"square",strokeLinejoin:"bevel"}),(0,t.jsx)("path",{className:"stroke",d:"M7.35229 12.7623L10.6092 16.0192",strokeLinecap:"square",strokeLinejoin:"bevel"})]}),Es=()=>(0,t.jsx)("svg",{className:"icon icon--line",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("line",{className:"stroke",x1:"8.05164",x2:"16.468",y1:"12.594",y2:"12.594"})}),Ds=e=>{const{as:n="label",htmlFor:r,label:o,required:i=!1,unstyled:s=!1}=e,{uuid:l}=Lo(),{path:c}=Po(),u=ws(),d=r||xs(c,u,l),{i18n:f}=(0,Be.B)();return o?(0,t.jsxs)(n,{className:"field-label "+(s?"unstyled":""),htmlFor:d,children:[(0,a.sC)(o,f),i&&!s&&(0,t.jsx)("span",{className:"required",children:"*"})]}):null},Ns=e=>{const{CustomLabel:n}=e;return void 0!==n?n:(0,t.jsx)(Ds,{...e})},As="checkbox-input",Ts=({id:e,name:n,AfterInput:r,BeforeInput:a,CustomLabel:o,checked:i,className:s,inputRef:l,label:c,labelProps:u,onToggle:d,partialChecked:f,readOnly:p,required:m})=>(0,t.jsxs)("div",{className:[s,As,i&&`${As}--checked`,p&&`${As}--read-only`].filter(Boolean).join(" "),children:[(0,t.jsxs)("div",{className:`${As}__input`,children:[a,(0,t.jsx)("input",{"aria-label":"",defaultChecked:Boolean(i),disabled:p,id:e,name:n,onInput:d,ref:l,required:m,type:"checkbox"}),(0,t.jsxs)("span",{className:[`${As}__icon`,!i&&f?"check":"partial"].filter(Boolean).join(" "),children:[i&&(0,t.jsx)(Os,{}),!i&&f&&(0,t.jsx)(Es,{})]}),r]}),(0,t.jsx)(Ns,{CustomLabel:o,htmlFor:e,label:c,required:m,...u||{}})]}),Rs="checkbox",Is=vs((e=>{const{id:n,name:r,AfterInput:a,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,checked:u,className:d,descriptionProps:f,disableFormData:p,errorProps:m,label:h,labelProps:g,onChange:v,partialChecked:b,path:y,readOnly:w,required:x,style:P,validate:j,width:k}=e,{uuid:S}=Lo(),C=ws(),M=(0,o.useCallback)(((e,t)=>{if("function"==typeof j)return j(e,{...t,required:x})}),[j,x]),{path:_,readOnly:O}=Po(),{formInitializing:E,formProcessing:D,path:N,setValue:A,showError:T,value:R}=hs({disableFormData:p,path:_??y??r,validate:M}),I=w||O||D||E,L=(0,o.useCallback)((()=>{I||(A(!R),"function"==typeof v&&v(!R))}),[v,I,A,R]),$=u||Boolean(R),W=n||xs(N,C,S);return(0,t.jsxs)("div",{className:[Ms,Rs,T&&"error",d,R&&`${Rs}--checked`,I&&`${Rs}--read-only`].filter(Boolean).join(" "),style:{...P,width:k},children:[(0,t.jsx)(Cs,{CustomError:l,path:N,...m||{}}),(0,t.jsx)(Ts,{AfterInput:a,BeforeInput:i,CustomLabel:c,checked:$,id:W,inputRef:null,label:h,labelProps:g,name:N,onToggle:L,partialChecked:b,readOnly:I,required:x}),void 0!==s?s:(0,t.jsx)(ks,{...f||{}})]})})),Ls=({fieldValue:e,localized:n,path:r})=>{const{dispatchFields:a,setModified:i}=Lo(),{code:s}=ls(),{localization:l}=Ut(),[c,u]=o.useState("number"!=typeof e),d=l&&l.defaultLocale?l.defaultLocale:"en",{t:f}=(0,Be.B)();if(!n||s===d||l&&!l.fallback)return null;if(e){let t=!1;if("number"==typeof e&&e>0&&(t=!0),Array.isArray(e)&&e.length>0&&(t=!0),t)return c&&u(!1),null}return(0,t.jsx)(Tn,{children:(0,t.jsx)(Is,{checked:c,id:`field-${r.replace(/\./g,"__")}`,label:f("general:fallbackToDefaultLocale")})})},$s=e=>{const t=document.getElementById(e);if(t){const e=t.getBoundingClientRect();window.scrollBy({behavior:"smooth",top:e.top-100})}},Ws=()=>(0,t.jsxs)("svg",{className:"icon icon--copy",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{className:"stroke",height:"8",width:"8",x:"6.5",y:"10"}),(0,t.jsx)("path",{className:"stroke",d:"M10 9.98438V6.5H18V14.5H14"})]}),Fs=({className:e})=>(0,t.jsxs)("svg",{className:["icon icon--more",e].filter(Boolean).join(" "),viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:"fill",cx:"16.3872",cy:"12.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"12.3872",cy:"12.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"8.61279",cy:"12.5",r:"1"})]}),zs="popup-button",Bs=e=>{const{active:n,button:r,buttonType:a,className:o,setActive:i}=e,s=[zs,o,`${zs}--${a}`].filter(Boolean).join(" "),l=()=>{i(!n)};return"none"===a?null:"custom"===a?(0,t.jsx)("div",{className:s,onClick:l,onKeyDown:e=>{"Enter"===e.key&&l()},role:"button",tabIndex:0,children:r}):(0,t.jsx)("button",{className:s,onClick:()=>i(!n),tabIndex:0,type:"button",children:r})},Hs="popup",Ys=e=>{const{boundingRef:n,button:r,buttonClassName:a,buttonType:i="default",caret:s=!0,children:l,className:c,forceOpen:u,horizontalAlign:d="left",initActive:f=!1,onToggleOpen:p,render:m,showOnHover:h=!1,showScrollbar:g=!1,size:v="medium",verticalAlign:b="top"}=e,{height:y,width:w}=Le(),[x,P]=Wt({root:n?.current||null,rootMargin:"-100px 0px 0px 0px",threshold:1}),j=(0,o.useRef)(null),[k,S]=(0,o.useState)(f),[C,M]=(0,o.useState)(b),[_,O]=(0,o.useState)(d),E=(0,o.useCallback)((({horizontal:e=!1,vertical:t=!1})=>{if(j.current){const r=j.current.getBoundingClientRect(),{bottom:a,left:o,right:i,top:s}=r;let l=100,c=document.documentElement.clientWidth,u=document.documentElement.clientHeight,d=0;n?.current&&({bottom:u,left:d,right:c,top:l}=n.current.getBoundingClientRect()),e&&(i>c&&o>d?O("right"):o<d&&i<c&&O("left")),t&&(s<l&&a<u?M("bottom"):a>u&&s>l&&M("top"))}}),[n]),D=(0,o.useCallback)((e=>{j.current.contains(e.target)||S(!1)}),[j]);(0,o.useEffect)((()=>{E({horizontal:!0})}),[P,E,w]),(0,o.useEffect)((()=>{E({vertical:!0})}),[P,E,y]),(0,o.useEffect)((()=>("function"==typeof p&&p(k),k?document.addEventListener("mousedown",D):document.removeEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)})),[k,D,p]),(0,o.useEffect)((()=>{S(u)}),[u]);const N=[Hs,c,`${Hs}--size-${v}`,`${Hs}--v-align-${C}`,`${Hs}--h-align-${_}`,k&&`${Hs}--active`,g&&`${Hs}--show-scrollbar`].filter(Boolean).join(" ");return(0,t.jsxs)("div",{className:N,children:[(0,t.jsx)("div",{className:`${Hs}__trigger-wrap`,children:h?(0,t.jsx)("div",{className:`${Hs}__on-hover-watch`,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:(0,t.jsx)(Bs,{active:k,button:r,buttonType:i,className:a,setActive:S})}):(0,t.jsx)(Bs,{active:k,button:r,buttonType:i,className:a,setActive:S})}),(0,t.jsxs)("div",{className:`${Hs}__content`,ref:j,children:[(0,t.jsx)("div",{className:`${Hs}__hide-scrollbar`,ref:x,children:(0,t.jsx)("div",{className:`${Hs}__scroll-container`,children:(0,t.jsxs)("div",{className:`${Hs}__scroll-content`,children:[m&&m({close:()=>S(!1)}),l&&l]})})}),s&&(0,t.jsx)("div",{className:`${Hs}__caret`})]})]})},Vs=Dn().default||Dn(),qs="popup-button-list",Us=({buttonSize:e="default",children:n,className:r,textAlign:a="left"})=>{const o=[qs,r,`${qs}__text-align--${a}`,`${qs}__button-size--${e}`].filter(Boolean).join(" ");return(0,t.jsx)("div",{className:o,children:n})},Gs=({id:e,active:n,children:r,className:a,href:o,onClick:i})=>{const s=[`${qs}__button`,n&&`${qs}__button--selected`,a].filter(Boolean).join(" ");return o?(0,t.jsx)(Vs,{className:s,href:o,id:e,onClick:()=>{i&&i()},children:r}):i?(0,t.jsx)("button",{className:s,id:e,onClick:()=>{i&&i()},type:"button",children:r}):(0,t.jsx)("div",{className:s,id:e,children:r})},Ks="array-actions",Xs=({addRow:e,duplicateRow:n,hasMaxRows:r,index:a,isSortable:o,moveRow:s,removeRow:l,rowCount:c})=>{const{t:u}=(0,Be.B)();return(0,t.jsx)(Ys,{button:(0,t.jsx)(Fs,{}),buttonClassName:`${Ks}__button`,className:Ks,horizontalAlign:"center",render:({close:d})=>(0,t.jsxs)(Us,{buttonSize:"small",children:[o&&0!==a&&(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__move-up`,onClick:()=>{s(a,a-1),d()},children:[(0,t.jsx)("div",{className:`${Ks}__action-chevron`,children:(0,t.jsx)(Tt,{direction:"up"})}),u("general:moveUp")]}),o&&a<c-1&&(0,t.jsxs)(Gs,{className:`${Ks}__action`,onClick:()=>{s(a,a+1),d()},children:[(0,t.jsx)("div",{className:`${Ks}__action-chevron`,children:(0,t.jsx)(Tt,{})}),u("general:moveDown")]}),!r&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__add`,onClick:()=>{e(a+1),d()},children:[(0,t.jsx)(Lt,{}),u("general:addBelow")]}),(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__duplicate`,onClick:()=>{n(a),d()},children:[(0,t.jsx)(Ws,{}),u("general:duplicate")]})]}),(0,t.jsxs)(Gs,{className:`${Ks}__action ${Ks}__remove`,onClick:()=>{l(a),d()},children:[(0,t.jsx)($t.u,{}),u("general:remove")]})]}),size:"medium"})};var Qs=n(31786);const Js=({className:e})=>(0,t.jsxs)("svg",{className:["icon icon--drag-handle",e].filter(Boolean).join(" "),viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:"fill",cx:"10.468",cy:"14.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"14.532",cy:"14.5",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"10.468",cy:"11.35",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"14.532",cy:"11.35",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"10.468",cy:"8.3",r:"1"}),(0,t.jsx)("circle",{className:"fill",cx:"14.532",cy:"8.3",r:"1"})]}),Zs=(0,o.createContext)({isCollapsed:void 0,isVisible:void 0,isWithinCollapsible:void 0,toggle:()=>{}}),el=({children:e,isCollapsed:n,isWithinCollapsible:r=!0,toggle:a})=>{const{isCollapsed:o,isVisible:s}=tl(),l=i().useMemo((()=>({isCollapsed:n,isVisible:s&&!o,isWithinCollapsible:r,toggle:a})),[n,r,a,o,s]);return(0,t.jsx)(Zs.Provider,{value:l,children:e})},tl=()=>(0,o.useContext)(Zs),nl=Qs.A.default||Qs.A,rl="collapsible",al=({actions:e,children:n,className:r,collapsibleStyle:a="default",dragHandleProps:s,header:l,initCollapsed:c,isCollapsed:u,onToggle:d})=>{const[f,p]=(0,o.useState)(Boolean(c)),[m,h]=(0,o.useState)(!1),{isWithinCollapsible:g}=tl(),{t:v}=(0,Be.B)(),b="boolean"==typeof u?u:f,y=i().useCallback((()=>{"function"==typeof d&&d(!b),p(!b)}),[d,b]);return(0,t.jsx)("div",{className:[rl,r,s&&`${rl}--has-drag-handle`,b&&`${rl}--collapsed`,g&&`${rl}--nested`,m&&`${rl}--hovered`,`${rl}--style-${a}`].filter(Boolean).join(" "),children:(0,t.jsxs)(el,{isCollapsed:b,toggle:y,children:[(0,t.jsxs)("div",{className:`${rl}__toggle-wrap`,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[s&&(0,t.jsx)("div",{className:`${rl}__drag`,...s.attributes,...s.listeners,children:(0,t.jsx)(Js,{})}),(0,t.jsx)("button",{className:[`${rl}__toggle`,`${rl}__toggle--${b?"collapsed":"open"}`].filter(Boolean).join(" "),onClick:y,type:"button",children:(0,t.jsx)("span",{children:v("fields:toggleBlock")})}),l&&(0,t.jsx)("div",{className:[`${rl}__header-wrap`,s&&`${rl}__header-wrap--has-drag-handle`].filter(Boolean).join(" "),children:l&&l}),(0,t.jsxs)("div",{className:`${rl}__actions-wrap`,children:[e&&(0,t.jsx)("div",{className:`${rl}__actions`,children:e}),(0,t.jsx)("div",{className:`${rl}__indicator`,children:(0,t.jsx)(Tt,{direction:b?void 0:"up"})})]})]}),(0,t.jsx)(nl,{duration:200,height:b?0:"auto",children:(0,t.jsx)("div",{className:`${rl}__content`,children:n})})]})})},ol=vs((e=>{const{name:n,disableModifyingForm:r=!0,forceUsePathFromProps:a,path:i,value:s}=e,{path:l}=Po(),{path:c,setValue:u,value:d}=hs({path:(a?null:l)||i||n});return(0,o.useEffect)((()=>{void 0!==s&&u(s,r)}),[s,u,r]),(0,t.jsx)("input",{id:`field-${c?.replace(/\./g,"__")}`,name:c,onChange:u,type:"hidden",value:d||""})})),il=({name:e,type:n,CustomField:r,custom:a,disabled:o,fieldComponentProps:i,indexPath:s,isHidden:l,path:c,permissions:u,readOnly:d,schemaPath:f,siblingPermissions:p})=>{const m=ms(),{readOnly:h}=Po(),g=qm(),v=[c,e].filter(Boolean).join("."),b=[f,e].filter(Boolean).join(".");if(!1===u?.read?.permission||o)return null;let y=d;h&&!1!==y&&(y=!0),!1===u?.[m]?.permission&&(y=!0);const w=l?ol:g[n];return void 0!==r||w?(0,t.jsx)(xo,{custom:a,indexPath:s,path:v,permissions:u,readOnly:y,schemaPath:b,siblingPermissions:p,type:n,children:void 0!==r?r:(0,t.jsx)(w,{...i})}):null},sl="render-fields",ll=e=>{const{className:n,fieldMap:r,forceRender:a,indexPath:o,margins:s,path:l,permissions:c,schemaPath:u}=e,{i18n:d}=(0,Be.B)(),[f,p]=i().useState(Boolean(a)),[m,h]=Wt({rootMargin:"1000px"},Boolean(a)),g=Boolean(h?.isIntersecting),v=a||g||h?.boundingClientRect?.top<0;return i().useEffect((()=>{v&&!f&&p(!0)}),[v,f]),!r||Array.isArray(r)&&0===r.length?null:(d||console.error("Need to implement i18n when calling RenderFields"),r?(0,t.jsx)("div",{className:[sl,n,s&&`${sl}--margins-${s}`,!1===s&&`${sl}--margins-none`].filter(Boolean).join(" "),ref:m,children:f&&r?.map(((e,n)=>{const{type:r,CustomField:i,custom:s,disabled:d,fieldComponentProps:f,fieldComponentProps:{readOnly:p},isHidden:m}=e,h="number"==typeof a&&n<=a||!0,g="name"in e?e.name:void 0;return(0,t.jsx)(il,{CustomField:i,custom:s,disabled:d,fieldComponentProps:{...f,forceRender:h},indexPath:void 0!==o?`${o}.${n}`:`${n}`,isHidden:m,name:g,path:l,permissions:c?.[g],readOnly:p,schemaPath:u,siblingPermissions:c,type:r},n)}))}):null)},cl=i().createContext({data:{},path:"",rowNumber:void 0}),ul=({children:e,path:n,rowNumber:r})=>{const{getDataByPath:a,getSiblingData:i}=(0,o.useContext)(Do),s=i(n),l=a(n)||s;return(0,t.jsx)(cl.Provider,{value:{data:l,path:n,rowNumber:r},children:e})},dl="row-label",fl=e=>{const{RowLabelComponent:n,className:r,i18n:o,path:i,rowLabel:s,rowNumber:l}=e;if(n)return(0,t.jsx)(ul,{path:i,rowNumber:l,children:n});const c=s?"object"==typeof s?(0,a.sC)(s,o):"string"==typeof s?s:"":"";return(0,t.jsx)("span",{className:[dl,r].filter(Boolean).join(" "),style:{pointerEvents:"none"},children:c})},pl="array-field",ml=({CustomRowLabel:e,addRow:n,attributes:r,duplicateRow:o,errorCount:i,fieldMap:s,forceRender:l=!1,hasMaxRows:c,indexPath:u,isSortable:d,labels:f,listeners:p,moveRow:m,path:h,permissions:g,readOnly:v,removeRow:b,row:y,rowCount:w,rowIndex:x,schemaPath:P,setCollapse:j,setNodeRef:k,transform:S})=>{const C=`${h}.${x}`,{i18n:M}=(0,Be.B)(),_=$o(),O=`${(0,a.sC)(f.singular,M)} ${String(x+1).padStart(2,"0")}`,E=i>0&&_,D=[`${pl}__row`,E?`${pl}__row--has-errors`:`${pl}__row--no-errors`].filter(Boolean).join(" ");return(0,t.jsx)("div",{id:`${h.split(".").join("-")}-row-${x}`,ref:k,style:{transform:S},children:(0,t.jsx)(al,{actions:v?void 0:(0,t.jsx)(Xs,{addRow:n,duplicateRow:o,hasMaxRows:c,index:x,isSortable:d,moveRow:m,removeRow:b,rowCount:w}),className:D,collapsibleStyle:E?"error":"default",dragHandleProps:d?{id:y.id,attributes:r,listeners:p}:void 0,header:(0,t.jsxs)("div",{className:`${pl}__row-header`,children:[(0,t.jsx)(fl,{RowLabelComponent:e,i18n:M,path:C,rowLabel:O,rowNumber:x+1}),E&&(0,t.jsx)(yo,{count:i,i18n:M,withMessage:!0})]}),isCollapsed:y.collapsed,onToggle:e=>j(y.id,e),children:(0,t.jsx)(ll,{className:`${pl}__fields`,fieldMap:s,forceRender:l,indexPath:u,margins:"small",path:C,permissions:g?.fields,readOnly:v,schemaPath:P})})},`${h}-row-${y.id}`)},hl="array-field",gl=vs((e=>{const{name:n,CustomDescription:r,CustomError:s,CustomLabel:l,CustomRowLabel:c,className:u,descriptionProps:d,errorProps:f,fieldMap:p,forceRender:m=!1,isSortable:h=!0,label:g,labelProps:v,localized:b,maxRows:y,minRows:w,path:x,readOnly:P,required:j,validate:k}=e,{indexPath:S,path:C,permissions:M,readOnly:_}=Po(),O=w??j?1:0,{setDocFieldPreferences:E}=us(),{addFieldRow:D,dispatchFields:N,setModified:A}=Lo(),T=$o(),{code:R}=ls(),{i18n:I,t:L}=(0,Be.B)(),{localization:$}=Ut(),W=(()=>{if($&&$.fallback){const e=$.defaultLocale||"en";return R===e}return!0})(),F="labels"in(z=e)&&z?.labels?z.labels:"label"in z&&z?.label?{plural:void 0,singular:z?.label}:{plural:L("general:rows"),singular:L("general:row")};var z;const B=(0,o.useCallback)(((e,t)=>!W&&null===e||("function"==typeof k?k(e,{...t,maxRows:y,minRows:O,required:j}):void 0)),[y,O,j,k,W]),{errorPaths:H,formInitializing:Y,formProcessing:V,path:q,rows:U=[],schemaPath:G,showError:K,valid:X,value:Q}=hs({hasRows:!0,path:C??x??n,validate:B}),J=P||_||V||Y,Z=(0,o.useCallback)((async e=>{await D({path:q,rowIndex:e,schemaPath:G}),A(!0),setTimeout((()=>{$s(`${q}-row-${e+1}`)}),0)}),[D,q,A,G]),ee=(0,o.useCallback)((e=>{N({type:"DUPLICATE_ROW",path:q,rowIndex:e}),A(!0),setTimeout((()=>{$s(`${q}-row-${e}`)}),0)}),[N,q,A]),te=(0,o.useCallback)((e=>{N({type:"REMOVE_ROW",path:q,rowIndex:e}),A(!0)}),[N,q,A]),ne=(0,o.useCallback)(((e,t)=>{N({type:"MOVE_ROW",moveFromIndex:e,moveToIndex:t,path:q}),A(!0)}),[N,q,A]),re=(0,o.useCallback)((e=>{N({type:"SET_ALL_ROWS_COLLAPSED",collapsed:e,path:q,setDocFieldPreferences:E})}),[N,q,E]),ae=(0,o.useCallback)(((e,t)=>{N({type:"SET_ROW_COLLAPSED",collapsed:t,path:q,rowID:e,setDocFieldPreferences:E})}),[N,q,E]),oe=y&&U.length>=y,ie=H.length,se=T&&H.length>0,le=J&&0===U.length,ce=U.length<O||j&&0===U.length;return(0,t.jsxs)("div",{className:[Ms,hl,u,se?`${hl}--has-error`:`${hl}--has-no-error`].filter(Boolean).join(" "),id:`field-${q.replace(/\./g,"__")}`,children:[K&&(0,t.jsx)(Cs,{CustomError:s,path:q,...f||{}}),(0,t.jsxs)("header",{className:`${hl}__header`,children:[(0,t.jsxs)("div",{className:`${hl}__header-wrap`,children:[(0,t.jsxs)("div",{className:`${hl}__header-content`,children:[(0,t.jsx)("h3",{className:`${hl}__title`,children:(0,t.jsx)(Ns,{CustomLabel:l,as:"span",label:g,required:j,unstyled:!0,...v||{}})}),se&&ie>0&&(0,t.jsx)(yo,{count:ie,i18n:I,withMessage:!0})]}),U.length>0&&(0,t.jsxs)("ul",{className:`${hl}__header-actions`,children:[(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${hl}__header-action`,onClick:()=>re(!0),type:"button",children:L("fields:collapseAll")})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${hl}__header-action`,onClick:()=>re(!1),type:"button",children:L("fields:showAll")})})]})]}),(0,t.jsx)(ks,{CustomDescription:r,...d||{}})]}),(0,t.jsx)(Ls,{fieldValue:Q,localized:b,path:q}),(U.length>0||!X&&(le||ce))&&(0,t.jsxs)(vo,{className:`${hl}__draggable-rows`,ids:U.map((e=>e.id)),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>ne(e,t),children:[U.map(((e,n)=>{const r=H?.filter((e=>e.startsWith(`${q}.${n}.`))).length;return(0,t.jsx)(go,{disabled:J||!h,id:e.id,children:a=>(0,t.jsx)(ml,{...a,CustomRowLabel:c,addRow:Z,duplicateRow:ee,errorCount:r,fieldMap:p,forceRender:m,hasMaxRows:oe,indexPath:S,isSortable:h,labels:F,moveRow:ne,path:q,permissions:M,readOnly:J,removeRow:te,row:e,rowCount:U.length,rowIndex:n,schemaPath:G,setCollapse:ae})},e.id)})),!X&&(0,t.jsxs)(i().Fragment,{children:[le&&(0,t.jsx)(Tn,{children:L("validation:fieldHasNo",{label:(0,a.sC)(F.plural,I)})}),ce&&(0,t.jsx)(Tn,{type:"error",children:L("validation:requiresAtLeast",{count:O,label:(0,a.sC)(O>1?F.plural:F.singular,I)||L(O>1?"general:rows":"general:row")})})]})]}),!J&&!oe&&(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${hl}__add-row`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>Z(Q||0),children:L("fields:addLabel",{label:(0,a.sC)(F.singular,I)})})]})})),vl="gutter",bl=(0,o.forwardRef)(((e,n)=>{const{children:r,className:a,left:o=!0,negativeLeft:i=!1,negativeRight:s=!1,right:l=!0}=e,c=o&&!i,u=l&&!s;return(0,t.jsx)("div",{className:[c&&`${vl}--left`,u&&`${vl}--right`,i&&`${vl}--negative-left`,s&&`${vl}--negative-right`,a].filter(Boolean).join(" "),ref:n,children:r})}));bl.displayName="Gutter";const yl="drawer",wl=({slug:e,children:n,className:r,disabled:a,onClick:i,...s})=>{const{openModal:l}=O(),c=(0,o.useCallback)((t=>{l(e),"function"==typeof i&&i(t)}),[l,e,i]);return(0,t.jsx)("button",{className:r,disabled:a,onClick:c,type:"button",...s,children:n})},xl=({slug:e,Header:n,children:r,className:a,gutter:i=!0,hoverTitle:s,title:l})=>{const{t:c}=(0,Be.B)(),{closeModal:u,modalState:d}=O(),f=ws(),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{m(d[e]?.isOpen)}),[e,d]),(0,o.useEffect)((()=>{g(p)}),[p]),p?(0,t.jsxs)(ce,{className:[a,yl,h&&`${yl}--is-open`,f>1&&`${yl}--nested`].filter(Boolean).join(" "),slug:e,style:{zIndex:100+f},children:[(!f||1===f)&&(0,t.jsx)("div",{className:`${yl}__blur-bg`}),(0,t.jsx)("button",{"aria-label":c("general:close"),className:`${yl}__close`,id:`close-drawer__${e}`,onClick:()=>u(e),type:"button"}),(0,t.jsxs)("div",{className:`${yl}__content`,children:[(0,t.jsx)("div",{className:`${yl}__blur-bg-content`}),(0,t.jsx)(bl,{className:`${yl}__content-children`,left:i,right:i,children:(0,t.jsxs)(bs.Provider,{value:f+1,children:[n,void 0===n&&(0,t.jsxs)("div",{className:`${yl}__header`,children:[(0,t.jsx)("h2",{className:`${yl}__header__title`,title:s?l:null,children:l}),(0,t.jsx)("button",{"aria-label":c("general:close"),className:`${yl}__header__close`,id:`close-drawer__${e}`,onClick:()=>u(e),type:"button",children:(0,t.jsx)($t.u,{})})]}),r]})})]})]}):null},Pl=e=>(({slug:e,depth:t})=>`drawer_${t}_${e}`)({slug:`${e}-${(0,o.useId)()}`,depth:ws()}),jl=Dn().default,kl="pill",Sl=e=>{const{id:n,className:r}=e,{attributes:a,isDragging:o,listeners:i,setNodeRef:s,transform:l}=ho({id:n});return(0,t.jsx)(Cl,{...e,className:[o&&`${kl}--is-dragging`,r].filter(Boolean).join(" "),elementProps:{...i,...a,ref:s,style:{transform:l}}})},Cl=e=>{const{alignIcon:n="right","aria-checked":r,"aria-controls":a,"aria-expanded":o,"aria-label":i,children:s,className:l,draggable:c,elementProps:u,icon:d,onClick:f,pillStyle:p="light",rounded:m,to:h}=e,g=[kl,`${kl}--style-${p}`,l&&l,h&&`${kl}--has-link`,(h||f)&&`${kl}--has-action`,d&&`${kl}--has-icon`,d&&`${kl}--align-icon-${n}`,c&&`${kl}--draggable`,m&&`${kl}--rounded`].filter(Boolean).join(" ");let v="div";return f&&!h&&(v="button"),h&&(v=jl),(0,t.jsxs)(v,{...u,"aria-checked":r,"aria-controls":a,"aria-expanded":o,"aria-label":i,className:g,href:h||null,onClick:f,type:"button"===v?"button":void 0,children:[d&&"left"===n&&(0,t.jsx)("span",{className:`${kl}__icon`,children:d}),(0,t.jsx)("span",{className:`${kl}__label`,children:s}),d&&"right"===n&&(0,t.jsx)("span",{className:`${kl}__icon`,children:d})]})},Ml=e=>{const{draggable:n}=e;return n?(0,t.jsx)(Sl,{...e}):(0,t.jsx)(Cl,{...e})},_l="thumbnail-card",Ol=e=>{const{alignLabel:n,className:r,collection:a,doc:o,label:i,onClick:s,thumbnail:l}=e,c=Ut(),{i18n:u}=(0,Be.B)(),d=[_l,r,"function"==typeof s&&`${_l}--has-on-click`,n&&`${_l}--align-label-${n}`].filter(Boolean).join(" ");let f=i;return f||(f=Qi({collectionConfig:a,data:o,dateFormat:c.admin.dateFormat,fallback:o?.filename,i18n:u})),(0,t.jsxs)("button",{className:d,onClick:s,title:f,type:"button",children:[(0,t.jsx)("div",{className:`${_l}__thumbnail`,children:l}),(0,t.jsx)("div",{className:`${_l}__label`,children:f})]})};const El={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var Dl,Nl=new Uint8Array(16);function Al(){if(!Dl&&!(Dl="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dl(Nl)}for(var Tl=[],Rl=0;Rl<256;++Rl)Tl.push((Rl+256).toString(16).slice(1));function Il(e,t=0){return(Tl[e[t+0]]+Tl[e[t+1]]+Tl[e[t+2]]+Tl[e[t+3]]+"-"+Tl[e[t+4]]+Tl[e[t+5]]+"-"+Tl[e[t+6]]+Tl[e[t+7]]+"-"+Tl[e[t+8]]+Tl[e[t+9]]+"-"+Tl[e[t+10]]+Tl[e[t+11]]+Tl[e[t+12]]+Tl[e[t+13]]+Tl[e[t+14]]+Tl[e[t+15]]).toLowerCase()}const Ll=function(e,t,n){if(El.randomUUID&&!t&&!e)return El.randomUUID();var r=(e=e||{}).random||(e.rng||Al)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return Il(r)},$l=()=>{const[e]=(0,o.useState)(`pattern${Ll()}`),[n]=(0,o.useState)(`image${Ll()}`);return(0,t.jsxs)("svg",{fill:"none",height:"53",viewBox:"0 0 82 53",width:"82",children:[(0,t.jsx)("rect",{fill:`url(#${e})`,height:"52.7791",width:"80.574",x:"0.713013"}),(0,t.jsxs)("defs",{children:[(0,t.jsx)("pattern",{height:"1",id:`${e}`,patternContentUnits:"objectBoundingBox",width:"1",children:(0,t.jsx)("use",{transform:"scale(0.00387597 0.00591716)",xlinkHref:`#${n}`})}),(0,t.jsx)("image",{height:"169",id:n,width:"258",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQIAAACpCAYAAADA4zPJAAALpklEQVR4Ae2dSY/UOhSF+///DCSGHQuEgAVI7BBITAI2zCCGZuhmpqEBP53W8yOvK1UdO3Zyr/NFilJdXalyTo4/X984zlZgQQEUWLwCW4tXAAFQAAUCIMAEKIACgAAPoAAKBECACVAABQABHkABFAiAABOgAAoAAjyAAiggBbhqgA9QAAUAAR5AARQgIsADKIACdA3wAAqggBQgR4APUAAFAAEeQAEUICLAAyiAAnQN8AAKoIAUIEeAD1AABQABHkABFCAiwAMogAJ0DfAACqCAFCBHgA9QAAUAAR5AARQgIsADKIACdA3wAAqggBQgR4APUAAFAAEeQAEUICLAAyiAAnQN8AAKoIAUIEeAD1AABQABHkABFCAiwAMogAJ0DfAACqCAFCBHgA9QAAUAAR5AARQgIsADKIACdA3wAAqggBQgR4APUAAFAAEeQAEUICLAAyiAAnQN8AAKoIAUIEeAD1AABQABHkABFCAiwAMLVmB/fz98+/YtfPr0KXz48CHs7u6GnZ2dg+3Hjx/D169fw48fP8KfP3+aV4muQfOnmAPsKqDKr4r/9u3bsL29PXgVKPb29pqFAiDouoTXzSrw8+fPg5Y+pfL3ffbdu3fh+/fvzekECJo7pRxQVwGF9YoA+ir1mPfUhVB00coCCFo5kxzHigKqqGrBx1T4Tfu+efOmmegAEKzYhzdaUEBdAVXUTRW51P+UVPS+AALvZ5DyryigSGAqCESYeIcBIFixEW94VuDXr1/JVwRiZR671VUFrwsg8HrmKPeKAkoMKok3tkLn7q8oRCDyuAACj2eNMvcqoMFBuZW41H4alORxAQQezxplXlHg9+/fk+cF1sHDYxcBEKxYijc8KvDly5fZo4EIhvfv37uTEBC4O2UU+LACyg2kDhmOlbbWVpcvPS2AwNPZoqy9CigUr1Whc79Xoxk9LYDA09mirL0K1BhCnAuAuJ8iFE8LIPB0tihrrwI1hxHHip2z9XQpERD0Wos3vSig/EBOJZ1iH09XDwCBF8dTzl4FNJx4ikqd8xu6kuFlAQRezhTl7FVAMwjlVNIp9vn8+XNvmS2+aR4E6md56mtZPMktl8niFYMIGU9XDkyDQCdZ47e1eupvtVzxrB0bEUGZM2ISBEoAafLISNa4FWH1PxYUiApo4E70h7UtOYJ4ljK2OrGbLgfpfy1NEZUhEbt0FNA9BtYAEMvjaW5DMxGBWnpN7hBFPGrrfSKIjpd5OVIBa8OLo3c9DTM2AQJRXbdvRgGHbrWP9mVZtgKaanyoZ6b6nPJanrqxs4MgJgRzTxCJxGVDQEevEDzXP7X2E5w8LbOBQLQsOUZ8TCLx9evX4fHjx+HRo0esTjW4efNmKL3eu3cvyBs5sPB2lWsWENSaZlr3gacmEi9fvhyOHTvGiga9Hjh79mwyDJSz8NQtUOQyOQhSEoI5JNY+mrJqyPLy5cvekw8YAGPXA7du3UqKCob6b4hHp/rMZCDITQjmwmBIIvH+/fuAgEjgSA9cuXJlMAh0edtbNCDYTAICjf6a4xKPflO/vW4BBLT83ZZ/3esUEHi6ZNitF1VBIDLqxovcVr3UfipDH6UBASBYV/m77w8FgaeRhF0I6HU1EChpp+Rdqco89nv6EomAABB0K/y610NAoCHxfY3N4Qpn9e8qILAwv3wfODTmoJvIef78+ZH9w3Xm4P3lQOTGjRsbGzSNGfAMgeIRgRKCFkd5HYaCyqiyaj1//jwwIGG41gOnT58Ourp02EPx7zHjVyxFB8UigrkSgvGEpG5jIlEw0ECiO3fusDaowe3bt8PVq1eDwvvU9fr162sh0NqI1tEgsJIQTAVB/Py6RKIlWlOWcQrIo+oSlrpypShADUhLyygQaOYgSwnBWLlTtzoGZkFqydb9xxKBkONZQUSNRqs+yQaBbvRQeJRa6ax+Xsfi6f7xfqvz7lAFVKEVJSjbLzCookc/a6uBQcol6ZKgxgZ4TwYepUsyCBQSeUgI5gJHxmgt7DvKBPwfBZJAIDKW6mflVtQp9tMxeh0hhqVRIEeBQSBQWKQQaYpKaOk3dMyth4Q5pmGf9hQ4EgTqS+3s7CwOAhFIOvZWE0Tt2ZkjylVgIwhaSwjGyp26JZGYay/286JALwiULOubTjy1ArX2ee/jyb2YknJOr8AKCJQk06WT1ipxqeORNiQSpzcqv1hXgf9AsNSEYC4gSCTWNSbfPq0CByBYekIwFwYkEqc1K79WT4GtsdOJ51aiVvZTItHbjLX17MQ3e1Vgq5UKOfdxtHI7ajSy7iYlFxLVaH8LCLa3iyVGlUhMnU7dmsWUK+pOL6dZpxlUZe0slS8PICgIghiV6F4M3ct+6dIlV+vFixcPJmo5d+5c6K4XLlwI+p/l47l27RpdtBF8AAQVQHDmzJm1M94wxVm9Kc6kOzeM5dEAEBQGgR6dRmWvV9mP0lbdM5Z0BQBBYRA8ePAAEMw4B6KeVciSrgAgAARNgQsQpENAewACQAAI8upOU3sBgsIgePjwYVMV66g+ubX/ExHk8QkQFAaB5sA/ceIEMJghT3D8+HHmnczjAF2DeO2/5Pbu3bvh1KlTwGBCGJw8eTI8efIksxqwGxFB4YggAuXVq1fh2bNn4enTp0euL168OJj/QaP4Sq26O1JzLw75/Rqf0czApY5lyPcwfmAczABBJRBEIAzd6ual7nMZx5xWK3eTxkfLjTkW9p1GAUBgBAQRGGMrj7W7SRWV6AYmFtsKAAJjIBAQciqPbgyyPL0cj5YDBMXu7out5lK2QyuPl+nleLScXRgQERiMCLqg2zQLkqIAJdK6n7f+mhmhbcIAEBgHgSp2X+VRlnx3d9cVBLqQGpsLsVmd/JYKEDgAQaxA8bmM1hKCsXypWx4tZwccgMARCFTRFB2kVjjrn2dG6PmBAAicgcB6pc4t36ZcyPzVpP0SAAJAYCbC6MuFtF8FbRwhIAAEZkAQowkeLTc9HAABIDAHAgGBR8tNCwNAAAhMgiBGByQSpwECIAAEpkEgIJBIrA8DQAAIzINAMFAikUfL1QMCIAAELkAQuwqtPVquXtVO+2ZAAAhcgUBAaOHRcmnVtP6nAQEgcAeCGB3ohiuWMgoAAkDgFgQCgm68Ypqy8TAABIDANQgEAxKJgMC9iWOYy3b84+lJJOYDgYiAiKApmGoWpP39/fwasdA9AQEgaAoEMbIqNSP0UrgACABBkyAQEEgkDscYIAAEzYJAMMiZEXp49Wnnk4AAEDQNgthVGDojdDtVO+1IAAEgWAQIBAQSievhAAgAwWJAIBhozAGJxFUgAAJAsCgQxK4C06n/HwaAABAsEgQCAonEvzAABIBgsSCI0QGJxBAAASBYPAgEhKU/lxEQAAJA8K8HljydOiAABIDgkAfio+X+9qDbfwUIDpkg9hvZjr8b0LOGS3suIyAABEQEGzywlOnUAcEGE3hu0Sh7uYhmCdOpAwJAQEQwwAOtJxIBwQAT0LqWa129a9nqcxkBASAgIkj0QIvPZQQEiSbw3qJR/nLRTUuJREAACIgIRniglUQiIBhhAlrXcq2rZy1bmE4dEAACIoJCHvA8nTogKGQCzy0aZS8X2Xh9LiMgAAREBBU84O25jICgggloYcu1sJ619DSdOiAABEQEFT3gJZEICCqawHNrRtnLRjXWE4mAABAQEUzkAcvTqQOCiUxAC1u2hfWsp8Xp1AEBICAimMED1hKJgGAGE3huzSh7ucjG0nTqgAAQEBHM7AEL06kDgplNQAtbroX1rOXciURAAAiICIx4QGMO5kokAgIjJvDcmlH2slHNHM9lBASAgIjAoAemTiQCAoMmoIUt28J61nOqRCIgAAREBMY9MMUsSIDAuAk8t2aUvVxkU3s6dUAACIgIHHmg1nMZAYEjE9DClmthPWtZYzp1QAAIiAiceqDkdOqAwKkJPLdolL1cZFMqkbilkUysaIAH/Hpgb28vjF3+AbSb48mcXO9tAAAAAElFTkSuQmCC"})]})]})},Wl=()=>(0,t.jsxs)("svg",{className:"icon icon--search",fill:"none",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:"stroke",cx:"11.2069",cy:"10.7069",r:"5"}),(0,t.jsx)("line",{className:"stroke",x1:"14.914",x2:"20.5002",y1:"13.9998",y2:"19.586"})]}),Fl="block-search",zl=e=>{const{setSearchTerm:n}=e,{t:r}=(0,Be.B)();return(0,t.jsxs)("div",{className:Fl,children:[(0,t.jsx)("input",{className:`${Fl}__input`,onChange:e=>{n(e.target.value)},placeholder:r("fields:searchForBlock")}),(0,t.jsx)(Wl,{})]})},Bl="blocks-drawer",Hl=e=>{const{addRow:n,addRowIndex:r,blocks:i,drawerSlug:s,labels:l}=e,[c,u]=(0,o.useState)(""),[d,f]=(0,o.useState)(i),{closeModal:p,isModalOpen:m}=O(),{i18n:h,t:g}=(0,Be.B)();return(0,o.useEffect)((()=>{m||u("")}),[m]),(0,o.useEffect)((()=>{const e=c.toLowerCase(),t=i?.reduce(((t,n)=>{const r=((e,t)=>"string"==typeof e.labels.singular?e.labels.singular.toLowerCase():"object"==typeof e.labels.singular?(0,a.sC)(e.labels.singular,t).toLowerCase():"")(n,h);return r.includes(e)&&t.push(n),t}),[]);f(t)}),[c,i,h]),(0,t.jsxs)(xl,{slug:s,title:g("fields:addLabel",{label:(0,a.sC)(l.singular,h)}),children:[(0,t.jsx)(zl,{setSearchTerm:u}),(0,t.jsx)("div",{className:`${Bl}__blocks-wrapper`,children:(0,t.jsx)("ul",{className:`${Bl}__blocks`,children:d?.map(((e,o)=>{const{slug:i,imageAltText:l,imageURL:c,labels:u}=e;return(0,t.jsx)("li",{className:`${Bl}__block`,children:(0,t.jsx)(Ol,{alignLabel:"center",label:(0,a.sC)(u?.singular,h),onClick:()=>{n(r,i),p(s)},thumbnail:c?(0,t.jsx)("img",{alt:l,src:c}):(0,t.jsx)("div",{className:`${Bl}__default-image`,children:(0,t.jsx)($l,{})})})},o)}))})})]})},Yl=e=>{const{addRow:n,blockType:r,blocks:a,duplicateRow:o,hasMaxRows:s,isSortable:l,labels:c,moveRow:u,removeRow:d,rowCount:f,rowIndex:p}=e,{closeModal:m,openModal:h}=O(),g=Pl("blocks-drawer"),[v,b]=i().useState(null);return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Hl,{addRow:(e,t)=>{"function"==typeof n&&n(v,t),m(g)},addRowIndex:p,blocks:a,drawerSlug:g,labels:c}),(0,t.jsx)(Xs,{addRow:e=>{b(e),h(g)},duplicateRow:()=>o(p,r),hasMaxRows:s,index:p,isSortable:l,moveRow:u,removeRow:d,rowCount:f})]})},Vl="section-title",ql=e=>{const{customOnChange:n,customValue:r,path:a,readOnly:o}=e,{setValue:i,value:s}=hs({path:a}),{t:l}=(0,Be.B)(),c=[Vl].filter(Boolean).join(" "),u=n||(e=>{e.stopPropagation(),e.preventDefault(),i(e.target.value)});return(0,t.jsx)("div",{className:c,"data-value":r||s,children:(0,t.jsx)("input",{className:`${Vl}__input`,id:a,name:a,onChange:u,placeholder:l("general:untitled"),readOnly:o,type:"text",value:r||s||""})})},Ul="blocks-field",Gl=({addRow:e,attributes:n,block:r,blocks:o,duplicateRow:i,errorCount:s,forceRender:l,hasMaxRows:c,isSortable:u,labels:d,listeners:f,moveRow:p,path:m,permissions:h,readOnly:g,removeRow:v,row:b,rowCount:y,rowIndex:w,schemaPath:x,setCollapse:P,setNodeRef:j,transform:k})=>{const S=`${m}.${w}`,{i18n:C}=(0,Be.B)(),M=$o()&&s>0,_=[`${Ul}__row`,M?`${Ul}__row--has-errors`:`${Ul}__row--no-errors`].filter(Boolean).join(" ");return(0,t.jsx)("div",{id:`${m.split(".").join("-")}-row-${w}`,ref:j,style:{transform:k},children:(0,t.jsx)(al,{actions:g?void 0:(0,t.jsx)(Yl,{addRow:e,blockType:b.blockType,blocks:o,duplicateRow:i,fieldMap:r.fieldMap,hasMaxRows:c,isSortable:u,labels:d,moveRow:p,removeRow:v,rowCount:y,rowIndex:w}),className:_,collapsibleStyle:M?"error":"default",dragHandleProps:u?{id:b.id,attributes:n,listeners:f}:void 0,header:(0,t.jsxs)("div",{className:`${Ul}__block-header`,children:[(0,t.jsx)("span",{className:`${Ul}__block-number`,children:String(w+1).padStart(2,"0")}),(0,t.jsx)(Ml,{className:`${Ul}__block-pill ${Ul}__block-pill-${b.blockType}`,pillStyle:"white",children:(0,a.sC)(r.labels.singular,C)}),(0,t.jsx)(ql,{path:`${S}.blockName`,readOnly:g}),M&&(0,t.jsx)(yo,{count:s,i18n:C,withMessage:!0})]}),isCollapsed:b.collapsed,onToggle:e=>P(b.id,e),children:(0,t.jsx)(ll,{className:`${Ul}__fields`,fieldMap:r.fieldMap,forceRender:l,margins:"small",path:S,permissions:h?.blocks?.[r.slug]?.fields,readOnly:g,schemaPath:`${x}.${r.slug}`})},b.id)},`${m}-row-${w}`)},Kl="blocks-field",Xl=vs((e=>{const{i18n:n,t:r}=(0,Be.B)(),{name:s,CustomDescription:l,CustomError:c,CustomLabel:u,blocks:d,className:f,descriptionProps:p,errorProps:m,forceRender:h=!1,isSortable:g=!0,label:v,labelProps:b,labels:y,localized:w,maxRows:x,minRows:P,path:j,readOnly:k,required:S,validate:C}=e,{indexPath:M,readOnly:_}=Po(),O=P??S?1:0,{setDocFieldPreferences:E}=us(),{addFieldRow:D,dispatchFields:N,setModified:A}=Lo(),{code:T}=ls(),{localization:R}=Ut(),I=Pl("blocks-drawer"),L=$o(),$={plural:r("fields:blocks"),singular:r("fields:block"),...y},W=(()=>{if(R&&R.fallback){const e=R.defaultLocale||"en";return T===e}return!0})(),F=(0,o.useCallback)(((e,t)=>!W&&null===e||("function"==typeof C?C(e,{...t,maxRows:x,minRows:O,required:S}):void 0)),[x,O,S,C,W]),{path:z}=Po(),{errorPaths:B,formInitializing:H,formProcessing:Y,path:V,permissions:q,rows:U=[],schemaPath:G,showError:K,valid:X,value:Q}=hs({hasRows:!0,path:z??j??s,validate:F}),J=k||_||Y||H,Z=(0,o.useCallback)((async(e,t)=>{await D({data:{blockType:t},path:V,rowIndex:e,schemaPath:`${G}.${t}`}),A(!0),setTimeout((()=>{$s(`${V}-row-${e+1}`)}),0)}),[D,V,A,G]),ee=(0,o.useCallback)((e=>{N({type:"DUPLICATE_ROW",path:V,rowIndex:e}),A(!0),setTimeout((()=>{$s(`${V}-row-${e+1}`)}),0)}),[N,V,A]),te=(0,o.useCallback)((e=>{N({type:"REMOVE_ROW",path:V,rowIndex:e}),A(!0)}),[V,N,A]),ne=(0,o.useCallback)(((e,t)=>{N({type:"MOVE_ROW",moveFromIndex:e,moveToIndex:t,path:V}),A(!0)}),[N,V,A]),re=(0,o.useCallback)((e=>{N({type:"SET_ALL_ROWS_COLLAPSED",collapsed:e,path:V,setDocFieldPreferences:E})}),[N,V,E]),ae=(0,o.useCallback)(((e,t)=>{N({type:"SET_ROW_COLLAPSED",collapsed:t,path:V,rowID:e,setDocFieldPreferences:E})}),[N,V,E]),oe=x&&U.length>=x,ie=B.length,se=L&&ie+(X?0:1)>0,le=U.length<O||S&&0===U.length,ce=J&&0===U.length;return(0,t.jsxs)("div",{className:[Ms,Kl,f,se?`${Kl}--has-error`:`${Kl}--has-no-error`].filter(Boolean).join(" "),id:`field-${V.replace(/\./g,"__")}`,children:[K&&(0,t.jsx)(Cs,{CustomError:c,path:V,...m||{}}),(0,t.jsxs)("header",{className:`${Kl}__header`,children:[(0,t.jsxs)("div",{className:`${Kl}__header-wrap`,children:[(0,t.jsxs)("div",{className:`${Kl}__heading-with-error`,children:[(0,t.jsx)("h3",{children:(0,t.jsx)(Ns,{CustomLabel:u,as:"span",label:v,required:S,unstyled:!0,...b||{}})}),se&&ie>0&&(0,t.jsx)(yo,{count:ie,i18n:n,withMessage:!0})]}),U.length>0&&(0,t.jsxs)("ul",{className:`${Kl}__header-actions`,children:[(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${Kl}__header-action`,onClick:()=>re(!0),type:"button",children:r("fields:collapseAll")})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:`${Kl}__header-action`,onClick:()=>re(!1),type:"button",children:r("fields:showAll")})})]})]}),(0,t.jsx)(ks,{CustomDescription:l,...p||{}})]}),(0,t.jsx)(Ls,{fieldValue:Q,localized:w,path:V}),(U.length>0||!X&&(ce||le))&&(0,t.jsxs)(vo,{className:`${Kl}__rows`,ids:U.map((e=>e.id)),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>ne(e,t),children:[U.map(((e,n)=>{const{blockType:r}=e,a=d.find((e=>e.slug===r));if(a){const r=B.filter((e=>e.startsWith(`${V}.${n}`))).length;return(0,t.jsx)(go,{disabled:J||!g,id:e.id,children:o=>(0,t.jsx)(Gl,{...o,addRow:Z,block:a,blocks:d,duplicateRow:ee,errorCount:r,forceRender:h,hasMaxRows:oe,indexPath:M,isSortable:g,labels:$,moveRow:ne,path:V,permissions:q,readOnly:J,removeRow:te,row:e,rowCount:U.length,rowIndex:n,schemaPath:G,setCollapse:ae})},e.id)}return null})),!W&&(0,t.jsxs)(i().Fragment,{children:[le&&(0,t.jsx)(Tn,{type:"error",children:r("validation:requiresAtLeast",{count:O,label:(0,a.sC)(O>1?$.plural:$.singular,n)||r(O>1?"general:row":"general:rows")})}),ce&&(0,t.jsx)(Tn,{children:r("validation:fieldHasNo",{label:(0,a.sC)($.plural,n)})})]})]}),!J&&!oe&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(wl,{className:`${Kl}__drawer-toggler`,slug:I,children:(0,t.jsx)(Yt,{buttonStyle:"icon-label",el:"span",icon:"plus",iconPosition:"left",iconStyle:"with-border",children:r("fields:addLabel",{label:(0,a.sC)($.singular,n)})})}),(0,t.jsx)(Hl,{addRow:Z,addRowIndex:U?.length||0,blocks:d,drawerSlug:I,labels:$})]})]})}));var Ql=n(5683);const Jl=(0,o.lazy)((()=>Promise.resolve().then(n.bind(n,7064)))),Zl=e=>{const{height:n="35vh"}=e;return(0,t.jsx)(o.Suspense,{fallback:(0,t.jsx)(Ql.l,{height:n}),children:(0,t.jsx)(Jl,{...e,height:n})})},ec={js:"javascript",ts:"typescript"},tc="code-field",nc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,editorOptions:d={},errorProps:f,label:p,labelProps:m,language:h="javascript",path:g,readOnly:v,required:b,style:y,validate:w,width:x}=e,P=(0,o.useCallback)(((e,t)=>{if("function"==typeof w)return w(e,{...t,required:b})}),[w,b]),{path:j,readOnly:k}=Po(),{formInitializing:S,formProcessing:C,path:M,setValue:_,showError:O,value:E}=hs({path:j??g??n,validate:P}),D=v||k||C||S;return(0,t.jsxs)("div",{className:[Ms,tc,c,O&&"error",D&&"read-only"].filter(Boolean).join(" "),style:{...y,width:x},children:[(0,t.jsx)(Ns,{CustomLabel:l,label:p,required:b,...m||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:s,path:M,...f||{}}),a,(0,t.jsx)(Zl,{defaultLanguage:ec[h]||h,onChange:D?()=>null:e=>_(e),options:d,readOnly:D,value:E||""}),r]}),i||(0,t.jsx)(ks,{...u||{}})]})})),rc=(e,t)=>t.reduce(((t,n)=>{const r="fieldMap"in n.fieldComponentProps?n.fieldComponentProps.fieldMap:void 0;if(r)if(n.isFieldAffectingData){const r="name"in n?n.name:"unnamed";t.push(e?`${e}.${r}.`:`${r}.`)}else t.push(...rc(e,r));else if("tabs"===n.type)"tabs"in n.fieldComponentProps&&n.fieldComponentProps.tabs?.forEach((n=>{let r=e;"name"in n&&(r=e?`${e}.${n.name}`:n.name),t.push(...rc(r,n.fieldMap))}));else if(n.isFieldAffectingData){const r="name"in n?n.name:"unnamed";t.push(e?`${e}.${r}`:r)}return t}),[]),ac=({fieldMap:e,path:t,setErrorCount:n})=>{const[r]=Ho(),a=$o(),o=rc(t,e);return Yo((()=>{if(a){const{errorCount:e}=(({formState:e,pathSegments:t})=>{const n={};let r=0;return Object.entries(e).forEach((([a])=>{const o=t?.some((e=>e.endsWith(".")?a.startsWith(e):a===e));if(o){const t=e[a];n[a]=t,"valid"in t&&!t.valid&&(r+=1)}})),{errorCount:r,fieldState:n}})({formState:r,pathSegments:o});n(e)}}),250,[r,a,e]),null},oc="collapsible-field",ic=vs((e=>{const{CustomDescription:n,CustomLabel:r,className:a,descriptionProps:i,fieldMap:s,initCollapsed:l=!1,label:c,path:u,readOnly:d}=e,{indexPath:f,path:p,readOnly:m,schemaPath:h,siblingPermissions:g}=Po(),v=zo(),b=Wo(),y=p??u,{i18n:w}=(0,Be.B)(),{getPreference:x,setPreference:P}=dn(),{preferencesKey:j}=us(),[k,S]=(0,o.useState)(),C=`collapsible-${f.replace(/\./g,"__")}`,[M,_]=(0,o.useState)(0),O=M>0,E=(0,o.useCallback)((async e=>{const t=await x(j);j&&P(j,{...t,...y?{fields:{...t?.fields||{},[y]:{...t?.fields?.[y],collapsed:e}}}:{fields:{...t?.fields||{},[C]:{...t?.fields?.[C],collapsed:e}}}})}),[j,C,x,P,y]);if((0,o.useEffect)((()=>{(async()=>{if(j){const e=await x(j),t=y?e?.fields?.[y]?.collapsed:e?.fields?.[C]?.collapsed;S(void 0!==t?Boolean(t):"boolean"==typeof l&&l)}else S("boolean"==typeof l&&l)})()}),[x,j,C,l,y]),"boolean"!=typeof k)return null;const D=d||m||b||v;return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(ac,{fieldMap:s,path:y,setErrorCount:_}),(0,t.jsxs)("div",{className:[Ms,oc,a,O?`${oc}--has-error`:`${oc}--has-no-error`].filter(Boolean).join(" "),id:`field-${C}${y?`-${y.replace(/\./g,"__")}`:""}`,children:[(0,t.jsx)(al,{className:`${oc}__collapsible`,collapsibleStyle:O?"error":"default",header:(0,t.jsxs)("div",{className:`${oc}__row-label-wrap`,children:[(0,t.jsx)(fl,{RowLabelComponent:r,i18n:w,path:y,rowLabel:c}),O&&(0,t.jsx)(yo,{count:M,i18n:w,withMessage:!0})]}),initCollapsed:k,onToggle:E,children:(0,t.jsx)(ll,{fieldMap:s,forceRender:!0,indexPath:f,margins:"small",path:y,permissions:g,readOnly:D,schemaPath:h})}),(0,t.jsx)(ks,{CustomDescription:n,...i||{}})]})]})})),sc=e=>{const{disabled:n}=e,r=Bo((([e])=>e?.password)),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((e=>e?e===r?.value||a("fields:passwordsDoNotMatch"):a("validation:required")),[r,a]),s="confirm-password",{setValue:l,showError:c,value:u}=hs({disableFormData:!0,path:s,validate:i});return(0,t.jsxs)("div",{className:[Ms,"confirm-password",c&&"error"].filter(Boolean).join(" "),children:[(0,t.jsx)(Ns,{htmlFor:"field-confirm-password",label:a("authentication:confirmPassword"),required:!0}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{path:s}),(0,t.jsx)("input",{autoComplete:"off",disabled:!!n,id:"field-confirm-password",name:"confirm-password",onChange:l,type:"password",value:u||""})]})]})},lc=(0,o.lazy)((()=>Promise.resolve().then(n.bind(n,73417)))),cc=e=>(0,t.jsx)(o.Suspense,{fallback:(0,t.jsx)(Ql.l,{height:50}),children:(0,t.jsx)(lc,{...e})}),uc="date-time-field",dc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,date:d,descriptionProps:f,errorProps:p,label:m,labelProps:h,path:g,placeholder:v,readOnly:b,required:y,style:w,validate:x,width:P}=e,{i18n:j}=(0,Be.B)(),k=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:y})}),[x,y]),{path:S,readOnly:C}=Po(),{formInitializing:M,formProcessing:_,path:O,setValue:E,showError:D,value:N}=hs({path:S??g??n,validate:k}),A=b||C||_||M;return(0,t.jsxs)("div",{className:[Ms,uc,u,D&&`${uc}--has-error`,A&&"read-only"].filter(Boolean).join(" "),style:{...w,width:P},children:[(0,t.jsx)(Ns,{CustomLabel:c,label:m,required:y,...h||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,id:`field-${O.replace(/\./g,"__")}`,children:[(0,t.jsx)(Cs,{CustomError:l,path:O,...p||{}}),i,(0,t.jsx)(cc,{...d,onChange:e=>{A||E(e?.toISOString()||null)},placeholder:(0,a.sC)(v,j),readOnly:A,value:N}),r]}),void 0!==s?s:(0,t.jsx)(ks,{...f||{}})]})})),fc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,autoComplete:u,className:d,descriptionProps:f,errorProps:p,label:m,labelProps:h,path:g,placeholder:v,readOnly:b,required:y,style:w,validate:x,width:P}=e,{i18n:j}=(0,Be.B)(),k=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:y})}),[x,y]),{path:S,readOnly:C}=Po(),{formInitializing:M,formProcessing:_,path:O,setValue:E,showError:D,value:N}=hs({path:S??g??n,validate:k}),A=b||C||_||M;return(0,t.jsxs)("div",{className:[Ms,"email",d,D&&"error",A&&"read-only"].filter(Boolean).join(" "),style:{...w,width:P},children:[(0,t.jsx)(Ns,{CustomLabel:c,label:m,required:y,...h||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:l,path:O,...p||{}}),i,(0,t.jsx)("input",{autoComplete:u,disabled:A,id:`field-${O.replace(/\./g,"__")}`,name:O,onChange:E,placeholder:(0,a.sC)(v,j),type:"email",value:N||""}),r]}),void 0!==s?s:(0,t.jsx)(ks,{...f||{}})]})})),pc=(0,o.createContext)(!1),mc=({children:e,withinRow:n=!0})=>(0,t.jsx)(pc.Provider,{value:n,children:e}),hc=(0,o.createContext)(!1),gc=({children:e,withinTab:n=!0})=>(0,t.jsx)(hc.Provider,{value:n,children:e}),vc=(0,o.createContext)(!1),bc=({children:e,withinGroup:n=!0})=>(0,t.jsx)(vc.Provider,{value:n,children:e}),yc="group-field",wc=vs((e=>{const{CustomDescription:n,CustomLabel:r,className:i,descriptionProps:s,fieldMap:l,hideGutter:c,label:u,readOnly:d,style:f,width:p}=e,{path:m,permissions:h,readOnly:g,schemaPath:v}=Po(),{i18n:b}=(0,Be.B)(),{isWithinCollapsible:y}=tl(),w=(0,o.useContext)(vc),x=(0,o.useContext)(pc),P=(0,o.useContext)(hc),{errorPaths:j}=hs({path:m}),k=zo(),S=Wo(),C=$o(),M=j.length,_=C&&M>0,O=d||g||S||k,E=!(y||w||x);return(0,t.jsx)(o.Fragment,{children:(0,t.jsx)("div",{className:[Ms,yc,E&&`${yc}--top-level`,y&&`${yc}--within-collapsible`,w&&`${yc}--within-group`,x&&`${yc}--within-row`,P&&`${yc}--within-tab`,!c&&w&&`${yc}--gutter`,_&&`${yc}--has-error`,i].filter(Boolean).join(" "),id:`field-${m?.replace(/\./g,"__")}`,style:{...f,width:p},children:(0,t.jsx)(bc,{children:(0,t.jsxs)("div",{className:`${yc}__wrap`,children:[(0,t.jsxs)("div",{className:`${yc}__header`,children:[(r||n||u)&&(0,t.jsxs)("header",{children:[void 0!==r?r:u?(0,t.jsx)("h3",{className:`${yc}__title`,children:(0,a.sC)(u,b)}):null,void 0!==n?n:(0,t.jsx)(ks,{...s||{}})]}),_&&(0,t.jsx)(yo,{count:M,i18n:b,withMessage:!0})]}),(0,t.jsx)(ll,{fieldMap:l,margins:"small",path:m,permissions:h?.fields,readOnly:O,schemaPath:v})]})})})})})),xc="json-field",Pc=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,editorOptions:d,errorProps:f,jsonSchema:p,label:m,labelProps:h,path:g,readOnly:v,required:b,style:y,validate:w,width:x}=e,[P,j]=(0,o.useState)(),[k,S]=(0,o.useState)(),[C,M]=(0,o.useState)(!1),_=(0,o.useCallback)(((e,t)=>{if("function"==typeof w)return w(e,{...t,jsonError:k,required:b})}),[w,b,k]),{path:O,readOnly:E}=Po(),{formInitializing:D,formProcessing:N,initialValue:A,path:T,setValue:R,showError:I,value:L}=hs({path:O??g??n,validate:_}),$=v||E||N||D,W=(0,o.useCallback)(((e,t)=>{if(!p)return;const n=t.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],r=t.Uri.parse(p.uri),a=t.editor.createModel(JSON.stringify(L,null,2),"json",r);t.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...n,p],validate:!0}),e.setModel(a)}),[p,L]),F=(0,o.useCallback)((e=>{if(!$){j(e);try{R(e?JSON.parse(e):null),S(void 0)}catch(t){R(e||null),S(t)}}}),[$,R,j]);return(0,o.useEffect)((()=>{C||void 0===L||(j(L||A?JSON.stringify(L||A,null,2):""),M(!0))}),[A,L,C]),(0,t.jsxs)("div",{className:[Ms,xc,c,I&&"error",$&&"read-only"].filter(Boolean).join(" "),style:{...y,width:x},children:[(0,t.jsx)(Ns,{CustomLabel:l,label:m,required:b,...h||{}}),(0,t.jsx)(Cs,{CustomError:s,path:T,...f||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:s,path:T,...f||{}}),a,(0,t.jsx)(Zl,{defaultLanguage:"json",onChange:F,onMount:W,options:d,readOnly:$,value:P}),r]}),void 0!==i?i:(0,t.jsx)(ks,{...u||{}})]})})),jc=require("payload/shared");function kc(e){return kc="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},kc(e)}function Sc(e){var t=function(e,t){if("object"!=kc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=kc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==kc(t)?t:t+""}function Cc(e,t,n){return(t=Sc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mc(Object(n),!0).forEach((function(t){Cc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Oc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ec(e,t){if(e){if("string"==typeof e)return Oc(e,t);var n=Object.prototype.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)?Oc(e,t):void 0}}function Dc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||Ec(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nc(e,t){if(null==e)return{};var n,r,a=u(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ac=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Tc(e){var t=e.defaultInputValue,n=void 0===t?"":t,r=e.defaultMenuIsOpen,a=void 0!==r&&r,i=e.defaultValue,s=void 0===i?null:i,l=e.inputValue,c=e.menuIsOpen,u=e.onChange,d=e.onInputChange,f=e.onMenuClose,p=e.onMenuOpen,m=e.value,h=Nc(e,Ac),g=Dc((0,o.useState)(void 0!==l?l:n),2),v=g[0],b=g[1],y=Dc((0,o.useState)(void 0!==c?c:a),2),w=y[0],x=y[1],P=Dc((0,o.useState)(void 0!==m?m:s),2),j=P[0],k=P[1],S=(0,o.useCallback)((function(e,t){"function"==typeof u&&u(e,t),k(e)}),[u]),C=(0,o.useCallback)((function(e,t){var n;"function"==typeof d&&(n=d(e,t)),b(void 0!==n?n:e)}),[d]),M=(0,o.useCallback)((function(){"function"==typeof p&&p(),x(!0)}),[p]),_=(0,o.useCallback)((function(){"function"==typeof f&&f(),x(!1)}),[f]),O=void 0!==l?l:v,E=void 0!==c?c:w,D=void 0!==m?m:j;return _c(_c({},h),{},{inputValue:O,menuIsOpen:E,onChange:S,onInputChange:C,onMenuClose:_,onMenuOpen:M,value:D})}function Rc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sc(r.key),r)}}function Ic(e){return Ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ic(e)}function Lc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Lc=function(){return!!e})()}function $c(e,t){if(t&&("object"===kc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Wc(e){return function(e){if(Array.isArray(e))return Oc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ec(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Fc=n(45396),zc=n(87205),Bc=n(33622),Hc=!!o.useInsertionEffect&&o.useInsertionEffect,Yc=Hc||function(e){return e()},Vc=(Hc||o.useLayoutEffect,{}.hasOwnProperty),qc=o.createContext("undefined"!=typeof HTMLElement?(0,Fc.A)({key:"css"}):null);qc.Provider;var Uc=function(e){return(0,o.forwardRef)((function(t,n){var r=(0,o.useContext)(qc);return e(t,r,n)}))};var Gc=o.createContext({});var Kc="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Xc=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return(0,zc.SF)(t,n,r),Yc((function(){return(0,zc.sk)(t,n,r)})),null},Qc=Uc((function(e,t,n){var r=e.css;"string"==typeof r&&void 0!==t.registered[r]&&(r=t.registered[r]);var a=e[Kc],i=[r],s="";"string"==typeof e.className?s=(0,zc.Rk)(t.registered,i,e.className):null!=e.className&&(s=e.className+" ");var l=(0,Bc.J)(i,void 0,o.useContext(Gc));s+=t.key+"-"+l.name;var c={};for(var u in e)Vc.call(e,u)&&"css"!==u&&u!==Kc&&(c[u]=e[u]);return c.ref=n,c.className=s,o.createElement(o.Fragment,null,o.createElement(Xc,{cache:t,serialized:l,isStringTag:"string"==typeof a}),o.createElement(a,c))}));var Jc=Qc,Zc=(n(8896),function(e,t){var n=arguments;if(null==t||!Vc.call(t,"css"))return o.createElement.apply(void 0,n);var r=n.length,a=new Array(r);a[0]=Jc,a[1]=function(e,t){var n={};for(var r in t)Vc.call(t,r)&&(n[r]=t[r]);return n[Kc]=e,n}(e,t);for(var i=2;i<r;i++)a[i]=n[i];return o.createElement.apply(null,a)});function eu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,Bc.J)(t)}var tu=n(97036);const nu=o.useLayoutEffect;var ru=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],au=function(){};function ou(e,t){return t?"-"===t[0]?e+t:e+"__"+t:e}function iu(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];var o=[].concat(r);if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&o.push("".concat(ou(e,i)));return o.filter((function(e){return e})).map((function(e){return String(e).trim()})).join(" ")}var su=function(e){return t=e,Array.isArray(t)?e.filter(Boolean):"object"===kc(e)&&null!==e?[e]:[];var t},lu=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,_c({},Nc(e,ru))},cu=function(e,t,n){var r=e.cx,a=e.getStyles,o=e.getClassNames,i=e.className;return{css:a(t,e),className:r(null!=n?n:{},o(t,e),i)}};function uu(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function du(e){return uu(e)?window.pageYOffset:e.scrollTop}function fu(e,t){uu(e)?window.scrollTo(0,t):e.scrollTop=t}function pu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:au,a=du(e),o=t-a,i=0;!function t(){var s,l=o*((s=(s=i+=10)/n-1)*s*s+1)+a;fu(e,l),i<n?window.requestAnimationFrame(t):r(e)}()}function mu(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.offsetHeight/3;r.bottom+a>n.bottom?fu(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+a,e.scrollHeight)):r.top-a<n.top&&fu(e,Math.max(t.offsetTop-a,0))}function hu(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}var gu=!1,vu={get passive(){return gu=!0}},bu="undefined"!=typeof window?window:{};bu.addEventListener&&bu.removeEventListener&&(bu.addEventListener("p",au,vu),bu.removeEventListener("p",au,!1));var yu=gu;function wu(e){return null!=e}function xu(e,t,n){return e?t:n}var Pu=["children","innerProps"],ju=["children","innerProps"];function ku(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,a=e.placement,o=e.shouldScroll,i=e.isFixedPosition,s=e.controlHeight,l=function(e){var t=getComputedStyle(e),n="absolute"===t.position,r=/(auto|scroll)/;if("fixed"===t.position)return document.documentElement;for(var a=e;a=a.parentElement;)if(t=getComputedStyle(a),(!n||"static"!==t.position)&&r.test(t.overflow+t.overflowY+t.overflowX))return a;return document.documentElement}(n),c={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return c;var u,d=l.getBoundingClientRect().height,f=n.getBoundingClientRect(),p=f.bottom,m=f.height,h=f.top,g=n.offsetParent.getBoundingClientRect().top,v=i?window.innerHeight:uu(u=l)?window.innerHeight:u.clientHeight,b=du(l),y=parseInt(getComputedStyle(n).marginBottom,10),w=parseInt(getComputedStyle(n).marginTop,10),x=g-w,P=v-h,j=x+b,k=d-b-h,S=p-v+b+y,C=b+h-w,M=160;switch(a){case"auto":case"bottom":if(P>=m)return{placement:"bottom",maxHeight:t};if(k>=m&&!i)return o&&pu(l,S,M),{placement:"bottom",maxHeight:t};if(!i&&k>=r||i&&P>=r)return o&&pu(l,S,M),{placement:"bottom",maxHeight:i?P-y:k-y};if("auto"===a||i){var _=t,O=i?x:j;return O>=r&&(_=Math.min(O-y-s,t)),{placement:"top",maxHeight:_}}if("bottom"===a)return o&&fu(l,S),{placement:"bottom",maxHeight:t};break;case"top":if(x>=m)return{placement:"top",maxHeight:t};if(j>=m&&!i)return o&&pu(l,C,M),{placement:"top",maxHeight:t};if(!i&&j>=r||i&&x>=r){var E=t;return(!i&&j>=r||i&&x>=r)&&(E=i?x-w:j-w),o&&pu(l,C,M),{placement:"top",maxHeight:E}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(a,'".'))}return c}var Su,Cu=function(e){return"auto"===e?"bottom":e},Mu=(0,o.createContext)(null),_u=function(e){var t=e.children,n=e.minMenuHeight,r=e.maxMenuHeight,a=e.menuPlacement,i=e.menuPosition,s=e.menuShouldScrollIntoView,l=e.theme,c=((0,o.useContext)(Mu)||{}).setPortalPlacement,u=(0,o.useRef)(null),d=Dc((0,o.useState)(r),2),f=d[0],p=d[1],m=Dc((0,o.useState)(null),2),h=m[0],g=m[1],v=l.spacing.controlHeight;return nu((function(){var e=u.current;if(e){var t="fixed"===i,o=ku({maxHeight:r,menuEl:e,minHeight:n,placement:a,shouldScroll:s&&!t,isFixedPosition:t,controlHeight:v});p(o.maxHeight),g(o.placement),null==c||c(o.placement)}}),[r,a,i,s,n,c,v]),t({ref:u,placerProps:_c(_c({},e),{},{placement:h||Cu(a),maxHeight:f})})},Ou=function(e){var t=e.children,n=e.innerRef,r=e.innerProps;return Zc("div",c({},cu(e,"menu",{menu:!0}),{ref:n},r),t)},Eu=function(e,t){var n=e.theme,r=n.spacing.baseUnit,a=n.colors;return _c({textAlign:"center"},t?{}:{color:a.neutral40,padding:"".concat(2*r,"px ").concat(3*r,"px")})},Du=Eu,Nu=Eu,Au=["size"],Tu=["innerProps","isRtl","size"];var Ru,Iu,Lu={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},$u=function(e){var t=e.size,n=Nc(e,Au);return Zc("svg",c({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Lu},n))},Wu=function(e){return Zc($u,c({size:20},e),Zc("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"}))},Fu=function(e){return Zc($u,c({size:20},e),Zc("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"}))},zu=function(e,t){var n=e.isFocused,r=e.theme,a=r.spacing.baseUnit,o=r.colors;return _c({label:"indicatorContainer",display:"flex",transition:"color 150ms"},t?{}:{color:n?o.neutral60:o.neutral20,padding:2*a,":hover":{color:n?o.neutral80:o.neutral40}})},Bu=zu,Hu=zu,Yu=function(){var e=eu.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_"}}}(Su||(Ru=["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"],Iu||(Iu=Ru.slice(0)),Su=Object.freeze(Object.defineProperties(Ru,{raw:{value:Object.freeze(Iu)}})))),Vu=function(e){var t=e.delay,n=e.offset;return Zc("span",{css:eu({animation:"".concat(Yu," 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"},"","")})},qu=function(e){var t=e.children,n=e.isDisabled,r=e.isFocused,a=e.innerRef,o=e.innerProps,i=e.menuIsOpen;return Zc("div",c({ref:a},cu(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":r,"control--menu-is-open":i}),o,{"aria-disabled":n||void 0}),t)},Uu=["data"],Gu=function(e){var t=e.children,n=e.cx,r=e.getStyles,a=e.getClassNames,o=e.Heading,i=e.headingProps,s=e.innerProps,l=e.label,u=e.theme,d=e.selectProps;return Zc("div",c({},cu(e,"group",{group:!0}),s),Zc(o,c({},i,{selectProps:d,theme:u,getStyles:r,getClassNames:a,cx:n}),l),Zc("div",null,t))},Ku=["innerRef","isDisabled","isHidden","inputClassName"],Xu={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},Qu={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":_c({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Xu)},Ju=function(e){return _c({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},Xu)},Zu=function(e){var t=e.cx,n=e.value,r=lu(e),a=r.innerRef,o=r.isDisabled,i=r.isHidden,s=r.inputClassName,l=Nc(r,Ku);return Zc("div",c({},cu(e,"input",{"input-container":!0}),{"data-value":n||""}),Zc("input",c({className:t({input:!0},s),ref:a,style:Ju(i),disabled:o},l)))},ed=function(e){var t=e.children,n=e.innerProps;return Zc("div",n,t)};var td=function(e){var t=e.children,n=e.components,r=e.data,a=e.innerProps,o=e.isDisabled,i=e.removeProps,s=e.selectProps,l=n.Container,c=n.Label,u=n.Remove;return Zc(l,{data:r,innerProps:_c(_c({},cu(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:s},Zc(c,{data:r,innerProps:_c({},cu(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:s},t),Zc(u,{data:r,innerProps:_c(_c({},cu(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},i),selectProps:s}))},nd={ClearIndicator:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),t||Zc(Wu,null))},Control:qu,DropdownIndicator:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),t||Zc(Fu,null))},DownChevron:Fu,CrossIcon:Wu,Group:Gu,GroupHeading:function(e){var t=lu(e);t.data;var n=Nc(t,Uu);return Zc("div",c({},cu(e,"groupHeading",{"group-heading":!0}),n))},IndicatorsContainer:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"indicatorsContainer",{indicators:!0}),n),t)},IndicatorSeparator:function(e){var t=e.innerProps;return Zc("span",c({},t,cu(e,"indicatorSeparator",{"indicator-separator":!0})))},Input:Zu,LoadingIndicator:function(e){var t=e.innerProps,n=e.isRtl,r=e.size,a=void 0===r?4:r,o=Nc(e,Tu);return Zc("div",c({},cu(_c(_c({},o),{},{innerProps:t,isRtl:n,size:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),Zc(Vu,{delay:0,offset:n}),Zc(Vu,{delay:160,offset:!0}),Zc(Vu,{delay:320,offset:!n}))},Menu:Ou,MenuList:function(e){var t=e.children,n=e.innerProps,r=e.innerRef,a=e.isMulti;return Zc("div",c({},cu(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:r},n),t)},MenuPortal:function(e){var t=e.appendTo,n=e.children,r=e.controlElement,a=e.innerProps,i=e.menuPlacement,l=e.menuPosition,u=(0,o.useRef)(null),d=(0,o.useRef)(null),f=Dc((0,o.useState)(Cu(i)),2),p=f[0],m=f[1],h=(0,o.useMemo)((function(){return{setPortalPlacement:m}}),[]),g=Dc((0,o.useState)(null),2),v=g[0],b=g[1],y=(0,o.useCallback)((function(){if(r){var e=function(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}(r),t="fixed"===l?0:window.pageYOffset,n=e[p]+t;n===(null==v?void 0:v.offset)&&e.left===(null==v?void 0:v.rect.left)&&e.width===(null==v?void 0:v.rect.width)||b({offset:n,rect:e})}}),[r,l,p,null==v?void 0:v.offset,null==v?void 0:v.rect.left,null==v?void 0:v.rect.width]);nu((function(){y()}),[y]);var w=(0,o.useCallback)((function(){"function"==typeof d.current&&(d.current(),d.current=null),r&&u.current&&(d.current=(0,tu.ll)(r,u.current,y,{elementResize:"ResizeObserver"in window}))}),[r,y]);nu((function(){w()}),[w]);var x=(0,o.useCallback)((function(e){u.current=e,w()}),[w]);if(!t&&"fixed"!==l||!v)return null;var P=Zc("div",c({ref:x},cu(_c(_c({},e),{},{offset:v.offset,position:l,rect:v.rect}),"menuPortal",{"menu-portal":!0}),a),n);return Zc(Mu.Provider,{value:h},t?(0,s.createPortal)(P,t):P)},LoadingMessage:function(e){var t=e.children,n=void 0===t?"Loading...":t,r=e.innerProps,a=Nc(e,ju);return Zc("div",c({},cu(_c(_c({},a),{},{children:n,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),n)},NoOptionsMessage:function(e){var t=e.children,n=void 0===t?"No options":t,r=e.innerProps,a=Nc(e,Pu);return Zc("div",c({},cu(_c(_c({},a),{},{children:n,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),n)},MultiValue:td,MultiValueContainer:ed,MultiValueLabel:ed,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({role:"button"},n),t||Zc(Wu,{size:14}))},Option:function(e){var t=e.children,n=e.isDisabled,r=e.isFocused,a=e.isSelected,o=e.innerRef,i=e.innerProps;return Zc("div",c({},cu(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":r,"option--is-selected":a}),{ref:o,"aria-disabled":n},i),t)},Placeholder:function(e){var t=e.children,n=e.innerProps;return Zc("div",c({},cu(e,"placeholder",{placeholder:!0}),n),t)},SelectContainer:function(e){var t=e.children,n=e.innerProps,r=e.isDisabled,a=e.isRtl;return Zc("div",c({},cu(e,"container",{"--is-disabled":r,"--is-rtl":a}),n),t)},SingleValue:function(e){var t=e.children,n=e.isDisabled,r=e.innerProps;return Zc("div",c({},cu(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),r),t)},ValueContainer:function(e){var t=e.children,n=e.innerProps,r=e.isMulti,a=e.hasValue;return Zc("div",c({},cu(e,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":a}),n),t)}},rd=n(38237);for(var ad={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"},od=function(e){return Zc("span",c({css:ad},e))},id={guidance:function(e){var t=e.isSearchable,n=e.isMulti,r=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(r?", 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,r=void 0===n?"":n,a=e.labels,o=e.isDisabled;switch(t){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(a.length>1?"s":""," ").concat(a.join(","),", selected.");case"select-option":return"option ".concat(r,o?" is disabled. Select another option.":", selected.");default:return""}},onFocus:function(e){var t=e.context,n=e.focused,r=e.options,a=e.label,o=void 0===a?"":a,i=e.selectValue,s=e.isDisabled,l=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&&i)return"value ".concat(o," focused, ").concat(u(i,n),".");if("menu"===t&&c){var d=s?" disabled":"",f="".concat(l?" selected":"").concat(d);return"".concat(o).concat(f,", ").concat(u(r,n),".")}return""},onFilter:function(e){var t=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}},sd=function(e){var t=e.ariaSelection,n=e.focusedOption,r=e.focusedValue,a=e.focusableOptions,i=e.isFocused,s=e.selectValue,l=e.selectProps,c=e.id,u=e.isAppleDevice,d=l.ariaLiveMessages,f=l.getOptionLabel,p=l.inputValue,m=l.isMulti,h=l.isOptionDisabled,g=l.isSearchable,v=l.menuIsOpen,b=l.options,y=l.screenReaderStatus,w=l.tabSelectsValue,x=l.isLoading,P=l["aria-label"],j=l["aria-live"],k=(0,o.useMemo)((function(){return _c(_c({},id),d||{})}),[d]),S=(0,o.useMemo)((function(){var e,n="";if(t&&k.onChange){var r=t.option,a=t.options,o=t.removedValue,i=t.removedValues,l=t.value,c=o||r||(e=l,Array.isArray(e)?null:e),u=c?f(c):"",d=a||i||void 0,p=d?d.map(f):[],m=_c({isDisabled:c&&h(c,s),label:u,labels:p},t);n=k.onChange(m)}return n}),[t,k,h,s,f]),C=(0,o.useMemo)((function(){var e="",t=n||r,o=!!(n&&s&&s.includes(n));if(t&&k.onFocus){var i={focused:t,label:f(t),isDisabled:h(t,s),isSelected:o,options:a,context:t===n?"menu":"value",selectValue:s,isAppleDevice:u};e=k.onFocus(i)}return e}),[n,r,f,h,k,a,s,u]),M=(0,o.useMemo)((function(){var e="";if(v&&b.length&&!x&&k.onFilter){var t=y({count:a.length});e=k.onFilter({inputValue:p,resultsMessage:t})}return e}),[a,p,v,k,b,y,x]),_="initial-input-focus"===(null==t?void 0:t.action),O=(0,o.useMemo)((function(){var e="";if(k.guidance){var t=r?"value":v?"menu":"input";e=k.guidance({"aria-label":P,context:t,isDisabled:n&&h(n,s),isMulti:m,isSearchable:g,tabSelectsValue:w,isInitialFocus:_})}return e}),[P,n,r,m,h,g,v,k,s,w,_]),E=Zc(o.Fragment,null,Zc("span",{id:"aria-selection"},S),Zc("span",{id:"aria-focused"},C),Zc("span",{id:"aria-results"},M),Zc("span",{id:"aria-guidance"},O));return Zc(o.Fragment,null,Zc(od,{id:c},_&&E),Zc(od,{"aria-live":j,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!_&&E))},ld=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],cd=new RegExp("["+ld.map((function(e){return e.letters})).join("")+"]","g"),ud={},dd=0;dd<ld.length;dd++)for(var fd=ld[dd],pd=0;pd<fd.letters.length;pd++)ud[fd.letters[pd]]=fd.base;var md=function(e){return e.replace(cd,(function(e){return ud[e]}))},hd=(0,rd.default)(md),gd=function(e){return e.replace(/^\s+|\s+$/g,"")},vd=function(e){return"".concat(e.label," ").concat(e.value)},bd=["innerRef"];function yd(e){var t=e.innerRef,n=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var a=Object.entries(e).filter((function(e){var t=Dc(e,1)[0];return!n.includes(t)}));return a.reduce((function(e,t){var n=Dc(t,2),r=n[0],a=n[1];return e[r]=a,e}),{})}(Nc(e,bd),"onExited","in","enter","exit","appear");return Zc("input",c({ref:t},n,{css:eu({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 wd=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};var xd=["boxSizing","height","overflow","paddingRight","position"],Pd={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function jd(e){e.preventDefault()}function kd(e){e.stopPropagation()}function Sd(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Cd(){return"ontouchstart"in window||navigator.maxTouchPoints}var Md=!("undefined"==typeof window||!window.document||!window.document.createElement),_d=0,Od={capture:!1,passive:!1};var Ed=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},Dd={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Nd(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,a=function(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,a=e.onTopArrive,i=e.onTopLeave,s=(0,o.useRef)(!1),l=(0,o.useRef)(!1),c=(0,o.useRef)(0),u=(0,o.useRef)(null),d=(0,o.useCallback)((function(e,t){if(null!==u.current){var o=u.current,c=o.scrollTop,d=o.scrollHeight,f=o.clientHeight,p=u.current,m=t>0,h=d-f-c,g=!1;h>t&&s.current&&(r&&r(e),s.current=!1),m&&l.current&&(i&&i(e),l.current=!1),m&&t>h?(n&&!s.current&&n(e),p.scrollTop=d,g=!0,s.current=!0):!m&&-t>c&&(a&&!l.current&&a(e),p.scrollTop=0,g=!0,l.current=!0),g&&wd(e)}}),[n,r,a,i]),f=(0,o.useCallback)((function(e){d(e,e.deltaY)}),[d]),p=(0,o.useCallback)((function(e){c.current=e.changedTouches[0].clientY}),[]),m=(0,o.useCallback)((function(e){var t=c.current-e.changedTouches[0].clientY;d(e,t)}),[d]),h=(0,o.useCallback)((function(e){if(e){var t=!!yu&&{passive:!1};e.addEventListener("wheel",f,t),e.addEventListener("touchstart",p,t),e.addEventListener("touchmove",m,t)}}),[m,p,f]),g=(0,o.useCallback)((function(e){e&&(e.removeEventListener("wheel",f,!1),e.removeEventListener("touchstart",p,!1),e.removeEventListener("touchmove",m,!1))}),[m,p,f]);return(0,o.useEffect)((function(){if(t){var e=u.current;return h(e),function(){g(e)}}}),[t,h,g]),function(e){u.current=e}}({isEnabled:void 0===r||r,onBottomArrive:e.onBottomArrive,onBottomLeave:e.onBottomLeave,onTopArrive:e.onTopArrive,onTopLeave:e.onTopLeave}),i=function(e){var t=e.isEnabled,n=e.accountForScrollbars,r=void 0===n||n,a=(0,o.useRef)({}),i=(0,o.useRef)(null),s=(0,o.useCallback)((function(e){if(Md){var t=document.body,n=t&&t.style;if(r&&xd.forEach((function(e){var t=n&&n[e];a.current[e]=t})),r&&_d<1){var o=parseInt(a.current.paddingRight,10)||0,i=document.body?document.body.clientWidth:0,s=window.innerWidth-i+o||0;Object.keys(Pd).forEach((function(e){var t=Pd[e];n&&(n[e]=t)})),n&&(n.paddingRight="".concat(s,"px"))}t&&Cd()&&(t.addEventListener("touchmove",jd,Od),e&&(e.addEventListener("touchstart",Sd,Od),e.addEventListener("touchmove",kd,Od))),_d+=1}}),[r]),l=(0,o.useCallback)((function(e){if(Md){var t=document.body,n=t&&t.style;_d=Math.max(_d-1,0),r&&_d<1&&xd.forEach((function(e){var t=a.current[e];n&&(n[e]=t)})),t&&Cd()&&(t.removeEventListener("touchmove",jd,Od),e&&(e.removeEventListener("touchstart",Sd,Od),e.removeEventListener("touchmove",kd,Od)))}}),[r]);return(0,o.useEffect)((function(){if(t){var e=i.current;return s(e),function(){l(e)}}}),[t,s,l]),function(e){i.current=e}}({isEnabled:n});return Zc(o.Fragment,null,n&&Zc("div",{onClick:Ed,css:Dd}),t((function(e){a(e),i(e)})))}var Ad={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Td=function(e){var t=e.name,n=e.onFocus;return Zc("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:Ad,value:"",onChange:function(){}})};function Rd(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function Id(){return Rd(/^Mac/i)}function Ld(){return Rd(/^iPhone/i)||Rd(/^iPad/i)||Id()&&navigator.maxTouchPoints>1}var $d=function(e){return e.label},Wd=function(e){return e.value},Fd={clearIndicator:Hu,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,r=e.isFocused,a=e.theme,o=a.colors,i=a.borderRadius;return _c({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:r?o.primary:o.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:r?o.primary:o.neutral30}})},dropdownIndicator:Bu,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,r=n.colors,a=n.spacing;return _c({label:"group",cursor:"default",display:"block"},t?{}:{color:r.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,r=e.theme,a=r.spacing.baseUnit,o=r.colors;return _c({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,r=e.value,a=e.theme,o=a.spacing,i=a.colors;return _c(_c({visibility:n?"hidden":"visible",transform:r?"translateZ(0)":""},Qu),t?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:i.neutral80})},loadingIndicator:function(e,t){var n=e.isFocused,r=e.size,a=e.theme,o=a.colors,i=a.spacing.baseUnit;return _c({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},t?{}:{color:n?o.neutral60:o.neutral20,padding:2*i})},loadingMessage:Nu,menu:function(e,t){var n,r=e.placement,a=e.theme,o=a.borderRadius,i=a.spacing,s=a.colors;return _c((Cc(n={label:"menu"},function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(r),"100%"),Cc(n,"position","absolute"),Cc(n,"width","100%"),Cc(n,"zIndex",1),n),t?{}:{backgroundColor:s.neutral0,borderRadius:o,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:i.menuGutter,marginTop:i.menuGutter})},menuList:function(e,t){var n=e.maxHeight,r=e.theme.spacing.baseUnit;return _c({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},t?{}:{paddingBottom:r,paddingTop:r})},menuPortal:function(e){var t=e.rect,n=e.offset,r=e.position;return{left:t.left,position:r,top:n,width:t.width,zIndex:1}},multiValue:function(e,t){var n=e.theme,r=n.spacing,a=n.borderRadius,o=n.colors;return _c({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:r.baseUnit/2})},multiValueLabel:function(e,t){var n=e.theme,r=n.borderRadius,a=n.colors,o=e.cropWithEllipsis;return _c({overflow:"hidden",textOverflow:o||void 0===o?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:r/2,color:a.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},multiValueRemove:function(e,t){var n=e.theme,r=n.spacing,a=n.borderRadius,o=n.colors,i=e.isFocused;return _c({alignItems:"center",display:"flex"},t?{}:{borderRadius:a/2,backgroundColor:i?o.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},noOptionsMessage:Du,option:function(e,t){var n=e.isDisabled,r=e.isFocused,a=e.isSelected,o=e.theme,i=o.spacing,s=o.colors;return _c({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:a?s.primary:r?s.primary25:"transparent",color:n?s.neutral20:a?s.neutral0:"inherit",padding:"".concat(2*i.baseUnit,"px ").concat(3*i.baseUnit,"px"),":active":{backgroundColor:n?void 0:a?s.primary:s.primary50}})},placeholder:function(e,t){var n=e.theme,r=n.spacing,a=n.colors;return _c({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:a.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},singleValue:function(e,t){var n=e.isDisabled,r=e.theme,a=r.spacing,o=r.colors;return _c({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,r=e.isMulti,a=e.hasValue,o=e.selectProps.controlShouldRenderValue;return _c({alignItems:"center",display:r&&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")})}};var zd={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}},Bd={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:hu(),captureMenuScroll:!hu(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:function(e){return function(t,n){if(t.data.__isNew__)return!0;var r=_c({ignoreCase:!0,ignoreAccents:!0,stringify:vd,trim:!0,matchFrom:"any"},e),a=r.ignoreCase,o=r.ignoreAccents,i=r.stringify,s=r.trim,l=r.matchFrom,c=s?gd(n):n,u=s?gd(i(t)):i(t);return a&&(c=c.toLowerCase(),u=u.toLowerCase()),o&&(c=hd(c),u=md(u)),"start"===l?u.substr(0,c.length)===c:u.indexOf(c)>-1}}(),formatGroupLabel:function(e){return e.label},getOptionLabel:$d,getOptionValue:Wd,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 Hd(e,t,n,r){return{type:"option",data:t,isDisabled:Qd(e,t,n),isSelected:Jd(e,t,n),label:Kd(e,t),value:Xd(e,t),index:r}}function Yd(e,t){return e.options.map((function(n,r){if("options"in n){var a=n.options.map((function(n,r){return Hd(e,n,t,r)})).filter((function(t){return Ud(e,t)}));return a.length>0?{type:"group",data:n,options:a,index:r}:void 0}var o=Hd(e,n,t,r);return Ud(e,o)?o:void 0})).filter(wu)}function Vd(e){return e.reduce((function(e,t){return"group"===t.type?e.push.apply(e,Wc(t.options.map((function(e){return e.data})))):e.push(t.data),e}),[])}function qd(e,t){return e.reduce((function(e,n){return"group"===n.type?e.push.apply(e,Wc(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 Ud(e,t){var n=e.inputValue,r=void 0===n?"":n,a=t.data,o=t.isSelected,i=t.label,s=t.value;return(!ef(e)||!o)&&Zd(e,{label:i,value:s,data:a},r)}var Gd=function(e,t){var n;return(null===(n=e.find((function(e){return e.data===t})))||void 0===n?void 0:n.id)||null},Kd=function(e,t){return e.getOptionLabel(t)},Xd=function(e,t){return e.getOptionValue(t)};function Qd(e,t,n){return"function"==typeof e.isOptionDisabled&&e.isOptionDisabled(t,n)}function Jd(e,t,n){if(n.indexOf(t)>-1)return!0;if("function"==typeof e.isOptionSelected)return e.isOptionSelected(t,n);var r=Xd(e,t);return n.some((function(t){return Xd(e,t)===r}))}function Zd(e,t,n){return!e.filterOption||e.filterOption(t,n)}var ef=function(e){var t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},tf=1,nf=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(l,e);var t,n,r,a,i,s=(t=l,n=Lc(),function(){var e,r=Ic(t);if(n){var a=Ic(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return $c(this,e)});function l(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=s.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=Id()||Ld(),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 r=t.props,a=r.onChange,o=r.name;n.name=o,t.ariaOnChange(e,n),a(e,n)},t.setValue=function(e,n,r){var a=t.props,o=a.closeMenuOnSelect,i=a.isMulti,s=a.inputValue;t.onInputChange("",{action:"set-value",prevInputValue:s}),o&&(t.setState({inputIsHiddenAfterUpdate:!i}),t.onMenuClose()),t.setState({clearFocusValueOnUpdate:!0}),t.onChange(e,{action:n,option:r})},t.selectOption=function(e){var n=t.props,r=n.blurInputOnSelect,a=n.isMulti,o=n.name,i=t.state.selectValue,s=a&&t.isOptionSelected(e,i),l=t.isOptionDisabled(e,i);if(s){var c=t.getOptionValue(e);t.setValue(i.filter((function(e){return t.getOptionValue(e)!==c})),"deselect-option",e)}else{if(l)return void t.ariaOnChange(e,{action:"select-option",option:e,name:o});a?t.setValue([].concat(Wc(i),[e]),"select-option",e):t.setValue(e,"select-option")}r&&t.blurInput()},t.removeValue=function(e){var n=t.props.isMulti,r=t.state.selectValue,a=t.getOptionValue(e),o=r.filter((function(e){return t.getOptionValue(e)!==a})),i=xu(n,o,o[0]||null);t.onChange(i,{action:"remove-value",removedValue:e}),t.focusInput()},t.clearValue=function(){var e=t.state.selectValue;t.onChange(xu(t.props.isMulti,[],null),{action:"clear",removedValues:e})},t.popValue=function(){var e=t.props.isMulti,n=t.state.selectValue,r=n[n.length-1],a=n.slice(0,n.length-1),o=xu(e,a,a[0]||null);t.onChange(o,{action:"pop-value",removedValue:r})},t.getFocusedOptionId=function(e){return Gd(t.state.focusableOptionsWithIds,e)},t.getFocusableOptionsWithIds=function(){return qd(Yd(t.props,t.state.selectValue),t.getElementId("option"))},t.getValue=function(){return t.state.selectValue},t.cx=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return iu.apply(void 0,[t.props.classNamePrefix].concat(n))},t.getOptionLabel=function(e){return Kd(t.props,e)},t.getOptionValue=function(e){return Xd(t.props,e)},t.getStyles=function(e,n){var r=t.props.unstyled,a=Fd[e](n,r);a.boxSizing="border-box";var o=t.props.styles[e];return o?o(a,n):a},t.getClassNames=function(e,n){var r,a;return null===(r=(a=t.props.classNames)[e])||void 0===r?void 0:r.call(a,n)},t.getElementId=function(e){return"".concat(t.state.instancePrefix,"-").concat(e)},t.getComponents=function(){return e=t.props,_c(_c({},nd),e.components);var e},t.buildCategorizedOptions=function(){return Yd(t.props,t.state.selectValue)},t.getCategorizedOptions=function(){return t.props.menuIsOpen?t.buildCategorizedOptions():[]},t.buildFocusableOptions=function(){return Vd(t.buildCategorizedOptions())},t.getFocusableOptions=function(){return t.props.menuIsOpen?t.buildFocusableOptions():[]},t.ariaOnChange=function(e,n){t.setState({ariaSelection:_c({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,r=n.isMulti,a=n.menuIsOpen;t.focusInput(),a?(t.setState({inputIsHiddenAfterUpdate:!r}),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.focusInput():setTimeout((function(){return t.focusInput()})))},t.onScroll=function(e){"boolean"==typeof t.props.closeMenuOnScroll?e.target instanceof HTMLElement&&uu(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,r=n&&n.item(0);r&&(t.initialTouchX=r.clientX,t.initialTouchY=r.clientY,t.userIsDragging=!1)},t.onTouchMove=function(e){var n=e.touches,r=n&&n.item(0);if(r){var a=Math.abs(r.clientX-t.initialTouchX),o=Math.abs(r.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,r=e.currentTarget.value;t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange(r,{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;t.menuListRef&&t.menuListRef.contains(document.activeElement)?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 ef(t.props)},t.onValueInputFocus=function(e){e.preventDefault(),e.stopPropagation(),t.focus()},t.onKeyDown=function(e){var n=t.props,r=n.isMulti,a=n.backspaceRemovesValue,o=n.escapeClearsValue,i=n.inputValue,s=n.isClearable,l=n.isDisabled,c=n.menuIsOpen,u=n.onKeyDown,d=n.tabSelectsValue,f=n.openMenuOnFocus,p=t.state,m=p.focusedOption,h=p.focusedValue,g=p.selectValue;if(!(l||"function"==typeof u&&(u(e),e.defaultPrevented))){switch(t.blockOptionHover=!0,e.key){case"ArrowLeft":if(!r||i)return;t.focusValue("previous");break;case"ArrowRight":if(!r||i)return;t.focusValue("next");break;case"Delete":case"Backspace":if(i)return;if(h)t.removeValue(h);else{if(!a)return;r?t.popValue():s&&t.clearValue()}break;case"Tab":if(t.isComposing)return;if(e.shiftKey||!c||!d||!m||f&&t.isOptionSelected(m,g))return;t.selectOption(m);break;case"Enter":if(229===e.keyCode)break;if(c){if(!m)return;if(t.isComposing)return;t.selectOption(m);break}return;case"Escape":c?(t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange("",{action:"menu-close",prevInputValue:i}),t.onMenuClose()):s&&o&&t.clearValue();break;case" ":if(i)return;if(!c){t.openMenu("first");break}if(!m)return;t.selectOption(m);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||++tf),t.state.selectValue=su(e.value),e.menuIsOpen&&t.state.selectValue.length){var n=t.getFocusableOptionsWithIds(),r=t.buildFocusableOptions(),a=r.indexOf(t.state.selectValue[0]);t.state.focusableOptionsWithIds=n,t.state.focusedOption=r[a],t.state.focusedOptionId=Gd(n,r[a])}return t}return r=l,a=[{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&&mu(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,r=t.menuIsOpen,a=this.state.isFocused;(a&&!n&&e.isDisabled||a&&r&&!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&&(mu(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,r=n.selectValue,a=n.isFocused,o=this.buildFocusableOptions(),i="first"===e?0:o.length-1;if(!this.props.isMulti){var s=o.indexOf(r[0]);s>-1&&(i=s)}this.scrollToFocusedOptionOnUpdate=!(a&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:o[i],focusedOptionId:this.getFocusedOptionId(o[i])},(function(){return t.onMenuOpen()}))}},{key:"focusValue",value:function(e){var t=this.state,n=t.selectValue,r=t.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var a=n.indexOf(r);r||(a=-1);var o=n.length-1,i=-1;if(n.length){switch(e){case"previous":i=0===a?0:-1===a?o:a-1;break;case"next":a>-1&&a<o&&(i=a+1)}this.setState({inputIsHidden:-1!==i,focusedValue:n[i]})}}}},{key:"focusOption",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props.pageSize,n=this.state.focusedOption,r=this.getFocusableOptions();if(r.length){var a=0,o=r.indexOf(n);n||(o=-1),"up"===e?a=o>0?o-1:r.length-1:"down"===e?a=(o+1)%r.length:"pageup"===e?(a=o-t)<0&&(a=0):"pagedown"===e?(a=o+t)>r.length-1&&(a=r.length-1):"last"===e&&(a=r.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:r[a],focusedValue:null,focusedOptionId:this.getFocusedOptionId(r[a])})}}},{key:"getTheme",value:function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(zd):_c(_c({},zd),this.props.theme):zd}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,r=this.getClassNames,a=this.getValue,o=this.selectOption,i=this.setValue,s=this.props,l=s.isMulti,c=s.isRtl,u=s.options;return{clearValue:e,cx:t,getStyles:n,getClassNames:r,getValue:a,hasValue:this.hasValue(),isMulti:l,isRtl:c,options:u,selectOption:o,selectProps:s,setValue:i,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 Qd(this.props,e,t)}},{key:"isOptionSelected",value:function(e,t){return Jd(this.props,e,t)}},{key:"filterOption",value:function(e,t){return Zd(this.props,e,t)}},{key:"formatOptionLabel",value:function(e,t){if("function"==typeof this.props.formatOptionLabel){var n=this.props.inputValue,r=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:r})}return this.getOptionLabel(e)}},{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,r=e.inputId,a=e.inputValue,i=e.tabIndex,s=e.form,l=e.menuIsOpen,u=e.required,d=this.getComponents().Input,f=this.state,p=f.inputIsHidden,m=f.ariaSelection,h=this.commonProps,g=r||this.getElementId("input"),v=_c(_c(_c({"aria-autocomplete":"list","aria-expanded":l,"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":u,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},l&&{"aria-controls":this.getElementId("listbox")}),!n&&{"aria-readonly":!0}),this.hasValue()?"initial-input-focus"===(null==m?void 0:m.action)&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return n?o.createElement(d,c({},h,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:g,innerRef:this.getInputRef,isDisabled:t,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:i,form:s,type:"text",value:a},v)):o.createElement(yd,c({id:g,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:au,onFocus:this.onInputFocus,disabled:t,tabIndex:i,inputMode:"none",form:s,value:""},v))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.getComponents(),n=t.MultiValue,r=t.MultiValueContainer,a=t.MultiValueLabel,i=t.MultiValueRemove,s=t.SingleValue,l=t.Placeholder,u=this.commonProps,d=this.props,f=d.controlShouldRenderValue,p=d.isDisabled,m=d.isMulti,h=d.inputValue,g=d.placeholder,v=this.state,b=v.selectValue,y=v.focusedValue,w=v.isFocused;if(!this.hasValue()||!f)return h?null:o.createElement(l,c({},u,{key:"placeholder",isDisabled:p,isFocused:w,innerProps:{id:this.getElementId("placeholder")}}),g);if(m)return b.map((function(t,s){var l=t===y,d="".concat(e.getOptionLabel(t),"-").concat(e.getOptionValue(t));return o.createElement(n,c({},u,{components:{Container:r,Label:a,Remove:i},isFocused:l,isDisabled:p,key:d,index:s,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(h)return null;var x=b[0];return o.createElement(s,c({},u,{data:x,isDisabled:p}),this.formatOptionLabel(x,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.getComponents().ClearIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,a=n.isLoading,i=this.state.isFocused;if(!this.isClearable()||!e||r||!this.hasValue()||a)return null;var s={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,c({},t,{innerProps:s,isFocused:i}))}},{key:"renderLoadingIndicator",value:function(){var e=this.getComponents().LoadingIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,a=n.isLoading,i=this.state.isFocused;return e&&a?o.createElement(e,c({},t,{innerProps:{"aria-hidden":"true"},isDisabled:r,isFocused:i})):null}},{key:"renderIndicatorSeparator",value:function(){var e=this.getComponents(),t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var r=this.commonProps,a=this.props.isDisabled,i=this.state.isFocused;return o.createElement(n,c({},r,{isDisabled:a,isFocused:i}))}},{key:"renderDropdownIndicator",value:function(){var e=this.getComponents().DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,r=this.state.isFocused,a={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,c({},t,{innerProps:a,isDisabled:n,isFocused:r}))}},{key:"renderMenu",value:function(){var e=this,t=this.getComponents(),n=t.Group,r=t.GroupHeading,a=t.Menu,i=t.MenuList,s=t.MenuPortal,l=t.LoadingMessage,u=t.NoOptionsMessage,d=t.Option,f=this.commonProps,p=this.state.focusedOption,m=this.props,h=m.captureMenuScroll,g=m.inputValue,v=m.isLoading,b=m.loadingMessage,y=m.minMenuHeight,w=m.maxMenuHeight,x=m.menuIsOpen,P=m.menuPlacement,j=m.menuPosition,k=m.menuPortalTarget,S=m.menuShouldBlockScroll,C=m.menuShouldScrollIntoView,M=m.noOptionsMessage,_=m.onMenuScrollToTop,O=m.onMenuScrollToBottom;if(!x)return null;var E,D=function(t,n){var r=t.type,a=t.data,i=t.isDisabled,s=t.isSelected,l=t.label,u=t.value,m=p===a,h=i?void 0:function(){return e.onOptionHover(a)},g=i?void 0:function(){return e.selectOption(a)},v="".concat(e.getElementId("option"),"-").concat(n),b={id:v,onClick:g,onMouseMove:h,onMouseOver:h,tabIndex:-1,role:"option","aria-selected":e.isAppleDevice?void 0:s};return o.createElement(d,c({},f,{innerProps:b,data:a,isDisabled:i,isSelected:s,key:v,label:l,type:r,value:u,isFocused:m,innerRef:m?e.getFocusedOptionRef:void 0}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())E=this.getCategorizedOptions().map((function(t){if("group"===t.type){var a=t.data,i=t.options,s=t.index,l="".concat(e.getElementId("group"),"-").concat(s),u="".concat(l,"-heading");return o.createElement(n,c({},f,{key:l,data:a,options:i,Heading:r,headingProps:{id:u,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return D(e,"".concat(s,"-").concat(e.index))})))}if("option"===t.type)return D(t,"".concat(t.index))}));else if(v){var N=b({inputValue:g});if(null===N)return null;E=o.createElement(l,f,N)}else{var A=M({inputValue:g});if(null===A)return null;E=o.createElement(u,f,A)}var T={minMenuHeight:y,maxMenuHeight:w,menuPlacement:P,menuPosition:j,menuShouldScrollIntoView:C},R=o.createElement(_u,c({},f,T),(function(t){var n=t.ref,r=t.placerProps,s=r.placement,l=r.maxHeight;return o.createElement(a,c({},f,T,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:v,placement:s}),o.createElement(Nd,{captureEnabled:h,onTopArrive:_,onBottomArrive:O,lockEnabled:S},(function(t){return o.createElement(i,c({},f,{innerRef:function(n){e.getMenuListRef(n),t(n)},innerProps:{role:"listbox","aria-multiselectable":f.isMulti,id:e.getElementId("listbox")},isLoading:v,maxHeight:l,focusedOption:p}),E)})))}));return k||"fixed"===j?o.createElement(s,c({},f,{appendTo:k,controlElement:this.controlRef,menuPlacement:P,menuPosition:j}),R):R}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,r=t.isDisabled,a=t.isMulti,i=t.name,s=t.required,l=this.state.selectValue;if(s&&!this.hasValue()&&!r)return o.createElement(Td,{name:i,onFocus:this.onValueInputFocus});if(i&&!r){if(a){if(n){var c=l.map((function(t){return e.getOptionValue(t)})).join(n);return o.createElement("input",{name:i,type:"hidden",value:c})}var u=l.length>0?l.map((function(t,n){return o.createElement("input",{key:"i-".concat(n),name:i,type:"hidden",value:e.getOptionValue(t)})})):o.createElement("input",{name:i,type:"hidden",value:""});return o.createElement("div",null,u)}var d=l[0]?this.getOptionValue(l[0]):"";return o.createElement("input",{name:i,type:"hidden",value:d})}}},{key:"renderLiveRegion",value:function(){var e=this.commonProps,t=this.state,n=t.ariaSelection,r=t.focusedOption,a=t.focusedValue,i=t.isFocused,s=t.selectValue,l=this.getFocusableOptions();return o.createElement(sd,c({},e,{id:this.getElementId("live-region"),ariaSelection:n,focusedOption:r,focusedValue:a,isFocused:i,selectValue:s,focusableOptions:l,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var e=this.getComponents(),t=e.Control,n=e.IndicatorsContainer,r=e.SelectContainer,a=e.ValueContainer,i=this.props,s=i.className,l=i.id,u=i.isDisabled,d=i.menuIsOpen,f=this.state.isFocused,p=this.commonProps=this.getCommonProps();return o.createElement(r,c({},p,{className:s,innerProps:{id:l,onKeyDown:this.onKeyDown},isDisabled:u,isFocused:f}),this.renderLiveRegion(),o.createElement(t,c({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:u,isFocused:f,menuIsOpen:d}),o.createElement(a,c({},p,{isDisabled:u}),this.renderPlaceholderOrValue(),this.renderInput()),o.createElement(n,c({},p,{isDisabled:u}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],i=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,r=t.clearFocusValueOnUpdate,a=t.inputIsHiddenAfterUpdate,o=t.ariaSelection,i=t.isFocused,s=t.prevWasFocused,l=t.instancePrefix,c=e.options,u=e.value,d=e.menuIsOpen,f=e.inputValue,p=e.isMulti,m=su(u),h={};if(n&&(u!==n.value||c!==n.options||d!==n.menuIsOpen||f!==n.inputValue)){var g=d?function(e,t){return Vd(Yd(e,t))}(e,m):[],v=d?qd(Yd(e,m),"".concat(l,"-option")):[],b=r?function(e,t){var n=e.focusedValue,r=e.selectValue.indexOf(n);if(r>-1){if(t.indexOf(n)>-1)return n;if(r<t.length)return t[r]}return null}(t,m):null,y=function(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}(t,g);h={selectValue:m,focusedOption:y,focusedOptionId:Gd(v,y),focusableOptionsWithIds:v,focusedValue:b,clearFocusValueOnUpdate:!1}}var w=null!=a&&e!==n?{inputIsHidden:a,inputIsHiddenAfterUpdate:void 0}:{},x=o,P=i&&s;return i&&!P&&(x={value:xu(p,m,m[0]||null),options:m,action:"initial-input-focus"},P=!s),"initial-input-focus"===(null==o?void 0:o.action)&&(x=null),_c(_c(_c({},h),w),{},{prevProps:e,ariaSelection:x,prevWasFocused:P})}}],a&&Rc(r.prototype,a),i&&Rc(r,i),Object.defineProperty(r,"prototype",{writable:!1}),l}(o.Component);nf.defaultProps=Bd;var rf=(0,o.forwardRef)((function(e,t){var n=Tc(e);return o.createElement(nf,c({ref:t},n))})),af=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],of=function(){var e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,n=String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase(),r=String(t.getOptionValue(e)).toLowerCase(),a=String(t.getOptionLabel(e)).toLowerCase();return r===n||a===n},sf={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,t,n,r){return!(!e||t.some((function(t){return of(e,t,r)}))||n.some((function(t){return of(e,t,r)})))},getNewOptionData:function(e,t){return{label:t,value:e,__isNew__:!0}}};var lf=(0,o.forwardRef)((function(e,t){var n=function(e){var t=e.allowCreateWhileLoading,n=void 0!==t&&t,r=e.createOptionPosition,a=void 0===r?"last":r,i=e.formatCreateLabel,s=void 0===i?sf.formatCreateLabel:i,l=e.isValidNewOption,c=void 0===l?sf.isValidNewOption:l,u=e.getNewOptionData,d=void 0===u?sf.getNewOptionData:u,f=e.onCreateOption,p=e.options,m=void 0===p?[]:p,h=e.onChange,g=Nc(e,af),v=g.getOptionValue,b=void 0===v?Wd:v,y=g.getOptionLabel,w=void 0===y?$d:y,x=g.inputValue,P=g.isLoading,j=g.isMulti,k=g.value,S=g.name,C=(0,o.useMemo)((function(){return c(x,su(k),m,{getOptionValue:b,getOptionLabel:w})?d(x,s(x)):void 0}),[s,d,w,b,x,c,m,k]),M=(0,o.useMemo)((function(){return!n&&P||!C?m:"first"===a?[C].concat(Wc(m)):[].concat(Wc(m),[C])}),[n,a,P,C,m]),_=(0,o.useCallback)((function(e,t){if("select-option"!==t.action)return h(e,t);var n=Array.isArray(e)?e:[e];if(n[n.length-1]!==C)h(e,t);else if(f)f(x);else{var r=d(x,x),a={action:"create-option",name:S,option:r};h(xu(j,[].concat(Wc(su(k)),[r]),r),a)}}),[d,x,j,S,C,f,h,k]);return _c(_c({},g),{},{options:M,onChange:_})}(Tc(e));return o.createElement(nf,c({ref:t},n))})),cf=lf;const uf="clear-indicator",df=e=>{const{clearValue:n,innerProps:{ref:r,...a}}=e;return(0,t.jsx)("div",{className:uf,ref:"string"==typeof r?null:r,...a,onKeyDown:e=>{"Enter"===e.key&&(n(),e.stopPropagation())},role:"button",tabIndex:0,children:(0,t.jsx)($t.u,{className:`${uf}__icon`})})},ff=e=>{const{children:n,innerProps:r,selectProps:{customProps:{disableKeyDown:a,disableMouseDown:o}={}}={}}=e;return(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.Control,{...e,innerProps:{...r,onKeyDown:e=>{if(a){e.stopPropagation();const t=new CustomEvent("bypassKeyDown",{detail:e});document.dispatchEvent(t)}},onMouseDown:e=>{o||r.onMouseDown(e)}},children:n})})},pf="dropdown-indicator",mf=e=>{const{innerProps:{ref:n,...r}}=e;return(0,t.jsx)("button",{className:pf,ref:n,...r,onKeyDown:e=>{"Enter"===e.key&&(e.key=" ")},type:"button",children:(0,t.jsx)(Tt,{className:`${pf}__icon`})})},hf=e=>(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.Input,{...e,"aria-activedescendant":void 0})}),gf="multi-value";function vf(e,t){return"function"==typeof t?t(e):e.value}const bf=e=>{const{className:n,data:r,innerProps:a,isDisabled:o,selectProps:{customProps:{disableMouseDown:s}={},getOptionValue:l,isSortable:c}={}}=e,{attributes:u,isDragging:d,listeners:f,setNodeRef:p,transform:m}=ho({id:vf(r,l),disabled:!c}),h=[gf,n,!o&&c&&"draggable",d&&`${gf}--is-dragging`].filter(Boolean).join(" ");return(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.MultiValue,{...e,className:h,innerProps:{...c?{...u,...f}:{},...a,onMouseDown:e=>{s||e.stopPropagation()},ref:p,style:c?{transform:m,...u?.style}:{}}})})},yf="multi-value-label",wf=e=>{const{selectProps:{customProps:{draggableProps:n}={}}={}}=e;return(0,t.jsx)("div",{className:yf,children:(0,t.jsx)(nd.MultiValueLabel,{...e,innerProps:{className:`${yf}__text`,...n||{}}})})},xf="multi-value-remove",Pf=e=>{const{innerProps:{className:n,onClick:r,onTouchEnd:a}}=e,[o,s]=i().useState(!1),{t:l}=(0,Be.B)();return(0,t.jsxs)("button",{"aria-label":l("general:remove"),className:[xf,n].filter(Boolean).join(" "),onClick:e=>{s(!1),r(e)},onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onTouchEnd:a,type:"button",children:[(0,t.jsx)(Ft,{className:`${xf}__tooltip`,show:o,children:l("general:remove")}),(0,t.jsx)($t.u,{className:`${xf}__icon`})]})},jf="react-select--single-value",kf=e=>{const{children:n,className:r}=e;return(0,t.jsx)(i().Fragment,{children:(0,t.jsx)(nd.SingleValue,{...e,className:[jf,r].filter(Boolean).join(" "),children:n})})},Sf=e=>{const{selectProps:{customProps:n}={}}=e;return(0,t.jsx)("div",{className:"value-container",ref:n?.droppableRef,children:(0,t.jsx)(nd.ValueContainer,{...e})})},Cf=e=>{const{i18n:n,t:r}=(0,Be.B)(),[s,l]=i().useState(""),c=(0,o.useId)(),[u,d]=i().useState(!1);(0,o.useEffect)((()=>{d(!0)}),[]);const{className:f,components:p,customProps:m,disabled:h=!1,filterOption:g,getOptionValue:v,isClearable:b=!0,isCreatable:y,isLoading:w,isSearchable:x=!0,noOptionsMessage:P=(()=>r("general:noOptions")),numberOnly:j=!1,onChange:k,onMenuClose:S,onMenuOpen:C,options:M,placeholder:_=r("general:selectValue"),showError:O,value:E}=e,D=()=>r("general:loading")+"...",N=[f,"react-select",O&&"react-select--error"].filter(Boolean).join(" ");if(!u)return(0,t.jsx)(Ql.l,{height:"calc(var(--base) * 2 + 2px)"});if(!y)return(0,t.jsx)(rf,{captureMenuScroll:!0,customProps:m,isLoading:w,placeholder:(0,a.sC)(_,n),...e,className:N,classNamePrefix:"rs",components:{ClearIndicator:df,Control:ff,DropdownIndicator:mf,Input:hf,MultiValue:bf,MultiValueLabel:wf,MultiValueRemove:Pf,SingleValue:kf,ValueContainer:Sf,...p},filterOption:g,getOptionValue:v,instanceId:c,isClearable:b,isDisabled:h,isSearchable:x,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:P,onChange:k,onMenuClose:S,onMenuOpen:C,options:M,value:E});return(0,t.jsx)(cf,{captureMenuScroll:!0,isLoading:w,placeholder:(0,a.sC)(_,n),...e,className:N,classNamePrefix:"rs",components:{ClearIndicator:df,Control:ff,DropdownIndicator:mf,Input:hf,MultiValue:bf,MultiValueLabel:wf,MultiValueRemove:Pf,SingleValue:kf,ValueContainer:Sf,...p},filterOption:g,inputValue:s,instanceId:c,isClearable:b,isDisabled:h,isSearchable:x,loadingMessage:D,menuPlacement:"auto",noOptionsMessage:P,onChange:k,onInputChange:e=>l(e),onKeyDown:e=>{if(!0===j){const t=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],n=!/\D/.test(e.key),r=t.includes(e.key);if(!n&&!r)return void e.preventDefault()}var t;if(E&&s&&""!==s.trim()&&(!g||g(null,s)))switch(e.key){case"Enter":case"Tab":k([...E,(t=s,{label:t,value:t})]),l(""),e.preventDefault()}},onMenuClose:S,onMenuOpen:C,options:M,value:E})},Mf=e=>{const{getOptionValue:n,onChange:r,value:a}=e;let o=[];return a&&(o=(Array.isArray(a)?a:[a]).map((e=>vf(e,n)))),(0,t.jsx)(vo,{className:"react-select-container",ids:o,onDragEnd:({moveFromIndex:e,moveToIndex:t})=>{let n=a;a&&Array.isArray(a)&&(n=Xa(a,e,t)),r(n)},children:(0,t.jsx)(Cf,{...e})})},_f=e=>{const{isMulti:n,isSortable:r}=e;return n&&r?(0,t.jsx)(Mf,{...e}):(0,t.jsx)(Cf,{...e})},Of=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,hasMany:p=!1,label:m,labelProps:h,max:g=1/0,maxRows:v=1/0,min:b=-1/0,onChange:y,path:w,placeholder:x,readOnly:P,required:j,step:k=1,style:S,validate:C,width:M}=e,{i18n:_,t:O}=(0,Be.B)(),E=(0,o.useCallback)(((e,t)=>{if("function"==typeof C)return C(e,{...t,max:g,min:b,required:j})}),[C,b,g,j]),{path:D,readOnly:N}=Po(),{formInitializing:A,formProcessing:T,path:R,setValue:I,showError:L,value:$}=hs({path:D??w??n,validate:E}),W=P||N||T||A,F=(0,o.useCallback)((e=>{const t=parseFloat(e.target.value);let n=t;Number.isNaN(t)&&(n=void 0),"function"==typeof y&&y(n),I(n)}),[y,I]),[z,B]=(0,o.useState)([]),H=(0,o.useCallback)((e=>{if(!W){let t;t=e?Array.isArray(e)?e.map((e=>Number(e.value?.value||e.value))):[Number(e.value?.value||e.value)]:[],I(t)}}),[W,I]);return(0,o.useEffect)((()=>{p&&Array.isArray($)&&B($.map(((e,t)=>({id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}}))))}),[$,p]),(0,t.jsxs)("div",{className:[Ms,"number",u,L&&"error",W&&"read-only",p&&"has-many"].filter(Boolean).join(" "),style:{...S,width:M},children:[(0,t.jsx)(Ns,{CustomLabel:c,label:m,required:j,...h||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:l,path:R,...f||{}}),p?(0,t.jsx)(_f,{className:`field-${R.replace(/\./g,"__")}`,disabled:W,filterOption:(e,t)=>{const n=Array.isArray($)&&$.length>=v;return(0,jc.isNumber)(t)&&!n},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray($)&&$.length>=v?O("validation:limitReached",{max:v,value:$.length+1}):null,onChange:H,options:[],placeholder:O("general:enterAValue"),showError:L,value:z}):(0,t.jsxs)("div",{children:[i,(0,t.jsx)("input",{disabled:W,id:`field-${R.replace(/\./g,"__")}`,max:g,min:b,name:R,onChange:F,onWheel:e=>{e.target.blur()},placeholder:(0,a.sC)(x,_),step:k,type:"number",value:"number"==typeof $?$:""}),r]}),void 0!==s?s:(0,t.jsx)(ks,{...d||{}})]})]})})),Ef=vs((e=>{const{name:n,CustomError:r,CustomLabel:a,autoComplete:i,className:s,disabled:l,errorProps:c,label:u,labelProps:d,path:f,required:p,style:m,validate:h,width:g}=e,v=(0,o.useCallback)(((e,t)=>{if("function"==typeof h)return h(e,{...t,required:p})}),[h,p]),{formInitializing:b,formProcessing:y,path:w,setValue:x,showError:P,value:j}=hs({path:f||n,validate:v}),k=l||b||y;return(0,t.jsxs)("div",{className:[Ms,"password",s,P&&"error",k&&"read-only"].filter(Boolean).join(" "),style:{...m,width:g},children:[(0,t.jsx)(Ns,{CustomLabel:a,label:u,required:p,...d||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:r,path:w,...c||{}}),(0,t.jsx)("input",{autoComplete:i,disabled:k,id:`field-${w.replace(/\./g,"__")}`,name:w,onChange:x,type:"password",value:j||""})]})]})})),Df="point",Nf=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,label:p,labelProps:m,path:h,placeholder:g,readOnly:v,required:b,step:y,style:w,validate:x,width:P}=e,{i18n:j,t:k}=(0,Be.B)(),S=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:b})}),[x,b]),{path:C,readOnly:M}=Po(),_=v||M,{path:O,setValue:E,showError:D,value:N=[null,null]}=hs({path:C??h??n,validate:S}),A=(0,o.useCallback)(((e,t)=>{let n=parseFloat(e.target.value);Number.isNaN(n)&&(n=e.target.value);const r=[...N];r[t]=n,E(r)}),[E,N]),T=e=>{const t=k("longitude"===e?"fields:longitude":"fields:latitude"),n=p?(0,a.sC)(p,j):"";return{...m,label:`${n}${n?" - ":""}${t}`}};return(0,t.jsxs)("div",{className:[Ms,Df,u,D&&"error",_&&"read-only"].filter(Boolean).join(" "),style:{...w,width:P},children:[(0,t.jsx)(Cs,{CustomError:l,path:O,...f||{}}),(0,t.jsxs)("ul",{className:`${Df}__wrap`,children:[(0,t.jsxs)("li",{children:[void 0!==c?c:(0,t.jsx)(Ns,{...T("longitude")}),(0,t.jsxs)("div",{className:"input-wrapper",children:[i,(0,t.jsx)("input",{disabled:_,id:`field-longitude-${O.replace(/\./g,"__")}`,name:`${O}.longitude`,onChange:e=>A(e,0),placeholder:(0,a.sC)(g,j),step:y,type:"number",value:N&&"number"==typeof N[0]?N[0]:""}),r]})]}),(0,t.jsxs)("li",{children:[void 0!==c?c:(0,t.jsx)(Ns,{...T("latitude")}),(0,t.jsxs)("div",{className:"input-wrapper",children:[i,(0,t.jsx)("input",{disabled:_,id:`field-latitude-${O.replace(/\./g,"__")}`,name:`${O}.latitude`,onChange:e=>A(e,1),placeholder:(0,a.sC)(g,j),step:y,type:"number",value:N&&"number"==typeof N[1]?N[1]:""}),r]})]})]}),void 0!==s?s:(0,t.jsx)(ks,{...d||{}})]})})),Af="radio-input",Tf=e=>{const{isSelected:n,onChange:r,option:o,path:i,readOnly:s,uuid:l}=e,{i18n:c}=(0,Be.B)(),u=ws(),d=`field-${i}-${o.value}${u>1?`-${u}`:""}${l?`-${l}`:""}`;return(0,t.jsx)("label",{htmlFor:d,children:(0,t.jsxs)("div",{className:[Af,n&&`${Af}--is-selected`].filter(Boolean).join(" "),children:[(0,t.jsx)("input",{checked:n,disabled:s,id:d,name:i,onChange:()=>"function"==typeof r?r(o.value):null,type:"radio"}),(0,t.jsx)("span",{className:`${Af}__styled-radio`}),(0,t.jsx)("span",{className:`${Af}__label`,children:(0,a.sC)(o.label,c)})]})})},Rf="radio-group",If=vs((e=>{const{name:n,CustomDescription:r,CustomError:a,CustomLabel:i,className:s,descriptionProps:l,errorProps:c,label:u,labelProps:d,layout:f="horizontal",onChange:p,options:m=[],path:h,readOnly:g,required:v,style:b,validate:y,value:w,width:x}=e,{uuid:P}=Lo(),j=(0,o.useCallback)(((e,t)=>{if("function"==typeof y)return y(e,{...t,options:m,required:v})}),[y,m,v]),{path:k,readOnly:S}=Po(),{formInitializing:C,formProcessing:M,path:_,setValue:O,showError:E,value:D}=hs({path:k??h??n,validate:j}),N=g||S||M||C,A=D||w;return(0,t.jsxs)("div",{className:[Ms,Rf,s,`${Rf}--layout-${f}`,E&&"error",N&&`${Rf}--read-only`].filter(Boolean).join(" "),style:{...b,width:x},children:[(0,t.jsx)(Ns,{CustomLabel:i,label:u,required:v,...d||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:a,path:_,...c||{}}),(0,t.jsx)("ul",{className:`${Rf}--group`,id:`field-${_.replace(/\./g,"__")}`,children:m.map((e=>{let n="";n=(0,jc.optionIsObject)(e)?e.value:e;const r=String(n)===String(A),a=`field-${_}-${n}${P?`-${P}`:""}`;return(0,t.jsx)("li",{children:(0,t.jsx)(Tf,{id:a,isSelected:r,onChange:()=>{"function"==typeof p&&p(n),N||O(n)},option:(0,jc.optionIsObject)(e)?e:{label:e,value:e},path:_,readOnly:N,uuid:P})},`${_} - ${n}`)}))}),void 0!==r?r:(0,t.jsx)(ks,{...l||{}})]})]})})),Lf=e=>{const t=Ut(),[n]=(0,o.useState)((()=>{if(e){return("string"==typeof e?[e]:e).map((e=>t.collections.find((t=>t.slug===e))))}return[]}));return n},$f=(0,o.createContext)({}),Wf=({children:e,initialParams:n})=>{const[r,a]=i().useReducer(((e,t)=>{const n={...e};return"SET"===t.type?(null===t.params?.uploadEdits&&n?.uploadEdits&&delete n.uploadEdits,null===t.params?.uploadEdits?.crop&&n?.uploadEdits?.crop&&delete n.uploadEdits.crop,null===t.params?.uploadEdits?.focalPoint&&n?.uploadEdits?.focalPoint&&delete n.uploadEdits.focalPoint,{...n,...t.params}):e}),n||{}),o=ls();return i().useEffect((()=>{o?.code&&a({type:"SET",params:{locale:o.code}})}),[o.code]),(0,t.jsx)($f.Provider,{value:{dispatchFormQueryParams:a,formQueryParams:r},children:e})},Ff=()=>(0,o.useContext)($f),zf="id-label",Bf=({id:e,className:n,prefix:r="ID:"})=>(0,t.jsxs)("div",{className:[zf,n].filter(Boolean).join(" "),title:e,children:[r," ",e]}),Hf="render-title",Yf=e=>{const{className:n,element:r="h1",fallback:a,title:i}=e,{id:s,isInitializing:l,title:c}=us(),u=i||c||a,d=u===s,f=r,p=(0,t.jsx)(o.Fragment,{children:" "});return(0,t.jsx)(f,{className:[n,Hf,d&&`${Hf}--has-id`].filter(Boolean).join(" "),title:u,children:l?p:(0,t.jsx)(o.Fragment,{children:d?(0,t.jsx)(Bf,{className:`${Hf}__id`,id:s}):u||p})})},Vf=({id:e,Header:n,collectionSlug:r,drawerSlug:a,onSave:s})=>{const l=Ut(),{routes:{api:c},serverURL:u}=l,{closeModal:d,modalState:f,toggleModal:p}=O(),m=ls(),{t:h}=(0,Be.B)(),[g,v]=(0,o.useState)(e),[b,y]=(0,o.useState)(!1),[w]=Lf(r),{formQueryParams:x}=Ff(),P=ge().stringify(x),{componentMap:j}=wn(),{Edit:k}=j[""+(r?"collections":"globals")][r],S=Boolean(g),C=g?`${u}${c}/${r}/${g}${m?.code?`?locale=${m.code}`:""}`:null,M=`${u}${c}/${r}${S?`/${g}`:""}?${P}`;(0,o.useEffect)((()=>{y(Boolean(f[a]?.isOpen))}),[f,a]);const _=i().useCallback((e=>{b&&(d(a),Ct.error(e.errors?.[0].message||h("error:unspecific")))}),[d,a,b,h]),E=(0,o.useCallback)((e=>{v(e.doc.id),"function"==typeof s&&s({...e,collectionConfig:w})}),[s,w]);return(0,t.jsx)(ds,{BeforeDocument:(0,t.jsxs)(bl,{className:`${Uf}__header`,children:[(0,t.jsxs)("div",{className:`${Uf}__header-content`,children:[(0,t.jsx)("h2",{className:`${Uf}__header-text`,children:n||(0,t.jsx)(Yf,{element:"span"})}),(0,t.jsx)("button",{"aria-label":h("general:close"),className:`${Uf}__header-close`,onClick:()=>p(a),type:"button",children:(0,t.jsx)($t.u,{})})]}),(0,t.jsx)(qf,{})]}),action:M,apiURL:C,collectionSlug:w.slug,disableActions:!0,disableLeaveWithoutSaving:!0,id:g,isEditing:S,onLoadError:_,onSave:E,children:k})},qf=()=>{const{id:e,title:n}=us();return e&&e!==n?(0,t.jsx)(Bf,{id:e.toString()}):null},Uf="doc-drawer",Gf=({id:e,children:n,className:r,collectionSlug:o,disabled:i,drawerSlug:s,...l})=>{const{i18n:c,t:u}=(0,Be.B)(),[d]=Lf(o);return(0,t.jsx)(wl,{"aria-label":u(e?"general:editLabel":"fields:addNewLabel",{label:(0,a.sC)(d.labels.singular,c)}),className:[r,`${Uf}__toggler`].filter(Boolean).join(" "),disabled:i,slug:s,...l,children:n})},Kf=e=>{const{drawerSlug:n}=e;return(0,t.jsx)(xl,{Header:null,className:Uf,gutter:!1,slug:n,children:(0,t.jsx)(Vf,{...e})})},Xf=({id:e,collectionSlug:n})=>{const r=ws(),a=(0,o.useId)(),{closeModal:i,modalState:s,openModal:l,toggleModal:c}=O(),[u,d]=(0,o.useState)(!1),f=(({id:e,collectionSlug:t,depth:n,uuid:r})=>`doc-drawer_${t}_${n}${e?`_${e}`:""}_${r}`)({id:e,collectionSlug:n,depth:r,uuid:a});(0,o.useEffect)((()=>{d(Boolean(s[f]?.isOpen))}),[s,f]);const p=(0,o.useCallback)((()=>{c(f)}),[c,f]),m=(0,o.useCallback)((()=>{i(f)}),[i,f]),h=(0,o.useCallback)((()=>{l(f)}),[l,f]);return[(0,o.useMemo)((()=>t=>(0,o.createElement)(Kf,{...t,collectionSlug:n,drawerSlug:f,id:e,key:f})),[e,f,n]),(0,o.useMemo)((()=>r=>(0,t.jsx)(Gf,{...r,collectionSlug:n,drawerSlug:f,id:e})),[e,f,n]),(0,o.useMemo)((()=>({closeDrawer:m,drawerDepth:r,drawerSlug:f,isDrawerOpen:u,openDrawer:h,toggleDrawer:p})),[r,f,u,p,m,h])]},Qf="relationship-add-new",Jf=({hasMany:e,path:n,relationTo:r,setValue:i,value:s})=>{const l=Lf(r),{permissions:c}=sn(),[u,d]=(0,o.useState)(!1),[f,p]=(0,o.useState)(),m=l.length>1,[h,g]=(0,o.useState)((()=>m?void 0:l[0])),[v,b]=(0,o.useState)(!1),{i18n:y,t:w}=(0,Be.B)(),[x,P]=(0,o.useState)(!1),[j,k,{isDrawerOpen:S,toggleDrawer:C}]=Xf({collectionSlug:h?.slug}),M=(0,o.useCallback)((({doc:t,operation:n})=>{if("create"===n){const n=Array.isArray(r)?{relationTo:h?.slug,value:t.id}:t.id,a=Array.isArray(r)&&Array.isArray(s)?!s.some((e=>e&&"object"==typeof e&&e.value===t.id)):s!==t.id;a&&i(e?[...Array.isArray(s)?s:[],n]:n),p(void 0)}}),[r,h,e,i,s]),_=(0,o.useCallback)((e=>{b(e)}),[]);return(0,o.useEffect)((()=>{c&&(1===l.length?d(c.collections[l[0]?.slug]?.create?.permission):d(l.some((e=>c.collections[e?.slug]?.create?.permission))))}),[c,l]),(0,o.useEffect)((()=>{m&&f&&g(l.find((e=>e?.slug===f)))}),[f,m,l]),(0,o.useEffect)((()=>{m&&h&&(C(),p(void 0))}),[C,m,h]),(0,o.useEffect)((()=>{m&&!S&&g(void 0)}),[S,m]),u?(0,t.jsxs)("div",{className:Qf,id:`${n}-add-new`,children:[1===l.length&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)(k,{className:`${Qf}__add-button`,onClick:()=>P(!1),onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:[(0,t.jsx)(Ft,{className:`${Qf}__tooltip`,show:x,children:w("fields:addNewLabel",{label:(0,a.sC)(l[0].labels.singular,y)})}),(0,t.jsx)(Lt,{})]}),(0,t.jsx)(j,{onSave:M})]}),l.length>1&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Ys,{button:(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Qf}__add-button`,tooltip:v?void 0:w("fields:addNew"),children:(0,t.jsx)(Lt,{})}),buttonType:"custom",horizontalAlign:"center",onToggleOpen:_,render:({close:e})=>(0,t.jsx)(Us,{children:l.map((n=>c.collections[n?.slug].create.permission?(0,t.jsx)(Gs,{className:`${Qf}__relation-button--${n?.slug}`,onClick:()=>{e(),p(n?.slug)},children:(0,a.sC)(n?.labels?.singular,y)},n?.slug):null))}),size:"medium"}),h&&c.collections[h?.slug]?.create?.permission&&(0,t.jsx)(j,{onSave:M})]})]}):null},Zf=({hasMany:e,relationTo:t,value:n})=>{const r=Array.isArray(t);let a;if(a=Array.isArray(t)?t.reduce(((e,t)=>({...e,[t]:[]})),{}):{[t]:[]},null===n)return a;const o=(e,t)=>{"string"!=typeof t&&"number"!=typeof t||"string"!=typeof e||(a[e]?a[e].push(t):a[e]=[t])};return e&&Array.isArray(n)?n.forEach((e=>{r&&"object"==typeof e&&"relationTo"in e&&"value"in e&&o(e.relationTo,e.value),r||"string"!=typeof t||o(t,e)})):r&&Array.isArray(t)?"object"==typeof n&&"relationTo"in n&&"value"in n&&o(n.relationTo,n.value):o(t,n),a},ep=e=>e.reduce(((e,t)=>t.options?[...e,...ep(t.options)]:[...e,{id:t.value,relationTo:t.relationTo}]),[]),tp=e=>e.sort(((e,t)=>"function"==typeof e?.label?.localeCompare&&"function"==typeof t?.label?.localeCompare?e.label.localeCompare(t.label):0)),np=(e,t)=>{switch(t.type){case"CLEAR":return[];case"UPDATE":{const{collection:n,config:r,doc:a,i18n:o}=t,i=n.slug,s=[...e],l=Qi({collectionConfig:n,data:a,dateFormat:r.admin.dateFormat,fallback:`${o.t("general:untitled")} - ID: ${a.id}`,i18n:o}),c=s.find((e=>e.label===n.labels.plural)),u=c?.options?.find((e=>e.value===a.id));return u&&(u.label=l,u.relationTo=i),s}case"ADD":{const{collection:n,config:r,docs:o,i18n:i,ids:s=[],sort:l}=t,c=n.slug,u=ep(e),d=[...e],f=d.find((e=>e.label===n.labels.plural)),p=o.reduce(((e,t)=>{if(0===u.filter((e=>e.id===t.id&&e.relationTo===c)).length){u.push({id:t.id,relationTo:c});const a=Qi({collectionConfig:n,data:t,dateFormat:r.admin.dateFormat,fallback:`${i.t("general:untitled")} - ID: ${t.id}`,i18n:i});return[...e,{label:a,relationTo:c,value:t.id}]}return e}),[]);if(s.forEach((e=>{0===u.filter((t=>t.id===e&&t.relationTo===c)).length&&(u.push({id:e,relationTo:c}),p.push({label:`${i.t("general:untitled")} - ID: ${e}`,relationTo:c,value:e}))})),f){const e=[...f.options,...p];f.options=l?tp(e):e}else d.push({label:(0,a.sC)(n.labels.plural,i),options:l?tp(p):p});return d}default:return e}},rp="relationship--multi-value-label",ap=e=>{const{data:{label:n,relationTo:r,value:a},selectProps:{customProps:{draggableProps:i,setDrawerIsOpen:s}={}}={}}=e,{permissions:l}=sn(),[c,u]=(0,o.useState)(!1),{t:d}=(0,Be.B)(),f=Boolean(l?.collections?.[r]?.read?.permission),[p,m,{isDrawerOpen:h}]=Xf({id:a?.toString(),collectionSlug:r});return(0,o.useEffect)((()=>{"function"==typeof s&&s(h)}),[h,s]),(0,t.jsxs)("div",{className:rp,children:[(0,t.jsx)("div",{className:`${rp}__content`,children:(0,t.jsx)(nd.MultiValueLabel,{...e,innerProps:{className:`${rp}__text`,...i||{}}})}),r&&f&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)(m,{"aria-label":`Edit ${n}`,className:`${rp}__drawer-toggler`,onClick:()=>u(!1),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onTouchEnd:e=>e.stopPropagation(),children:[(0,t.jsx)(Ft,{className:`${rp}__tooltip`,show:c,children:d("general:editLabel",{label:""})}),(0,t.jsx)(Rt,{className:`${rp}__icon`})]}),(0,t.jsx)(p,{onSave:null})]})]})},op="relationship--single-value",ip=e=>{const{children:n,data:{label:r,relationTo:a,value:s},selectProps:{customProps:{onSave:l,setDrawerIsOpen:c}={}}={}}=e,[u,d]=(0,o.useState)(!1),{t:f}=(0,Be.B)(),{permissions:p}=sn(),m=Boolean(p?.collections?.[a]?.read?.permission),[h,g,{isDrawerOpen:v}]=Xf({id:s.toString(),collectionSlug:a});return(0,o.useEffect)((()=>{"function"==typeof c&&c(v)}),[v,c]),(0,t.jsx)(i().Fragment,{children:(0,t.jsxs)(nd.SingleValue,{...e,className:op,children:[(0,t.jsx)("div",{className:`${op}__label`,children:(0,t.jsxs)("div",{className:`${op}__label-text`,children:[(0,t.jsx)("div",{className:`${op}__text`,children:n}),a&&m&&(0,t.jsx)(o.Fragment,{children:(0,t.jsxs)(g,{"aria-label":f("general:editLabel",{label:r}),className:`${op}__drawer-toggler`,onClick:()=>d(!1),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onTouchEnd:e=>e.stopPropagation(),children:[(0,t.jsx)(Ft,{className:`${op}__tooltip`,show:u,children:f("general:edit")}),(0,t.jsx)(Rt,{})]})})]})}),a&&m&&(0,t.jsx)(h,{onSave:l})]})})},sp="relationship",lp=vs((e=>{const{name:n,CustomDescription:r,CustomError:a,CustomLabel:i,allowCreate:s=!0,className:l,descriptionProps:c,errorProps:u,hasMany:d,isSortable:f=!0,label:p,labelProps:m,path:h,readOnly:g,relationTo:v,required:b,sortOptions:y,style:w,validate:x,width:P}=e,j=Ut(),{collections:k,routes:{api:S},serverURL:C}=j,{i18n:M,t:_}=(0,Be.B)(),{permissions:O}=sn(),{code:E}=ls(),D=Array.isArray(v),[N,A]=(0,o.useReducer)(np,[]),[T,R]=(0,o.useState)(-1),[I,L]=(0,o.useState)({}),[$,W]=(0,o.useState)(""),[F,z]=(0,o.useState)(""),[B,H]=(0,o.useState)(!1),[Y,V]=(0,o.useState)(!1),q=(0,o.useRef)(!1),U=(0,o.useRef)(!1),G=(0,o.useCallback)(((e,t)=>{if("function"==typeof x)return x(e,{...t,required:b})}),[x,b]),{path:K,readOnly:X}=Po(),{filterOptions:Q,formInitializing:J,formProcessing:Z,initialValue:ee,path:te,setValue:ne,showError:re,value:ae}=hs({path:K??h??n,validate:G}),oe=g||X||J,ie=(0,o.useRef)(ae);ie.current=ae;const[se,le]=(0,o.useState)(!1),ce=(0,o.useCallback)((async({lastFullyLoadedRelation:e,lastLoadedPage:t,onSuccess:n,search:r,sort:a,value:o})=>{if(!O)return;const i=void 0!==e?e:-1,s=Array.isArray(v)?v:[v],l=-1===i?s:s.slice(i+1);let c=0;const u=Zf({hasMany:d,relationTo:v,value:o});$||(await l.reduce((async(e,n)=>{const o=Q?.[n];let i;if(i=F!==r?1:t[n]+1,await e,!1===o)return R(s.indexOf(n)),Promise.resolve();if(c<10){const e=k.find((e=>e.slug===n)),t=e?.admin?.useAsTitle||"id";let l=e?.defaultSort||"id";"string"==typeof y?l=y:y?.[n]&&(l=y[n]);const d={depth:0,draft:!0,limit:10,locale:E,page:i,sort:l,where:{and:[{id:{not_in:u[n]}}]}};r&&d.where.and.push({[t]:{like:r}}),o&&"boolean"!=typeof o&&d.where.and.push(o);const f=await fetch(`${C}${S}/${n}`,{body:ge().stringify(d),credentials:"include",headers:{"Accept-Language":M.language,"Content-Type":"application/x-www-form-urlencoded","X-HTTP-Method-Override":"GET"},method:"POST"});if(f.ok){const t=await f.json();L((e=>({...e,[n]:i}))),t.nextPage||R(s.indexOf(n)),t.docs.length>0&&(c+=t.docs.length,A({type:"ADD",collection:e,config:j,docs:t.docs,i18n:M,sort:a}))}else 403===f.status?(R(s.indexOf(n)),A({type:"ADD",collection:e,config:j,docs:[],i18n:M,ids:u[n],sort:a})):W(_("error:unspecific"))}}),Promise.resolve()),"function"==typeof n&&n())}),[O,v,d,$,F,k,E,Q,C,y,S,M,j,_]),ue=((e,t)=>{const n=(0,o.useRef)(void 0);return(0,o.useCallback)(((...r)=>{clearTimeout(n.current),n.current=setTimeout((()=>{clearTimeout(n.current),e(...r)}),t)}),[e,t])})(((e,t)=>{ce({lastLoadedPage:{},search:e,sort:!0,value:t}),z(e)}),300),de=(0,o.useCallback)(((e,t)=>{F!==e&&(L({}),ue(e,t,""!==e))}),[F,ue]);(0,o.useEffect)((()=>{const e=Zf({hasMany:d,relationTo:v,value:ae});Object.entries(e).reduce((async(e,[t,n])=>{await e;const r=n.filter((e=>!N.find((n=>n?.options?.find((n=>n.value===e&&n.relationTo===t))))));if(r.length>0){const e={depth:0,draft:!0,limit:r.length,locale:E,where:{id:{in:r}}};if(!$){const n=await fetch(`${C}${S}/${t}`,{body:ge().stringify(e),credentials:"include",headers:{"Accept-Language":M.language,"Content-Type":"application/x-www-form-urlencoded","X-HTTP-Method-Override":"GET"},method:"POST"}),a=k.find((e=>e.slug===t));let o=[];if(n.ok){o=(await n.json()).docs}A({type:"ADD",collection:a,config:j,docs:o,i18n:M,ids:r,sort:!0})}}}),Promise.resolve())}),[N,ae,d,$,k,D,C,S,M,v,E,j]),(0,o.useEffect)((()=>{const e=(Array.isArray(v)?v:[v]).reduce(((e,t)=>{const n=k.find((e=>e.slug===t));return"id"===(n?.admin?.useAsTitle||"id")&&e}),!0);V(!e)}),[v,k]),(0,o.useEffect)((()=>{U.current&&q.current&&(H(!0),ce({lastLoadedPage:{},onSuccess:()=>{U.current=!0,H(!1)},value:ie.current})),A({type:"CLEAR"}),R(-1),L({}),U.current=!1}),[v,Q,E,q,ce,ie,U,te]);const fe=(0,o.useCallback)((e=>{A({type:"UPDATE",collection:e.collectionConfig,config:j,doc:e.doc,i18n:M})}),[M,j]),pe=(0,o.useCallback)(((e,t)=>{if(!t)return!0;const n=(0,jc.wordBoundariesRegex)(t||"");let r=e.label;for(;r.length>250;){const e=r.indexOf(" ",t.length);if(n.test(r.slice(0,-1===e?t.length:e+1)))return!0;r=r.slice(-1===e?t.length:e+1)}return n.test(r.slice(-250))}),[]),me=(({options:e,value:t})=>{if(t||"number"==typeof t){if(Array.isArray(t))return t.map((t=>{let n;return e.forEach((e=>{n||(n=e.options.find((e=>"object"==typeof t?e.value===t.value&&e.relationTo===t.relationTo:t===e.value)))})),n}));let n;return e.forEach((e=>{n||(n=e.options.find((e=>"object"==typeof t?e.value===t.value&&e.relationTo===t.relationTo:t===e.value)))})),n}})({options:N,value:ae});return Array.isArray(me)||"null"!==me?.value||(me.value=null),(0,t.jsxs)("div",{className:[Ms,sp,l,re&&"error",$&&"error-loading",oe&&`${sp}--read-only`].filter(Boolean).join(" "),id:`field-${te.replace(/\./g,"__")}`,style:{...w,width:P},children:[(0,t.jsx)(Ns,{CustomLabel:i,label:p,required:b,...m||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:a,path:te,...u||{}}),!$&&(0,t.jsxs)("div",{className:`${sp}__wrap`,children:[(0,t.jsx)(_f,{backspaceRemovesValue:!se,components:{MultiValueLabel:ap,SingleValue:ip},customProps:{disableKeyDown:se,disableMouseDown:se,onSave:fe,setDrawerIsOpen:le},disabled:oe||Z||se,filterOption:Y?pe:void 0,getOptionValue:e=>{if(e)return d&&Array.isArray(v)?`${e.relationTo}_${e.value}`:e.value},isLoading:B,isMulti:d,isSortable:f,onChange:oe?void 0:e=>{null===e?ne(d?[]:null):d&&Array.isArray(e)?ne(e?e.map((e=>D?{relationTo:e.relationTo,value:e.value}:e.value)):null):D&&!Array.isArray(e)?ne({relationTo:e.relationTo,value:e.value}):Array.isArray(e)||ne(e.value)},onInputChange:e=>de(e,ae),onMenuClose:()=>{q.current=!1},onMenuOpen:()=>{q.current=!0,U.current||(H(!0),ce({lastLoadedPage:{},onSuccess:()=>{U.current=!0,H(!1)},value:ee}))},onMenuScrollToBottom:()=>{ce({lastFullyLoadedRelation:T,lastLoadedPage:I,search:F,sort:!1,value:ee})},options:N,showError:re,value:me??null}),!oe&&s&&(0,t.jsx)(Jf,{dispatchOptions:A,hasMany:d,options:N,path:te,relationTo:v,setValue:ne,value:ae})]}),$&&(0,t.jsx)("div",{className:`${sp}__error-loading`,children:$}),void 0!==r?r:(0,t.jsx)(ks,{...c||{}})]})]})})),cp="row",up=vs((e=>{const{className:n,fieldMap:r,forceRender:a=!1}=e,{indexPath:o,path:i,readOnly:s,schemaPath:l,siblingPermissions:c}=Po();return(0,t.jsx)(mc,{children:(0,t.jsx)("div",{className:[Ms,cp,n].filter(Boolean).join(" "),children:(0,t.jsx)(ll,{fieldMap:r,forceRender:a,path:i,readOnly:s,schemaPath:l,className:`${cp}__fields`,fieldMap:r,forceRender:a,indexPath:o,margins:!1,permissions:c})})})})),dp=e=>{const{AfterInput:n,BeforeInput:r,CustomDescription:o,CustomError:i,CustomLabel:s,className:l,descriptionProps:c,errorProps:u,hasMany:d=!1,isClearable:f=!0,isSortable:p=!0,label:m,labelProps:h,onChange:g,options:v,path:b,readOnly:y,required:w,showError:x,style:P,value:j,width:k}=e,{i18n:S}=(0,Be.B)();let C;if(d&&Array.isArray(j))C=j.map((e=>{const t=v.find((t=>t.value===e));return{label:t?(0,a.sC)(t.label,S):e,value:t?.value??e}}));else if(j){const e=v.find((e=>e.value===j));C={label:e?(0,a.sC)(e.label,S):j,value:e?.value??j}}return(0,t.jsxs)("div",{className:[Ms,"select",l,x&&"error",y&&"read-only"].filter(Boolean).join(" "),id:`field-${b.replace(/\./g,"__")}`,style:{...P,width:k},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:m,required:w,...h||{}}),(0,t.jsx)(Cs,{CustomError:i,path:b,...u||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:i,path:b,...u||{}}),r,(0,t.jsx)(_f,{disabled:y,isClearable:f,isMulti:d,isSortable:p,onChange:g,options:v.map((e=>({...e,label:(0,a.sC)(e.label,S)}))),showError:x,value:C}),n]}),void 0!==o?o:(0,t.jsx)(ks,{...c||{}})]})},fp=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,hasMany:p=!1,isClearable:m=!0,isSortable:h=!0,label:g,labelProps:v,onChange:b,options:y=[],path:w,readOnly:x,required:P,style:j,validate:k,width:S}=e,C=i().useMemo((()=>(e=>e.map((e=>"object"!=typeof e||!e.value&&""!==e.value?{label:e,value:e}:e)))(y)),[y]),M=(0,o.useCallback)(((e,t)=>{if("function"==typeof k)return k(e,{...t,hasMany:p,options:C,required:P})}),[k,P,p,C]),{path:_,readOnly:O}=Po(),{formInitializing:E,formProcessing:D,path:N,setValue:A,showError:T,value:R}=hs({path:_??w??n,validate:M}),I=x||O||D||E,L=(0,o.useCallback)((e=>{if(!I){let t=null;e&&p?t=Array.isArray(e)?e.map((e=>e.value)):[]:e&&!Array.isArray(e)&&(t=e.value),"function"==typeof b&&b(t),A(t)}}),[I,p,A,b]);return(0,t.jsx)(dp,{AfterInput:r,BeforeInput:a,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,hasMany:p,isClearable:m,isSortable:h,label:g,labelProps:v,name:n,onChange:L,options:C,path:N,readOnly:I,required:P,showError:T,style:j,value:R,width:S})})),pp="tabs-field__tab-button",mp=({isActive:e,parentPath:n,setIsActive:r,tab:s})=>{const{name:l,label:c}=s,{i18n:u}=(0,Be.B)(),[d,f]=(0,o.useState)(void 0),p="name"in s,m=`${n?`${n}.`:""}${"name"in s?l:""}`,h=d>0;return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(ac,{fieldMap:s.fieldMap,path:m,setErrorCount:f}),(0,t.jsxs)("button",{className:[pp,h&&`${pp}--has-error`,e&&`${pp}--active`].filter(Boolean).join(" "),onClick:r,type:"button",children:[c?(0,a.sC)(c,u):p&&l,h&&(0,t.jsx)(yo,{count:d,i18n:u})]})]})},hp="tabs-field",gp=vs((e=>{const{name:n,CustomDescription:r,className:s,descriptionProps:l,forceRender:c=!1,path:u,readOnly:d,tabs:f=[]}=e,{indexPath:p,path:m,readOnly:h,schemaPath:g,siblingPermissions:v}=Po(),b=d||h,y=m??u??n,{getPreference:w,setPreference:x}=dn(),{preferencesKey:P}=us(),{i18n:j}=(0,Be.B)(),{isWithinCollapsible:k}=tl(),[S,C]=(0,o.useState)(0),M=`tabs-${p}`;(0,o.useEffect)((()=>{if(P){(async()=>{const e=await w(P);C((y?e?.fields?.[y]?.tabIndex:e?.fields?.[M]?.tabIndex)||0)})()}}),[y,w,P,M]);const _=(0,o.useCallback)((async e=>{C(e);const t=await w(P);P&&x(P,{...t,...y?{fields:{...t?.fields||{},[y]:{...t?.fields?.[y],tabIndex:e}}}:{fields:{...t?.fields,[M]:{...t?.fields?.[M],tabIndex:e}}}})}),[P,w,x,y,M]),O=f[S];return(0,t.jsx)("div",{className:[Ms,s,hp,k&&`${hp}--within-collapsible`].filter(Boolean).join(" "),children:(0,t.jsxs)(gc,{children:[(0,t.jsx)("div",{className:`${hp}__tabs-wrap`,children:(0,t.jsx)("div",{className:`${hp}__tabs`,children:f.map(((e,n)=>(0,t.jsx)(mp,{isActive:S===n,parentPath:y,setIsActive:()=>_(n),tab:e},n)))})}),(0,t.jsx)("div",{className:`${hp}__content-wrap`,children:O&&(0,t.jsx)(i().Fragment,{children:(0,t.jsxs)("div",{className:[`${hp}__tab`,O.label&&`${hp}__tabConfigLabel-${(0,jc.toKebabCase)((0,a.sC)(O.label,j))}`].filter(Boolean).join(" "),children:[r||(0,t.jsx)(ks,{...l||{}}),(0,t.jsx)(ll,{fieldMap:O.fieldMap,forceRender:c,margins:"small",path:function(){let e=y;return y&&O.name?e=`${y}.${O.name}`:!y&&O.name&&(e=O.name),e}(),permissions:"name"in O&&v?.[O.name]?.fields?v[O.name]?.fields:v,readOnly:b,schemaPath:`${g?`${g}`:""}${O.name?`.${O.name}`:""}`},O.label?(0,a.sC)(O.label,j):O.name)]})})})]})})})),vp=e=>{const{AfterInput:n,BeforeInput:r,CustomDescription:o,CustomError:i,CustomLabel:s,className:l,descriptionProps:c,errorProps:u,hasMany:d,inputRef:f,label:p,labelProps:m,maxRows:h,onChange:g,onKeyDown:v,path:b,placeholder:y,readOnly:w,required:x,rtl:P,showError:j,style:k,value:S,valueToRender:C,width:M}=e,{i18n:_,t:O}=(0,Be.B)();return(0,t.jsxs)("div",{className:[Ms,"text",l,j&&"error",w&&"read-only",d&&"has-many"].filter(Boolean).join(" "),style:{...k,width:M},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:p,required:x,...m||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:i,path:b,...u||{}}),d?(0,t.jsx)(_f,{className:`field-${b.replace(/\./g,"__")}`,disabled:w,filterOption:()=>!h||!(Array.isArray(S)&&h&&S.length>=h),isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(S)&&S.length>=h?O("validation:limitReached",{max:h,value:S.length+1}):null,onChange:g,options:[],placeholder:O("general:enterAValue"),showError:j,value:C}):(0,t.jsxs)("div",{children:[r,(0,t.jsx)("input",{"data-rtl":P,disabled:w,id:`field-${b?.replace(/\./g,"__")}`,name:b,onChange:g,onKeyDown:v,placeholder:(0,a.sC)(y,_),ref:f,type:"text",value:S||""}),n]}),void 0!==o?o:(0,t.jsx)(ks,{...c||{}})]})]})},bp=vs((e=>{const{name:n,AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,errorProps:d,hasMany:f,inputRef:p,label:m,labelProps:h,localized:g,maxLength:v,maxRows:b,minLength:y,minRows:w,path:x,placeholder:P,readOnly:j,required:k,rtl:S,style:C,validate:M,width:_}=e,O=ls(),{localization:E}=Ut(),D=(0,o.useCallback)(((e,t)=>{if("function"==typeof M)return M(e,{...t,maxLength:v,minLength:y,required:k})}),[M,y,v,k]),{path:N,readOnly:A}=Po(),{formInitializing:T,formProcessing:R,path:I,setValue:L,showError:$,value:W}=hs({path:N??x??n,validate:D}),F=j||A||R||T,z=_s({fieldLocalized:g,fieldRTL:S,locale:O,localizationConfig:E||void 0}),[B,H]=(0,o.useState)([]),Y=(0,o.useCallback)((e=>{if(!F){let t;t=e?Array.isArray(e)?e.map((e=>e.value?.value||e.value)):[e.value?.value||e.value]:[],L(t)}}),[F,L]);return(0,o.useEffect)((()=>{f&&Array.isArray(W)&&H(W.map(((e,t)=>({id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}}))))}),[W,f]),(0,t.jsx)(vp,{AfterInput:r,BeforeInput:a,CustomDescription:i,CustomError:s,CustomLabel:l,className:c,descriptionProps:u,errorProps:d,hasMany:f,inputRef:p,label:m,labelProps:h,maxRows:b,minRows:w,onChange:f?Y:e=>{L(e.target.value)},path:I,placeholder:P,readOnly:F,required:k,rtl:z,showError:$,style:C,value:W||"",valueToRender:B,width:_})})),yp=e=>{const{AfterInput:n,BeforeInput:r,CustomDescription:o,CustomError:i,CustomLabel:s,className:l,descriptionProps:c,errorProps:u,label:d,labelProps:f,onChange:p,path:m,placeholder:h,readOnly:g,required:v,rows:b,rtl:y,showError:w,style:x,value:P,width:j}=e,{i18n:k}=(0,Be.B)();return(0,t.jsxs)("div",{className:[Ms,"textarea",l,w&&"error",g&&"read-only"].filter(Boolean).join(" "),style:{...x,width:j},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:d,required:v,...f||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:i,path:m,...u||{}}),r,(0,t.jsx)("label",{className:"textarea-outer",htmlFor:`field-${m.replace(/\./g,"__")}`,children:(0,t.jsxs)("div",{className:"textarea-inner",children:[(0,t.jsx)("div",{className:"textarea-clone","data-value":P||h||""}),(0,t.jsx)("textarea",{className:"textarea-element","data-rtl":y,disabled:g,id:`field-${m.replace(/\./g,"__")}`,name:m,onChange:p,placeholder:(0,a.sC)(h,k),rows:b,value:P||""})]})}),n,void 0!==o?o:(0,t.jsx)(ks,{...c||{}})]})]})},wp=vs((e=>{const{name:n,AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,label:p,labelProps:m,locale:h,localized:g,maxLength:v,minLength:b,path:y,placeholder:w,readOnly:x,required:P,rows:j,rtl:k,style:S,validate:C,width:M}=e,{i18n:_}=(0,Be.B)(),{localization:O}=Ut(),E=_s({fieldLocalized:g,fieldRTL:k,locale:h,localizationConfig:O||void 0}),D=(0,o.useCallback)(((e,t)=>{if("function"==typeof C)return C(e,{...t,maxLength:v,minLength:b,required:P})}),[C,P,v,b]),{path:N,readOnly:A}=Po(),{formInitializing:T,formProcessing:R,path:I,setValue:L,showError:$,value:W}=hs({path:N??y??n,validate:D}),F=x||A||R||T;return(0,t.jsx)(yp,{AfterInput:r,BeforeInput:i,CustomDescription:s,CustomError:l,CustomLabel:c,className:u,descriptionProps:d,errorProps:f,label:p,labelProps:m,onChange:e=>{L(e.target.value)},path:I,placeholder:(0,a.sC)(w,_),readOnly:F,required:P,rows:j,rtl:E,showError:$,style:S,value:W,width:M})})),xp=e=>{e.preventDefault(),e.stopPropagation()},Pp="dropzone",jp=({className:e,mimeTypes:n,onChange:r})=>{const a=i().useRef(null),[o,s]=i().useState(!1),l=i().useRef(null),{t:c}=(0,Be.B)(),u=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),e.clipboardData.files&&e.clipboardData.files.length>0&&r(e.clipboardData.files)}),[r]),d=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),s(!0)}),[]),f=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),s(!1)}),[]),p=i().useCallback((e=>{e.preventDefault(),e.stopPropagation(),s(!1),e.dataTransfer.files&&e.dataTransfer.files.length>0&&(r(e.dataTransfer.files),s(!1),e.dataTransfer.clearData())}),[r]),m=i().useCallback((e=>{e.target.files&&e.target.files.length>0&&r(e.target.files)}),[r]);i().useEffect((()=>{const e=a.current;return e?(e.addEventListener("dragenter",d),e.addEventListener("dragleave",f),e.addEventListener("dragover",xp),e.addEventListener("drop",p),e.addEventListener("paste",u),()=>{e.removeEventListener("dragenter",d),e.removeEventListener("dragleave",f),e.removeEventListener("dragover",xp),e.removeEventListener("drop",p),e.removeEventListener("paste",u)}):()=>null}),[d,f,p,u]);const h=[Pp,e,o?"dragging":""].filter(Boolean).join(" ");return(0,t.jsxs)("div",{className:h,ref:a,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",className:`${Pp}__file-button`,onClick:()=>{l.current.click()},size:"small",children:c("upload:selectFile")}),(0,t.jsx)("input",{accept:n?.join(","),className:`${Pp}__hidden-input`,onChange:m,ref:l,type:"file"}),(0,t.jsxs)("p",{className:`${Pp}__label`,children:[c("general:or")," ",c("upload:dragAndDrop")]})]})},kp=require("react-image-crop");var Sp=n.n(kp);const Cp="edit-upload",Mp=(0,o.forwardRef)(((e,n)=>{const{name:r,onChange:a,value:o}=e;return(0,t.jsxs)("div",{className:`${Cp}__input`,children:[r,(0,t.jsx)("input",{name:r,onChange:e=>a(e.target.value),ref:n,type:"number",value:o})]})})),_p={height:100,heightPixels:0,unit:"%",width:100,widthPixels:0,x:0,y:0},Op=({fileName:e,fileSrc:n,imageCacheTag:r,initialCrop:a,initialFocalPoint:s,onSave:l,showCrop:c,showFocalPoint:u})=>{const{closeModal:d}=O(),{t:f}=(0,Be.B)(),[p,m]=(0,o.useState)((()=>({..._p,...a}))),h={x:50,y:50},[g,v]=(0,o.useState)((()=>({...h,...s}))),[b,y]=(0,o.useState)(!1),[w,x]=(0,o.useState)(0),[P,j]=(0,o.useState)(0),k=(0,o.useRef)(void 0),S=(0,o.useRef)(void 0),C=(0,o.useRef)(void 0),M=(0,o.useRef)(null),_=(0,o.useRef)(null),[E,D]=(0,o.useState)(!1),N=e=>{x(e.currentTarget.naturalHeight),j(e.currentTarget.naturalWidth),D(!0)},A=({dimension:e,value:t})=>{const n=parseInt(t);if("width"===e&&n>=P)return null;if("height"===e&&n>=w)return null;const r=n/("width"===e?P:w)*100;if(100===r||0===r)return null;m({...p,[e]:r})},T=({coordinate:e,value:t})=>{const n=parseInt(t);n>=0&&n<=100&&v((t=>({...t,[e]:n})))},R=i().useCallback((({x:e,y:t})=>{v({x:e,y:t}),y(!1)}),[]),I=r?`${n}?${r}`:n;return(0,t.jsxs)("div",{className:Cp,children:[(0,t.jsxs)("div",{className:`${Cp}__header`,children:[(0,t.jsxs)("h2",{title:`${f("general:editing")} ${e}`,children:[f("general:editing")," ",e]}),(0,t.jsxs)("div",{className:`${Cp}__actions`,children:[(0,t.jsx)(Yt,{"aria-label":f("general:cancel"),buttonStyle:"secondary",className:`${Cp}__cancel`,onClick:()=>d(Bp),children:f("general:cancel")}),(0,t.jsx)(Yt,{"aria-label":f("general:applyChanges"),buttonStyle:"primary",className:`${Cp}__save`,disabled:!E,onClick:()=>{"function"==typeof l&&l({crop:p?{...p,heightPixels:Number(M.current?.value??p.heightPixels),widthPixels:Number(_.current?.value??p.widthPixels)}:void 0,focalPosition:g}),d(Bp)},children:f("general:applyChanges")})]})]}),(0,t.jsxs)("div",{className:`${Cp}__toolWrap`,children:[(0,t.jsx)("div",{className:`${Cp}__crop`,children:(0,t.jsxs)("div",{className:`${Cp}__focal-wrapper`,ref:k,style:{aspectRatio:""+P/w},children:[c?(0,t.jsx)(Sp(),{className:`${Cp}__reactCrop`,crop:p,onChange:(e,t)=>m(t),onComplete:()=>y(!0),renderSelectionAddon:()=>(0,t.jsx)("div",{className:`${Cp}__crop-window`,ref:C}),children:(0,t.jsx)("img",{alt:f("upload:setCropArea"),onLoad:N,ref:S,src:I})}):(0,t.jsx)("img",{alt:f("upload:setFocalPoint"),onLoad:N,ref:S,src:I}),u&&(0,t.jsx)(Ep,{boundsRef:c?C:S,checkBounds:!!c&&b,className:`${Cp}__focalPoint`,containerRef:k,initialPosition:g,onDragEnd:R,setCheckBounds:!!c&&y,children:(0,t.jsx)(Lt,{})})]})}),(c||u)&&(0,t.jsxs)("div",{className:`${Cp}__sidebar`,children:[c&&(0,t.jsxs)("div",{className:`${Cp}__groupWrap`,children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:`${Cp}__titleWrap`,children:[(0,t.jsx)("h3",{children:f("upload:crop")}),(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Cp}__reset`,onClick:()=>m({height:100,heightPixels:w,unit:"%",width:100,widthPixels:P,x:0,y:0}),children:f("general:reset")})]})}),(0,t.jsx)("span",{className:`${Cp}__description`,children:f("upload:cropToolDescription")}),(0,t.jsxs)("div",{className:`${Cp}__inputsWrap`,children:[(0,t.jsx)(Mp,{name:`${f("upload:width")} (px)`,onChange:e=>A({dimension:"width",value:e}),ref:_,value:(p.width/100*P).toFixed(0)}),(0,t.jsx)(Mp,{name:`${f("upload:height")} (px)`,onChange:e=>A({dimension:"height",value:e}),ref:M,value:(p.height/100*w).toFixed(0)})]})]}),u&&(0,t.jsxs)("div",{className:`${Cp}__groupWrap`,children:[(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:`${Cp}__titleWrap`,children:[(0,t.jsx)("h3",{children:f("upload:focalPoint")}),(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Cp}__reset`,onClick:()=>{const e=k.current.getBoundingClientRect(),t=c?C.current.getBoundingClientRect():S.current.getBoundingClientRect(),n=(t.left-e.left+t.width/2)/e.width*100,r=(t.top-e.top+t.height/2)/e.height*100;v({x:n,y:r})},children:f("general:reset")})]})}),(0,t.jsx)("span",{className:`${Cp}__description`,children:f("upload:focalPointDescription")}),(0,t.jsxs)("div",{className:`${Cp}__inputsWrap`,children:[(0,t.jsx)(Mp,{name:"X %",onChange:e=>T({coordinate:"x",value:e}),value:g.x.toFixed(0)}),(0,t.jsx)(Mp,{name:"Y %",onChange:e=>T({coordinate:"y",value:e}),value:g.y.toFixed(0)})]})]})]})]})]})},Ep=({boundsRef:e,checkBounds:n,children:r,className:a,containerRef:s,initialPosition:l={x:50,y:50},onDragEnd:c,setCheckBounds:u})=>{const[d,f]=(0,o.useState)({x:l.x,y:l.y}),[p,m]=(0,o.useState)(!1),h=(0,o.useRef)(void 0),g=i().useCallback(((t,n,r)=>{const a=s.current.getBoundingClientRect(),o=e.current.getBoundingClientRect(),i=t??o.left,l=n??o.top,c=i<o.left||i>o.right,u=l<o.top||l>o.bottom;let d=(i-a.left)/a.width*100,f=(l-a.top)/a.height*100;const p=(o.left-a.left+o.width/2)/a.width*100,h=(o.top-a.top+o.height/2)/a.height*100;return(c||u)&&(m(!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),l<o.top?f=(o.top-a.top)/a.height*100:l>o.bottom&&(f=(a.height-(a.bottom-o.bottom))/a.height*100),r&&(d=c?p:d,f=u?h:f)),{x:d,y:f}}),[e,s]);return i().useEffect((()=>{if(!p&&h.current&&n){const{height:e,left:t,top:n,width:r}=h.current.getBoundingClientRect(),{x:a,y:o}=g(t+r/2,n+e/2,!0);return c({x:a,y:o}),f({x:a,y:o}),void u(!1)}}),[g,p,n,u,d.x,d.y,c]),i().useEffect((()=>{f({x:l.x,y:l.y})}),[l.x,l.y]),(0,t.jsxs)("div",{className:[`${Cp}__draggable-container`,p&&`${Cp}__draggable-container--dragging`].filter(Boolean).join(" "),onMouseMove:e=>{if(!p)return null;const{x:t,y:n}=g(e.clientX,e.clientY);f({x:t,y:n})},children:[(0,t.jsx)("button",{className:[`${Cp}__draggable`,a].filter(Boolean).join(" "),onMouseDown:e=>{e.preventDefault(),m(!0)},onMouseUp:()=>{m(!1),c(d)},ref:h,style:{left:`${d.x}%`,top:`${d.y}%`},type:"button",children:r}),(0,t.jsx)("div",{})]})},Dp=({defaultMessage:e,successMessage:n,value:r})=>{const a=(0,o.useRef)(null),[i,s]=(0,o.useState)(!1),[l,c]=(0,o.useState)(!1),{t:u}=(0,Be.B)();return r?(0,t.jsxs)("button",{className:"copy-to-clipboard",onClick:()=>{a&&a.current&&(a.current.select(),a.current.setSelectionRange(0,r.length+1),document.execCommand("copy"),s(!0))},onMouseEnter:()=>{c(!0),s(!1)},onMouseLeave:()=>{c(!1),s(!1)},type:"button",children:[(0,t.jsx)(Ws,{}),(0,t.jsxs)(Ft,{delay:i?0:void 0,show:l||i,children:[i&&(n??u("general:copied")),!i&&(e??u("general:copy"))]}),(0,t.jsx)("textarea",{readOnly:!0,ref:a,tabIndex:-1,value:r})]}):null},Np="file-meta",Ap=e=>{const{id:n,collection:r,filename:a,filesize:s,height:l,mimeType:c,url:u,width:d}=e,[f,p]=(0,o.useState)(!1),m=Boolean(n&&r),[h,g]=Xf({id:n,collectionSlug:r});return(0,t.jsxs)("div",{className:Np,children:[(0,t.jsxs)("div",{className:`${Np}__url`,children:[m&&(0,t.jsx)(h,{}),(0,t.jsx)("a",{href:u,rel:"noopener noreferrer",target:"_blank",children:a}),(0,t.jsx)(Dp,{defaultMessage:"Copy URL",value:u}),m&&(0,t.jsxs)(g,{className:`${Np}__edit`,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[(0,t.jsx)(Rt,{}),(0,t.jsx)(Ft,{show:f,children:"Edit"})]})]}),(0,t.jsxs)("div",{className:`${Np}__size-type`,children:[(0,jc.formatFilesize)(s),d&&l&&(0,t.jsxs)(i().Fragment,{children:[" - ",d,"x",l]}),c&&(0,t.jsxs)(i().Fragment,{children:[" - ",c]})]})]})},Tp="preview-sizes",Rp=(e,t)=>{if(!t||0===t.length)return e;const n={};return t.forEach((({name:t})=>{e[t]&&(n[t]=e[t])})),n},Ip=({name:e,active:n,meta:r,onClick:a,previewSrc:o})=>(0,t.jsxs)("div",{className:[`${Tp}__sizeOption`,n&&`${Tp}--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,t.jsx)("div",{className:`${Tp}__image`,children:(0,t.jsx)("img",{alt:r.filename,src:o})}),(0,t.jsxs)("div",{className:`${Tp}__sizeMeta`,children:[(0,t.jsx)("div",{className:`${Tp}__sizeName`,children:e}),(0,t.jsx)(Ap,{...r})]})]}),Lp=({doc:e,imageCacheTag:n,uploadConfig:r})=>{const{imageSizes:a}=r,{sizes:i}=e,[s,l]=(0,o.useState)((()=>Rp(i,a))),[c,u]=(0,o.useState)(null),d=e=>e.filename?e.url?`${e.url}${n?`?${n}`:""}`:void 0:null;(0,o.useEffect)((()=>{l(Rp(i,a))}),[i,a,n]);const f=d(c?e.sizes[c]:e),p=(0,o.useMemo)((()=>({filename:e.filename,filesize:e.filesize,height:e.height,mimeType:e.mimeType,url:e.url,width:e.width})),[e]),m="Original";return(0,t.jsxs)("div",{className:Tp,children:[(0,t.jsxs)("div",{className:`${Tp}__imageWrap`,children:[(0,t.jsxs)("div",{className:`${Tp}__meta`,children:[(0,t.jsx)("div",{className:`${Tp}__sizeName`,children:c||m}),(0,t.jsx)(Ap,{...c?s[c]:p})]}),(0,t.jsx)("img",{alt:e.filename,className:`${Tp}__preview`,src:f})]}),(0,t.jsx)("div",{className:`${Tp}__listWrap`,children:(0,t.jsxs)("div",{className:`${Tp}__list`,children:[(0,t.jsx)(Ip,{active:!c,meta:p,name:m,onClick:()=>u(null),previewSrc:d(e)}),Object.entries(s).map((([e,n])=>{const r=c===e,a=d(n);return a?(0,t.jsx)(Ip,{active:r,meta:n,name:e,onClick:()=>u(e),previewSrc:a},e):null}))]})})]})},$p=()=>(0,t.jsxs)("svg",{height:"150",viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{fill:"#333333",height:"150",transform:"translate(0 0.5)",width:"150"}),(0,t.jsx)("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),(0,t.jsx)("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]}),Wp="thumbnail",Fp=e=>{const{className:n="",doc:{filename:r}={},fileSrc:a,imageCacheTag:o,size:s}=e,[l,c]=i().useState(void 0),u=[Wp,`${Wp}--size-${s||"medium"}`,n].join(" ");return i().useEffect((()=>{if(!a)return void c(!1);const e=new Image;e.src=a,e.onload=()=>{c(!0)},e.onerror=()=>{c(!1)}}),[a]),(0,t.jsxs)("div",{className:u,children:[void 0===l&&(0,t.jsx)(Ql.l,{height:"100%"}),l&&(0,t.jsx)("img",{alt:r,src:`${a}${o?`?${o}`:""}`}),!1===l&&(0,t.jsx)($p,{})]})},zp="file-field",Bp="edit-upload",Hp="preview-sizes",Yp=e=>!(!e&&void 0!==e)||"A file is required.",Vp=({customActions:e,enableAdjustments:n,enablePreviewSizes:r,mimeType:a})=>{const{t:o}=(0,Be.B)(),s=(0,jc.isImage)(a)&&"image/svg+xml"!==a;return s||e&&0!==e.length?(0,t.jsxs)("div",{className:`${zp}__upload-actions`,children:[s&&(0,t.jsxs)(i().Fragment,{children:[r&&(0,t.jsx)(wl,{className:`${zp}__previewSizes`,slug:Hp,children:o("upload:previewSizes")}),n&&(0,t.jsx)(wl,{className:`${zp}__edit`,slug:Bp,children:o("upload:editImage")})]}),e&&e.map(((e,n)=>(0,t.jsx)(i().Fragment,{children:e},n)))]}):null},qp=e=>{const{collectionSlug:n,customActions:r,initialState:a,onChange:s,uploadConfig:l}=e,[c,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(null),{t:p}=(0,Be.B)(),{setModified:m}=Lo(),{dispatchFormQueryParams:h,formQueryParams:g}=Ff(),[v,b]=(0,o.useState)(as(a||{},!0)),{docPermissions:y}=us(),{errorMessage:w,setValue:x,showError:P,value:j}=hs({path:"file",validate:Yp}),[k,S]=(0,o.useState)({x:0,y:0}),C=i().useCallback((e=>{if(e instanceof File){const t=new FileReader;t.onload=e=>{const t=e.target?.result;"string"==typeof t&&f(t)},t.readAsDataURL(e)}x(e),"function"==typeof s&&s(e)}),[s,x]),M=i().useCallback((e=>{const t=e?.[0];C(t)}),[C]),_=(0,o.useCallback)((()=>{u(!0),C(null),f("")}),[C]),O=i().useCallback((({crop:e,focalPosition:t})=>{S({x:e.x||0,y:e.y||0}),m(!0),h({type:"SET",params:{uploadEdits:e||t?{crop:e||null,focalPoint:t||null}:null}})}),[h,m]);(0,o.useEffect)((()=>{b(as(a||{},!0)),u(!1)}),[a]);const E=y?.update?.permission&&"delete"in y&&y?.delete?.permission,D=l?.imageSizes?.length>0,N=Boolean(l?.resizeOptions),A=!0===l?.focalPoint,{crop:T=!0,focalPoint:R=!0}=l,I=R&&(D||N||A);return(0,t.jsxs)("div",{className:[Ms,zp].filter(Boolean).join(" "),children:[(0,t.jsx)(Cs,{message:w,showError:P}),v.filename&&!c&&(0,t.jsx)(Gp,{collectionSlug:n,customUploadActions:r,doc:v,enableAdjustments:T||I,handleRemove:E?_:void 0,hasImageSizes:D,imageCacheTag:v.updatedAt,uploadConfig:l}),(!v.filename||c)&&(0,t.jsxs)("div",{className:`${zp}__upload`,children:[!j&&(0,t.jsx)(jp,{className:`${zp}__dropzone`,mimeTypes:l?.mimeTypes,onChange:M}),j&&d&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${zp}__thumbnail-wrap`,children:(0,t.jsx)(Fp,{collectionSlug:n,fileSrc:(0,jc.isImage)(j.type)?d:null})}),(0,t.jsxs)("div",{className:`${zp}__file-adjustments`,children:[(0,t.jsx)("input",{className:`${zp}__filename`,onChange:e=>{const t=e.target.value;if(j){const e=new File([j],t,{type:j.type});C(e)}},type:"text",value:j.name}),(0,t.jsx)(Vp,{customActions:r,enableAdjustments:T||I,enablePreviewSizes:D&&v.filename&&!c,mimeType:j.type})]}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${zp}__remove`,icon:"x",iconStyle:"with-border",onClick:_,round:!0,tooltip:p("general:cancel")})]})]}),(j||v.filename)&&(0,t.jsx)(xl,{Header:null,slug:Bp,children:(0,t.jsx)(Op,{fileName:j?.name||v?.filename,fileSrc:d||v?.url,imageCacheTag:v.updatedAt,initialCrop:g?.uploadEdits?.crop??{},initialFocalPoint:{x:g?.uploadEdits?.focalPoint.x||v.focalX||50,y:g?.uploadEdits?.focalPoint.y||v.focalY||50},onSave:O,showCrop:T,showFocalPoint:I})}),v&&D&&(0,t.jsx)(xl,{className:`${zp}__previewDrawer`,hoverTitle:!0,slug:Hp,title:p("upload:sizesFor",{label:v?.filename}),children:(0,t.jsx)(Lp,{doc:v,imageCacheTag:v.updatedAt,uploadConfig:l})})]})},Up="file-details",Gp=e=>{const{collectionSlug:n,customUploadActions:r,doc:a,enableAdjustments:o,handleRemove:i,hasImageSizes:s,imageCacheTag:l,uploadConfig:c}=e,{id:u,filename:d,filesize:f,height:p,mimeType:m,thumbnailURL:h,url:g,width:v}=a;return(0,t.jsx)("div",{className:Up,children:(0,t.jsxs)("header",{children:[(0,t.jsx)(Fp,{collectionSlug:n,doc:a,fileSrc:h||g,imageCacheTag:l,uploadConfig:c}),(0,t.jsxs)("div",{className:`${Up}__main-detail`,children:[(0,t.jsx)(Ap,{collection:n,filename:d,filesize:f,height:p,id:u,mimeType:m,url:g,width:v}),(0,t.jsx)(Vp,{customActions:r,enableAdjustments:o,enablePreviewSizes:s&&a.filename,mimeType:m})]}),i&&(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${Up}__remove`,icon:"x",iconStyle:"with-border",onClick:i,round:!0})]})})},Kp=(e,t={})=>{const{initialData:n,initialParams:r={}}=t,{i18n:a}=(0,Be.B)(),[i,s]=(0,o.useState)(n||{}),[l,c]=(0,o.useState)(r),[u,d]=(0,o.useState)(!n),[f,p]=(0,o.useState)(!1),{code:m}=ls(),h=(0,o.useRef)(!1),g=ge().stringify({locale:m,..."object"==typeof l?l:{}},{addQueryPrefix:!0});return(0,o.useEffect)((()=>{if(n&&!h.current)return void(h.current=!0);const t=new AbortController;return e?(async()=>{p(!1),d(!0);try{const n=await mt.get(`${e}${g}`,{headers:{"Accept-Language":a.language},signal:t.signal});n.status>201&&p(!0);const r=await n.json();s(r),d(!1)}catch(e){t.signal.aborted||(p(!0),d(!1))}})():(p(!1),d(!1)),()=>{t.abort()}}),[e,m,g,a.language,n]),(0,o.useEffect)((()=>{n&&h.current&&s(n)}),[n]),[{data:i,isError:f,isLoading:u},{setParams:c}]},Xp=(0,o.createContext)({}),Qp=({children:e,...n})=>(0,t.jsx)(Xp.Provider,{value:n,children:e}),Jp=(0,o.createContext)({}),Zp=()=>(0,o.useContext)(Jp),em=({children:e,data:n,defaultLimit:r,defaultSort:a,handlePageChange:o,handlePerPageChange:s,handleSearchChange:l,handleSortChange:c,handleWhereChange:u,modifySearchParams:d,preferenceKey:f})=>{const p=(0,ht.useRouter)(),{setPreference:m}=dn(),h=i().useRef(!1),{searchParams:g}=nn(),v=i().useCallback((async e=>{if(!d)return;const t={};let n=!1;"limit"in e&&(t.limit=e.limit,n=!0),"sort"in e&&(t.sort=e.sort,n=!0),n&&f&&await m(f,t);const r={limit:"limit"in e?e.limit:g?.limit,page:"page"in e?e.page:g?.page,search:"search"in e?e.search:g?.search,sort:"sort"in e?e.sort:g?.sort,where:"where"in e?e.where:g?.where};p.replace(`${ge().stringify(r,{addQueryPrefix:!0})}`)}),[f,d,p,m,g]),b=i().useCallback((async e=>{"function"==typeof o&&o(e),await v({page:String(e)})}),[v,o]),y=i().useCallback((async e=>{"function"==typeof s&&s(e),await v({limit:String(e)})}),[v,s]),w=i().useCallback((async e=>{"function"==typeof l&&l(e),await v({search:e})}),[v,l]),x=i().useCallback((async e=>{"function"==typeof c&&c(e),await v({sort:e})}),[v,c]),P=i().useCallback((async e=>{"function"==typeof u&&u(e),await v({where:e})}),[v,u]);return i().useEffect((()=>{if(!h.current){if(d){let e=!1;(0,jc.isNumber)(r)&&!("limit"in g)&&(g.limit=String(r),e=!0),a&&!("sort"in g)&&(g.sort=a,e=!0),e&&p.replace(`?${ge().stringify(g)}`)}h.current=!0}}),[a,r,p,d,g]),(0,t.jsx)(Jp.Provider,{value:{data:n,handlePageChange:b,handlePerPageChange:y,handleSearchChange:w,handleSortChange:x,handleWhereChange:P,refineListData:v},children:e})},tm=(e,t)=>e.reduce(((e,n)=>{if("name"in n||t&&n.fieldIsPresentational)return e.push(n),e;if("fieldMap"in n.fieldComponentProps)e.push(...tm(n.fieldComponentProps.fieldMap,t));else if("tabs"===n.type&&"tabs"in n.fieldComponentProps&&Array.isArray(n.fieldComponentProps.tabs))return[...e,...n.fieldComponentProps.tabs.reduce(((e,n)=>[...e,..."name"in n?[{...n}]:tm(n.fieldMap,t)]),[])];return e}),[]);var nm;!function(e){e.AllAvailable="allAvailable",e.AllInPage="allInPage",e.None="none",e.Some="some"}(nm||(nm={}));const rm=(0,o.createContext)({}),am=({children:e,docs:n=[],totalDocs:r})=>{const a=(0,o.useRef)({}),{code:i}=ls(),[s,l]=(0,o.useState)((()=>{const e={};return n.forEach((({id:t})=>{e[t]=!1})),e})),[c,u]=(0,o.useState)("none"),[d,f]=(0,o.useState)(0),{searchParams:p}=nn(),m=(0,o.useCallback)(((e=!1)=>{const t={};e?(u("allAvailable"),n.forEach((({id:e})=>{t[e]=!0}))):"allAvailable"===c||"allInPage"===c?(u("none"),n.forEach((({id:e})=>{t[e]=!1}))):n.forEach((({id:e})=>{t[e]="some"!==c})),l(t)}),[n,c]),h=(0,o.useCallback)((e=>{const t=!s[e],n={...s,[e]:t};t||u("some"),l(n)}),[s]),g=(0,o.useCallback)((e=>{let t;if("allAvailable"===c){const e=p?.where;t=e||{id:{not_equals:""}}}else t={id:{in:Object.keys(s).filter((e=>s[e])).map((e=>e))}};return e&&(t={and:[{...e},t]}),ge().stringify({locale:i,where:t},{addQueryPrefix:!0})}),[c,s,i,p]);return(0,o.useEffect)((()=>{if("allAvailable"===c)return;let e=!1,t=!0;Object.values(s).forEach((n=>{t=t&&n,e=e||n})),u(t?"allInPage":e?"some":"none")}),[c,s]),(0,o.useEffect)((()=>{const e="allAvailable"===c?r:Object.keys(s).filter((e=>s[e])).length;f(e)}),[c,s,r]),a.current={count:d,getQueryParams:g,selectAll:c,selected:s,setSelection:h,toggleAll:m,totalDocs:r},(0,t.jsx)(rm.Provider,{value:a.current,children:e})},om=()=>(0,o.useContext)(rm),im="select-all",sm=()=>{const{selectAll:e,toggleAll:n}=om(),{i18n:r}=(0,Be.B)();return(0,t.jsx)(Ts,{"aria-label":e===nm.None?r.t("general:selectAllRows"):r.t("general:deselectAllRows"),checked:e===nm.AllInPage||e===nm.AllAvailable,className:[im,`${im}__checkbox`].join(" "),id:"select-all",name:"select-all",onToggle:()=>n(),partialChecked:e===nm.Some})},lm=i().createContext({}),cm=e=>{const{cellData:n,cellProps:r,children:a,columnIndex:o,customCellContext:i,rowData:s}=e,l=um();return(0,t.jsx)(lm.Provider,{value:{cellData:n,cellProps:r,columnIndex:o,customCellContext:i,rowData:s,...l},children:a})},um=()=>i().useContext(lm),dm="select-row",fm=()=>{const{selected:e,setSelection:n}=om(),{rowData:r}=um();return(0,t.jsx)(Ts,{checked:e?.[r?.id],className:[dm,`${dm}__checkbox`].join(" "),onToggle:()=>n(r.id)})},pm="sort-column",mm=e=>{const{name:n,Label:r,disable:a=!1,label:i}=e,{searchParams:s}=nn(),{refineListData:l}=Zp(),{t:c}=(0,Be.B)(),{sort:u}=s,d=`-${n}`,f=n,p=[`${pm}__asc`];u===f&&p.push(`${pm}--active`);const m=[`${pm}__desc`];u===d&&m.push(`${pm}--active`);const h=(0,o.useCallback)((e=>{l({sort:e})}),[l]);return(0,t.jsxs)("div",{className:pm,children:[(0,t.jsx)("span",{className:`${pm}__label`,children:r}),!a&&(0,t.jsxs)("div",{className:`${pm}__buttons`,children:[(0,t.jsx)("button",{"aria-label":c("general:sortByLabelDirection",{direction:c("general:ascending"),label:i}),className:[...p,`${pm}__button`].filter(Boolean).join(" "),onClick:()=>h(f),type:"button",children:(0,t.jsx)(Tt,{direction:"up"})}),(0,t.jsx)("button",{"aria-label":c("general:sortByLabelDirection",{direction:c("general:descending"),label:i}),className:[...m,`${pm}__button`].filter(Boolean).join(" "),onClick:()=>h(d),type:"button",children:(0,t.jsx)(Tt,{})})]})]})},hm=({cellData:e,nowrap:n})=>{const r=e.length>100?`${e.substring(0,100)}…`:e,a=n?{whiteSpace:"nowrap"}:{};return(0,t.jsx)("code",{className:"code-cell",style:a,children:(0,t.jsx)("span",{children:r})})},gm="file",vm=!("undefined"==typeof window||!window.document||!window.document.createElement);function bm(e,t){switch(t.type){case"REQUEST":{const n={...e};return t.docs.forEach((({relationTo:e,value:t})=>{"object"!=typeof n[e]&&(n[e]={}),n[e][t]=null})),n}case"ADD_LOADED":{const n={...e};"object"!=typeof n[t.relationTo]&&(n[t.relationTo]={});const r=[...t.idsToLoad];return Array.isArray(t.docs)&&t.docs.forEach((e=>{r.splice(r.indexOf(e.id),1),n[t.relationTo][e.id]=e})),r.forEach((e=>{n[t.relationTo][e]=!1})),n}default:return e}}const ym=(0,o.createContext)({}),wm=({children:e})=>{const[n,r]=(0,o.useReducer)(bm,{}),a=Qt(n,100),i=Ut(),{i18n:s}=(0,Be.B)(),{code:l}=ls(),c=(0,o.useRef)(l),{routes:{api:u},serverURL:d}=i,f=(0,o.useCallback)(((e=!1)=>{Object.entries(a).forEach((async([t,n])=>{const a=[];if(Object.entries(n).forEach((([t,n])=>{(null===n||e)&&a.push(t)})),a.length>0){const e=`${d}${u}/${t}`,n=new URLSearchParams;if(n.append("depth","0"),n.append("limit","250"),l&&n.append("locale",l),a&&a.length>0){const e=a.map((e=>String(e)));n.append("where[id][in]",e.join(","))}const o=`?${n.toString()}`,i=await fetch(`${e}${o}`,{credentials:"include",headers:{"Accept-Language":s.language}});if(i.ok){const e=await i.json();e.docs&&r({type:"ADD_LOADED",docs:e.docs,idsToLoad:a,relationTo:t})}else r({type:"ADD_LOADED",docs:[],idsToLoad:a,relationTo:t})}}))}),[a,d,u,s,l]);(0,o.useEffect)((()=>{f(l&&c.current!==l),c.current=l}),[l,f]);const p=(0,o.useCallback)((e=>{r({type:"REQUEST",docs:e})}),[]);return(0,t.jsx)(ym.Provider,{value:{documents:n,getRelationships:p},children:e})},xm=({cellData:e,label:n,relationTo:r})=>{const s=Ut(),{collections:l,routes:c}=s,[u,d]=Wt(),[f,p]=(0,o.useState)([]),{documents:m,getRelationships:h}=(0,o.useContext)(ym),[g,v]=(0,o.useState)(!1),{i18n:b,t:y}=(0,Be.B)(),w=!!vm&&d?.boundingClientRect?.top<window.innerHeight;return(0,o.useEffect)((()=>{if((e||"number"==typeof e)&&w&&!g){const t=[],n=Array.isArray(e)?e:[e];n.slice(0,n.length<3?n.length:3).forEach((e=>{"object"==typeof e&&"relationTo"in e&&"value"in e&&t.push(e),"number"!=typeof e&&"string"!=typeof e||"string"!=typeof r||t.push({relationTo:r,value:e})})),h(t),v(!0),p(t)}}),[e,r,l,w,c.api,g,h]),(0,o.useEffect)((()=>{g&&v(!1)}),[e]),(0,t.jsxs)("div",{className:"relationship-cell",ref:u,children:[f.map((({relationTo:e,value:n},r)=>{const a=m[e][n],o=l.find((({slug:t})=>t===e)),c=Qi({collectionConfig:o,data:a||null,dateFormat:s.admin.dateFormat,fallback:`${y("general:untitled")} - ID: ${n}`,i18n:b});return(0,t.jsxs)(i().Fragment,{children:[!1===a&&`${y("general:untitled")} - ID: ${n}`,null===a&&`${y("general:loading")}...`,a?c:null,f.length>r+1&&", "]},r)})),Array.isArray(e)&&e.length>3&&y("fields:itemsAndMore",{count:e.length-3,items:""}),0===f.length&&y("general:noLabel",{label:(0,a.sC)(n||"",b)})]})},Pm=({cellData:e,options:n})=>{const{i18n:r}=(0,Be.B)(),o=e=>e.map((e=>{const t=n.filter((t=>t.value===e))?.[0]?.label;return(0,a.sC)(t,r)})).join(", ");let i="";return i=(0,jc.optionsAreObjects)(n)?Array.isArray(e)?o(e):o([e]):Array.isArray(e)?e.join(", "):e,(0,t.jsx)("span",{children:i})},jm={File:({cellData:e,customCellContext:n,rowData:r})=>{const{collectionSlug:a,uploadConfig:o}=n;return(0,t.jsxs)("div",{className:gm,children:[(0,t.jsx)(Fp,{className:`${gm}__thumbnail`,collectionSlug:a,doc:{...r,filename:e},fileSrc:r?.thumbnailURL||r?.url,size:"small",uploadConfig:o}),(0,t.jsx)("span",{className:`${gm}__filename`,children:String(e)})]})},array:({cellData:e,labels:n})=>{const{i18n:r}=(0,Be.B)(),o=`${(e??[]).length} ${(0,a.sC)(n?.plural||r.t("general:rows"),r)}`;return(0,t.jsx)("span",{children:o})},blocks:({blocks:e,cellData:n,labels:r})=>{const{i18n:o}=(0,Be.B)(),i=Array.isArray(n)?n.map((({blockType:e})=>e)):[],s=e?.map((e=>({slug:e.slug,label:(0,a.sC)(e.labels.singular,o)})));let l=`0 ${(0,a.sC)(r?.plural,o)}`;const c=e=>e.map((e=>{const t=s.filter((t=>t.slug===e))?.[0];return t?.label})).join(", ");if(i.length>5){const e=i.length-5;l=`${i.length} ${(0,a.sC)(r?.plural,o)} - ${o.t("fields:itemsAndMore",{count:e,items:c(i.slice(0,5))})}`}else i.length>0&&(l=`${i.length} ${(0,a.sC)(1===i.length?r?.singular:r?.plural,o)} - ${c(i)}`);return(0,t.jsx)("span",{children:l})},checkbox:({cellData:e})=>{const{t:n}=(0,Be.B)();return(0,t.jsx)("code",{className:"bool-cell",children:(0,t.jsx)("span",{children:n(`general:${e}`).toLowerCase()})})},code:hm,date:({cellData:e,dateDisplayFormat:n})=>{const{admin:{dateFormat:r}}=Ut(),{i18n:a}=(0,Be.B)(),o=n||r;return(0,t.jsx)("span",{children:e&&Ki({date:e,i18n:a,pattern:o})})},json:({cellData:e})=>{const n=e?.length>100?`${e.substring(0,100)}…`:e;return(0,t.jsx)("code",{className:"json-cell",children:(0,t.jsx)("span",{children:JSON.stringify(n)})})},radio:Pm,relationship:xm,select:Pm,textarea:({cellData:e})=>{const n=e?.length>100?`${e.substring(0,100)}…`:e;return(0,t.jsx)("span",{children:n})},upload:xm},km=Dn().default||Dn(),Sm=e=>{const{name:n,className:r,fieldType:o,isFieldAffectingData:i,label:s,onClick:l}=e,{i18n:c}=(0,Be.B)(),{routes:{admin:u}}=Ut(),d=um(),{cellData:f,cellProps:p,columnIndex:m,customCellContext:h,rowData:g}=d||{},{className:v,link:b,onClick:y}=p||{},w=l||y;let x="span";const P={className:r||v};if((void 0!==b?b:0===m)&&(x=km,P.href=h?.collectionSlug?`${u}/collections/${h?.collectionSlug}/${g.id}`:""),"function"==typeof w&&(x="button",P.type="button",P.onClick=()=>{w({cellData:f,collectionSlug:h?.collectionSlug,rowData:g})}),"id"===n)return(0,t.jsx)(x,{...P,children:(0,t.jsx)(hm,{cellData:`ID: ${f}`,name:n,nowrap:!0,rowData:g,schemaPath:d?.cellProps?.schemaPath})});const j=void 0!==f&&jm[o];let k=null;if(j)k=(0,t.jsx)(j,{cellData:f,customCellContext:h,rowData:g,...e});else if(!j){if(!h.uploadConfig||!i||"filename"!==n)return(0,t.jsxs)(x,{...P,children:[(""===f||void 0===f)&&"label"in e&&c.t("general:noLabel",{label:(0,a.sC)(s||"data",c)}),"string"==typeof f&&f,"number"==typeof f&&f,"object"==typeof f&&JSON.stringify(f)]});{const n=jm.File;k=(0,t.jsx)(n,{cellData:f,customCellContext:h,rowData:g,...e})}}return(0,t.jsx)(x,{...P,children:k})},Cm=e=>"ui"===e.type,Mm=e=>{const{cellProps:n,columnPreferences:r,columns:a,enableRowSelections:o,fieldMap:i,useAsTitle:s}=e;let l=tm(i);const c=l.findIndex((e=>"id"===e.name));if(c>-1){const e=l.splice(c,1)[0];l.unshift(e)}const u=s?l.findIndex((e=>e.name===s)):-1;if(u>-1){const e=l.splice(u,1)[0];l.unshift(e)}const d=r||a;d&&(l=l.sort(((e,t)=>{const n=d.findIndex((t=>"name"in e&&t.accessor===e.name)),r=d.findIndex((e=>"name"in t&&e.accessor===t.name));return-1===n&&-1===r?0:-1===n?1:-1===r?-1:n-r})));const f=[],p=l.reduce(((e,o,i)=>{const s=r?.find((e=>"name"in o&&e.accessor===o.name));let l=!1;s?l=s.active:a&&Array.isArray(a)&&a.length>0?l=a.find((e=>e.accessor===o.name))?.active:f.length<4&&(l=!0),l&&!f.includes(i)&&f.push(i);const c=f[0]===i,u="name"in o?o.name:void 0,d=void 0!==o.CustomCell?o.CustomCell:(0,t.jsx)(Sm,{...o.cellComponentProps}),p=o&&"fieldComponentProps"in o&&"CustomLabel"in o.fieldComponentProps&&void 0!==o.fieldComponentProps.CustomLabel?o.fieldComponentProps.CustomLabel:void 0,m=(0,t.jsx)(Ns,{CustomLabel:p,label:o.fieldComponentProps?.label,...o.fieldComponentProps?.labelProps||{},unstyled:!0}),h=o&&o.type&&("array"===o.type||"group"===o.type||"blocks"===o.type),g=(0,t.jsx)(mm,{Label:m,disable:h||Cm(o)||void 0,label:"fieldComponentProps"in o&&"label"in o.fieldComponentProps?o.fieldComponentProps.label:void 0,name:"name"in o?o.name:void 0});if(o){const t={name:u,type:o.type,Label:m,accessor:u,active:l,admin:{disableListColumn:o.disableListColumn,disableListFilter:o.disableListFilter},cellProps:{...o.cellComponentProps,...n?.[i],link:c,relationTo:"relationship"===o.type&&"relationTo"in o.fieldComponentProps?o.fieldComponentProps.relationTo:void 0},components:{Cell:d,Heading:g}};e.push(t)}return e}),[]);return o&&p.unshift({name:"",accessor:"_select",active:!0,components:{Cell:(0,t.jsx)(fm,{}),Heading:(0,t.jsx)(sm,{})},label:null}),p};function _m(e){return"name"in e&&"ui"!==e.type}const Om=(e,t)=>e.reduce(((e,n)=>_m(n)&&n.name===t?e:!_m(n)&&"fieldMap"in n.fieldComponentProps?[...e,...Om(n.fieldComponentProps.fieldMap,t)]:"tabs"===n.type&&"tabs"in n.fieldComponentProps?[...e,...n.fieldComponentProps.tabs.reduce(((e,n)=>[...e,..."name"in n?[n.name]:Om(n.fieldMap,t)]),[])]:[...e,n.name]),[]),Em=(0,o.createContext)({}),Dm=()=>(0,o.useContext)(Em),Nm=({cellProps:e,children:n,collectionSlug:r,enableRowSelections:a=!1,listPreferences:s,preferenceKey:l})=>{const c=Ut(),{componentMap:u}=wn(),{fieldMap:d}=u.collections[r],f=c.collections.find((e=>e.slug===r)),{admin:{defaultColumns:p,useAsTitle:m}}=f,h=i().useRef(r),{getPreference:g,setPreference:v}=dn(),[b]=(0,o.useState)((()=>((e,t,n)=>{let r=[];if(Array.isArray(n)&&n.length>=1)r=n;else{t&&r.push(t);const n=Om(e,t);r=r.concat(n),r=r.slice(0,4)}return r.map((e=>({accessor:e,active:!0})))})((e=>{const t=e=>"ui"!==e.type&&!0===e.disabled||!0===e?.disableListColumn;return e.reduce(((e,n)=>{if(t(n))return e;const r="tabs"===n.type&&"tabs"in n.fieldComponentProps?{...n,fieldComponentProps:{...n.fieldComponentProps,tabs:n.fieldComponentProps.tabs.map((e=>({...e,fieldMap:e.fieldMap.filter((e=>!t(e)))})))}}:n;return[...e,r]}),[])})(d),m,p))),[y,w]=i().useState((()=>Mm({cellProps:e,columnPreferences:s?.columns,columns:b,enableRowSelections:a,fieldMap:d,useAsTitle:m}))),x=i().useCallback((e=>{const t=e.map((e=>({accessor:e?.accessor,active:e?.active})));v(l,{columns:t},!0)}),[l,v]),P=e=>{let t=!1;return e.map((e=>{const n=e.active&&!t&&"_select"!==e.accessor;return n&&(t=!0),{...e,cellProps:{...e.cellProps,link:n}}}))},j=(0,o.useCallback)((e=>{const{fromIndex:t,toIndex:n}=e,r=[...y],[a]=r.splice(t,1);r.splice(n,0,a);const o=P(r);w(o),x(o)}),[y,x]),k=(0,o.useCallback)((e=>{const t=y.map((t=>({...t,active:t?.name===e?!t.active:t.active}))),n=P(t);w(n),x(n)}),[y,x]),S=i().useCallback((e=>{const t=y.map((t=>({...t,active:e.includes(t.accessor)}))),n=P(t);x(n)}),[y,x]);return i().useEffect((()=>{(async()=>{if(h.current!==r||!s){const t=await g(l);h.current=r,t?.columns&&w(Mm({cellProps:e,columnPreferences:t?.columns,columns:b,enableRowSelections:!0,fieldMap:d,useAsTitle:m}))}})()}),[l,g,r,d,e,p,m,s,b]),(0,t.jsx)(Em.Provider,{value:{columns:y,moveColumn:j,setActiveColumns:S,toggleColumn:k},children:n})};const Am=e=>{const{i18n:n}=(0,Be.B)(),{description:r}=e;if(function(e){return i().isValidElement(e)}(r)){const e=r;return(0,t.jsx)(e,{})}return r?(0,t.jsx)("div",{className:"view-description",children:"function"==typeof r?r():(0,a.sC)(r,n)}):null},Tm=(e,t)=>("and"in e?e.and.push(t):e={and:[e,t]},e),Rm=({collectionSlugs:e,customHeader:n,drawerSlug:r,filterOptions:i,onSelect:s,selectedCollection:l})=>{const{i18n:c,t:u}=(0,Be.B)(),{permissions:d}=sn(),{setPreference:f}=dn(),{closeModal:p,isModalOpen:m}=O(),[h,g]=(0,o.useState)(),[v,b]=(0,o.useState)(null),[y,w]=(0,o.useState)(1),[x,P]=(0,o.useState)(null),[j,k]=(0,o.useState)(""),{componentMap:S}=wn(),{collections:C,routes:{api:M},serverURL:_}=Ut(),E=C.filter((({slug:t})=>e.includes(t))),[D,N]=(0,o.useState)((()=>E.find((({slug:e})=>e===l))||E?.[0])),{List:A}=S.collections?.[D?.slug]||{},[T,R]=(0,o.useState)((()=>D?{label:(0,a.sC)(D.labels.singular,c),value:D.slug}:void 0));(0,o.useEffect)((()=>{}),[D]),(0,o.useEffect)((()=>{if(l){const e=E.find((({slug:e})=>e===l))||E?.[0];N(e)}}),[l,E,s,u]);const I=`${D.slug}-list`,[L,$,{drawerSlug:W}]=Xf({collectionSlug:D.slug});(0,o.useEffect)((()=>{T&&!Array.isArray(T)&&N(E.find((({slug:e})=>T.value===e)))}),[T,E]);const F=d?.collections?.[D?.slug],z=F?.create?.permission,B=m(r)?`${_}${M}/${D.slug}`:null,[H,Y]=(0,o.useReducer)((e=>e+1),0),[{data:V,isError:q,isLoading:U},{setParams:G}]=Kp(B,{}),K=E.length>1;(0,o.useEffect)((()=>{const{slug:e,admin:{listSearchableFields:t,useAsTitle:n}={},versions:r}=D,a={};let o={...x||{}};const s=i?.[e];if(i&&"boolean"!=typeof s&&(o=Tm(o,s)),j){const e=(t||[n]).map((e=>({[e]:{like:j}})),[]);if(e.length>0){const t={or:[...e]};o=Tm(o,t)}}y&&(a.page=y),v&&(a.sort=v),H&&(a.cacheBust=H),o&&(a.where=o),r?.drafts&&(a.draft="true"),G(a)}),[y,v,x,j,H,i,D,u,G]),(0,o.useEffect)((()=>{f(I,{limit:h,sort:v},!0)}),[v,h,f,I]);const X=(0,o.useCallback)((({doc:e})=>{"function"==typeof s&&s({collectionSlug:D.slug,docID:e.id}),Y(),p(W),p(r)}),[p,W,r,s,D]);return!D||q?null:U?(0,t.jsx)(Ye,{}):(0,t.jsx)(Qp,{Header:(0,t.jsxs)("header",{className:`${Im}__header`,children:[(0,t.jsxs)("div",{className:`${Im}__header-wrap`,children:[(0,t.jsxs)("div",{className:`${Im}__header-content`,children:[(0,t.jsx)("h2",{className:`${Im}__header-text`,children:n||(0,a.sC)(D?.labels?.plural,c)}),z&&(0,t.jsx)($,{className:`${Im}__create-new-button`,children:(0,t.jsx)(Ml,{children:u("general:createNew")})})]}),(0,t.jsx)("button",{"aria-label":u("general:close"),className:`${Im}__header-close`,onClick:()=>{p(r)},type:"button",children:(0,t.jsx)($t.u,{})})]}),D?.admin?.description&&(0,t.jsx)("div",{className:`${Im}__sub-header`,children:(0,t.jsx)(Am,{description:D.admin.description})}),K&&(0,t.jsxs)("div",{className:`${Im}__select-collection-wrap`,children:[(0,t.jsx)(Ns,{label:u("upload:selectCollectionToBrowse")}),(0,t.jsx)(_f,{className:`${Im}__select-collection`,onChange:R,options:E.map((e=>({label:(0,a.sC)(e.labels.singular,c),value:e.slug}))),value:T})]})]}),collectionConfig:D,collectionSlug:D.slug,hasCreatePermission:z,newDocumentURL:null,children:(0,t.jsx)(em,{data:V,defaultLimit:h||D?.admin?.pagination?.defaultLimit,defaultSort:v,handlePageChange:w,handlePerPageChange:g,handleSearchChange:k,handleSortChange:b,handleWhereChange:P,modifySearchParams:!1,preferenceKey:I,children:(0,t.jsxs)(Nm,{cellProps:[{className:`${Im}__first-cell`,link:!1,onClick:({collectionSlug:e,rowData:t})=>{"function"==typeof s&&s({collectionSlug:e,docID:t.id})}}],collectionSlug:D.slug,preferenceKey:I,children:[A,(0,t.jsx)(L,{onSave:X})]})})})},Im="list-drawer",Lm=({children:e,className:n,disabled:r,drawerSlug:a,...o})=>(0,t.jsx)(wl,{className:[n,`${Im}__toggler`].filter(Boolean).join(" "),disabled:r,slug:a,...o,children:e}),$m=e=>{const{drawerSlug:n}=e;return(0,t.jsx)(xl,{Header:null,className:Im,gutter:!1,slug:n,children:(0,t.jsx)(Rm,{...e})})},Wm=({collectionSlugs:e,filterOptions:n,selectedCollection:r,uploads:a})=>{const{collections:i}=Ut(),s=ws(),l=(0,o.useId)(),{closeModal:c,modalState:u,openModal:d,toggleModal:f}=O(),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(e),v=(({depth:e,uuid:t})=>`list-drawer_${e}_${t}`)({depth:s,uuid:l});(0,o.useEffect)((()=>{m(Boolean(u[v]?.isOpen))}),[u,v]),(0,o.useEffect)((()=>{if(!h||0===h.length){const e=i.filter((({upload:e})=>!a||!0===Boolean(e)));g(e.map((({slug:e})=>e)))}}),[h,a,i]);const b=(0,o.useCallback)((()=>{f(v)}),[f,v]),y=(0,o.useCallback)((()=>{c(v)}),[v,c]),w=(0,o.useCallback)((()=>{d(v)}),[v,d]);return[(0,o.useMemo)((()=>e=>(0,o.createElement)($m,{...e,closeDrawer:y,collectionSlugs:h,drawerSlug:v,filterOptions:n,key:v,selectedCollection:r,uploads:a})),[v,h,a,y,r,n]),(0,o.useMemo)((()=>e=>(0,t.jsx)(Lm,{...e,drawerSlug:v})),[v]),(0,o.useMemo)((()=>({closeDrawer:y,drawerDepth:s,drawerSlug:v,isDrawerOpen:p,openDrawer:w,toggleDrawer:b})),[s,v,p,b,y,w])]},Fm="upload",zm=e=>{const{CustomDescription:n,CustomError:r,CustomLabel:s,api:l="/api",className:c,collection:u,customUploadActions:d,descriptionProps:f,errorProps:p,filterOptions:m,label:h,labelProps:g,onChange:v,readOnly:b,relationTo:y,required:w,serverURL:x,showError:P,style:j,value:k,width:S}=e,{i18n:C,t:M}=(0,Be.B)(),[_,O]=(0,o.useState)(void 0),[E,D]=(0,o.useState)(!1),[N]=(0,o.useState)([u?.slug]),[A,T,{closeDrawer:R}]=Xf({collectionSlug:N[0]}),[I,L,{closeDrawer:$}]=Wm({collectionSlugs:N,filterOptions:m});(0,o.useEffect)((()=>{if(null!=k&&""!==k){(async()=>{const e=await fetch(`${x}${l}/${y}/${k}`,{credentials:"include",headers:{"Accept-Language":C.language}});if(e.ok){const t=await e.json();O(t)}else D(!0),O(void 0)})()}else O(void 0)}),[k,y,l,x,C]);const W=(0,o.useCallback)((e=>{D(!1),v(e.doc),R()}),[v,R]),F=(0,o.useCallback)((e=>{D(!1),v({id:e.docID}),$()}),[v,$]);return u.upload?(0,t.jsxs)("div",{className:[Ms,Fm,c,P&&"error",b&&"read-only"].filter(Boolean).join(" "),style:{...j,width:S},children:[(0,t.jsx)(Ns,{CustomLabel:s,label:h,required:w,...g||{}}),(0,t.jsxs)("div",{className:`${Ms}__wrap`,children:[(0,t.jsx)(Cs,{CustomError:r,...p||{}}),u?.upload&&(0,t.jsxs)(i().Fragment,{children:[_&&!E&&(0,t.jsx)(Gp,{collectionSlug:y,customUploadActions:d,doc:_,handleRemove:b?void 0:()=>{v(null)},uploadConfig:u.upload}),(!_||E)&&(0,t.jsx)("div",{className:`${Fm}__wrap`,children:(0,t.jsxs)("div",{className:`${Fm}__buttons`,children:[(0,t.jsx)(T,{className:`${Fm}__toggler`,disabled:b,children:(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:b,el:"div",children:M("fields:uploadNewLabel",{label:(0,a.sC)(u.labels.singular,C)})})}),(0,t.jsx)(L,{className:`${Fm}__toggler`,disabled:b,children:(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:b,el:"div",children:M("fields:chooseFromExisting")})})]})}),void 0!==n?n:(0,t.jsx)(ks,{...f||{}})]}),!b&&(0,t.jsx)(A,{onSave:W}),!b&&(0,t.jsx)(I,{onSelect:F})]})]}):null},Bm=vs((e=>{const{CustomDescription:n,CustomError:r,CustomLabel:a,className:i,descriptionProps:s,errorProps:l,label:c,labelProps:u,path:d,readOnly:f,relationTo:p,required:m,style:h,validate:g,width:v}=e,{collections:b,routes:{api:y},serverURL:w}=Ut(),x=b.find((e=>e.slug===p)),P=(0,o.useCallback)(((e,t)=>{if("function"==typeof g)return g(e,{...t,required:m})}),[g,m]),{path:j,readOnly:k}=Po(),{filterOptions:S,formInitializing:C,formProcessing:M,path:_,setValue:O,showError:E,value:D}=hs({path:j??d,validate:P}),N=f||k||M||C,A=(0,o.useCallback)((e=>{O(e?.id||e)}),[O]);return x.upload?(0,t.jsx)(zm,{CustomDescription:n,CustomError:r,CustomLabel:a,api:y,className:i,collection:x,descriptionProps:s,errorProps:l,filterOptions:S,label:c,labelProps:u,onChange:A,path:_,readOnly:N,relationTo:p,required:m,serverURL:w,showError:E,style:h,value:D,width:v}):null})),Hm={array:gl,blocks:Xl,checkbox:Is,code:nc,collapsible:ic,confirmPassword:sc,date:dc,email:fc,group:wc,hidden:ol,json:Pc,number:Of,password:Ef,point:Nf,radio:If,relationship:lp,richText:()=>null,row:up,select:fp,tabs:gp,text:bp,textarea:wp,ui:()=>null,upload:Bm},Ym=(0,o.createContext)(Hm),Vm=({children:e})=>(0,t.jsx)(Ym.Provider,{value:Hm,children:e}),qm=()=>(0,o.useContext)(Ym),Um=(0,o.createContext)({}),Gm=({children:e})=>{const n=(0,ht.useParams)();return(0,t.jsx)(Um.Provider,{value:n,children:e})};var Km=n(84348),Xm=n(44666);const Qm=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#FF8C91"}),(0,t.jsx)("path",{d:"M15.4001 10.5996L10.6001 15.3996M10.6001 10.5996L15.4001 15.3996",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})]}),Jm=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#C3C3C3"}),(0,t.jsx)("path",{d:"M13 16.1998V12.9998M13 9.7998H13.0077",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})]}),Zm=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#A0E6C1"}),(0,t.jsx)("path",{d:"M10.6001 13.0004L12.2001 14.6004L15.4001 11.4004",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})]}),eh=()=>(0,t.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.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:"#E4E694"}),(0,t.jsx)("path",{d:"M13 10V13.2M13 16.4H13.008",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})]}),th=()=>(0,t.jsx)(At,{className:"payload-toast-container",closeButton:!0,dir:"undefined",icons:{error:(0,t.jsx)(Qm,{}),info:(0,t.jsx)(Jm,{}),success:(0,t.jsx)(Zm,{}),warning:(0,t.jsx)(eh,{})},offset:"36px",toastOptions:{classNames:{closeButton:"payload-toast-close-button",content:"toast-content",error:"toast-error",icon:"toast-icon",info:"toast-info",success:"toast-success",toast:"payload-toast-item",warning:"toast-warning"},unstyled:!0},visibleToasts:5}),nh=({children:e,componentMap:n,config:r,dateFNSKey:a,fallbackLang:i,languageCode:s,languageOptions:l,switchLanguageServerAction:c,theme:u,translations:d})=>(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Km.Y,{children:(0,t.jsx)(qt,{config:r,children:(0,t.jsx)(yn,{componentMap:n,children:(0,t.jsx)(Vm,{children:(0,t.jsx)(Cn,{children:(0,t.jsx)(Be.D,{dateFNSKey:a,fallbackLang:i,language:s,languageOptions:l,switchLanguageServerAction:c,translations:d,children:(0,t.jsx)(Fe,{breakpoints:{l:"(max-width: 1440px)",m:"(max-width: 1024px)",s:"(max-width: 768px)",xs:"(max-width: 400px)"},children:(0,t.jsx)(Re,{children:(0,t.jsx)(tn,{children:(0,t.jsx)(Ne,{classPrefix:"payload",transTime:0,zIndex:"var(--z-modal)",children:(0,t.jsxs)(on,{children:[(0,t.jsx)(un,{children:(0,t.jsx)(Xm.NP,{cookiePrefix:r.cookiePrefix,theme:u,children:(0,t.jsx)(Gm,{children:(0,t.jsx)(ss,{children:(0,t.jsx)(vn,{children:(0,t.jsx)(Xe,{children:(0,t.jsx)(_n,{children:(0,t.jsx)(jn,{children:(0,t.jsx)(mn,{children:e})})})})})})})})}),(0,t.jsx)(me,{}),(0,t.jsx)(Xt,{})]})})})})})})})})})})}),(0,t.jsx)(th,{})]}),rh=({Component:e,serverOnlyProps:n,...r})=>{if(e){const a=r=>{const a={...r,...(0,jc.isReactServerComponentOrFunction)(e)?n??{}:{}};return(0,t.jsx)(e,{...a})};return(0,t.jsx)(a,{...r})}return null},ah=e=>{const{WithServerSideProps:n,collectionConfig:r,globalConfig:a}=e,o=(r||a)?.admin?.components?.views?.Edit,i="object"==typeof r?.admin?.components?.views?.List?r?.admin?.components?.views?.List?.actions:void 0,s={Edit:{},List:[]};return o&&Object.entries(o).forEach((([e,r])=>{"object"==typeof r&&"actions"in r&&r.actions.forEach((r=>{const a=r;"function"==typeof a&&(s.Edit[e]=[...s[e]||[],(0,t.jsx)(n,{Component:a})])}))})),i&&i.forEach((e=>{const r=e;"function"==typeof r&&(s.List=[...s.List,(0,t.jsx)(n,{Component:r})])})),s},oh=require("payload");const ih=e=>{const{WithServerSideProps:n,config:r,disableAddingID:a,fieldSchema:i,filter:s,i18n:l,i18n:{t:c},parentPath:u,readOnly:d}=e,f=i.reduce(((e,a)=>{const i=(0,jc.fieldIsPresentationalOnly)(a);let f=a.admin?.components?.Field,p=a.admin?.components?.Cell;const m=a?.admin&&"hidden"in a.admin&&a.admin.hidden;if((i||!a?.hidden&&!0!==a?.admin?.disabled)&&(s&&"function"==typeof s&&s(a)||!s)){m&&f&&(f=ol);const h=(0,jc.fieldAffectsData)(a),g=function(e,t){let n=e||"";return e&&t?n=`${e}.${t}`:!e&&t&&(n=t),n}(u,h&&"name"in a?a.name:""),v="admin"in a&&"components"in a.admin&&"afterInput"in a.admin.components&&Array.isArray(a.admin?.components?.afterInput)&&(0,t.jsx)(o.Fragment,{children:a.admin.components.afterInput.map(((e,r)=>(0,t.jsx)(n,{Component:e},r)))})||null,b="admin"in a&&a.admin?.components&&"beforeInput"in a.admin.components&&Array.isArray(a.admin.components.beforeInput)&&(0,t.jsx)(o.Fragment,{children:a.admin.components.beforeInput.map(((e,r)=>(0,t.jsx)(n,{Component:e},r)))})||null;let y;"label"in a&&("string"==typeof a.label||"object"==typeof a.label?y=a.label:"function"==typeof a.label&&(y=a.label({t:c})));const w={label:y,required:"required"in a?a.required:void 0,schemaPath:g},x="admin"in a&&a.admin?.components&&"Label"in a.admin.components&&a.admin.components?.Label||void 0,P=void 0!==x?(0,t.jsx)(n,{Component:x,...w||{}}):void 0;let j;a.admin&&"description"in a.admin&&("string"==typeof a.admin?.description||"object"==typeof a.admin?.description?j=a.admin.description:"function"==typeof a.admin?.description&&(j=a.admin?.description({t:c})));const k={description:j};let S;a.admin?.components&&"Description"in a.admin.components&&a.admin.components?.Description?S=a.admin.components.Description:j&&(S=ks);const C=void 0!==S?(0,t.jsx)(n,{Component:S,...k||{}}):void 0,M={path:g},_="admin"in a&&a.admin?.components&&"Error"in a.admin.components&&a.admin?.components?.Error||void 0,O={AfterInput:v,BeforeInput:b,CustomDescription:C,CustomError:void 0!==_?(0,t.jsx)(n,{Component:_,...M||{}}):void 0,CustomLabel:P,custom:"admin"in a&&"custom"in a.admin?a.admin?.custom:void 0,descriptionProps:k,disabled:"admin"in a&&"disabled"in a.admin&&a.admin?.disabled,errorProps:M,label:w?.label,path:g,required:"required"in a?a.required:void 0};let E,D;"options"in a&&(D=a.options.map((e=>"object"==typeof e&&"function"==typeof e.label?{label:e.label({t:c}),value:e.value}:e)));const N={name:"name"in a?a.name:void 0,fieldType:a.type,isFieldAffectingData:h,label:w?.label||void 0,labels:"labels"in a?a.labels:void 0,options:"options"in a?D:void 0,relationTo:"relationTo"in a?a.relationTo:void 0,schemaPath:g};switch(a.type){case"array":{let e;if("admin"in a&&a.admin.components&&"RowLabel"in a.admin.components&&a.admin.components.RowLabel){const r=a.admin.components.RowLabel;e=(0,t.jsx)(n,{Component:r,...w||{}})}E={...O,name:a.name,CustomRowLabel:e,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),isSortable:a.admin?.isSortable,labels:a.labels,maxRows:a.maxRows,minRows:a.minRows,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break}case"blocks":{const e=a.blocks.map((e=>{const t=ih({WithServerSideProps:n,config:r,fieldSchema:e.fields,filter:s,i18n:l,parentPath:`${g}.${e.slug}`,readOnly:d});return{slug:e.slug,custom:e.admin?.custom,fieldMap:t,imageAltText:e.imageAltText,imageURL:e.imageURL,labels:e.labels}}));E={...O,name:a.name,blocks:e,className:a.admin?.className,disabled:a.admin?.disabled,isSortable:a.admin?.isSortable,labels:a.labels,maxRows:a.maxRows,minRows:a.minRows,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width},N.blocks=a.blocks.map((e=>({slug:e.slug,labels:e.labels})));break}case"checkbox":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"code":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,editorOptions:a.admin?.editorOptions,language:a.admin?.language,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"collapsible":{let e;if(a?.admin?.components&&"RowLabel"in a.admin.components&&a?.admin?.components?.RowLabel){const r=a.admin.components.RowLabel;e=(0,t.jsx)(n,{Component:r,...w||{}})}E={...O,CustomLabel:e,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),initCollapsed:a.admin?.initCollapsed,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break}case"date":E={...O,name:a.name,className:a.admin?.className,date:a.admin?.date,disabled:a.admin?.disabled,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width},N.dateDisplayFormat=a.admin?.date?.displayFormat;break;case"email":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"group":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),hideGutter:a.admin?.hideGutter,readOnly:a.admin?.readOnly,style:a.admin?.style,width:a.admin?.width};break;case"json":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,editorOptions:a.admin?.editorOptions,jsonSchema:a.jsonSchema,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"number":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,max:a.max,maxRows:a.maxRows,min:a.min,readOnly:a.admin?.readOnly,required:a.required,step:a.admin?.step,style:a.admin?.style,width:a.admin?.width};break;case"point":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"relationship":{const e={...O,name:a.name,allowCreate:a.admin.allowCreate,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,isSortable:a.admin?.isSortable,readOnly:a.admin?.readOnly,relationTo:a.relationTo,required:a.required,sortOptions:a.admin.sortOptions,style:a.admin?.style,width:a.admin?.width};N.relationTo=a.relationTo,E=e;break}case"radio":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,options:D,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};N.options=D,E=e;break}case"richText":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};if(!a?.editor)throw new oh.MissingEditorProp(a);if("function"==typeof a?.editor)throw new Error("Attempted to access unsanitized rich text editor.");const t=a.editor.FieldComponent,o=a.editor.CellComponent;if("function"==typeof a.editor.generateComponentMap){const t=a.editor.generateComponentMap({WithServerSideProps:n,config:r,i18n:l,schemaPath:g});e.richTextComponentMap=t,N.richTextComponentMap=t}t&&(f=t),o&&(p=o),E=e;break}case"row":E={...O,className:a.admin?.className,disabled:a.admin?.disabled,fieldMap:ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:a.fields,filter:s,i18n:l,parentPath:g,readOnly:d}),readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"tabs":{const e=a.tabs.map((e=>{const t=ih({WithServerSideProps:n,config:r,disableAddingID:!0,fieldSchema:e.fields,filter:s,i18n:l,parentPath:g,readOnly:d});return{name:"name"in e?e.name:void 0,fieldMap:t,label:e.label}}));E={...O,name:"name"in a?a.name:void 0,className:a.admin?.className,disabled:a.admin?.disabled,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,tabs:e,width:a.admin?.width};break}case"text":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,maxLength:a.maxLength,minLength:a.minLength,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};break;case"textarea":E={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,maxLength:a.maxLength,minLength:a.minLength,placeholder:a.admin?.placeholder,readOnly:a.admin?.readOnly,required:a.required,rows:a.admin?.rows,style:a.admin?.style,width:a.admin?.width};break;case"ui":E=O;break;case"upload":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,filterOptions:a.filterOptions,readOnly:a.admin?.readOnly,relationTo:a.relationTo,required:a.required,style:a.admin?.style,width:a.admin?.width};N.relationTo=a.relationTo,E=e;break}case"select":{const e={...O,name:a.name,className:a.admin?.className,disabled:a.admin?.disabled,hasMany:a.hasMany,isClearable:a.admin?.isClearable,options:D,readOnly:a.admin?.readOnly,required:a.required,style:a.admin?.style,width:a.admin?.width};N.options=D,E=e;break}}const A={name:"name"in a?a.name:void 0,type:a.type,CustomCell:p?(0,t.jsx)(n,{Component:p,...N}):void 0,CustomField:f?(0,t.jsx)(n,{Component:f,...E}):void 0,cellComponentProps:N,custom:a?.admin?.custom,disableBulkEdit:"admin"in a&&"disableBulkEdit"in a.admin&&a.admin.disableBulkEdit,disableListColumn:"admin"in a&&"disableListColumn"in a.admin&&a.admin.disableListColumn,disableListFilter:"admin"in a&&"disableListFilter"in a.admin&&a.admin.disableListFilter,fieldComponentProps:E,fieldIsPresentational:i,isFieldAffectingData:h,isHidden:m,isSidebar:"admin"in a&&"position"in a.admin&&"sidebar"===a.admin.position,localized:"localized"in a&&a.localized,unique:"unique"in a&&a.unique};e.push(A)}return e}),[]),p=f.findIndex((e=>"name"in e&&e.isFieldAffectingData&&"id"===e.name))>-1;return a||p||f.push({name:"id",type:"text",CustomField:null,cellComponentProps:{name:"id",schemaPath:"id"},disableBulkEdit:!0,fieldComponentProps:{name:"id",label:"ID"},fieldIsPresentational:!1,isFieldAffectingData:!0,isHidden:!0,localized:void 0}),f},sh=e=>{const{DefaultEditView:n,DefaultListView:r,children:a,i18n:o,payload:i,readOnly:s}=e,l=i.config,c=({Component:e,...n})=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:o,payload:i},...n}),u=(e=>{const{DefaultEditView:n,DefaultListView:r,WithServerSideProps:a,collections:o,config:i,i18n:s,i18n:{t:l},readOnly:c}=e;return o.reduce(((e,o)=>{const{slug:u,fields:d}=o;if(["payload-preferences","payload-migrations"].includes(u))return e;const f=o?.admin?.components?.views?.Edit,p=o?.admin?.components?.views?.List,m="function"==typeof f?f:"object"==typeof f&&(0,jc.isReactComponentOrFunction)(f.Default)?f.Default:"object"==typeof f?.Default&&"Component"in f.Default&&(0,jc.isReactComponentOrFunction)(f.Default.Component)?f.Default.Component:void 0,h="function"==typeof p?p:"object"==typeof p&&(0,jc.isReactComponentOrFunction)(p.Component)?p.Component:void 0,g=m||n,v=h||r,b=o?.admin?.components?.edit?.SaveButton,y=b?(0,t.jsx)(a,{Component:b}):void 0,w=o?.admin?.components?.edit?.SaveDraftButton,x=w?(0,t.jsx)(a,{Component:w}):void 0,P=o?.admin?.components?.edit?.PreviewButton,j=P?(0,t.jsx)(a,{Component:P}):void 0,k=o?.admin?.components?.edit?.PublishButton,S=k?(0,t.jsx)(a,{Component:k}):void 0,C=o?.admin?.components?.edit?.Upload,M=C?(0,t.jsx)(a,{Component:C}):void 0,_=o?.admin?.components?.beforeList,O=_&&Array.isArray(_)&&_?.map((e=>(0,t.jsx)(a,{Component:e})))||null,E=o?.admin?.components?.beforeListTable,D=E&&Array.isArray(E)&&E?.map((e=>(0,t.jsx)(a,{Component:e})))||null,N=o?.admin?.components?.afterList,A=N&&Array.isArray(N)&&N?.map((e=>(0,t.jsx)(a,{Component:e})))||null,T=o?.admin?.components?.afterListTable,R=T&&Array.isArray(T)&&T?.map((e=>(0,t.jsx)(a,{Component:e})))||null;let I;o.admin&&"description"in o.admin&&("string"==typeof o.admin?.description||"object"==typeof o.admin?.description?I=o.admin.description:"function"==typeof o.admin?.description&&(I=o.admin?.description({t:l})));const L={description:I},$=o.admin?.components?.edit?.Description||(I?Am:void 0),W={AfterList:A,AfterListTable:R,BeforeList:O,BeforeListTable:D,Description:void 0!==$?(0,t.jsx)(a,{Component:$,...L||{}}):void 0,Edit:(0,t.jsx)(g,{collectionSlug:o.slug}),List:(0,t.jsx)(v,{collectionSlug:o.slug}),PreviewButton:j,PublishButton:S,SaveButton:y,SaveDraftButton:x,Upload:M,actionsMap:ah({WithServerSideProps:a,collectionConfig:o}),fieldMap:ih({WithServerSideProps:a,config:i,fieldSchema:d,i18n:s,readOnly:c}),isPreviewEnabled:!!o?.admin?.preview};return{...e,[u]:W}}),{})})({DefaultEditView:n,DefaultListView:r,WithServerSideProps:c,collections:l.collections,config:l,i18n:o,readOnly:s}),d=(({args:e})=>{const{DefaultEditView:n,WithServerSideProps:r,config:a,globals:o,i18n:i,i18n:{t:s},readOnly:l}=e;return o.reduce(((e,o)=>{const{slug:c,fields:u}=o,d=o?.admin?.components?.views?.Edit,f=o?.admin?.components?.elements?.SaveButton,p=f?(0,t.jsx)(r,{Component:f}):void 0,m=o?.admin?.components?.elements?.SaveDraftButton,h=m?(0,t.jsx)(r,{Component:m}):void 0,g=o?.admin?.components?.elements?.PreviewButton,v=g?(0,t.jsx)(r,{Component:g}):void 0,b=o?.admin?.components?.elements?.PublishButton,y=b?(0,t.jsx)(r,{Component:b}):void 0,w=("function"==typeof d?d:"object"==typeof d&&(0,jc.isReactComponentOrFunction)(d.Default)?d.Default:"object"==typeof d?.Default&&"Component"in d.Default&&(0,jc.isReactComponentOrFunction)(d.Default.Component)?d.Default.Component:void 0)||n;let x;o.admin&&"description"in o.admin&&("string"==typeof o.admin?.description||"object"==typeof o.admin?.description?x=o.admin.description:"function"==typeof o.admin?.description&&(x=o.admin?.description({t:s})));const P={description:x},j=o.admin?.components?.elements?.Description||(x?Am:void 0),k={Description:void 0!==j?(0,t.jsx)(r,{Component:j,...P||{}}):void 0,Edit:(0,t.jsx)(w,{globalSlug:o.slug}),PreviewButton:v,PublishButton:y,SaveButton:p,SaveDraftButton:h,Upload:null,actionsMap:ah({WithServerSideProps:r,globalConfig:o}),fieldMap:ih({WithServerSideProps:r,config:a,fieldSchema:u,i18n:i,readOnly:l}),isPreviewEnabled:!!o?.admin?.preview};return{...e,[c]:k}}),{})})({args:{DefaultEditView:n,WithServerSideProps:c,config:l,globals:l.globals,i18n:o,readOnly:s}}),f=({children:e,providers:n})=>{const r=n[0];return n.length>1?(0,t.jsx)(r,{children:(0,t.jsx)(f,{providers:n.slice(1),children:e})}):(0,t.jsx)(r,{children:e})},p=l.admin?.components?.logout?.Button,m=p?(0,t.jsx)(c,{Component:p}):null,h=l.admin?.components?.graphics?.Icon;return{componentMap:{Icon:h?(0,t.jsx)(c,{Component:h}):null,LogoutButton:m,actions:l.admin?.components?.actions?.map((e=>(0,t.jsx)(c,{Component:e}))),collections:u,globals:d},wrappedChildren:Array.isArray(l.admin?.components?.providers)&&l.admin?.components?.providers.length>0?(0,t.jsx)(f,{providers:l.admin?.components?.providers,children:a}):a}};var lh=n(97922),ch=n(15186);n(22411);let uh=n.g._payload;uh||(uh=n.g._payload={payload:null,promise:null,reload:!1});const dh=async e=>{if(!e?.config)throw new Error("Error: the payload config is required for getPayload to work.");if(uh.payload){const t=await e.config;if(!0===uh.reload){let e;uh.reload=new Promise((t=>e=t)),await(async(e,t)=>{"function"==typeof t.db.destroy&&await t.db.destroy(),t.config=e,t.collections=e.collections.reduce(((e,n)=>(e[n.slug]={config:n,customIDType:t.collections[n.slug]?.customIDType},e)),{}),t.globals={config:e.globals},!1!==e.typescript.autoGenerate&&t.bin({args:["generate:types"],log:!1}),await t.db.init(),t.db.connect&&await t.db.connect({hotReload:!0})})(t,uh.payload),e()}return uh.reload instanceof Promise&&await uh.reload,uh.payload}uh.promise||(uh.promise=(new oh.BasePayload).init(e));try{uh.payload=await uh.promise}catch(e){throw uh.promise=null,e}return uh.payload},fh=({config:e,cookies:t,headers:n})=>{const r=Object.keys(e.i18n.supportedLanguages),o=t.get(`${e.cookiePrefix||"payload"}-lng`),i="string"==typeof o?o:o?.value;if(i&&r.includes(i))return i;const s=n.get("Accept-Language")?(0,a.R8)(n.get("Accept-Language")):void 0;return s&&r.includes(s)?s:e.i18n.fallbackLanguage},ph=["dark","light"];var mh=n(98077);const hh={413:"Your request was too large to submit successfully."};var gh=n(4648),vh=n.n(gh);const bh=(e,t)=>{const n={},r=Object.entries(t).reduce(((t,[r,a])=>{const o=t;if(0===r.indexOf(`${e}.`)){const[t]=r.replace(`${e}.`,"").split(".");o[t]||(o[t]={}),o[t][r.replace(`${e}.${String(t)}.`,"")]={...a}}else n[r]=a;return o}),[]);return{remainingFields:n,rows:r}},yh=(e,t)=>t.reduce(((t,n,r)=>({...t,...Object.entries(n).reduce(((t,[n,a])=>({...t,[`${e}.${r}.${n}`]:{...a}})),{})})),{}),wh=vh().default||vh();function xh(e,t){switch(t.type){case"REPLACE_STATE":if(!1!==t.optimize){const n={};return Object.entries(t.state).forEach((([t,r])=>{const a=e[t],o=r;pt(a,o)?a&&(n[t]=a):n[t]=o})),n}return t.state;case"REMOVE":{const n={...e};return n[t.path]&&delete n[t.path],n}case"ADD_SERVER_ERRORS":{let n={...e};const r=[];return t.errors.forEach((({field:e,message:t})=>{n[e]={...n[e]||{initialValue:null,value:null},errorMessage:t,valid:!1};const a=e.split(".");a.length>1&&r.push({fieldErrorPath:e,parentPath:a.slice(0,a.length-1).join(".")})})),n=Object.entries(n).reduce(((e,[t,n])=>{const a=r.reduce(((e,{fieldErrorPath:n,parentPath:r})=>(r.startsWith(t)&&e.push(n),e)),[]);let o=!1;if(a.length>0){const r=Array.isArray(n.errorPaths)?n.errorPaths:[];a.forEach((e=>{r.includes(e)||(r.push(e),o=!0)})),o&&(e[t]={...n,errorPaths:r})}return o||(e[t]=n),e}),{}),n}case"UPDATE":{const n=Object.entries(t).reduce(((e,[t,n])=>["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(t)?{...e,[t]:n}:e),e[t.path]||{});return{...e,[t.path]:n}}case"REMOVE_ROW":{const{path:n,rowIndex:r}=t,{remainingFields:a,rows:o}=bh(n,e),i=[...e[n]?.rows||[]];o.splice(r,1),i.splice(r,1);return{...a,[n]:{...e[n],disableFormData:o.length>0,rows:i,value:o.length},...yh(n,o)}}case"ADD_ROW":{const{blockType:n,path:r,rowIndex:a,subFieldState:o={}}=t,i="number"==typeof a?a:e[r]?.rows?.length||0,s=[...e[r]?.rows||[]],l={id:o?.id?.value||(new wh).toHexString(),blockType:n||void 0,collapsed:!1};s.splice(i,0,l),n&&(o.blockType={initialValue:n,valid:!0,value:n});const{remainingFields:c,rows:u}=bh(r,e);u.splice(i,0,o);return{...c,...yh(r,u),[r]:{...e[r],disableFormData:!0,rows:s,value:u.length}}}case"REPLACE_ROW":{const{blockType:n,path:r,rowIndex:a,subFieldState:o={}}=t,{remainingFields:i,rows:s}=bh(r,e),l=Math.max(0,Math.min(a,s?.length-1||0)),c=[...e[r]?.rows||[]];c[l]={id:(new wh).toHexString(),blockType:n||void 0,collapsed:!1},n&&(o.blockType={initialValue:n,valid:!0,value:n}),s[l]=o;return{...i,...yh(r,s),[r]:{...e[r],disableFormData:!0,rows:c,value:s.length}}}case"DUPLICATE_ROW":{const{path:n,rowIndex:r}=t,{remainingFields:a,rows:o}=bh(n,e),i=[...e[n].rows||[]],s=(0,jc.deepCopyObject)(i[r]);s.id&&(s.id=(new wh).toHexString());const l=(0,jc.deepCopyObject)(o[r]);l.id&&(l.id=(new wh).toHexString()),Object.keys(l).length>0&&(o.splice(r+1,0,l),i.splice(r+1,0,s));return{...a,...yh(n,o),[n]:{...e[n],disableFormData:!0,rows:i,value:o.length}}}case"MOVE_ROW":{const{moveFromIndex:n,moveToIndex:r,path:a}=t,{remainingFields:o,rows:i}=bh(a,e),s=i[n];i.splice(n,1),i.splice(r,0,s);const l=[...e[a]?.rows||[]],c={...l[n]};l.splice(n,1),l.splice(r,0,c);return{...o,...yh(a,i),[a]:{...e[a],rows:l}}}case"SET_ROW_COLLAPSED":{const{collapsed:n,path:r,rowID:a,setDocFieldPreferences:o}=t,i=e[r],{collapsedRowIDs:s,matchedIndex:l}=e[r].rows.reduce(((e,t,r)=>{const o=t.id===a;return o&&(e.matchedIndex=r),(!o&&t.collapsed||o&&n)&&e.collapsedRowIDs.push(t.id),e}),{collapsedRowIDs:[],matchedIndex:void 0});l>-1&&(i.rows[l].collapsed=n,o(r,{collapsed:s}));return{...e,[r]:{...i}}}case"SET_ALL_ROWS_COLLAPSED":{const{collapsed:n,path:r,setDocFieldPreferences:a}=t,{collapsedRowIDs:o,rows:i}=e[r].rows.reduce(((e,t)=>(n&&e.collapsedRowIDs.push(t.id),e.rows.push({...t,collapsed:n}),e)),{collapsedRowIDs:[],rows:[]});return a(r,{collapsed:o}),{...e,[r]:{...e[r],rows:i}}}default:return e}}const Ph={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:()=>{},disabled:!1,dispatchFields:()=>{},fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:()=>{},initializing:void 0,removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:()=>{},setDisabled:()=>{},setModified:()=>{},setProcessing:()=>{},setSubmitted:()=>{},submit:()=>{},validateForm:()=>{}};const jh=["passesCondition","valid","errorMessage"],kh=(e,t)=>{let n=!1;const r={};return e&&Object.entries(e).forEach((([e,a])=>{if(!t[e])return;const o=((e,t)=>{if(!e)return{changed:!1,result:void 0};const n=[],r=[];return Array.isArray(t)&&t?.length&&t.forEach((e=>r.push(e))),Array.isArray(e)&&e?.length&&e.forEach((e=>n.push(e))),function(e,t){if(e.length!==t.length)return!1;const n=e.slice().sort(),r=t.slice().sort();for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}(n,r)?{changed:!1,result:e}:{changed:!0,result:r}})(a.errorPaths,t[e].errorPaths);o.result&&(o.changed&&(n=o.changed),a.errorPaths=o.result),(t[e]?.filterOptions||a.filterOptions)&&(pt(t[e]?.filterOptions,a.filterOptions)||(n=!0,a.filterOptions=t[e].filterOptions)),jh.forEach((r=>{t[e]?.[r]!==a[r]&&(n=!0,r in t[e]?a[r]=t[e][r]:delete a[r])})),r[e]={...a}})),{changed:n,newState:r}},Sh="form",Ch=e=>{const{id:n,collectionSlug:r,globalSlug:a}=us(),{action:i,beforeSubmit:s,children:l,className:c,disableSuccessStatus:u,disableValidationOnSubmit:d,disabled:f,handleResponse:p,initialState:m,isInitializing:h,onChange:g,onSubmit:v,onSuccess:b,redirect:y,submitted:w,uuid:x,waitForAutocomplete:P}=e,j="method"in e?e?.method:void 0,k=(0,ht.useRouter)(),{code:S}=ls(),{i18n:C,t:M}=(0,Be.B)(),{refreshCookie:_,user:O}=sn(),E=ms(),{formQueryParams:D}=Ff(),N=Ut(),{routes:{api:A},serverURL:T}=N,[R,I]=(0,o.useState)(f||!1),[L,$]=(0,o.useState)(!1),[W,F]=(0,o.useState)(!1),[z,B]=(0,o.useState)(h),[H,Y]=(0,o.useState)(!1),[V,q]=(0,o.useState)(!1),U=(0,o.useRef)(null),G=(0,o.useRef)({}),K=(0,o.useReducer)(xh,{},(()=>m)),[X,Q]=K;G.current.fields=X;const J=(0,o.useCallback)((async()=>{const e={};let t=!0;const r=G.current.getData(),a=Object.entries(G.current.fields).map((async([a,o])=>{const i=o;if(!1!==o.passesCondition){let e=i.valid;if("function"==typeof o.validate){let t=o.value;o?.rows&&Array.isArray(o.rows)&&(t=G.current.getDataByPath(a)),e=await o.validate(t,{id:n,config:N,data:r,operation:E,siblingData:G.current.getSiblingData(a),t:M,user:O}),"string"==typeof e?(i.errorMessage=e,i.valid=!1):(i.valid=!0,i.errorMessage=void 0)}!1===i.valid&&(t=!1)}e[a]=i}));return await Promise.all(a),pt(G.current.fields,e)||Q({type:"REPLACE_STATE",state:e}),t}),[n,O,E,M,Q,N]),Z=(0,o.useCallback)((async(e={},t)=>{const{action:n,method:r=j,overrides:a={},skipValidation:o}=e;if(R)return void(t&&t.preventDefault());let l,c;const f=new Promise(((e,t)=>{l=e,c=t})),m=n||"string"==typeof i||"function"==typeof i;if(y||u||!m?(l=e=>Ct.success(e),c=e=>Ct.error(e)):Ct.promise(f,{error:e=>e,loading:M("general:submitting"),success:e=>e}),t&&(t.stopPropagation(),t.preventDefault()),Y(!0),I(!0),P&&await(0,jc.wait)(100),Array.isArray(s)){let e;await s.reduce((async(t,n)=>{await t;const r=await n({formState:X});e=r}),Promise.resolve());if(!Object.entries(e).every((([,e])=>e.valid)))return Y(!1),q(!0),I(!1),Q({type:"REPLACE_STATE",state:e})}if(!(!(!o&&!d)||await G.current.validateForm()))return c(M("error:correctInvalidFields")),Y(!1),q(!0),void I(!1);if(v){const e={...as(X,!0),...a};v(X,e)}if(!m)return Y(!1),q(!0),void I(!1);const h=G.current.createFormData(a);try{let e;const t=n||("string"==typeof i?`${i}${ge().stringify(D,{addQueryPrefix:!0})}`:null);if(t?e=await mt[r.toLowerCase()](t,{body:h,headers:{"Accept-Language":C.language}}):"function"==typeof i&&(e=await i(h)),F(!1),I(!1),"function"==typeof p)return void p(e,l,c);const a=e.headers.get("content-type"),o=a&&-1!==a.indexOf("application/json");let s={};if(o&&(s=await e.json()),e.status<400)"function"==typeof b&&await b(s),q(!1),Y(!1),y?k.push(y):u||l(s.message||M("general:submissionSuccessful"));else{if(Y(!1),q(!0),G.current={...G.current},s.message)return void c(s.message);if(Array.isArray(s.errors)){const[e,t]=s.errors.reduce((([e,t],n)=>{const r=[],a=[];return n?.message&&a.push(n),Array.isArray(n?.data?.errors)&&n.data?.errors.forEach((e=>{e?.field?r.push(e):a.push(e)})),[[...e,...r],[...t,...a]]}),[[],[]]);return Q({type:"ADD_SERVER_ERRORS",errors:e}),void t.forEach((e=>{c(e.message||M("error:unknown"))}))}const t=hh?.[e.status]||e?.statusText||M("error:unknown");c(t)}}catch(e){console.error("Error submitting form",e),Y(!1),q(!0),I(!1),c(e.message)}}),[s,i,u,d,R,Q,X,p,j,v,b,y,k,M,C,P,D]),ee=(0,o.useCallback)((()=>G.current.fields),[]),te=(0,o.useCallback)((e=>G.current.fields[e]),[]),ne=(0,o.useCallback)((()=>as(G.current.fields,!0)),[]),re=(0,o.useCallback)((e=>((e,t)=>{if(!e)return null;if(-1===t.indexOf("."))return as(e,!0);const n={},r=t.split("."),a=r[r.length-1],o=!Number.isNaN(Number(a));let i;return i=o?`${t}.`:t.substring(0,t.lastIndexOf(".")+1),Object.keys(e).forEach((t=>{e[t].disableFormData||0!==t.indexOf(i)||(n[t.replace(i,"")]=e[t].value)})),rs(n)})(G.current.fields,e)),[]),ae=(0,o.useCallback)((e=>((e,t)=>{const n=t.substring(0,t.lastIndexOf(".")+1),r=t.split(".").pop(),a={};Object.keys(e).forEach((r=>{e[r].disableFormData||0!==r.indexOf(`${t}.`)&&r!==t||(a[r.replace(n,"")]=e[r].value,e[r]?.rows&&0===e[r].rows.length&&(a[r.replace(n,"")]=[]))}));const o=rs(a);return o?.[r]})(G.current.fields,e)),[]),oe=(0,o.useCallback)(((e={})=>{const t=as(G.current.fields,!0),n=t?.file;n&&delete t.file;const r={...t,...e},a={_payload:JSON.stringify(r),file:n};return(0,mh.serialize)(a,{indices:!0,nullsAsUndefineds:!1})}),[]),ie=(0,o.useCallback)((async e=>{const t=await Ji({apiRoute:A,body:{id:n,collectionSlug:r,data:e,globalSlug:a,operation:E,schemaPath:r||a},serverURL:T});G.current={...Ph},F(!1),Q({type:"REPLACE_STATE",state:t})}),[A,r,Q,a,n,E,T]),se=(0,o.useCallback)((e=>{G.current={...Ph},F(!1),Q({type:"REPLACE_STATE",state:e})}),[Q]),le=(0,o.useCallback)((async({data:e,schemaPath:t})=>await Ji({apiRoute:A,body:{collectionSlug:r,data:e,globalSlug:a,schemaPath:t},serverURL:T})),[A,r,a,T]),ce=(0,o.useCallback)((async({data:e,path:t,rowIndex:n,schemaPath:r})=>{const a=await le({data:e,schemaPath:r});Q({type:"ADD_ROW",blockType:e?.blockType,path:t,rowIndex:n,subFieldState:a})}),[le,Q]),ue=(0,o.useCallback)((({path:e,rowIndex:t})=>{Q({type:"REMOVE_ROW",path:e,rowIndex:t})}),[Q]),de=(0,o.useCallback)((async({data:e,path:t,rowIndex:n,schemaPath:r})=>{const a=await le({data:e,schemaPath:r});Q({type:"REPLACE_ROW",blockType:e?.blockType,path:t,rowIndex:n,subFieldState:a})}),[le,Q]);(0,o.useEffect)((()=>{void 0!==h&&B(h)}),[h]),G.current.submit=Z,G.current.getFields=ee,G.current.getField=te,G.current.getData=ne,G.current.getSiblingData=re,G.current.getDataByPath=ae,G.current.validateForm=J,G.current.createFormData=oe,G.current.setModified=F,G.current.setProcessing=Y,G.current.setSubmitted=q,G.current.disabled=R,G.current.setDisabled=I,G.current.formRef=U,G.current.reset=ie,G.current.replaceState=se,G.current.dispatchFields=Q,G.current.addFieldRow=ce,G.current.removeFieldRow=ue,G.current.replaceFieldRow=de,G.current.uuid=x,G.current.initializing=z,(0,o.useEffect)((()=>{$(!0)}),[]),(0,o.useEffect)((()=>{"boolean"==typeof f&&I(f)}),[f]),(0,o.useEffect)((()=>{"boolean"==typeof w&&q(w)}),[w]),(0,o.useEffect)((()=>{m&&(G.current={...Ph},Q({type:"REPLACE_STATE",optimize:!1,state:m}))}),[m,Q]),Yo((()=>{_()}),15e3,[X]),(0,o.useEffect)((()=>{G.current={...G.current},F(!1)}),[S]);const fe=[c,Sh].filter(Boolean).join(" ");!function(e,t,n){const[r,a]=(0,o.useState)((()=>e));(0,o.useEffect)((()=>{const n=setTimeout((()=>{a((()=>e))}),t);return()=>{clearTimeout(n)}}),[...n,t]),(0,o.useEffect)((()=>{r()}),[r])}((()=>{W&&(async()=>{if(Array.isArray(g)){let e=G.current.fields;for(const t of g)e=await t({formState:e});const{changed:t,newState:n}=kh(G.current.fields||{},e);t&&Q({type:"REPLACE_STATE",optimize:!1,state:n})}})()}),150,[G.current.fields,Q,g,W]);const pe="string"==typeof i?`${i}${ge().stringify(D,{addQueryPrefix:!0})}`:"";return(0,t.jsx)("form",{action:j?pe:i,className:fe,method:j,noValidate:!0,onSubmit:e=>G.current.submit({},e),ref:U,children:(0,t.jsx)(Eo.Provider,{value:G.current,children:(0,t.jsx)(Do.Provider,{value:{fields:X,...G.current},children:(0,t.jsx)(No.Provider,{value:V,children:(0,t.jsx)(Ro.Provider,{value:!L||L&&z,children:(0,t.jsx)(Ao.Provider,{value:H,children:(0,t.jsx)(To.Provider,{value:W,children:(0,t.jsx)(Io.Provider,{value:K,children:l})})})})})})})})},Mh=(e,t,n)=>{const r={data:{},valid:!0};return e?(Object.keys(e).forEach((t=>{!0!==n&&e[t]?.disableFormData||(r.data[t]=e[t]?.value,e[t].valid||(r.valid=!1))})),t&&(r.data=rs(r.data)),r):r},_h=({id:e,collection:n,global:r,publishedDocUpdatedAt:a})=>{const{routes:{api:s},serverURL:l}=Ut(),{docConfig:c,getVersions:u,versions:d}=us(),{reportUpdate:f}=On(),{dispatchFields:p,setSubmitted:m}=Lo(),h=$o(),g=c?.versions,[v]=Ho(),b=Fo(),{code:y}=ls(),{i18n:w,t:x}=(0,Be.B)();let P=jc.versionDefaults.autosaveInterval;g.drafts&&g.drafts.autosave&&(P=g.drafts.autosave.interval);const[j,k]=(0,o.useState)(!1),[S,C]=(0,o.useState)(),M=Qt(v,P),_=Qt(b,P),O=(0,o.useRef)(v),E=(0,o.useRef)(_),D=(0,o.useRef)(y);return(0,o.useRef)(M).current=M,O.current=v,E.current=_,D.current=y,(0,o.useEffect)((()=>{const t=new AbortController;let a;return(()=>{if(_){let o,i,c;k(!0),n&&e&&(c=n.slug,o=`${l}${s}/${c}/${e}?draft=true&autosave=true&locale=${D.current}`,i="PATCH"),r&&(c=r.slug,o=`${l}${s}/globals/${c}?draft=true&autosave=true&locale=${D.current}`,i="POST"),o&&(a=setTimeout((async()=>{if(E.current){const{data:n,valid:r}={...Mh(O.current,!0)};n._status="draft";if(!(h&&!r&&g?.drafts&&g?.drafts?.validate)){const r=await fetch(o,{body:JSON.stringify(n),credentials:"include",headers:{"Accept-Language":w.language,"Content-Type":"application/json"},method:i,signal:t.signal});if(200===r.status){const t=new Date;C(t.getTime()),f({id:e,entitySlug:c,updatedAt:t.toISOString()}),u()}if(g?.drafts&&g?.drafts?.validate&&400===r.status){const e=await r.json();if(Array.isArray(e.errors)){const[t,n]=e.errors.reduce((([e,t],n)=>{const r=[],a=[];return n?.message&&a.push(n),Array.isArray(n?.data)&&n.data.forEach((e=>{e?.field?r.push(e):a.push(e)})),[[...e,...r],[...t,...a]]}),[[],[]]);return p({type:"ADD_SERVER_ERRORS",errors:t}),n.forEach((e=>{Ct.error(e.message||w.t("error:unknown"))})),m(!0),void k(!1)}}}}k(!1)}),1e3))}})(),()=>{clearTimeout(a),t.signal&&t.abort(),k(!1)}}),[s,n,p,u,r,w,e,P,_,f,l,m,g?.drafts,M,h]),(0,o.useEffect)((()=>{d?.docs?.[0]?C(new Date(d.docs[0].updatedAt).getTime()):a&&C(new Date(a).getTime())}),[a,d]),(0,t.jsxs)("div",{className:"autosave",children:[j&&x("general:saving"),!j&&S&&(0,t.jsx)(i().Fragment,{children:x("version:lastSavedAgo",{distance:Xi({date:S,i18n:w})})})]})},Oh=({elements:e,translationString:n})=>{const r=n.split(/(<[^>]+>.*?<\/[^>]+>)/g);return(0,t.jsx)("span",{children:r.map(((n,r)=>{if(e&&n.startsWith("<")&&n.endsWith(">")){const a=n[1],o=e[a];if(o){const e=new RegExp(`<${a}>(.*?)</${a}>`,"g"),i=n.replace(e,((e,t)=>t));return(0,t.jsx)(o,{children:(0,t.jsx)(Oh,{translationString:i})},r)}}return n}))})},Eh=({elements:e,i18nKey:n,t:r,variables:a})=>{const o=r(n,a||{});return e?(0,t.jsx)(Oh,{elements:e,translationString:o}):o},Dh="delete-document",Nh=e=>{const{id:n,buttonId:r,collectionSlug:s,singularLabel:l,title:c}=e,{routes:{admin:u,api:d},serverURL:f}=Ut(),{setModified:p}=Lo(),[m,h]=(0,o.useState)(!1),{toggleModal:g}=O(),v=(0,ht.useRouter)(),{i18n:b,t:y}=(0,Be.B)(),{title:w}=us(),x=c||w||n,P=`delete-${n}`,j=(0,o.useCallback)((()=>{h(!1),Ct.error(y("error:deletingTitle",{title:w}))}),[y,w]),k=(0,o.useCallback)((async()=>{h(!0),p(!1);try{await mt.delete(`${f}${d}/${s}/${n}`,{headers:{"Accept-Language":b.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return e.status<400?(h(!1),g(P),Ct.success(y("general:titleDeleted",{label:(0,a.sC)(l,b),title:w})||t.message),v.push(`${u}/collections/${s}`)):(g(P),t.errors?t.errors.forEach((e=>Ct.error(e.message))):j(),!1)}catch(e){return j()}}))}catch(e){j()}}),[p,f,d,s,n,g,P,y,l,b,w,v,u,j]);return n?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Gs,{id:r,onClick:()=>{h(!1),g(P)},children:y("general:delete")}),(0,t.jsx)(ce,{className:Dh,slug:P,children:(0,t.jsxs)("div",{className:`${Dh}__template`,children:[(0,t.jsx)("h1",{children:y("general:confirmDeletion")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{1:({children:e})=>(0,t.jsx)("strong",{children:e})},i18nKey:"general:aboutToDelete",t:y,variables:{label:(0,a.sC)(l,b),title:x}})}),(0,t.jsxs)("div",{className:`${Dh}__actions`,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:m?void 0:()=>g(P),type:"button",children:y("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-delete",onClick:m?void 0:k,children:y(m?"general:deleting":"general:confirm")})]})]})})]}):null},Ah="duplicate",Th=({id:e,slug:n,singularLabel:r})=>{const s=(0,ht.useRouter)(),l=Fo(),{toggleModal:c}=O(),u=ls(),{setModified:d}=Lo(),{routes:{api:f},serverURL:p}=Ut(),{routes:{admin:m}}=Ut(),[h,g]=(0,o.useState)(!1),{i18n:v,t:b}=(0,Be.B)(),y=`duplicate-${e}`,w=(0,o.useCallback)((async(t=!1)=>{g(!0),!l||t?await mt.post(`${p}${f}/${n}/${e}/duplicate${u?.code?`?locale=${u.code}`:""}`,{body:JSON.stringify({}),headers:{"Accept-Language":v.language,"Content-Type":"application/json",credentials:"include"}}).then((async e=>{const{doc:t,errors:o,message:i}=await e.json();e.status<400?(Ct.success(i||b("general:successfullyDuplicated",{label:(0,a.sC)(r,v)})),d(!1),s.push(`${m}/collections/${n}/${t.id}${u?.code?`?locale=${u.code}`:""}`)):Ct.error(o?.[0].message||i||b("error:unspecific",{label:(0,a.sC)(r,v)}))})):c(y)}),[u,l,p,f,n,e,v,c,y,b,r,d,s,m]),x=(0,o.useCallback)((async()=>{g(!1),await w(!0)}),[w]);return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Gs,{id:"action-duplicate",onClick:()=>w(!1),children:b("general:duplicate")}),l&&h&&(0,t.jsx)(ce,{className:`${Ah}__modal`,slug:y,children:(0,t.jsxs)("div",{className:`${Ah}__modal-template`,children:[(0,t.jsx)("h1",{children:b("general:confirmDuplication")}),(0,t.jsx)("p",{children:b("general:unsavedChangesDuplicate")}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:()=>c(y),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-duplicate",onClick:x,children:b("general:duplicateWithoutSaving")})]})})]})},Rh=()=>{const{generatePreviewURL:e,label:n}=(()=>{const{id:e,collectionSlug:t,globalSlug:n}=us(),[r,a]=(0,o.useState)(!1),[i,s]=(0,o.useState)(""),{code:l}=ls(),{routes:{api:c},serverURL:u}=Ut(),{t:d}=(0,Be.B)(),f=(0,o.useRef)(!1);return{generatePreviewURL:(0,o.useCallback)((async({openPreviewWindow:r=!1})=>{if(!f.current){f.current=!0;try{a(!0);let o=`${u}${c}`;t&&(o=`${o}/${t}/${e}/preview`),n&&(o=`${o}/globals/${n}/preview`);const i=await fetch(`${o}${l?`?locale=${l}`:""}`);if(!i.ok)throw new Error;const d=await i.json();if(!d)throw new Error;s(d),a(!1),f.current=!1,r&&window.open(d,"_blank")}catch(e){a(!1),f.current=!1,Ct.error(d("error:previewing"))}}}),[u,c,t,n,e,l,d]),isLoading:r,label:d(r?"general:loading":"version:preview"),previewURL:i}})();return(0,t.jsx)(Yt,{buttonStyle:"secondary",className:"preview-btn",onClick:()=>e({openPreviewWindow:!0}),size:"small",children:n})},Ih=({CustomComponent:e})=>e||(0,t.jsx)(Rh,{}),Lh=(0,o.forwardRef)(((e,n)=>{const{type:r="submit",buttonId:a,children:o,disabled:i}=e,s=Wo(),l=zo(),{disabled:c}=Lo(),u=!(i||l||s||c);return(0,t.jsx)("div",{className:"form-submit",children:(0,t.jsx)(Yt,{ref:n,...e,disabled:!u||void 0,id:a,type:r,children:o})})})),$h=({label:e})=>{const{hasPublishPermission:n,publishedDoc:r,unpublishedVersions:a}=us(),{submit:i}=Lo(),s=Fo(),{t:l}=(0,Be.B)(),c=e||l("version:publishChanges"),u=n&&(s||a?.totalDocs>0||!r),d=(0,o.useCallback)((()=>{i({overrides:{_status:"published"}})}),[i]);return n?(0,t.jsx)(Lh,{buttonId:"action-save",disabled:!u,onClick:d,size:"small",type:"button",children:c}):null},Wh=({CustomComponent:e})=>e||(0,t.jsx)($h,{}),Fh=new Map([]),zh={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"},Bh=e=>(zh[e.toLowerCase()]||e).trim().toLowerCase().replace("key",""),Hh=(e,t)=>{const{cmdCtrlKey:n,editDepth:r,keyCodes:a}=e,{modalState:i}=O(),s=(0,o.useCallback)((e=>{const o=e.detail?.key?e.detail:e;if(void 0===o.key)return;Fh.forEach(((e,t)=>{Date.now()-e>3e3&&Fh.delete(t)})),o.code&&(e=>{const t=Bh(e);"meta"===t&&Fh.forEach(((e,t)=>"meta"!==t&&Fh.delete(t))),Fh.set(t,Date.now())})(o.code);const s=window.navigator.userAgent.includes("Mac OS X"),l=[...Fh.keys()].filter((e=>!["alt","ctrl","meta","shift"].includes(e)));if((0,jc.setsAreEqual)(new Set(l),new Set(a))&&(!n||s&&Fh.has("meta")||!s&&o.ctrlKey)){const e=Object.keys(i).filter((e=>i[e]?.isOpen))?.length+1||1;if(e!==r)return;t(o)}}),[a,n,r,i,t]),l=(0,o.useCallback)((e=>{e.code&&(e=>{const t=Bh(e);"meta"===t&&Fh.clear(),Fh.delete(t)})(e.code)}),[]);(0,o.useEffect)((()=>(document.addEventListener("keydown",s,!1),document.addEventListener("bypassKeyDown",s,!1),document.addEventListener("keyup",l,!1),()=>{document.removeEventListener("keydown",s),document.removeEventListener("bypassKeyDown",s),document.removeEventListener("keyup",l)})),[s,l])},Yh=({label:e})=>{const{t:n}=(0,Be.B)(),{submit:r}=Lo(),a=Fo(),i=e||n("general:save"),s=(0,o.useRef)(null),l=ws(),c="update"===ms()&&!a;return Hh({cmdCtrlKey:!0,editDepth:l,keyCodes:["s"]},(e=>{e.preventDefault(),e.stopPropagation(),s?.current&&s.current.click()})),(0,t.jsx)(Lh,{buttonId:"action-save",disabled:c,onClick:()=>r(),ref:s,size:"small",type:"button",children:i})},Vh=({CustomComponent:e})=>e||(0,t.jsx)(Yh,{}),qh=()=>{const{routes:{api:e},serverURL:n}=Ut(),{id:r,collectionSlug:a,globalSlug:i}=us(),s=Fo(),{code:l}=ls(),c=(0,o.useRef)(null),u=ws(),{t:d}=(0,Be.B)(),{submit:f}=Lo(),p="update"===ms()&&!s,m=(0,o.useCallback)((async()=>{if(p)return;const t=`?locale=${l}&depth=0&fallback-locale=null&draft=true`;let o,s="POST";a&&(o=`${n}${e}/${a}${r?`/${r}`:""}${t}`,r&&(s="PATCH")),i&&(o=`${n}${e}/globals/${i}${t}`),await f({action:o,method:s,overrides:{_status:"draft"},skipValidation:!0})}),[f,a,i,n,e,l,r,p]);return Hh({cmdCtrlKey:!0,editDepth:u,keyCodes:["s"]},(e=>{e.preventDefault(),e.stopPropagation(),c?.current&&c.current.click()})),(0,t.jsx)(Lh,{buttonId:"action-save-draft",buttonStyle:"secondary",className:"save-draft",disabled:p,onClick:m,ref:c,size:"small",type:"button",children:d("version:saveDraft")})},Uh=({CustomComponent:e})=>e||(0,t.jsx)(qh,{}),Gh="status",Kh=()=>{const{id:e,collectionSlug:n,docPermissions:r,getVersions:a,globalSlug:s,publishedDoc:l,unpublishedVersions:c}=us(),{toggleModal:u}=O(),{routes:{api:d},serverURL:f}=Ut(),[p,m]=(0,o.useState)(!1),{reset:h}=Lo(),{code:g}=ls(),{i18n:v,t:b}=(0,Be.B)(),y=`confirm-un-publish-${e}`,w=`confirm-revert-${e}`;let x;c?.docs?.length>0&&l?x="changed":l?l&&c?.docs?.length<=1&&(x="published"):x="draft";const P=(0,o.useCallback)((async t=>{let r,o,i;m(!0),"unpublish"===t&&(i={_status:"draft"}),"revert"===t&&(i=l),n&&(r=`${f}${d}/${n}/${e}?locale=${g}&fallback-locale=null`,o="patch"),s&&(r=`${f}${d}/globals/${s}?locale=${g}&fallback-locale=null`,o="post");const c=await mt[o](r,{body:JSON.stringify(i),headers:{"Accept-Language":v.language,"Content-Type":"application/json"}});if(200===c.status){let e;const t=await c.json();s?e=t.result:n&&(e=t.doc),h(e),Ct.success(t.message),a()}else Ct.error(b("error:unPublishingDocument"));m(!1),"revert"===t&&u(w),"unpublish"===t&&u(y)}),[d,n,a,s,v.language,e,g,l,h,w,f,b,u,y]),j=r?.update?.permission;return x?(0,t.jsx)("div",{className:Gh,title:`${b("version:status")}: ${b(`version:${x}`)}`,children:(0,t.jsxs)("div",{className:`${Gh}__value-wrap`,children:[(0,t.jsxs)("span",{className:`${Gh}__label`,children:[b("version:status"),": "]}),(0,t.jsx)("span",{className:`${Gh}__value`,children:b(`version:${x}`)}),j&&"published"===x&&(0,t.jsxs)(i().Fragment,{children:[" — ",(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Gh}__action`,onClick:()=>u(y),children:b("version:unpublish")}),(0,t.jsx)(ce,{className:`${Gh}__modal`,slug:y,children:(0,t.jsxs)("div",{className:`${Gh}__modal-template`,children:[(0,t.jsx)("h1",{children:b("version:confirmUnpublish")}),(0,t.jsx)("p",{children:b("version:aboutToUnpublish")}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:p?void 0:()=>u(y),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{onClick:p?void 0:()=>P("unpublish"),children:b(p?"version:unpublishing":"general:confirm")})]})})]}),j&&"changed"===x&&(0,t.jsxs)(i().Fragment,{children:[" — ",(0,t.jsx)(Yt,{buttonStyle:"none",className:`${Gh}__action`,id:"action-revert-to-published",onClick:()=>u(w),children:b("version:revertToPublished")}),(0,t.jsx)(ce,{className:`${Gh}__modal`,slug:w,children:(0,t.jsxs)("div",{className:`${Gh}__modal-template`,children:[(0,t.jsx)("h1",{children:b("version:confirmRevertToSaved")}),(0,t.jsx)("p",{children:b("version:aboutToRevertToPublished")}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:p?void 0:()=>u(w),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{id:"action-revert-to-published-confirm",onClick:p?void 0:()=>P("revert"),children:b(p?"version:reverting":"general:confirm")})]})})]})]})}):null},Xh="doc-controls",Qh=e=>{const{id:n,slug:r,data:s,disableActions:l,hasSavePermission:c,isAccountView:u,isEditing:d,permissions:f}=e,{i18n:p}=(0,Be.B)(),m=Ut(),{getComponentMap:h}=wn(),g=m.collections.find((e=>e.slug===r)),v=m.globals.find((e=>e.slug===r)),b=h({collectionSlug:g?.slug,globalSlug:v?.slug}),{admin:{dateFormat:y},routes:{admin:w}}=m,[x,P]=i().useState(""),[j,k]=i().useState("");(0,o.useEffect)((()=>{s?.updatedAt&&P(Ki({date:s.updatedAt,i18n:p,pattern:y})),s?.createdAt&&k(Ki({date:s.createdAt,i18n:p,pattern:y}))}),[s,p,y]);const S=f&&"create"in f&&f.create?.permission,C=f&&"delete"in f&&f.delete?.permission,M=Boolean(g&&n&&!l&&(S||C)),_=!n&&g?.versions?.drafts&&g.versions?.drafts.validate;return(0,t.jsxs)(bl,{className:Xh,children:[(0,t.jsxs)("div",{className:`${Xh}__wrapper`,children:[(0,t.jsx)("div",{className:`${Xh}__content`,children:(0,t.jsxs)("ul",{className:`${Xh}__meta`,children:[g&&!d&&!u&&(0,t.jsx)("li",{className:`${Xh}__list-item`,children:(0,t.jsx)("p",{className:`${Xh}__value`,children:p.t("general:creatingNewLabel",{label:(0,a.sC)(g?.labels?.singular??p.t("general:document"),p)})})}),(g?.versions?.drafts||v?.versions?.drafts)&&(0,t.jsxs)(o.Fragment,{children:[(v||g&&d)&&(0,t.jsx)("li",{className:[`${Xh}__status`,`${Xh}__list-item`].filter(Boolean).join(" "),children:(0,t.jsx)(Kh,{})}),(g?.versions?.drafts&&g?.versions?.drafts?.autosave&&!_||v?.versions?.drafts&&v?.versions?.drafts?.autosave)&&c&&(0,t.jsx)("li",{className:`${Xh}__list-item`,children:(0,t.jsx)(_h,{collection:g,global:v,id:n,publishedDocUpdatedAt:s?.createdAt})})]}),g?.timestamps&&(d||u)&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)("li",{className:[`${Xh}__list-item`,`${Xh}__value-wrap`].filter(Boolean).join(" "),title:s?.updatedAt?x:"",children:[(0,t.jsxs)("p",{className:`${Xh}__label`,children:[p.t("general:lastModified"),": "]}),s?.updatedAt&&(0,t.jsx)("p",{className:`${Xh}__value`,children:x})]}),(0,t.jsxs)("li",{className:[`${Xh}__list-item`,`${Xh}__value-wrap`].filter(Boolean).join(" "),title:s?.createdAt?j:"",children:[(0,t.jsxs)("p",{className:`${Xh}__label`,children:[p.t("general:created"),": "]}),s?.createdAt&&(0,t.jsx)("p",{className:`${Xh}__value`,children:j})]})]})]})}),(0,t.jsxs)("div",{className:`${Xh}__controls-wrapper`,children:[(0,t.jsxs)("div",{className:`${Xh}__controls`,children:[b?.isPreviewEnabled&&(0,t.jsx)(Ih,{CustomComponent:b.PreviewButton}),c&&(0,t.jsx)(i().Fragment,{children:g?.versions?.drafts||v?.versions?.drafts?(0,t.jsxs)(i().Fragment,{children:[(g?.versions?.drafts&&!g?.versions?.drafts?.autosave||_||v?.versions?.drafts&&!v?.versions?.drafts?.autosave)&&(0,t.jsx)(Uh,{CustomComponent:b.SaveDraftButton}),(0,t.jsx)(Wh,{CustomComponent:b.PublishButton})]}):(0,t.jsx)(Vh,{CustomComponent:b.SaveButton})})]}),M&&(0,t.jsx)(Ys,{button:(0,t.jsxs)("div",{className:`${Xh}__dots`,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]}),className:`${Xh}__popup`,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:(0,t.jsxs)(Us,{children:[S&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Gs,{href:`${w}/collections/${g?.slug}/create`,id:"action-create",children:p.t("general:createNew")}),!g.disableDuplicate&&d&&(0,t.jsx)(Th,{id:n.toString(),singularLabel:g?.labels?.singular,slug:g?.slug})]}),C&&(0,t.jsx)(Nh,{buttonId:"action-delete",collectionSlug:g?.slug,id:n.toString(),singularLabel:g?.labels?.singular,useAsTitle:g?.admin?.useAsTitle})]})})]})]}),(0,t.jsx)("div",{className:`${Xh}__divider`})]})},Jh="document-fields",Zh=({AfterFields:e,BeforeFields:n,description:r,docPermissions:a,fieldMap:o,forceSidebarWrap:s,readOnly:l,schemaPath:c})=>{const u=o.filter((({isSidebar:e})=>!e)),d=o.filter((({isSidebar:e})=>e)),f=d&&d.length>0;return(0,t.jsx)(i().Fragment,{children:(0,t.jsxs)("div",{className:[Jh,f?`${Jh}--has-sidebar`:`${Jh}--no-sidebar`,s&&`${Jh}--force-sidebar-wrap`].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${Jh}__main`,children:(0,t.jsxs)(bl,{className:`${Jh}__edit`,children:[(0,t.jsx)("header",{className:`${Jh}__header`,children:r&&(0,t.jsx)("div",{className:`${Jh}__sub-header`})}),n,(0,t.jsx)(ll,{className:`${Jh}__fields`,fieldMap:u,forceRender:10,path:"",permissions:a?.fields,readOnly:l,schemaPath:c}),e]})}),f&&(0,t.jsx)("div",{className:`${Jh}__sidebar-wrap`,children:(0,t.jsx)("div",{className:`${Jh}__sidebar`,children:(0,t.jsx)("div",{className:`${Jh}__sidebar-fields`,children:(0,t.jsx)(ll,{fieldMap:d,forceRender:10,path:"",permissions:a?.fields,readOnly:l,schemaPath:c})})})})]})})};var eg=n(20344);const tg=({hasAccepted:e=!1,message:t="Are you sure want to leave this page?",onPrevent:n,prevent:r=!0})=>{((e=!0,t)=>{const n=(0,o.useCallback)((n=>{if("function"!=typeof e||e())return n.preventDefault(),t&&(n.returnValue=t),t}),[e,t]);(0,o.useEffect)((()=>{if(e)return function(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}(window,"beforeunload",n),()=>function(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}(window,"beforeunload",n)}),[e,n])})(r,t);const a=(0,eg.useRouter)(),i=(0,o.useRef)("");(0,o.useEffect)((()=>{function e(e){try{const a=function(e){for(;e&&"a"!==e.tagName.toLowerCase();)e=e.parentElement;return e}(e.target);if(a){const o=window.location.href,s=a.href,l=function(e,t){const n=new URL(e),r=new URL(t);if(n.hostname===r.hostname&&n.pathname===r.pathname&&n.search===r.search){const e=n.hash,t=r.hash;return e!==t&&n.href.replace(e,"")===r.href.replace(t,"")}return!1}(o,s),c=""!==a.download;!(s===o||l||c)&&r&&(n||!window.confirm(t))&&(i.current=s,e.preventDefault(),e.stopPropagation(),"function"==typeof n&&n())}}catch(e){alert(e)}}return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}}),[n,r,t]),(0,o.useEffect)((()=>{e&&i.current&&a.push(i.current)}),[e,a])},ng="leave-without-saving",rg="leave-without-saving",ag=({isActive:e,onCancel:n,onConfirm:r})=>{const{closeModal:a,modalState:i,openModal:s}=O(),{t:l}=(0,Be.B)();return(0,o.useEffect)((()=>{e?s(ng):a(ng)}),[e,s,a]),(0,t.jsx)(ce,{className:rg,onClose:n,slug:ng,children:(0,t.jsxs)("div",{className:`${rg}__wrapper`,children:[(0,t.jsxs)("div",{className:`${rg}__content`,children:[(0,t.jsx)("h1",{children:l("general:leaveWithoutSaving")}),(0,t.jsx)("p",{children:l("general:changesNotSaved")})]}),(0,t.jsxs)("div",{className:`${rg}__controls`,children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:n,children:l("general:stayOnThisPage")}),(0,t.jsx)(Yt,{onClick:r,children:l("general:leaveAnyway")})]})]})})},og=()=>{const e=Fo(),{user:n}=sn(),[r,a]=i().useState(!1),[s,l]=i().useState(!1),c=Boolean(e&&n),u=(0,o.useCallback)((()=>{a(!0)}),[]);return tg({hasAccepted:s,onPrevent:u,prevent:c}),(0,t.jsx)(ag,{isActive:r,onCancel:()=>{a(!1)},onConfirm:()=>{l(!0)}})},ig="generate-confirmation",sg=e=>{const{highlightField:n,setKey:r}=e,{id:a}=us(),{toggleModal:o}=O(),{t:s}=(0,Be.B)(),l=`generate-confirmation-${a}`;return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:()=>{o(l)},size:"small",children:s("authentication:generateNewAPIKey")}),(0,t.jsx)(ce,{className:ig,slug:l,children:(0,t.jsxs)("div",{className:`${ig}__template`,children:[(0,t.jsx)("h1",{children:s("authentication:confirmGeneration")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{1:({children:e})=>(0,t.jsx)("strong",{children:e})},i18nKey:"authentication:generatingNewAPIKeyWillInvalidate",t:s})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:()=>{o(l)},type:"button",children:s("general:cancel")}),(0,t.jsx)(Yt,{onClick:()=>{r(),o(l),Ct.success(s("authentication:newAPIKeyGenerated")),n(!0)},children:s("authentication:generate")})]})})]})},lg="apiKey",cg="field-type",ug=({enabled:e,readOnly:n})=>{const[r]=(0,o.useState)(Ll()),[a,s]=(0,o.useState)(!1),{t:l}=(0,Be.B)(),c=Ut(),u=Bo((([e])=>e&&e[lg]||null)),d=u?.value,f=(0,o.useMemo)((()=>(0,t.jsxs)("div",{className:"api-key__label",children:[(0,t.jsx)("span",{children:"API Key"}),(0,t.jsx)(Dp,{value:d})]})),[d]),p=hs({path:"apiKey",validate:e=>(0,jc.text)(e,{name:"apiKey",type:"text",data:{},maxLength:48,minLength:24,preferences:{fields:{}},req:{payload:{config:c},t:l},siblingData:{}})}),{setValue:m,value:h}=p;return(0,o.useEffect)((()=>{!d&&e&&m(r),e||m(null)}),[d,e,m,r]),(0,o.useEffect)((()=>{a&&setTimeout((()=>{s(!1)}),1e4)}),[a]),e?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)("div",{className:[cg,"api-key","read-only"].filter(Boolean).join(" "),children:[(0,t.jsx)(Ns,{CustomLabel:f,htmlFor:lg}),(0,t.jsx)("input",{className:a?"highlight":void 0,disabled:!0,id:"apiKey",name:"apiKey",type:"text",value:h||""})]}),!n&&(0,t.jsx)(sg,{highlightField:()=>{a&&s(!1),setTimeout((()=>{s(!0)}),1)},setKey:()=>m(Ll())})]}):null},dg="auth-fields",fg=e=>{const{className:n,collectionSlug:r,disableLocalStrategy:a,email:s,loginWithUsername:l,operation:c,readOnly:u,requirePassword:d,useAPIKey:f,verify:p}=e,[m,h]=(0,o.useState)(d),g=Bo((([e])=>e&&e?.enableAPIKey||null)),v=Bo((e=>e[1])),b=Fo(),{i18n:y,t:w}=(0,Be.B)(),{isInitializing:x}=us(),{routes:{api:P},serverURL:j}=Ut(),k=(0,o.useCallback)((e=>{e||(v({type:"REMOVE",path:"password"}),v({type:"REMOVE",path:"confirm-password"})),h(e)}),[v]),S=(0,o.useCallback)((async()=>{const e=`${j}${P}/${r}/unlock`;200===(await fetch(e,{body:JSON.stringify({email:s}),credentials:"include",headers:{"Accept-Language":y.language,"Content-Type":"application/json"},method:"post"})).status?Ct.success(w("authentication:successfullyUnlocked")):Ct.error(w("authentication:failedToUnlock"))}),[y,j,P,r,s,w]);if((0,o.useEffect)((()=>{b||h(!1)}),[b]),a&&!f)return null;const C=u||x;return(0,t.jsxs)("div",{className:[dg,n].filter(Boolean).join(" "),children:[!a&&(0,t.jsxs)(i().Fragment,{children:[!l&&(0,t.jsx)(fc,{autoComplete:"email",disabled:C,label:w("general:email"),name:"email",readOnly:u,required:!0}),l&&(0,t.jsx)(bp,{disabled:C,label:w("authentication:username"),name:"username",readOnly:u,required:!0}),(m||d)&&(0,t.jsxs)("div",{className:`${dg}__changing-password`,children:[(0,t.jsx)(Ef,{autoComplete:"off",disabled:C,label:w("authentication:newPassword"),name:"password",required:!0}),(0,t.jsx)(sc,{disabled:u})]}),(0,t.jsxs)("div",{className:`${dg}__controls`,children:[m&&!d&&(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:C,onClick:()=>k(!1),size:"small",children:w("general:cancel")}),!m&&!d&&(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:C,id:"change-password",onClick:()=>k(!0),size:"small",children:w("authentication:changePassword")}),"update"===c&&(0,t.jsx)(Yt,{buttonStyle:"secondary",disabled:C,onClick:()=>S(),size:"small",children:w("authentication:forceUnlock")})]})]}),f&&(0,t.jsxs)("div",{className:`${dg}__api-key`,children:[(0,t.jsx)(Is,{disabled:C,label:w("authentication:enableAPIKey"),name:"enableAPIKey",readOnly:u}),(0,t.jsx)(ug,{enabled:!!g?.value,readOnly:u})]}),p&&(0,t.jsx)(Is,{disabled:C,label:w("authentication:verified"),name:"_verified",readOnly:u})]})},pg=(0,o.createContext)({}),mg=({children:e,visibleEntities:n})=>{const r=(0,o.useCallback)((({collectionSlug:e,globalSlug:t})=>e?n.collections.includes(e):!!t&&n.globals.includes(t)),[n]);return(0,t.jsx)(pg.Provider,{value:{isEntityVisible:r,visibleEntities:n},children:e})},hg=()=>(0,o.useContext)(pg),gg=e=>{const{id:t,collectionSlug:n,globalSlug:r,pluralLabel:i,useAsTitle:s}=e,l=e?.view||void 0,{isEditing:c,isInitializing:u,title:d}=us(),{isEntityVisible:f}=hg(),p=f({collectionSlug:n,globalSlug:r}),{setStepNav:m}=hn(),{i18n:h,t:g}=(0,Be.B)(),{routes:{admin:v}}=Ut(),b=ws();return(0,o.useEffect)((()=>{const e=[];u||(n?(e.push({label:(0,a.sC)(i,h),url:p?`${v}/collections/${n}`:void 0}),c?e.push({label:s&&"id"!==s&&d||`${t}`,url:p?`${v}/collections/${n}/${t}`:void 0}):e.push({label:g("general:createNew")})):r&&e.push({label:d,url:p?`${v}/globals/${r}`:void 0}),l&&e.push({label:l}),b<=1&&m(e))}),[m,u,c,i,t,s,v,g,h,d,n,r,l,b,p]),null},vg=e=>{const{collectionConfig:t,config:n,fallback:r,globalConfig:a}=e,i=t?.admin?.useAsTitle,s=Bo((([e])=>i&&e&&e?.[i]||null)),l=(0,o.useRef)(!1),{i18n:c}=(0,Be.B)(),{setDocumentTitle:u}=us(),d=n?.admin?.dateFormat,f=Qi({collectionConfig:t,data:{id:""},dateFormat:d,fallback:"string"==typeof s?s:"number"==typeof s?String(s):s?.value||r,globalConfig:a,i18n:c});return(0,o.useEffect)((()=>{l.current?u(f):l.current=!0}),[u,f]),null},bg="collection-edit",yg=()=>{const{id:e,AfterDocument:n,AfterFields:r,BeforeDocument:a,BeforeFields:s,action:l,apiURL:c,collectionSlug:u,disableActions:d,disableLeaveWithoutSaving:f,docPermissions:p,getDocPreferences:m,getVersions:h,globalSlug:g,hasPublishPermission:v,hasSavePermission:b,initialData:y,initialState:w,isEditing:x,isInitializing:P,onSave:j}=us(),{refreshCookieAsync:k,user:S}=sn(),C=Ut(),M=(0,eg.useRouter)(),{dispatchFormQueryParams:_}=Ff(),{getComponentMap:O,getFieldMap:E}=wn(),D=(0,eg.useSearchParams)(),N=ws(),{reportUpdate:A}=On(),{admin:{user:T},collections:R,globals:I,routes:{admin:L,api:$},serverURL:W}=C,F=D.get("locale"),z=u&&R.find((e=>e.slug===u)),B=g&&I.find((e=>e.slug===g)),H=z?.slug||B?.slug,Y=O({collectionSlug:z?.slug,globalSlug:B?.slug}),V=E({collectionSlug:z?.slug,globalSlug:B?.slug}),q=u&&!e?"create":"update",U=z?z.auth:void 0,G=z?z.upload:void 0,K=!(z?.versions?.drafts&&z?.versions?.drafts?.autosave&&B?.versions?.drafts&&B?.versions?.drafts?.autosave||f),X=[bg,e&&`${bg}--is-editing`].filter(Boolean).join(" "),Q=(0,o.useCallback)((t=>{if(A({id:e,entitySlug:H,updatedAt:t?.result?.updatedAt||(new Date).toISOString()}),S&&u===T&&e===S.id&&k(),h(),"function"==typeof j&&j({...t,operation:e?"update":"create"}),!x&&N<2){const e=`${L}/collections/${u}/${t?.doc?.id}${F?`?locale=${F}`:""}`;M.push(e)}else _({type:"SET",params:{uploadEdits:null}})}),[j,T,A,e,H,S,N,u,h,x,k,L,F,M,_]),J=(0,o.useCallback)((async({formState:t})=>{const n=await m();return Ji({apiRoute:$,body:{id:e,collectionSlug:u,docPreferences:n,formState:t,globalSlug:g,operation:q,schemaPath:H},serverURL:W})}),[W,$,e,q,H,u,g,m]);return(0,t.jsx)("main",{className:X,children:(0,t.jsx)(ps,{operation:q,children:(0,t.jsxs)(Ch,{action:l,className:`${bg}__form`,disableValidationOnSubmit:!0,disabled:P||!b,initialState:!P&&w,isInitializing:P,method:e?"PATCH":"POST",onChange:[J],onSuccess:Q,children:[a,K&&(0,t.jsx)(og,{}),(0,t.jsx)(gg,{collectionSlug:z?.slug,globalSlug:B?.slug,id:e,pluralLabel:z?.labels?.plural,useAsTitle:z?.admin?.useAsTitle}),(0,t.jsx)(vg,{collectionConfig:z,config:C,fallback:N<=1?e?.toString():void 0,globalConfig:B}),(0,t.jsx)(Qh,{apiURL:c,data:y,disableActions:d,hasPublishPermission:v,hasSavePermission:b,id:e,isEditing:x,permissions:p,slug:z?.slug||B?.slug}),(0,t.jsx)(Zh,{AfterFields:r,BeforeFields:s||(0,t.jsxs)(o.Fragment,{children:[U&&(0,t.jsx)(fg,{className:`${bg}__auth`,collectionSlug:z.slug,disableLocalStrategy:z.auth?.disableLocalStrategy,email:y?.email,loginWithUsername:U?.loginWithUsername,operation:q,readOnly:!b,requirePassword:!e,useAPIKey:U.useAPIKey,verify:U.verify}),G&&(0,t.jsx)(i().Fragment,{children:void 0!==Y.Upload?Y.Upload:(0,t.jsx)(qp,{collectionSlug:z.slug,initialState:w,uploadConfig:G})})]}),docPermissions:p,fieldMap:V,readOnly:!b,schemaPath:H}),n]})})})},{WindowInfoProvider:wg}=e||{WindowInfoProvider:void 0},{useWindowInfo:xg}=e||{useWindowInfo:void 0},Pg=({actions:e})=>{const{setViewActions:t}=Pn();return(0,o.useEffect)((()=>(t(e),()=>{t([])})),[t,e]),null},jg="list-selection",kg=({label:e})=>{const{count:n,selectAll:r,toggleAll:a,totalDocs:i}=om(),{t:s}=(0,Be.B)();return 0===n?null:(0,t.jsxs)("div",{className:jg,children:[(0,t.jsx)("span",{children:s("general:selectedCount",{count:n,label:e})}),r!==nm.AllAvailable&&(0,t.jsxs)(o.Fragment,{children:[" ","—",(0,t.jsx)("button",{"aria-label":s("general:selectAll",{count:n,label:e}),className:`${jg}__button`,onClick:()=>a(!0),type:"button",children:s("general:selectAll",{count:i,label:e})})]})]})},Sg="column-selector",Cg=({collectionSlug:e})=>{const{columns:n,moveColumn:r,toggleColumn:a}=Dm(),i=(0,o.useId)(),s=ws();if(!n)return null;const l=(e=>e.filter((e=>!e.admin?.disableListColumn)))(n);return(0,t.jsx)(vo,{className:Sg,ids:l.map((e=>e?.accessor)),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>{r({fromIndex:e,toIndex:t})},children:l.map(((n,r)=>{if(!n)return null;const{Label:o,accessor:l,active:c}=n;return"_select"===n.accessor?null:(0,t.jsx)(Ml,{alignIcon:"left","aria-checked":c,className:[`${Sg}__column`,c&&`${Sg}__column--active`].filter(Boolean).join(" "),draggable:!0,icon:c?(0,t.jsx)($t.u,{}):(0,t.jsx)(Lt,{}),id:l,onClick:()=>{a(l)},children:o},`${e}-${n.name||r}${s?`-${s}-`:""}${i}`)}))})},Mg="delete-documents",_g=e=>{const{collection:{slug:n,labels:{plural:r}}={}}=e,{permissions:s}=sn(),{routes:{api:l},serverURL:c}=Ut(),{toggleModal:u}=O(),{count:d,getQueryParams:f,selectAll:p,toggleAll:m}=om(),{i18n:h,t:g}=(0,Be.B)(),[v,b]=(0,o.useState)(!1),y=(0,ht.useRouter)(),{stringifyParams:w}=nn(),{clearRouteCache:x}=(0,Km.P)(),P=s?.collections?.[n],j=P?.delete?.permission,k=`delete-${n}`,S=(0,o.useCallback)((()=>{Ct.error(g("error:unknown"))}),[g]),C=(0,o.useCallback)((async()=>{b(!0),await mt.delete(`${c}${l}/${n}${f()}`,{headers:{"Accept-Language":h.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return u(k),e.status<400?(Ct.success(t.message||g("general:deletedSuccessfully")),m(),y.replace(w({params:{page:p?"1":void 0},replace:!0})),x(),null):(t.errors?Ct.error(t.message):S(),!1)}catch(e){return S()}}))}),[S,l,f,h.language,k,y,p,c,n,w,g,m,u,x]);return p!==nm.None&&j?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{className:`${Mg}__toggle`,onClick:()=>{b(!1),u(k)},children:g("general:delete")}),(0,t.jsx)(ce,{className:Mg,slug:k,children:(0,t.jsxs)("div",{className:`${Mg}__template`,children:[(0,t.jsx)("h1",{children:g("general:confirmDeletion")}),(0,t.jsx)("p",{children:g("general:aboutToDeleteCount",{count:d,label:(0,a.sC)(r,h)})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:v?void 0:()=>u(k),type:"button",children:g("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-delete",onClick:v?void 0:C,children:g(v?"general:deleting":"general:confirm")})]})})]}):null},Og=(e,t)=>e&&t.isFieldAffectingData?`${e}.${t.name}`:(t.isFieldAffectingData,t.name),Eg=({customLabel:e,field:n,prefix:r})=>{const a=n&&"CustomLabel"in n.fieldComponentProps&&void 0!==n.fieldComponentProps.CustomLabel?n.fieldComponentProps.CustomLabel:null,i=n&&"label"in n.fieldComponentProps&&n.fieldComponentProps.label?(0,t.jsx)(Ns,{label:n.fieldComponentProps.label,...n.fieldComponentProps.labelProps||{}}):null,s=a||i||e;return s?(0,t.jsxs)(o.Fragment,{children:[r&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("span",{style:{display:"inline-block"},children:r})," > "]}),(0,t.jsx)("span",{style:{display:"inline-block"},children:s})]}):null},Dg=({fieldMap:e,labelPrefix:t=null,path:n=""})=>e?e?.reduce(((e,r)=>{const{isFieldAffectingData:a}=r;if(a&&(r.disableBulkEdit||r.unique||r.isHidden||"readOnly"in r.fieldComponentProps&&r.fieldComponentProps.readOnly))return e;if("array"!==r.type&&"blocks"!==r.type&&"fieldMap"in r.fieldComponentProps)return[...e,...Dg({fieldMap:r.fieldComponentProps.fieldMap,labelPrefix:Eg({field:r,prefix:t}),path:Og(n,r)})];if("tabs"===r.type&&"tabs"in r.fieldComponentProps)return[...e,...r.fieldComponentProps.tabs.reduce(((e,a)=>{if("fieldMap"in a){const o="name"in a&&a.name;return[...e,...Dg({fieldMap:a.fieldMap,labelPrefix:t,path:o?Og(n,r):n})]}}),[])];const o={label:Eg({field:r,prefix:t}),value:{...r,path:Og(n,r)}};return[...e,o]}),[]):[],Ng=({fieldMap:e,setSelected:n})=>{const{t:r}=(0,Be.B)(),[a]=(0,o.useState)((()=>Dg({fieldMap:e}))),{dispatchFields:i,getFields:s}=Lo();return(0,t.jsxs)("div",{className:"field-select",children:[(0,t.jsx)(Ns,{label:r("fields:selectFieldsToEdit")}),(0,t.jsx)(_f,{getOptionValue:e=>"object"==typeof e.value&&"path"in e.value?String(e.value.path):String(e.value),isMulti:!0,onChange:e=>{const t=s();n(null===e?[]:e.map((({value:e})=>e))),(null===e||Object.keys(t||[]).length>e.length)&&Object.keys(t).forEach((t=>{null!==e&&e.find((e=>e.value.path===t))||i({type:"REMOVE",path:t})}))},options:a})]})},Ag="edit-many",Tg=({action:e,disabled:n})=>{const{submit:r}=Lo(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((()=>{r({action:e,method:"PATCH",skipValidation:!0})}),[e,r]);return(0,t.jsx)(Lh,{className:`${Ag}__save`,disabled:n,onClick:i,children:a("general:save")})},Rg=({action:e,disabled:n})=>{const{submit:r}=Lo(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((()=>{r({action:e,method:"PATCH",overrides:{_status:"published"},skipValidation:!0})}),[e,r]);return(0,t.jsx)(Lh,{className:`${Ag}__publish`,disabled:n,onClick:i,children:a("version:publishChanges")})},Ig=({action:e,disabled:n})=>{const{submit:r}=Lo(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((()=>{r({action:e,method:"PATCH",overrides:{_status:"draft"},skipValidation:!0})}),[e,r]);return(0,t.jsx)(Lh,{className:`${Ag}__draft`,disabled:n,onClick:i,children:a("version:saveDraft")})},Lg=e=>{const{collection:{slug:n,labels:{plural:r}}={},collection:s,fieldMap:l}=e,{permissions:c}=sn(),{closeModal:u}=O(),{routes:{api:d},serverURL:f}=Ut(),{count:p,getQueryParams:m,selectAll:h}=om(),{i18n:g,t:v}=(0,Be.B)(),[b,y]=(0,o.useState)([]),{stringifyParams:w}=nn(),x=(0,ht.useRouter)(),[P,j]=(0,o.useState)(),k=i().useRef(!1),{clearRouteCache:S}=(0,Km.P)(),C=c?.collections?.[n],M=C?.update?.permission,_=`edit-${n}`;i().useEffect((()=>{if(!k.current){(async()=>{const e=await Ji({apiRoute:d,body:{collectionSlug:n,data:{},operation:"update",schemaPath:n},serverURL:f});j(e),k.current=!0})()}}),[d,k,f,n]);const E=(0,o.useCallback)((({formState:e})=>Ji({apiRoute:d,body:{collectionSlug:n,formState:e,operation:"update",schemaPath:n},serverURL:f})),[f,d,n]);if(h===nm.None||!M)return null;return(0,t.jsxs)("div",{className:Ag,children:[(0,t.jsx)(wl,{"aria-label":v("general:edit"),className:`${Ag}__toggle`,onClick:()=>{y([])},slug:_,children:v("general:edit")}),(0,t.jsx)(xl,{Header:null,slug:_,children:(0,t.jsx)(ds,{collectionSlug:n,id:null,children:(0,t.jsx)(fs.Provider,{value:"update",children:(0,t.jsxs)("div",{className:`${Ag}__main`,children:[(0,t.jsxs)("div",{className:`${Ag}__header`,children:[(0,t.jsx)("h2",{className:`${Ag}__header__title`,children:v("general:editingLabel",{count:p,label:(0,a.sC)(r,g)})}),(0,t.jsx)("button",{"aria-label":v("general:close"),className:`${Ag}__header__close`,id:`close-drawer__${_}`,onClick:()=>u(_),type:"button",children:(0,t.jsx)($t.u,{})})]}),(0,t.jsxs)(Ch,{className:`${Ag}__form`,initialState:P,onChange:[E],onSuccess:()=>{x.replace(w({params:{page:h===nm.AllAvailable?"1":void 0}})),S(),u(_)},children:[(0,t.jsx)(Ng,{fieldMap:l,setSelected:y}),0===b.length?null:(0,t.jsx)(ll,{fieldMap:b,path:"",readOnly:!1,schemaPath:n}),(0,t.jsx)("div",{className:`${Ag}__sidebar-wrap`,children:(0,t.jsx)("div",{className:`${Ag}__sidebar`,children:(0,t.jsx)("div",{className:`${Ag}__sidebar-sticky-wrap`,children:(0,t.jsx)("div",{className:`${Ag}__document-actions`,children:s?.versions?.drafts?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Rg,{action:`${f}${d}/${n}${m()}&draft=true`,disabled:0===b.length}),(0,t.jsx)(Ig,{action:`${f}${d}/${n}${m()}&draft=true`,disabled:0===b.length})]}):(0,t.jsx)(Tg,{action:`${f}${d}/${n}${m()}`,disabled:0===b.length})})})})})]})]})})})})]})},$g="publish-many",Wg=e=>{const{clearRouteCache:n}=(0,Km.P)(),{collection:{slug:r,labels:{plural:s},versions:l}={}}=e,{routes:{api:c},serverURL:u}=Ut(),{permissions:d}=sn(),{toggleModal:f}=O(),{i18n:p,t:m}=(0,Be.B)(),{getQueryParams:h,selectAll:g}=om(),[v,b]=(0,o.useState)(!1),y=(0,ht.useRouter)(),{stringifyParams:w}=nn(),x=d?.collections?.[r],P=x?.update?.permission,j=`publish-${r}`,k=(0,o.useCallback)((()=>{Ct.error(m("error:unknown"))}),[m]),S=(0,o.useCallback)((async()=>{b(!0),await mt.patch(`${u}${c}/${r}${h({_status:{not_equals:"published"}})}&draft=true`,{body:JSON.stringify({_status:"published"}),headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return f(j),e.status<400?(Ct.success(m("general:updatedSuccessfully")),y.replace(w({params:{page:g?"1":void 0}})),n(),null):(t.errors?t.errors.forEach((e=>Ct.error(e.message))):k(),!1)}catch(e){return k()}}))}),[k,c,h,p.language,j,g,u,r,m,f,y,w,n]);return l?.drafts&&g!==nm.None&&P?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{className:`${$g}__toggle`,onClick:()=>{b(!1),f(j)},children:m("version:publish")}),(0,t.jsx)(ce,{className:$g,slug:j,children:(0,t.jsxs)("div",{className:`${$g}__template`,children:[(0,t.jsx)("h1",{children:m("version:confirmPublish")}),(0,t.jsx)("p",{children:m("version:aboutToPublishSelection",{label:(0,a.sC)(s,p)})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:v?void 0:()=>f(j),type:"button",children:m("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-publish",onClick:v?void 0:S,children:m(v?"version:publishing":"general:confirm")})]})})]}):null},Fg="search-filter",zg=e=>{const{fieldLabel:n="ID",fieldName:r="id",handleChange:i,listSearchableFields:s}=e,{searchParams:l}=nn(),c=(0,ht.useRouter)(),u=(0,ht.usePathname)(),{i18n:d,t:f}=(0,Be.B)(),[p,m]=(0,o.useState)("string"==typeof l?.search?l?.search:""),[h,g]=(0,o.useState)(""),v=(0,o.useRef)(f("general:searchBy",{label:(0,a.sC)(n,d)})),b=Qt(p,300);return(0,o.useEffect)((()=>{b!==h&&(i&&i(b),g(b))}),[b,h,c,r,l,i,s,u]),(0,o.useEffect)((()=>{v.current=s?.length>0?s.reduce(((e,t,n)=>{const r="fieldComponentProps"in t&&"label"in t.fieldComponentProps&&t.fieldComponentProps.label?t.fieldComponentProps.label:t.name;return 0===n?`${f("general:searchBy",{label:(0,a.sC)(r,d)})}`:n===s.length-1?`${e} ${f("general:or")} ${(0,a.sC)(r,d)}`:`${e}, ${(0,a.sC)(r,d)}`}),""):f("general:searchBy",{label:(0,a.sC)(n,d)})}),[f,s,d,n]),(0,t.jsxs)("div",{className:Fg,children:[(0,t.jsx)("input",{className:`${Fg}__input`,onChange:e=>m(e.target.value),placeholder:v.current,type:"text",value:p||""}),(0,t.jsx)(Wl,{})]})},Bg="unpublish-many",Hg=e=>{const{collection:{slug:n,labels:{plural:r},versions:s}={}}=e,{routes:{api:l},serverURL:c}=Ut(),{permissions:u}=sn(),{toggleModal:d}=O(),{i18n:f,t:p}=(0,Be.B)(),{getQueryParams:m,selectAll:h}=om(),[g,v]=(0,o.useState)(!1),{stringifyParams:b}=nn(),y=(0,ht.useRouter)(),{clearRouteCache:w}=(0,Km.P)(),x=u?.collections?.[n],P=x?.update?.permission,j=`unpublish-${n}`,k=(0,o.useCallback)((()=>{Ct.error(p("error:unknown"))}),[p]),S=(0,o.useCallback)((async()=>{v(!0),await mt.patch(`${c}${l}/${n}${m({_status:{not_equals:"draft"}})}`,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":f.language,"Content-Type":"application/json"}}).then((async e=>{try{const t=await e.json();return d(j),e.status<400?(Ct.success(p("general:updatedSuccessfully")),y.replace(b({params:{page:h?"1":void 0}})),w(),null):(t.errors?t.errors.forEach((e=>Ct.error(e.message))):k(),!1)}catch(e){return k()}}))}),[k,l,m,f.language,j,h,c,n,p,d,y,w,b]);return s?.drafts&&h!==nm.None&&P?(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{className:`${Bg}__toggle`,onClick:()=>{v(!1),d(j)},children:p("version:unpublish")}),(0,t.jsx)(ce,{className:Bg,slug:j,children:(0,t.jsxs)("div",{className:`${Bg}__template`,children:[(0,t.jsx)("h1",{children:p("version:confirmUnpublish")}),(0,t.jsx)("p",{children:p("version:aboutToUnpublishSelection",{label:(0,a.sC)(r,f)})}),(0,t.jsx)(Yt,{buttonStyle:"secondary",id:"confirm-cancel",onClick:g?void 0:()=>d(j),type:"button",children:p("general:cancel")}),(0,t.jsx)(Yt,{id:"confirm-unpublish",onClick:g?void 0:S,children:p(g?"version:unpublishing":"general:confirm")})]})})]}):null},Yg=e=>{const{CustomComponent:n,DefaultComponent:r,componentProps:a={}}=e;return n?(0,t.jsx)(n,{...a}):r?(0,t.jsx)(r,{...a}):null},Vg=e=>e.reduce(((e,t)=>t.options?[...e,...Vg(t.options)]:[...e,t.id]),[]),qg=(e,t)=>{switch(t.type){case"CLEAR":return t.required?[]:[{label:t.i18n.t("general:none"),value:"null"}];case"ADD":{const{collection:n,data:r,hasMultipleRelations:o,i18n:i,relation:s}=t,l=n.admin.useAsTitle||"id",c=Vg(e);if(!o)return[...e,...r.docs.reduce(((e,t)=>-1===c.indexOf(t.id)?(c.push(t.id),[...e,{label:t[l],value:t.id}]):e),[])];const u=[...e],d=u.find((e=>e.label===(0,a.sC)(n.labels.plural,i))),f=r.docs.reduce(((e,t)=>-1===c.indexOf(t.id)?(c.push(t.id),[...e,{label:t[l],relationTo:s,value:t.id}]):e),[]);return d?d.options=[...d.options,...f]:u.push({label:(0,a.sC)(n.labels.plural,i),options:f,value:void 0}),u}default:return e}},Ug="condition-value-relationship",Gg=e=>e.map((e=>"object"!=typeof e||!e.value&&""!==e.value?{label:e,value:e}:e)),Kg=({disabled:e,onChange:n,operator:r,options:o,value:s})=>{const{i18n:l}=(0,Be.B)(),[c,u]=i().useState(Gg(o)),d=["in","not_in"].includes(r);let f;if(d&&Array.isArray(s))f=s.map((e=>{const t=c.find((t=>t.value===e));return{label:t?(0,a.sC)(t.label,l):e,value:t?.value??e}}));else if(s){const e=c.find((e=>e.value===s));f={label:e?(0,a.sC)(e.label,l):s,value:e?.value??s}}const p=i().useCallback((e=>{let t;t=e?d?Array.isArray(e)?e.map((e=>e.value)):[]:e.value:null,n(t)}),[d,n]);return i().useEffect((()=>{u(Gg(o))}),[o]),i().useEffect((()=>{!d&&Array.isArray(s)&&n(s[0])}),[d,n,s]),(0,t.jsx)(_f,{disabled:e,isMulti:d,onChange:p,options:c.map((e=>({...e,label:(0,a.sC)(e.label,l)}))),value:f})},Xg={Date:({admin:e,disabled:n,onChange:r,value:a})=>{const{date:o}=e||{};return(0,t.jsx)("div",{className:"condition-value-date",children:(0,t.jsx)(cc,{...o,onChange:r,readOnly:n,value:a})})},Number:({disabled:e,onChange:n,value:r})=>{const{t:a}=(0,Be.B)();return(0,t.jsx)("input",{className:"condition-value-number",disabled:e,onChange:e=>n(e.target.value),placeholder:a("general:enterAValue"),type:"number",value:r})},Relationship:e=>{const{admin:{isSortable:n}={},disabled:r,hasMany:a,onChange:s,relationTo:l,value:c}=e,{collections:u,routes:{api:d},serverURL:f}=Ut(),p=Array.isArray(l),[m,h]=(0,o.useReducer)(qg,[]),[g,v]=(0,o.useState)(""),[b,y]=(0,o.useState)(""),[w,x]=(0,o.useState)(!1),P=Qt(g,300),{i18n:j,t:k}=(0,Be.B)(),S=p?l:[l],C=i().useRef((()=>{const e=new Map;return S.forEach((t=>{e.set(t,1)})),e})()),M=i().useRef(S),_=(0,o.useCallback)(((e,t)=>{const n=u.find((e=>e.slug===t));h({type:"ADD",collection:n,data:e,hasMultipleRelations:p,i18n:j,relation:t})}),[u,p,j]),O=i().useCallback((async({abortController:e,relationSlug:t})=>{const n=u.find((e=>e.slug===t)),r=n?.admin?.useAsTitle||"id",a=C.current.get(t);if(M.current.includes(t)){const n={depth:0,limit:10,page:a,where:{and:[]}};P&&n.where.and.push({[r]:{like:P}});try{const r=await fetch(`${f}${d}/${t}${ge().stringify(n,{addQueryPrefix:!0})}`,{credentials:"include",headers:{"Accept-Language":j.language},signal:e.signal});if(r.ok){const e=await r.json();e.docs.length>0&&(_(e,t),P||(e.nextPage?C.current.set(t,e.nextPage):M.current=M.current.filter((e=>e!==t))))}else y(k("error:unspecific"))}catch(t){e.signal.aborted||console.error(t)}}x(!0)}),[_,d,u,P,j.language,f,k]),E=i().useCallback((()=>{if(M.current.length>0){const e=new AbortController;O({abortController:e,relationSlug:M.current[0]})}}),[O]),D=(0,o.useCallback)((()=>{if(c){if(a)return Array.isArray(c)?c.map((e=>{if(p){let t;return m.forEach((n=>{n.options&&n.options.some((n=>n?.value===e.value&&(t=n,!0)))})),t}return m.find((t=>t.value===e))})):void 0;if(p){let e;const t=c;return m.forEach((n=>{n?.options&&n.options.some((n=>n?.value===t.value&&(e=n,!0)))})),e}return m.find((e=>e.value===c))}}),[a,p,c,m]),N=(0,o.useCallback)((e=>{g!==e&&v(e)}),[g]),A=(0,o.useCallback)((async(e,t)=>{if(!b&&"null"!==e&&e&&t){const n=await fetch(`${f}${d}/${t}/${e}?depth=0`,{credentials:"include",headers:{"Accept-Language":j.language}});if(n.ok){const e=await n.json();_({docs:[e]},t)}else console.error(k("error:loadingDocument",{id:e}))}}),[j,_,d,b,f,k]);(0,o.useEffect)((()=>{const e=Array.isArray(l)?l:[l],t=[];return e.forEach((e=>{const n=new AbortController;O({abortController:n,relationSlug:e}),t.push(n)})),()=>{t.forEach((e=>{e.signal&&e.abort()}))}}),[j,O,l]),(0,o.useEffect)((()=>{if(c&&w)if(a){(D()||[]).forEach(((e,t)=>{e||(p?A(c[t].value,c[t].relationTo):A(c[t],l))}))}else{if(!D())if(p){const e=c;A(e.value,e.relationTo)}else A(c,l)}}),[A,D,a,p,l,c,w]);const T=["field-type",Ug,b&&"error-loading"].filter(Boolean).join(" "),R=D()||c;return(0,t.jsxs)("div",{className:T,children:[!b&&(0,t.jsx)(_f,{disabled:r,isMulti:a,isSortable:n,onChange:e=>{e?a&&Array.isArray(e)?s(e?e.map((e=>p?{relationTo:e?.relationTo,value:e?.value}:e?.value)):null):p&&!Array.isArray(e)?s({relationTo:e?.relationTo,value:e?.value}):Array.isArray(e)||s(e?.value):s(null)},onInputChange:N,onMenuScrollToBottom:E,options:m,placeholder:k("general:selectValue"),value:R}),b&&(0,t.jsx)("div",{className:`${Ug}__error-loading`,children:b})]})},Select:Kg,Text:({disabled:e,onChange:n,value:r})=>{const{t:a}=(0,Be.B)();return(0,t.jsx)("input",{className:"condition-value-text",disabled:e,onChange:e=>n(e.target.value),placeholder:a("general:enterAValue"),type:"text",value:r||""})}},Qg="condition",Jg=e=>{const{addCondition:n,andIndex:r,fieldName:a,fields:i,initialValue:s,operator:l,orIndex:c,removeCondition:u,updateCondition:d}=e,[f,p]=(0,o.useState)((()=>i.find((e=>a===e.value)))),[m,h]=(0,o.useState)(l),[g,v]=(0,o.useState)(s),b=Qt(g,300);(0,o.useEffect)((()=>{!f?.value&&"number"!=typeof f?.value||!m||[null,void 0].includes(b)||d({andIndex:r,fieldName:f.value,operator:m,orIndex:c,value:b})}),[b,r,f?.value,m,c,d,l]);const y=["exists"].includes(m)||"checkbox"===f?.props?.type,w=y?Kg:Xg[f?.component]||Xg.Text;let x;return y?x=["true","false"]:f?.props&&"options"in f.props&&(x=f.props.options),(0,t.jsx)("div",{className:Qg,children:(0,t.jsxs)("div",{className:`${Qg}__wrap`,children:[(0,t.jsxs)("div",{className:`${Qg}__inputs`,children:[(0,t.jsx)("div",{className:`${Qg}__field`,children:(0,t.jsx)(_f,{isClearable:!1,onChange:e=>{p(i.find((t=>t.value===e.value))),h(void 0),v(void 0)},options:i,value:i.find((e=>f?.value===e.value))||i[0]})}),(0,t.jsx)("div",{className:`${Qg}__operator`,children:(0,t.jsx)(_f,{disabled:!f?.value&&"number"!=typeof f?.value,isClearable:!1,onChange:e=>{h(e.value)},options:f?.operators,value:f?.operators.find((e=>m===e.value))||null})}),(0,t.jsx)("div",{className:`${Qg}__value`,children:(0,t.jsx)(Yg,{CustomComponent:f?.props?.admin?.components?.Filter,DefaultComponent:w,componentProps:{...f?.props,disabled:!m,onChange:v,operator:m,options:x,relationTo:"relationship"===f?.props?.type&&"cellComponentProps"in f.props&&"object"==typeof f.props.cellComponentProps&&"relationTo"in f.props.cellComponentProps?f.props.cellComponentProps?.relationTo:void 0,value:g??""}})})]}),(0,t.jsxs)("div",{className:`${Qg}__actions`,children:[(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${Qg}__actions-remove`,icon:"x",iconStyle:"with-border",onClick:()=>u({andIndex:r,orIndex:c}),round:!0}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${Qg}__actions-add`,icon:"plus",iconStyle:"with-border",onClick:()=>n({andIndex:r+1,fieldName:i[0].value,orIndex:c,relation:"and"}),round:!0})]})]})})},Zg=[{label:"equals",value:"equals"},{label:"isNotEqualTo",value:"not_equals"}],ev=[...Zg,{label:"isIn",value:"in"},{label:"isNotIn",value:"not_in"},{label:"exists",value:"exists"}],tv=[...ev,{label:"isGreaterThan",value:"greater_than"},{label:"isLessThan",value:"less_than"},{label:"isLessThanOrEqualTo",value:"less_than_equal"},{label:"isGreaterThanOrEqualTo",value:"greater_than_equal"}],nv=[...Zg,{label:"exists",value:"exists"},{label:"near",value:"near"}],rv={label:"within",value:"within"},av={label:"intersects",value:"intersects"},ov={label:"isLike",value:"like"},iv={label:"contains",value:"contains"},sv={checkbox:{component:"Text",operators:Zg},code:{component:"Text",operators:[...ev,ov,iv]},date:{component:"Date",operators:[...ev,...tv]},email:{component:"Text",operators:[...ev,iv]},json:{component:"Text",operators:[...ev,ov,iv,rv,av]},number:{component:"Number",operators:[...ev,...tv]},point:{component:"Point",operators:[...nv,rv,av]},radio:{component:"Select",operators:[...ev]},relationship:{component:"Relationship",operators:[...ev]},richText:{component:"Text",operators:[...ev,ov,iv]},select:{component:"Select",operators:[...ev]},text:{component:"Text",operators:[...ev,ov,iv]},textarea:{component:"Text",operators:[...ev,ov,iv]},upload:{component:"Text",operators:[...ev]}},lv=(e,t,n,r,a)=>e.reduce(((e,o)=>{if(o.disableListFilter)return e;if("tabs"===o.type&&"tabs"in o.fieldComponentProps){return o.fieldComponentProps.tabs.forEach((n=>{n.name&&"string"==typeof n.label&&n.fieldMap&&e.push(...lv(n.fieldMap,t,n.label,n.name))})),e}if("group"===o.type&&"fieldMap"in o.fieldComponentProps)return e.push(...lv(o.fieldComponentProps.fieldMap,t,o.fieldComponentProps.label,o.name)),e;if("object"==typeof sv[o.type]){const i=new Set,s=sv[o.type].operators.reduce(((e,n)=>(i.has(n.value)||(i.add(n.value),e.push({...n,label:t.t(`operators:${n.label}`)})),e)),[]),l=a&&"object"==typeof o.fieldComponentProps.label?o.fieldComponentProps.label[a]:o.fieldComponentProps.label,c={label:n?Eg({field:o,prefix:n}):l,value:r?Og(r,o):o.name,...sv[o.type],operators:s,props:{...o,...o?.cellComponentProps||{}}};return e.push(c),e}return e}),[]),cv=e=>{if(e?.or?.length>0&&e?.or?.[0]?.and&&e?.or?.[0]?.and?.length>0){const t=e.or.every((e=>!(!e.and||!Array.isArray(e.and))&&e.and.every((e=>{if("object"!=typeof e)return!1;const t=Object.keys(e);if(0===t.length)return!1;for(const n of t){const t=Object.keys(e[n])[0];if(!t||!jc.validOperators.includes(t))return!1}return!0}))));return t}return!1},uv="where-builder",dv=e=>{const{collectionPluralLabel:n,fieldMap:r}=e,{i18n:s,t:l}=(0,Be.B)(),{code:c}=ls(),[u,d]=(0,o.useState)((()=>lv(r,s)));(0,o.useEffect)((()=>{d(lv(r,s,void 0,void 0,c))}),[r,s,c]);const{searchParams:f}=nn(),{handleWhereChange:p}=Zp(),[m,h]=i().useState(!1),[g,v]=i().useState((()=>{const e=f.where;if(e){if(cv(e))return e.or;const n=(t=e)?t.or&&!t.and?{or:t.or.map((e=>e.and?e:{and:[e]}))}:t.and&&!t.or?{or:[{and:t.and}]}:t.or||t.and?t:{or:[{and:[t]}]}:{};if(cv(n))return n.or;console.warn(`Invalid where query in URL: ${JSON.stringify(e)}`)}var t;return[]})),b=i().useCallback((({andIndex:e,fieldName:t,orIndex:n,relation:r})=>{const a=[...g];"and"===r?a[n].and.splice(e,0,{[t]:{}}):a.push({and:[{[t]:{}}]}),v(a)}),[g]),y=i().useCallback((({andIndex:e,fieldName:t,operator:n,orIndex:r,value:a})=>{const o=g[r].and[e];if("object"==typeof o&&t&&n){const i=a??(n?o[n]:""),s={[t]:n?{[n]:i}:{}};JSON.stringify(o)!==JSON.stringify(s)&&(g[r].and[e]=s,v(g),[null,void 0].includes(i)||h(!0))}}),[g]),w=i().useCallback((({andIndex:e,orIndex:t})=>{const n=[...g];n[t].and.splice(e,1),0===n[t].and.length&&n.splice(t,1),v(n),h(!0)}),[g]);return i().useEffect((()=>{m&&(p({or:g}),h(!1))}),[g,p,m]),(0,t.jsxs)("div",{className:uv,children:[g.length>0&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${uv}__label`,children:l("general:filterWhere",{label:(0,a.sC)(n,s)})}),(0,t.jsx)("ul",{className:`${uv}__or-filters`,children:g.map(((e,n)=>{const r=`${n}_${Array.isArray(e?.and)?e.and.length:""}`;return(0,t.jsxs)("li",{children:[0!==n&&(0,t.jsx)("div",{className:`${uv}__label`,children:l("general:or")}),(0,t.jsx)("ul",{className:`${uv}__and-filters`,children:Array.isArray(e?.and)&&e.and.map(((e,r)=>{const a=Object.keys(g[n].and[r])[0],o=Object.keys(g[n].and[r]?.[a]||{})?.[0]||void 0,i=g[n].and[r]?.[a]?.[o]||"";return(0,t.jsxs)("li",{children:[0!==r&&(0,t.jsx)("div",{className:`${uv}__label`,children:l("general:and")}),(0,t.jsx)(Jg,{addCondition:b,andIndex:r,fieldName:a,fields:u,initialValue:i,operator:o,orIndex:n,removeCondition:w,updateCondition:y})]},r)}))})]},r)}))}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${uv}__add-or`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{b({andIndex:0,fieldName:u[0].value,orIndex:g.length,relation:"or"})},children:l("general:or")})]}),0===g.length&&(0,t.jsxs)("div",{className:`${uv}__no-filters`,children:[(0,t.jsx)("div",{className:`${uv}__label`,children:l("general:noFiltersSet")}),(0,t.jsx)(Yt,{buttonStyle:"icon-label",className:`${uv}__add-first-filter`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{u.length>0&&b({andIndex:0,fieldName:u[0].value,orIndex:g.length,relation:"or"})},children:l("general:addFilter")})]})]})},fv=(e,t)=>{if(e){return tm(t).filter((t=>t.isFieldAffectingData&&e.includes(t.name)))}return null},pv=Qs.A.default||Qs.A,mv="list-controls",hv=e=>{const{collectionConfig:n,enableColumns:r=!0,enableSort:s=!1,fieldMap:l}=e,{handleSearchChange:c}=Zp(),{searchParams:u}=nn(),d=((e,t)=>{const{admin:{useAsTitle:n}}=e;return tm(t).find((e=>e.name===n))})(n,l),{i18n:f,t:p}=(0,Be.B)(),{breakpoints:{s:m}}=Le(),h=(0,o.useRef)(Boolean(u?.where)),g=cv(u?.where),[v,b]=(0,o.useState)(g?"where":void 0);return(0,o.useEffect)((()=>{h.current&&!u?.where?(b(void 0),h.current=!1):u?.where&&(h.current=!0)}),[b,u?.where]),(0,t.jsxs)("div",{className:mv,children:[(0,t.jsxs)("div",{className:`${mv}__wrap`,children:[(0,t.jsx)(zg,{fieldLabel:(d&&(0,a.sC)("label"in d.fieldComponentProps&&"string"==typeof d.fieldComponentProps.label?d.fieldComponentProps.label:d.name,f))??void 0,fieldName:d?.name,handleChange:c,listSearchableFields:fv(n.admin.listSearchableFields,l)}),(0,t.jsx)("div",{className:`${mv}__buttons`,children:(0,t.jsxs)("div",{className:`${mv}__buttons-wrap`,children:[!m&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Lg,{collection:n,fieldMap:l}),(0,t.jsx)(Wg,{collection:n}),(0,t.jsx)(Hg,{collection:n}),(0,t.jsx)(_g,{collection:n})]}),r&&(0,t.jsx)(Ml,{"aria-controls":`${mv}-columns`,"aria-expanded":"columns"===v,className:`${mv}__toggle-columns ${"columns"===v?`${mv}__buttons-active`:""}`,icon:(0,t.jsx)(Tt,{}),onClick:()=>b("columns"!==v?"columns":void 0),pillStyle:"light",children:p("general:columns")}),(0,t.jsx)(Ml,{"aria-controls":`${mv}-where`,"aria-expanded":"where"===v,className:`${mv}__toggle-where ${"where"===v?`${mv}__buttons-active`:""}`,icon:(0,t.jsx)(Tt,{}),onClick:()=>b("where"!==v?"where":void 0),pillStyle:"light",children:p("general:filters")}),s&&(0,t.jsx)(Ml,{"aria-controls":`${mv}-sort`,"aria-expanded":"sort"===v,className:`${mv}__toggle-sort`,icon:(0,t.jsx)(Tt,{}),onClick:()=>b("sort"!==v?"sort":void 0),pillStyle:"light",children:p("general:sort")})]})})]}),r&&(0,t.jsx)(pv,{className:`${mv}__columns`,height:"columns"===v?"auto":0,id:`${mv}-columns`,children:(0,t.jsx)(Cg,{collectionSlug:n.slug})}),(0,t.jsx)(pv,{className:`${mv}__where`,height:"where"===v?"auto":0,id:`${mv}-where`,children:(0,t.jsx)(dv,{collectionPluralLabel:n?.labels?.plural,collectionSlug:n.slug,fieldMap:l},String(h.current&&!u?.where))}),s&&(0,t.jsx)(pv,{className:`${mv}__sort`,height:"sort"===v?"auto":0,id:`${mv}-sort`,children:(0,t.jsx)("p",{children:"Sort Complex"})})]})},gv=({columns:e,customCellContext:n,data:r})=>{const{columns:a}=Dm(),o=e||a,i=o?.filter((e=>e?.active));return i&&0!==i.length?(0,t.jsx)("div",{className:"table",children:(0,t.jsxs)("table",{cellPadding:"0",cellSpacing:"0",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:i.map(((e,n)=>(0,t.jsx)("th",{id:`heading-${e.accessor}`,children:e.components.Heading},n)))})}),(0,t.jsx)("tbody",{children:r&&r.map(((e,r)=>(0,t.jsx)("tr",{className:`row-${r+1}`,children:i.map(((r,a)=>(0,t.jsx)("td",{className:`cell-${r.accessor}`,children:(0,t.jsx)(cm,{cellData:e[r.accessor],cellProps:r?.cellProps,columnIndex:a,customCellContext:n,rowData:e,children:r.components.Cell})},a)))},r)))})]})}):(0,t.jsx)("div",{children:"No columns selected"})},vv="clickable-arrow",bv="paginator__page",yv=({isCurrent:e,isFirstPage:n=!1,isLastPage:r=!1,page:a=1,updatePage:o})=>{const i=[bv,e&&`${bv}--is-current`,n&&`${bv}--is-first-page`,r&&`${bv}--is-last-page`].filter(Boolean).join(" ");return(0,t.jsx)("button",{className:i,onClick:()=>o(a),type:"button",children:a})},wv={ClickableArrow:e=>{const{direction:n="right",isDisabled:r=!1,updatePage:a}=e,o=[vv,r&&`${vv}--is-disabled`,n&&`${vv}--${n}`].filter(Boolean).join(" ");return(0,t.jsx)("button",{className:o,disabled:r,onClick:r?void 0:a,type:"button",children:(0,t.jsx)(Tt,{})})},Page:yv,Separator:()=>(0,t.jsx)("span",{className:"paginator__separator",children:"—"})},xv=e=>{const{hasNextPage:n=!1,hasPrevPage:r=!1,nextPage:a=null,numberOfNeighbors:o=1,onChange:i,page:s,prevPage:l=null,totalPages:c=null}=e;if(!c||c<=1)return null;const u=e=>{"function"==typeof i&&i(e)},d=Array.from({length:c},((e,t)=>t+1));let f=s-1-o;f<=0&&(f=0);const p=s-1+o+1,m=d.slice(f,p);return s-o-1>=2&&m.unshift({type:"Separator"}),s>o+1&&m.unshift({type:"Page",props:{isFirstPage:!0,page:1,updatePage:u}}),s+o+1<c&&m.push({type:"Separator"}),p<c&&m.push({type:"Page",props:{isLastPage:!0,page:c,updatePage:u}}),m.unshift({type:"ClickableArrow",props:{direction:"right",isDisabled:!n,updatePage:()=>u(a)}}),m.unshift({type:"ClickableArrow",props:{direction:"left",isDisabled:!r,updatePage:()=>u(l)}}),(0,t.jsx)("div",{className:"paginator",children:m.map(((e,n)=>{if("number"==typeof e)return(0,t.jsx)(yv,{isCurrent:s===e,page:e,updatePage:u},n);const r=wv[e.type];return(0,t.jsx)(r,{...e.props},n)}))})},Pv="per-page",jv=jc.collectionDefaults.admin.pagination.limits,kv=({defaultLimit:e=10,handleChange:n,limit:r,limits:a=jv})=>{const{t:o}=(0,Be.B)(),i=(0,jc.isNumber)(r)?r:e;return(0,t.jsx)("div",{className:Pv,children:(0,t.jsx)(Ys,{button:(0,t.jsxs)("div",{className:`${Pv}__base-button`,children:[(0,t.jsx)("span",{children:o("general:perPage",{limit:i})})," ",(0,t.jsx)(Tt,{className:`${Pv}__icon`})]}),horizontalAlign:"right",render:({close:e})=>(0,t.jsx)(Us,{children:a.map(((r,a)=>(0,t.jsxs)(Gs,{className:[`${Pv}__button`,r===i&&`${Pv}__button-active`].filter(Boolean).join(" "),onClick:()=>{e(),n&&n(r)},children:[r===i&&(0,t.jsx)("div",{className:`${Pv}__chevron`,children:(0,t.jsx)(Tt,{direction:"right"})})," ",(0,t.jsx)("span",{children:r})]},a)))}),size:"small"})})};var Sv=n(40978),Cv=n.n(Sv);const Mv="collection-list",_v=Cv().default||Cv(),Ov=()=>{const{Header:e,collectionSlug:n,hasCreatePermission:r,newDocumentURL:i}=(0,o.useContext)(Xp),{data:s,defaultLimit:l,handlePageChange:c,handlePerPageChange:u}=Zp(),{searchParams:d}=nn(),f=Ut(),{getComponentMap:p}=wn(),m=p({collectionSlug:n}),{AfterList:h,AfterListTable:g,BeforeList:v,BeforeListTable:b,Description:y,actionsMap:w,fieldMap:x}=m||{},P=f.collections.find((e=>e.slug===n)),{labels:j}=P,{i18n:k}=(0,Be.B)(),S=ws(),{setStepNav:C}=hn(),{breakpoints:{s:M}}=xg();let _=s.docs||[];return P.upload&&(_=_?.map((e=>({...e,filesize:(0,jc.formatFilesize)(e.filesize)})))),(0,o.useEffect)((()=>{S<=1&&C([{label:j?.plural}])}),[C,j,S]),(0,t.jsxs)("div",{className:Mv,children:[(0,t.jsx)(Pg,{actions:w?.List}),v,(0,t.jsx)(am,{docs:s.docs,totalDocs:s.totalDocs,children:(0,t.jsxs)(bl,{className:`${Mv}__wrap`,children:[(0,t.jsx)("header",{className:`${Mv}__header`,children:e||(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("h1",{children:(0,a.sC)(j?.plural,k)}),r&&(0,t.jsx)(Ml,{"aria-label":k.t("general:createNewLabel",{label:(0,a.sC)(j?.singular,k)}),to:i,children:k.t("general:createNew")}),!M&&(0,t.jsx)(kg,{label:(0,a.sC)(P.labels.plural,k)}),y&&(0,t.jsx)("div",{className:`${Mv}__sub-header`,children:y})]})}),(0,t.jsx)(hv,{collectionConfig:P,fieldMap:x}),b,!s.docs&&(0,t.jsx)(Ql.E,{className:[`${Mv}__shimmer`,`${Mv}__shimmer--rows`].join(" "),count:6}),s.docs&&s.docs.length>0&&(0,t.jsx)(wm,{children:(0,t.jsx)(gv,{customCellContext:{collectionSlug:n,uploadConfig:P.upload},data:_,fieldMap:x})}),s.docs&&0===s.docs.length&&(0,t.jsxs)("div",{className:`${Mv}__no-results`,children:[(0,t.jsx)("p",{children:k.t("general:noResults",{label:(0,a.sC)(j?.plural,k)})}),r&&i&&(0,t.jsx)(Yt,{Link:_v,el:"link",to:i,children:k.t("general:createNewLabel",{label:(0,a.sC)(j?.singular,k)})})]}),g,s.docs&&s.docs.length>0&&(0,t.jsxs)("div",{className:`${Mv}__page-controls`,children:[(0,t.jsx)(xv,{hasNextPage:s.hasNextPage,hasPrevPage:s.hasPrevPage,limit:s.limit,nextPage:s.nextPage,numberOfNeighbors:1,onChange:c,page:s.page,prevPage:s.prevPage,totalPages:s.totalPages}),s?.totalDocs>0&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsxs)("div",{className:`${Mv}__page-info`,children:[s.page*s.limit-(s.limit-1),"-",s.totalPages>1&&s.totalPages!==s.page?s.limit*s.page:s.totalDocs," ",k.t("general:of")," ",s.totalDocs]}),(0,t.jsx)(kv,{handleChange:u,limit:(0,jc.isNumber)(d?.limit)?Number(d.limit):l,limits:P?.admin?.pagination?.limits,resetPage:s.totalDocs<=s.pagingCounter}),M&&(0,t.jsx)("div",{className:`${Mv}__list-selection`,children:(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(kg,{label:(0,a.sC)(P.labels.plural,k)}),(0,t.jsxs)("div",{className:`${Mv}__list-selection-actions`,children:[(0,t.jsx)(Lg,{collection:P,fieldMap:x}),(0,t.jsx)(Wg,{collection:P}),(0,t.jsx)(Hg,{collection:P}),(0,t.jsx)(_g,{collection:P})]})]})})]})]})]})}),h]})},Ev=(0,lh.Merriweather)({display:"swap",style:["normal","italic"],subsets:["latin"],variable:"--font-serif",weight:["400","900"]}),Dv=async({children:e,config:n})=>{const r=await n,o=(0,ch.headers)(),i=(0,oh.parseCookies)(o),s=fh({config:r,cookies:i,headers:o}),l=(({config:e,cookies:t,headers:n})=>{const r=t.get(`${e.cookiePrefix||"payload"}-theme`),a="string"==typeof r?r:r?.value;if(a&&ph.includes(a))return a;const o=n.get("Sec-CH-Prefers-Color-Scheme");return o&&ph.includes(o)?o:Xm.zQ})({config:r,cookies:i,headers:o}),c=await dh({config:r}),u=await(0,a.LE)({config:r.i18n,context:"client",language:s}),d=await(0,oh.createClientConfig)({config:r,t:u.t}),f=a.aG.includes(s)?"RTL":"LTR",p=Object.entries(r.i18n.supportedLanguages||{}).reduce(((e,[t,n])=>(Object.keys(r.i18n.supportedLanguages).includes(t)&&e.push({label:n.translations.general.thisLanguage,value:t}),e)),[]);const{componentMap:m,wrappedChildren:h}=sh({DefaultEditView:yg,DefaultListView:Ov,children:e,i18n:u,payload:c});return(0,t.jsx)("html",{className:Ev.variable,"data-theme":l,dir:f,lang:s,children:(0,t.jsxs)("body",{children:[(0,t.jsx)(nh,{componentMap:m,config:d,dateFNSKey:u.dateFNSKey,fallbackLang:d.i18n.fallbackLanguage,languageCode:s,languageOptions:p,switchLanguageServerAction:async function(e){(0,ch.cookies)().set({name:`${r.cookiePrefix||"payload"}-lng`,path:"/",value:e})},theme:l,translations:u.translations,children:h}),(0,t.jsx)("div",{id:"portal"})]})})},Nv=({permissions:e,user:t})=>{const{setPermissions:n,setUser:r}=sn();return(0,o.useEffect)((()=>{r(t),n(e)}),[t,e,r,n]),null};var Av;function Tv(e,t,n){return e.reduce(((e,r)=>{if(t?.[r.type.toLowerCase()]?.[r.entity.slug]?.read.permission){const t=(0,a.sC)(r.entity.admin.group,n);if(r.entity.admin.group){const o=e.find((e=>(0,a.sC)(e.label,n)===t));let i=o;o||(i={entities:[],label:t},e.push(i)),i.entities.push(r)}else{e.find((e=>(0,a.sC)(e.label,n)===n.t(`general:${r.type}`))).entities.push(r)}}return e}),[{entities:[],label:n.t("general:collections")},{entities:[],label:n.t("general:globals")}]).filter((e=>e.entities.length>0))}!function(e){e.collection="collections",e.global="globals"}(Av||(Av={}));const Rv=e=>{const{CustomComponent:n,DefaultComponent:r,componentProps:a,serverOnlyProps:o}=e;return n?(0,t.jsx)(rh,{Component:n,serverOnlyProps:o,...a}):r?(0,t.jsx)(rh,{Component:r,serverOnlyProps:o,...a}):null},Iv=({nav:e})=>{const{setStepNav:t}=hn();return(0,o.useEffect)((()=>{t(e)}),[t,e]),null},Lv="card",$v=e=>{const{id:n,Link:r,actions:a,buttonAriaLabel:o,href:i,onClick:s,title:l,titleAs:c}=e,u=[Lv,n,(s||i)&&`${Lv}--has-onclick`].filter(Boolean).join(" "),d=c??"div";return(0,t.jsxs)("div",{className:u,id:n,children:[(0,t.jsx)(d,{className:`${Lv}__title`,children:l}),a&&(0,t.jsx)("div",{className:`${Lv}__actions`,children:a}),(s||i)&&(0,t.jsx)(Yt,{Link:r,"aria-label":o,buttonStyle:"none",className:`${Lv}__click`,el:"link",onClick:s,to:i})]})},Wv="dashboard",Fv=e=>{const{Link:n,i18n:r,i18n:{t:i},locale:s,navGroups:l,params:c,payload:{config:{admin:{components:{afterDashboard:u,beforeDashboard:d}},routes:{admin:f}}},payload:p,permissions:m,searchParams:h,user:g}=e,v=Array.isArray(d)?d.map(((e,n)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:r,locale:s,params:c,payload:p,permissions:m,searchParams:h,user:g}},n))):null,b=Array.isArray(u)?u.map(((e,n)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:r,locale:s,params:c,payload:p,permissions:m,searchParams:h,user:g}},n))):null;return(0,t.jsxs)("div",{className:Wv,children:[(0,t.jsx)(Iv,{nav:[]}),(0,t.jsx)(Pg,{actions:[]}),(0,t.jsxs)(bl,{className:`${Wv}__wrap`,children:[Array.isArray(v)&&v.map((e=>e)),(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Pg,{actions:[]}),l&&0!==l?.length?l.map((({entities:e,label:o},s)=>(0,t.jsxs)("div",{className:`${Wv}__group`,children:[(0,t.jsx)("h2",{className:`${Wv}__label`,children:o}),(0,t.jsx)("ul",{className:`${Wv}__card-list`,children:e.map((({type:e,entity:o},s)=>{let l,c,u,d,p;return e===Av.collection&&(l=(0,a.sC)(o.labels.plural,r),c=i("general:showAllLabel",{label:l}),d=`${f}/collections/${o.slug}`,u=`${f}/collections/${o.slug}/create`,p=m?.collections?.[o.slug]?.create?.permission),e===Av.global&&(l=(0,a.sC)(o.label,r),c=i("general:editLabel",{label:(0,a.sC)(o.label,r)}),d=`${f}/globals/${o.slug}`),(0,t.jsx)("li",{children:(0,t.jsx)($v,{Link:n,actions:p&&e===Av.collection?(0,t.jsx)(Yt,{Link:n,"aria-label":i("general:createNewLabel",{label:(0,a.sC)(o.labels.singular,r)}),buttonStyle:"icon-label",el:"link",icon:"plus",iconStyle:"with-border",round:!0,to:u}):void 0,buttonAriaLabel:c,href:d,id:`card-${o.slug}`,title:l,titleAs:"h3"})},s)}))})]},s))):(0,t.jsx)("p",{children:"no nav groups...."})]}),Array.isArray(b)&&b.map((e=>e))]})]})},zv=(n.p,n.p,n.p,Cv().default||Cv()),Bv=({initPageResult:e,params:n,searchParams:r})=>{const{locale:a,permissions:i,req:{i18n:s,payload:{config:l},payload:c,user:u},visibleEntities:d}=e,f=l.admin.components?.views?.Dashboard,p=l.collections.filter((e=>i?.collections?.[e.slug]?.read?.permission&&d.collections.includes(e.slug))),m=l.globals.filter((e=>i?.globals?.[e.slug]?.read?.permission&&d.globals.includes(e.slug))),h=Tv([...p.map((e=>({type:Av.collection,entity:e})))??[],...m.map((e=>({type:Av.global,entity:e})))??[]],i,s),g={Link:zv,i18n:s,locale:a,navGroups:h,params:n,payload:c,permissions:i,searchParams:r,user:u,visibleEntities:d};return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Nv,{permissions:i,user:u}),(0,t.jsx)(Rv,{CustomComponent:"function"==typeof f?f:void 0,DefaultComponent:Fv,componentProps:g,serverOnlyProps:{i18n:s,locale:a,params:n,payload:c,permissions:i,searchParams:r,user:u}})]})},Hv=()=>(0,t.jsxs)("svg",{className:"graphic-logo",fill:"none",height:"50",viewBox:"0 0 180 50",width:"180",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("style",{children:"\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n"}),(0,t.jsx)("path",{d:"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z"}),(0,t.jsx)("path",{d:"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z"}),(0,t.jsx)("path",{d:"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z"}),(0,t.jsx)("path",{d:"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z"}),(0,t.jsx)("path",{d:"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z"}),(0,t.jsx)("path",{d:"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z"}),(0,t.jsx)("path",{d:"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z"}),(0,t.jsx)("path",{d:"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z"}),(0,t.jsx)("path",{d:"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"})]}),Yv=e=>{const{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}=e,{admin:{components:{graphics:{Logo:c}={Logo:void 0}}={}}={}}=o.config;return(0,t.jsx)(Rv,{CustomComponent:c,DefaultComponent:Hv,serverOnlyProps:{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}})},Vv="login__form",qv=Cv().default||Cv(),Uv=({searchParams:e})=>{const n=Ut(),{admin:{autoLogin:r,routes:{forgot:a},user:o},routes:{admin:i,api:s}}=n,l=n.collections?.find((e=>e?.slug===o)),c=l?.auth?.loginWithUsername,{t:u}=(0,Be.B)(),d=r&&r.prefillOnly,f={password:{initialValue:d?r.password:void 0,valid:!0,value:d?r.password:void 0}};return c?f.username={initialValue:d?r.username:void 0,valid:!0,value:d?r.username:void 0}:f.email={initialValue:d?r.email:void 0,valid:!0,value:d?r.email:void 0},(0,t.jsxs)(Ch,{action:`${s}/${o}/login`,className:Vv,disableSuccessStatus:!0,initialState:f,method:"POST",redirect:"string"==typeof e?.redirect?e.redirect:i,waitForAutocomplete:!0,children:[(0,t.jsxs)("div",{className:`${Vv}__inputWrap`,children:[c?(0,t.jsx)(bp,{label:u("authentication:username"),name:"username",required:!0,validate:e=>(0,jc.text)(e,{name:"username",type:"text",data:{},preferences:{fields:{}},req:{payload:{config:n},t:u},required:!0,siblingData:{}})}):(0,t.jsx)(fc,{autoComplete:"email",label:u("general:email"),name:"email",required:!0,validate:e=>(0,jc.email)(e,{name:"email",type:"email",data:{},preferences:{fields:{}},req:{t:u},required:!0,siblingData:{}})}),(0,t.jsx)(Ef,{autoComplete:"off",label:u("general:password"),name:"password",required:!0,validate:e=>(0,jc.password)(e,{name:"password",type:"text",data:{},preferences:{fields:{}},req:{payload:{config:n},t:u},required:!0,siblingData:{}})})]}),(0,t.jsx)(qv,{href:`${i}${a}`,children:u("authentication:forgotPasswordQuestion")}),(0,t.jsx)(Lh,{children:u("authentication:login")})]})},Gv="login",Kv=({initPageResult:e,params:n,searchParams:r})=>{const{locale:a,permissions:i,req:s}=e,{i18n:l,payload:{config:c},payload:u,user:d}=s,{admin:{components:{afterLogin:f,beforeLogin:p}={},user:m},collections:h,routes:{admin:g}}=c,v=Array.isArray(p)?p.map(((e,o)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:l,locale:a,params:n,payload:u,permissions:i,searchParams:r,user:d}},o))):null,b=Array.isArray(f)?f.map(((e,o)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:l,locale:a,params:n,payload:u,permissions:i,searchParams:r,user:d}},o))):null;d&&(0,eg.redirect)(g);const y=h.find((({slug:e})=>e===m));return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("div",{className:`${Gv}__brand`,children:(0,t.jsx)(Yv,{i18n:l,locale:a,params:n,payload:u,permissions:i,searchParams:r,user:d})}),Array.isArray(v)&&v.map((e=>e)),!y?.auth?.disableLocalStrategy&&(0,t.jsx)(Uv,{searchParams:r}),Array.isArray(b)&&b.map((e=>e))]})},Xv="nav-toggler",Qv=e=>{const{id:n,children:r,className:a,tabIndex:o=0}=e,{t:i}=(0,Be.B)(),{setPreference:s}=dn(),{navOpen:l,setNavOpen:c}=pn(),{breakpoints:{l:u}}=Le();return(0,t.jsx)("button",{"aria-label":`${i(l?"general:close":"general:open")} ${i("general:menu")}`,className:[Xv,l&&`${Xv}--is-open`,a].filter(Boolean).join(" "),id:n,onClick:async()=>{c(!l),u||await s("nav",{open:!l})},tabIndex:o,type:"button",children:r})},Jv="graphic-account",Zv=e=>(0,t.jsxs)("svg",{className:[Jv,e?.active&&`${Jv}--active`].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("circle",{className:`${Jv}__bg`,cx:"12.5",cy:"12.5",r:"11.5"}),(0,t.jsx)("circle",{className:`${Jv}__head`,cx:"12.5",cy:"10.73",r:"3.98"}),(0,t.jsx)("path",{className:`${Jv}__body`,d:"M12.5,24a11.44,11.44,0,0,0,7.66-2.94c-.5-2.71-3.73-4.8-7.66-4.8s-7.16,2.09-7.66,4.8A11.44,11.44,0,0,0,12.5,24Z"})]});var eb=n(41361),tb=n.n(eb);const nb=()=>{const{user:e}=sn(),n=tb()(e.email.trim().toLowerCase()),r=`?${new URLSearchParams({default:"mp",r:"g",s:"50"}).toString()}`;return(0,t.jsx)("img",{alt:"yas",className:"gravatar-account",height:25,src:`https://www.gravatar.com/avatar/${n}?${r}`,style:{borderRadius:"50%"},width:25})},rb=()=>{const{admin:{avatar:e},admin:{routes:{account:n}},routes:{admin:r}}=Ut(),{user:a}=sn(),o=(0,ht.usePathname)()===`${r}${n}`;return a?.email&&"default"!==e?"gravatar"===e?(0,t.jsx)(nb,{}):e?(0,t.jsx)(e,{active:o}):void 0:(0,t.jsx)(Zv,{active:o})},ab="hamburger",ob=e=>{const{t:n}=(0,Be.B)(),{closeIcon:r="x",isActive:a=!1}=e;return(0,t.jsx)("div",{className:ab,children:(0,t.jsx)("div",{className:`${ab}__wrapper`,children:(0,t.jsxs)("div",{className:`${ab}__icon`,children:[!a&&(0,t.jsxs)("div",{className:`${ab}__lines`,title:n("general:open"),children:[(0,t.jsx)("div",{className:`${ab}__line ${ab}__top`}),(0,t.jsx)("div",{className:`${ab}__line ${ab}__middle`}),(0,t.jsx)("div",{className:`${ab}__line ${ab}__bottom`})]}),a&&(0,t.jsxs)("div",{"aria-label":n("collapse"===r?"general:collapse":"general:close"),className:`${ab}__close-icon`,title:n("collapse"===r?"general:collapse":"general:close"),children:["x"===r&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${ab}__line ${ab}__x-left`}),(0,t.jsx)("div",{className:`${ab}__line ${ab}__x-right`})]}),"collapse"===r&&(0,t.jsx)(Tt,{className:`${ab}__collapse-chevron`,direction:"left"})]})]})})})},ib="localizer-button",sb=e=>{const{ariaLabel:n,className:r}=e,o=ls(),{i18n:i,t:s}=(0,Be.B)();return(0,t.jsxs)("div",{"aria-label":n||s("general:locale"),className:[ib,r].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${ib}__label`,children:`${s("general:locale")}:`})," ",(0,t.jsx)("span",{className:`${ib}__current-label`,children:`${(0,a.sC)(o.label,i)}`})," ",(0,t.jsx)(Tt,{className:`${ib}__chevron`})]})},lb="localizer",cb=e=>{const{className:n}=e,r=Ut(),{localization:o}=r,{i18n:i}=(0,Be.B)(),s=ls(),{stringifyParams:l}=nn(),c=(0,ht.useRouter)(),{clearRouteCache:u}=(0,Km.P)();if(o){const{locales:e}=o;return(0,t.jsx)("div",{className:[lb,n].filter(Boolean).join(" "),children:(0,t.jsx)(Ys,{button:(0,t.jsx)(sb,{}),horizontalAlign:"right",render:({close:n})=>(0,t.jsx)(Us,{children:e.map((e=>{const r=(0,a.sC)(e.label,i);return(0,t.jsxs)(Gs,{active:s.code===e.code,onClick:()=>{c.replace(l({params:{locale:e.code}})),u(),n()},children:[r,r!==e.code&&` (${e.code})`]},e.code)}))}),showScrollbar:!0,size:"large"})})}return null},ub=({fill:e})=>{const n=e||"var(--theme-elevation-1000)";return(0,t.jsxs)("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z",fill:n}),(0,t.jsx)("path",{d:"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z",fill:n})]})},db="step-nav",fb=({Link:e,className:n})=>{const{i18n:r}=(0,Be.B)(),{stepNav:i}=hn(),s=Ut(),{routes:{admin:l}}=s,{componentMap:c}=wn(),{t:u}=(0,Be.B)(),d=c?.Icon||(0,t.jsx)(ub,{}),f=e||"a";return(0,t.jsx)(o.Fragment,{children:i.length>0?(0,t.jsxs)("nav",{className:[db,n].filter(Boolean).join(" "),children:[(0,t.jsx)(f,{className:`${db}__home`,href:l,tabIndex:0,children:(0,t.jsx)("span",{title:u("general:dashboard"),children:d})}),(0,t.jsx)("span",{children:"/"}),i.map(((e,n)=>{const s=(0,a.sC)(e.label,r);return i.length===n+1?(0,t.jsx)("span",{className:`${db}__last`,children:s},n):(0,t.jsxs)(o.Fragment,{children:[e.url?(0,t.jsx)(f,{href:e.url,children:(0,t.jsx)("span",{children:s},n)}):(0,t.jsx)("span",{children:s},n),(0,t.jsx)("span",{children:"/"})]},n)}))]}):(0,t.jsx)("div",{className:[db,n].filter(Boolean).join(" "),children:(0,t.jsx)("div",{className:`${db}__home`,children:(0,t.jsx)("span",{title:u("general:dashboard"),children:d})})})})},pb="app-header",mb=()=>{const{t:e}=(0,Be.B)(),{admin:{routes:{account:n}},localization:r,routes:{admin:a}}=Ut(),{actions:i}=Pn(),{navOpen:s}=pn(),l=(0,o.useRef)(null),[c,u]=(0,o.useState)(!1);(0,o.useEffect)((()=>{const e=()=>{const e=l.current;if(e){const t=e.scrollWidth>e.clientWidth;u(t)}};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[i]);const d=Dn().default,f=d||"a";return(0,t.jsxs)("header",{className:[pb,s&&`${pb}--nav-open`].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${pb}__bg`}),(0,t.jsx)("div",{className:`${pb}__content`,children:(0,t.jsxs)("div",{className:`${pb}__wrapper`,children:[(0,t.jsx)(Qv,{className:`${pb}__mobile-nav-toggler`,tabIndex:-1,children:(0,t.jsx)(ob,{})}),(0,t.jsxs)("div",{className:`${pb}__controls-wrapper`,children:[(0,t.jsx)("div",{className:`${pb}__step-nav-wrapper`,children:(0,t.jsx)(fb,{Link:d,className:`${pb}__step-nav`})}),(0,t.jsxs)("div",{className:`${pb}__actions-wrapper`,children:[(0,t.jsx)("div",{className:`${pb}__actions`,ref:l,children:Array.isArray(i)&&i.map(((e,n)=>(0,t.jsx)("div",{className:c&&n===i.length-1?`${pb}__last-action`:"",children:e},n)))}),c&&(0,t.jsx)("div",{className:`${pb}__gradient-placeholder`})]}),r&&(0,t.jsx)(sb,{ariaLabel:"invisible",className:`${pb}__localizer-spacing`}),(0,t.jsx)(f,{"aria-label":e("authentication:account"),className:`${pb}__account`,href:`${a}${n}`,tabIndex:0,children:(0,t.jsx)(rb,{})})]})]})}),(0,t.jsx)(cb,{className:`${pb}__localizer`})]})},hb=()=>(0,t.jsxs)("svg",{className:"icon icon--logout",fill:"none",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{className:"stroke",d:"M10 5H18V19H10"}),(0,t.jsxs)("g",{children:[(0,t.jsx)("path",{className:"stroke",d:"M8 8.5L4.46447 12.0355L8 15.5711"}),(0,t.jsx)("line",{className:"stroke",x1:"5",x2:"13",y1:"12",y2:"12"})]})]}),gb=({Link:e,tabIndex:n})=>{const{t:r}=(0,Be.B)(),a=Ut(),{admin:{routes:{logout:o}},routes:{admin:i}}=a,s=process.env.NEXT_BASE_PATH??"",l=e||"a";return(0,t.jsx)(l,{"aria-label":r("authentication:logOut"),className:"nav__log-out",href:`${s}${i}${o}`,tabIndex:n,children:(0,t.jsx)(hb,{})})},vb=({Link:e,tabIndex:n=0})=>{const{componentMap:{LogoutButton:r}}=wn();return r?(0,t.jsx)(o.Fragment,{children:r}):(0,t.jsx)(gb,{Link:e,tabIndex:n})},bb=({baseClass:e})=>{const{navOpen:n,setNavOpen:r}=pn();return(0,t.jsx)("button",{className:`${e}__mobile-close`,onClick:()=>{r(!1)},tabIndex:n?void 0:-1,type:"button",children:(0,t.jsx)(ob,{isActive:!0})})},yb=e=>{const{baseClass:n,children:r}=e,{navOpen:a,navRef:o}=pn();return(0,t.jsx)("aside",{className:[n,a&&`${n}--nav-open`].filter(Boolean).join(" "),children:(0,t.jsx)("div",{className:`${n}__scroll`,ref:o,children:r})})},wb=Qs.A.default||Qs.A,xb="nav-group",Pb=({children:e,label:n})=>{const[r,a]=(0,o.useState)(!0),[s,l]=(0,o.useState)(!1),{getPreference:c,setPreference:u}=dn(),{navOpen:d}=pn(),f=`collapsed-${n}-groups`;if((0,o.useEffect)((()=>{if(n){(async()=>{const e=await c(f)||[];a(-1!==e.indexOf(n))})()}}),[c,n,f]),n){const o=async()=>{l(!0);let e=await c(f)||[];r?e=e.filter((e=>n!==e)):e.push(n),u(f,e),a(!r)};return(0,t.jsxs)("div",{className:[`${xb}`,`${n}`,r&&`${xb}--collapsed`].filter(Boolean).join(" "),id:`nav-group-${n}`,children:[(0,t.jsxs)("button",{className:[`${xb}__toggle`,`${xb}__toggle--${r?"collapsed":"open"}`].filter(Boolean).join(" "),onClick:o,tabIndex:d?0:-1,type:"button",children:[(0,t.jsx)("div",{className:`${xb}__label`,children:n}),(0,t.jsx)("div",{className:`${xb}__indicator`,children:(0,t.jsx)(Tt,{className:`${xb}__indicator`,direction:r?void 0:"up"})})]}),(0,t.jsx)(wb,{duration:s?200:0,height:r?0:"auto",children:(0,t.jsx)("div",{className:`${xb}__content`,children:e})})]})}return(0,t.jsx)(i().Fragment,{children:e})},jb="nav",kb=()=>{const{permissions:e}=sn(),{isEntityVisible:n}=hg(),{collections:r,globals:i,routes:{admin:s}}=Ut(),{i18n:l}=(0,Be.B)(),{navOpen:c}=pn(),u=Tv([...r.filter((({slug:e})=>n({collectionSlug:e}))).map((e=>({type:Av.collection,entity:e}))),...i.filter((({slug:e})=>n({globalSlug:e}))).map((e=>({type:Av.global,entity:e})))],e,l);return(0,t.jsx)(o.Fragment,{children:u.map((({entities:e,label:n},r)=>(0,t.jsx)(Pb,{label:n,children:e.map((({type:e,entity:n},r)=>{let o,i,u;e===Av.collection&&(i=`${s}/collections/${n.slug}`,o=(0,a.sC)(n.labels.plural,l),u=`nav-${n.slug}`),e===Av.global&&(i=`${s}/globals/${n.slug}`,o=(0,a.sC)(n.label,l),u=`nav-global-${n.slug}`);const d=Cv().default||Cv()||"a";return(0,t.jsxs)(d,{className:`${jb}__link`,href:i,id:u,tabIndex:c?void 0:-1,children:[(0,t.jsx)("span",{className:`${jb}__link-icon`,children:(0,t.jsx)(Tt,{direction:"right"})}),(0,t.jsx)("span",{className:`${jb}__link-label`,children:o})]},r)}))},r)))})},Sb="nav",Cb=e=>{const{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}=e;if(!o?.config)return null;const{admin:{components:{afterNavLinks:c,beforeNavLinks:u}}}=o.config,d=Array.isArray(u)?u.map(((e,c)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}},c))):null,f=Array.isArray(c)?c.map(((e,c)=>(0,t.jsx)(rh,{Component:e,serverOnlyProps:{i18n:n,locale:r,params:a,payload:o,permissions:i,searchParams:s,user:l}},c))):null;return(0,t.jsxs)(yb,{baseClass:Sb,children:[(0,t.jsxs)("nav",{className:`${Sb}__wrap`,children:[Array.isArray(d)&&d.map((e=>e)),(0,t.jsx)(kb,{}),Array.isArray(f)&&f.map((e=>e)),(0,t.jsx)("div",{className:`${Sb}__controls`,children:(0,t.jsx)(vb,{})})]}),(0,t.jsx)("div",{className:`${Sb}__header`,children:(0,t.jsx)("div",{className:`${Sb}__header-content`,children:(0,t.jsx)(bb,{baseClass:Sb})})})]})},Mb=()=>{const{navOpen:e}=pn();return(0,t.jsx)(ob,{closeIcon:"collapse",isActive:e})},_b=e=>{const{baseClass:n,children:r,className:a}=e,{navOpen:o}=pn();return(0,t.jsx)("div",{className:[n,a,o&&`${n}--nav-open`].filter(Boolean).join(" "),children:r})},Ob="template-default",Eb=({children:e,className:n,i18n:r,locale:a,params:o,payload:i,permissions:s,searchParams:l,user:c,visibleEntities:u})=>{const{admin:{components:{Nav:d}={Nav:void 0}}={}}=i.config||{},f={i18n:r,locale:a,params:o,payload:i,permissions:s,searchParams:l,user:c};return(0,t.jsx)(mg,{visibleEntities:u,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:`${Ob}__nav-toggler-wrapper`,id:"nav-toggler",children:(0,t.jsx)(Qv,{className:`${Ob}__nav-toggler`,children:(0,t.jsx)(Mb,{})})}),(0,t.jsxs)(_b,{baseClass:Ob,className:n,children:[(0,t.jsx)(Rv,{CustomComponent:d,DefaultComponent:Cb,componentProps:f,serverOnlyProps:{i18n:r,locale:a,params:o,payload:i,permissions:s,searchParams:l,user:c}}),(0,t.jsxs)("div",{className:`${Ob}__wrap`,children:[(0,t.jsx)(mb,{}),e]})]})]})})},Db="template-minimal",Nb=e=>{const{children:n,className:r,style:a={},width:o="normal"}=e,i=[r,Db,`${Db}--width-${o}`].filter(Boolean).join(" ");return(0,t.jsx)("section",{className:i,style:a,children:(0,t.jsx)("div",{className:`${Db}__wrap`,children:n})})},Ab=["createFirstUser","forgot","login","logout","forgot","inactivity","unauthorized","reset"],Tb=(e,t)=>e.startsWith(t),Rb=(e,t,n)=>{const r=e.admin?.routes?Object.entries(e.admin.routes).filter((([e])=>Ab.includes(e))).map((([e,t])=>t)):[];return r.some((e=>t.replace(n,"").startsWith(e)))},Ib=async({config:e,redirectUnauthenticatedUser:t=!1,route:n,searchParams:r})=>{const o=(0,ch.headers)(),i=await dh({config:e}),{collections:s,globals:l,i18n:c,localization:u,routes:{admin:d}}=i.config,f=`${ge().stringify(r??{},{addQueryPrefix:!0})}`,p=(0,oh.parseCookies)(o),m=fh({config:i.config,cookies:p,headers:o}),h=await(0,a.LE)({config:c,context:"client",language:m}),g=Object.entries(i.config.i18n.supportedLanguages||{}).reduce(((e,[t,n])=>(Object.keys(i.config.i18n.supportedLanguages).includes(t)&&e.push({label:n.translations.general.thisLanguage,value:t}),e)),[]),v=await(0,oh.createLocalReq)({fallbackLocale:null,req:{host:o.get("host"),i18n:h,query:ge().parse(f,{depth:10,ignoreQueryPrefix:!0}),url:`${i.config.serverURL}${n}${r?f:""}`}},i),{permissions:b,user:y}=await i.auth({headers:o,req:v});v.user=y;const w=r?.locale;let x;if(u){const e=u.defaultLocale?u.defaultLocale:"en";let t=w;if(!t)try{t=await(i.find({collection:"payload-preferences",depth:0,limit:1,user:y,where:{and:[{"user.relationTo":{equals:i.config.admin.user}},{"user.value":{equals:y.id}},{key:{equals:"locale"}}]}})?.then((e=>e.docs?.[0]?.value)))}catch(e){}x=os(u,t),x||(x=os(u,e)),v.locale=x.code}const P={collections:s.map((({slug:e,admin:{hidden:t}})=>(0,oh.isEntityHidden)({hidden:t,user:y})?null:e)).filter(Boolean),globals:l.map((({slug:e,admin:{hidden:t}})=>(0,oh.isEntityHidden)({hidden:t,user:y})?null:e)).filter(Boolean)};t&&!y&&(({config:e,redirectUnauthenticatedUser:t,route:n,searchParams:r})=>{const{admin:{routes:{login:a}},routes:{admin:o}}=e;if(!Rb(e,n,o)){r&&"redirect"in r&&delete r.redirect;const e=encodeURIComponent(n+Object.keys(r??{}).length?`${ge().stringify(r,{addQueryPrefix:!0})}`:void 0),i=`${o}${a}`,s="string"==typeof t?t:void 0,l=Tb(n,o)?i:s||a,c=ge().parse(l.split("?")[1]??""),u=`${ge().stringify({...c,...e?{redirect:e}:{}},{addQueryPrefix:!0})}`;(0,eg.redirect)(`${l.split("?")[0]}${u}`)}})({config:i.config,redirectUnauthenticatedUser:t,route:n,searchParams:r});const{collectionConfig:j,docID:k,globalConfig:S}=(({adminRoute:e,config:t,permissions:n,route:r})=>{if(Tb(r,e)){const a=r.replace(e,"").split("/").filter(Boolean),[o,i,s]=a,l="collections"===o?i:void 0,c="globals"===o?i:void 0,u=l&&"create"!==s?s:void 0;let d,f;return l&&(d=t.collections.find((e=>e.slug===l)),d||(0,eg.notFound)()),c&&(f=t.globals.find((e=>e.slug===c)),f||(0,eg.notFound)()),n.canAccessAdmin||Rb(t,r,e)||(0,eg.notFound)(),{collectionConfig:d,docID:u,globalConfig:f}}})({adminRoute:d,config:i.config,permissions:b,route:n});return{collectionConfig:j,cookies:p,docID:k,globalConfig:S,languageOptions:g,locale:x,permissions:b,req:v,translations:h.translations,visibleEntities:P}},Lb=({children:e})=>{const{id:t,collectionSlug:n,globalSlug:r}=us();return n&&("create"!==t?t:null)||r?e:null},$b=Cv().default||Cv(),Wb=({adminRoute:e,ariaLabel:n,baseClass:r,children:a,href:o,isActive:i,newTab:s})=>{const l=(0,eg.usePathname)(),c=(0,eg.useParams)(),{searchParams:u}=nn(),d="locale"in u&&"string"==typeof u.locale?u.locale:void 0,[f,p,m,h,...g]=c.segments||[],v="collections"===f;let b=`${e}/${v?"collections":"globals"}/${p}`;v&&m&&(b+=`/${m}`);const y=`${b}${o}`,w=`${y}${d?`?locale=${d}`:""}`,x=y===b&&l===b||y!==b&&l.startsWith(y)||i;return(0,t.jsx)("li",{"aria-label":n,className:[r,x&&`${r}--active`].filter(Boolean).join(" "),children:(0,t.jsx)($b,{className:`${r}__link`,href:x&&y===l?"":w,...s&&{rel:"noopener noreferrer",target:"_blank"},tabIndex:x?-1:0,children:a})})},Fb="doc-tab",zb=e=>{const{Pill:n,apiURL:r,collectionConfig:a,condition:i,config:s,globalConfig:l,href:c,i18n:u,isActive:d,label:f,newTab:p,permissions:m}=e,{routes:h}=s;let g="string"==typeof c?c:"",v="boolean"==typeof d&&d;"function"==typeof c&&(g=c({apiURL:r,collection:a,global:l,routes:h})),"function"==typeof d&&(v=d({href:g}));if(!i||i&&Boolean(i({collectionConfig:a,config:s,globalConfig:l,permissions:m}))){const e="function"==typeof f?f({t:u.t}):f;return(0,t.jsx)(Wb,{adminRoute:h.admin,ariaLabel:e,baseClass:Fb,href:g,isActive:v,isCollection:!!a&&!l,newTab:p,children:(0,t.jsxs)("span",{className:`${Fb}__label`,children:[e,n&&(0,t.jsxs)(o.Fragment,{children:[" ",(0,t.jsx)(n,{})]})]})})}return null},Bb=["API","Default","LivePreview","References","Relationships","Version","Versions"],Hb={API:{condition:({collectionConfig:e,globalConfig:t})=>e&&!e?.admin?.hideAPIURL||t&&!t?.admin?.hideAPIURL,href:"/api",label:"API",order:1e3},Default:{href:"",label:({t:e})=>e("general:edit"),order:0},LivePreview:{condition:({collectionConfig:e,config:t,globalConfig:n})=>e?Boolean(t?.admin?.livePreview?.collections?.includes(e.slug)||e?.admin?.livePreview):!!n&&Boolean(t?.admin?.livePreview?.globals?.includes(n.slug)||n?.admin?.livePreview),href:"/preview",label:({t:e})=>e("general:livePreview"),order:100},References:{condition:()=>!1},Relationships:{condition:()=>!1},Version:{condition:()=>!1},Versions:{Pill:()=>{const{versions:e}=us(),n=e?.totalDocs>0;return(0,t.jsx)("span",{className:[`${Fb}__count`,n?`${Fb}__count--has-count`:""].filter(Boolean).join(" "),children:n?e.totalDocs.toString():(0,t.jsx)(o.Fragment,{children:" "})})},condition:({collectionConfig:e,globalConfig:t,permissions:n})=>Boolean(e?.versions&&n?.collections?.[e?.slug]?.readVersions?.permission||t?.versions&&n?.globals?.[t?.slug]?.readVersions?.permission),href:"/versions",label:({t:e})=>e("version:versions"),order:200}},Yb="doc-tabs",Vb=e=>{const{collectionConfig:n,config:r,globalConfig:a,permissions:i}=e,s=(e=>{const{collectionConfig:t,globalConfig:n}=e;let r;if(t){const e="object"==typeof t?.admin?.components?.views?.Edit&&"function"!=typeof t?.admin?.components?.views?.Edit?t?.admin?.components?.views?.Edit:void 0;r=Object.entries(e||{}).reduce(((e,[t,n])=>Bb.includes(t)?e:[...e,{...n,key:t}]),[])}if(n){const e="object"==typeof n?.admin?.components?.views?.Edit&&"function"!=typeof n?.admin?.components?.views?.Edit?n?.admin?.components?.views?.Edit:void 0;r=Object.entries(e||{}).reduce(((e,[t,n])=>Bb.includes(t)?e:[...e,{...n,key:t}]),[])}return r})({collectionConfig:n,globalConfig:a});return(0,t.jsx)(Lb,{children:(0,t.jsx)("div",{className:Yb,children:(0,t.jsx)("div",{className:`${Yb}__tabs-container`,children:(0,t.jsxs)("ul",{className:`${Yb}__tabs`,children:[Object.entries(Hb)?.sort((([,e],[,t])=>void 0===e.order&&void 0===t.order?0:void 0===e.order?1:void 0===t.order?-1:e.order-t.order))?.map((([o,s],l)=>{const c=(e=>{const{name:t,collectionConfig:n,globalConfig:r}=e;if(n){const e="object"==typeof n?.admin?.components?.views?.Edit&&"function"!=typeof n?.admin?.components?.views?.Edit?n?.admin?.components?.views?.Edit:void 0;return e?.[t]}if(r){const e="object"==typeof r?.admin?.components?.views?.Edit&&"function"!=typeof r?.admin?.components?.views?.Edit?r?.admin?.components?.views?.Edit:void 0;return e?.[t]}return null})({name:o,collectionConfig:n,globalConfig:a}),u=c&&"Tab"in c?c.Tab:void 0,d="object"==typeof u?u:void 0,{condition:f}=d||{};return!f||f&&Boolean(f({collectionConfig:n,config:r,globalConfig:a,permissions:i}))?(0,t.jsx)(zb,{...e,...s||{},...u||{}},`tab-${l}`):null})),s?.map(((n,r)=>{if("Tab"in n){const{Tab:a,path:i}=n;if("object"==typeof a&&!(0,oh.isPlainObject)(a))throw new Error(`Custom 'Tab' Component for path: "${i}" must be a React Server Component. To use client-side functionality, render your Client Component within a Server Component and pass it only props that are serializable. More info: https://react.dev/reference/react/use-server#serializable-parameters-and-return-values`);return"function"==typeof a?(0,o.createElement)(a,{path:i,...e,key:`tab-custom-${r}`}):(0,t.jsx)(zb,{...e,...a},`tab-custom-${r}`)}return null}))]})})})})},qb="doc-header",Ub=e=>{const{collectionConfig:n,config:r,customHeader:a,globalConfig:i,hideTabs:s,i18n:l,permissions:c}=e;return(0,t.jsxs)(bl,{className:qb,children:[a&&a,!a&&(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Yf,{className:`${qb}__title`}),!s&&(0,t.jsx)(Vb,{collectionConfig:n,config:r,globalConfig:i,i18n:l,permissions:c})]})]})},Gb=async({id:e,data:t,fields:n,locale:r,siblingData:a,user:o})=>{const i=[];n.forEach((n=>{i.push((async({id:e,data:t,field:n,locale:r,siblingData:a,user:o})=>{switch((0,jc.fieldAffectsData)(n)&&void 0===a[n.name]&&void 0!==n.defaultValue&&(a[n.name]=await(0,oh.getDefaultValue)({defaultValue:n.defaultValue,locale:r,user:o,value:a[n.name]})),n.type){case"group":{"object"!=typeof a[n.name]&&(a[n.name]={});const i=a[n.name];await Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:i,user:o});break}case"array":{const i=a[n.name];if(Array.isArray(i)){const a=[];i.forEach((i=>{a.push(Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:i,user:o}))})),await Promise.all(a)}break}case"blocks":{const i=a[n.name];if(Array.isArray(i)){const a=[];i.forEach((i=>{const s=i.blockType,l=n.blocks.find((e=>e.slug===s));l&&(i.blockType=s,a.push(Gb({id:e,data:t,fields:l.fields,locale:r,siblingData:i,user:o})))})),await Promise.all(a)}break}case"row":case"collapsible":await Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:a,user:o});break;case"tab":{let i;(0,jc.tabHasName)(n)?("object"!=typeof a[n.name]&&(a[n.name]={}),i=a[n.name]):i=a,await Gb({id:e,data:t,fields:n.fields,locale:r,siblingData:i,user:o});break}case"tabs":await Gb({id:e,data:t,fields:n.tabs.map((e=>({...e,type:"tab"}))),locale:r,siblingData:a,user:o})}})({id:e,data:t,field:n,locale:r,siblingData:a,user:o}))})),await Promise.all(i)},Kb=async(e,t)=>{const{relationTo:n}=t,r=Array.isArray(n)?n:[n],a={};return void 0!==e&&await Promise.all(r.map((async n=>{a[n]="function"==typeof e?await e({...t,relationTo:n}):e,!0===a[n]&&(a[n]={}),!1===a[n]&&(a[n]={id:{exists:!1}})}))),a},Xb=vh().default||vh(),Qb=async({id:e,addErrorPathToParent:t,anyParentLocalized:n=!1,data:r,fields:a,filter:o,forceFullValue:i=!1,fullData:s,includeSchema:l=!1,omitParents:c=!1,operation:u,parentPassesCondition:d=!0,path:f="",preferences:p,req:m,skipConditionChecks:h=!1,skipValidation:g=!1,state:v={}})=>{const b=[];a.forEach(((a,y)=>{if(!(0,jc.fieldIsPresentationalOnly)(a)&&!a?.admin?.disabled){let w=!0;h||(w=Boolean((!a?.admin?.condition||Boolean(a.admin.condition(s||{},r||{},{user:m.user})))&&d)),b.push((async e=>{const{id:t,addErrorPathToParent:n,anyParentLocalized:r=!1,data:a,field:o,fieldIndex:i,filter:s,forceFullValue:l=!1,fullData:c,includeSchema:u=!1,omitParents:d=!1,operation:f,passesCondition:p,path:m,preferences:h,req:g,skipConditionChecks:v=!1,skipValidation:b=!1,state:y}=e;if((0,jc.fieldAffectsData)(o)){const i=o.validate,w={errorPaths:[],fieldSchema:u?o:void 0,initialValue:void 0,passesCondition:p,valid:!0,value:void 0};let x=!0;if("function"==typeof i&&!b&&p){let e;if("json"===o.type&&"string"==typeof a[o.name])try{JSON.parse(a[o.name])}catch(t){e=t}x=await i(a?.[o.name],{...o,id:t,data:c,operation:f,req:g,siblingData:a,jsonError:e,preferences:h})}const P=e=>{"function"==typeof n&&n(e),w.errorPaths.includes(e)||(w.errorPaths.push(e),w.valid=!1)};switch("string"==typeof x?(w.errorMessage=x,w.valid=!1,P(`${m}${o.name}`)):w.valid=!0,o.type){case"array":{const n=Array.isArray(a[o.name])?a[o.name]:[],{promises:i,rowMetadata:x}=n.reduce(((n,a,i)=>{const w=`${m}${o.name}.${i}.`;a.id=a?.id||(new Xb).toHexString(),d||s&&!s(e)||(y[`${w}id`]={fieldSchema:u?o.fields.find((e=>"name"in e&&"id"===e.name)):void 0,initialValue:a.id,valid:!0,value:a.id}),n.promises.push(Qb({id:t,addErrorPathToParent:P,anyParentLocalized:o.localized||r,data:a,fields:o.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:w,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y}));const x=h?.fields?.[`${m}${o.name}`]?.collapsed;return n.rowMetadata.push({id:a.id,collapsed:void 0===x?o.admin.initCollapsed:x.includes(a.id)}),n}),{promises:[],rowMetadata:[]});await Promise.all(i),null===a[o.name]?(w.value=null,w.initialValue=null):(w.value=l?n:n.length,w.initialValue=l?n:n.length,n.length>0&&(w.disableFormData=!0)),w.rows=x,d||s&&!s(e)||(y[`${m}${o.name}`]=w);break}case"blocks":{const n=Array.isArray(a[o.name])?a[o.name]:[],{promises:i,rowMetadata:x}=n.reduce(((n,a,i)=>{const w=o.blocks.find((e=>e.slug===a.blockType)),x=`${m}${o.name}.${i}.`;if(w){a.id=a?.id||(new Xb).toHexString(),d||s&&!s(e)||(y[`${x}id`]={fieldSchema:u?w.fields.find((e=>"name"in e&&"id"===e.name)):void 0,initialValue:a.id,valid:!0,value:a.id},y[`${x}blockType`]={fieldSchema:u?w.fields.find((e=>"name"in e&&"blockType"===e.name)):void 0,initialValue:a.blockType,valid:!0,value:a.blockType},y[`${x}blockName`]={fieldSchema:u?w.fields.find((e=>"name"in e&&"blockName"===e.name)):void 0,initialValue:a.blockName,valid:!0,value:a.blockName}),n.promises.push(Qb({id:t,addErrorPathToParent:P,anyParentLocalized:o.localized||r,data:a,fields:w.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:x,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y}));const i=h?.fields?.[`${m}${o.name}`]?.collapsed;n.rowMetadata.push({id:a.id,blockType:a.blockType,collapsed:void 0===i?o.admin.initCollapsed:i.includes(a.id)})}return n}),{promises:[],rowMetadata:[]});await Promise.all(i),null===a[o.name]?(w.value=null,w.initialValue=null):(w.value=l?n:n.length,w.initialValue=l?n:n.length,n.length>0&&(w.disableFormData=!0)),w.rows=x,d||s&&!s(e)||(y[`${m}${o.name}`]=w);break}case"group":s&&!s(e)||(w.disableFormData=!0,y[`${m}${o.name}`]=w),await Qb({id:t,addErrorPathToParent:P,anyParentLocalized:o.localized||r,data:a?.[o.name]||{},fields:o.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:`${m}${o.name}.`,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y});break;case"relationship":if("function"==typeof o.filterOptions){const e=await Kb(o.filterOptions,{id:t,data:c,relationTo:o.relationTo,siblingData:a,user:g.user});w.filterOptions=e}if(o.hasMany){const e=Array.isArray(a[o.name])?a[o.name].map((e=>Array.isArray(o.relationTo)?{relationTo:e.relationTo,value:e.value&&"object"==typeof e.value?e.value?.id:e.value}:"object"==typeof e&&null!==e?e.id:e)):void 0;w.value=e,w.initialValue=e}else if(Array.isArray(o.relationTo)){if(a[o.name]&&"object"==typeof a[o.name]&&"relationTo"in a[o.name]&&"value"in a[o.name]){const e="object"==typeof a[o.name]?.value&&a[o.name]?.value&&"id"in a[o.name].value?a[o.name].value.id:a[o.name].value,t={relationTo:a[o.name]?.relationTo,value:e};w.value=t,w.initialValue=t}}else{const e=a[o.name]&&"object"==typeof a[o.name]&&"id"in a[o.name]?a[o.name].id:a[o.name];w.value=e,w.initialValue=e}s&&!s(e)||(y[`${m}${o.name}`]=w);break;case"upload":{if("function"==typeof o.filterOptions){const e=await Kb(o.filterOptions,{id:t,data:c,relationTo:o.relationTo,siblingData:a,user:g.user});w.filterOptions=e}const n=a[o.name]&&"object"==typeof a[o.name]&&"id"in a[o.name]?a[o.name].id:a[o.name];w.value=n,w.initialValue=n,s&&!s(e)||(y[`${m}${o.name}`]=w);break}default:w.value=a[o.name],w.initialValue=a[o.name],s&&!s(e)||(y[`${m}${o.name}`]=w)}}else if((0,jc.fieldHasSubFields)(o))s&&!s(e)||(y[`${m}_index-${i}`]={disableFormData:!0,errorPaths:[],initialValue:void 0,passesCondition:p,valid:!0,value:void 0}),await Qb({id:t,addErrorPathToParent:n,anyParentLocalized:o.localized||r,data:a,fields:o.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:m,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y});else if("tabs"===o.type){const e=o.tabs.map((e=>{const o=(0,jc.tabHasName)(e);return Qb({id:t,addErrorPathToParent:n,anyParentLocalized:e.localized||r,data:o?a?.[e.name]||{}:a,fields:e.fields,filter:s,forceFullValue:l,fullData:c,includeSchema:u,omitParents:d,operation:f,parentPassesCondition:p,path:o?`${m}${e.name}.`:m,preferences:h,req:g,skipConditionChecks:v,skipValidation:b,state:y})}));await Promise.all(e)}else"ui"===o.type&&(s&&!s(e)||(y[`${m}_index-${i}`]={disableFormData:!0,errorPaths:[],initialValue:void 0,passesCondition:p,valid:!0,value:void 0}))})({id:e,addErrorPathToParent:t,anyParentLocalized:n,data:r,field:a,fieldIndex:y,filter:o,forceFullValue:i,fullData:s,includeSchema:l,omitParents:c,operation:u,passesCondition:w,path:f,preferences:p,req:m,skipConditionChecks:h,skipValidation:g,state:v}))}})),await Promise.all(b)},Jb=async e=>{const{id:t,data:n={},fieldSchema:r,operation:a,preferences:o,req:i}=e;if(r){const e={},s=await(async({id:e,data:t,fields:n,locale:r,user:a})=>(await Gb({id:e,data:t,fields:n,locale:r,siblingData:t,user:a}),t))({id:t,data:n,fields:r,locale:i.locale,siblingData:n,user:i.user});return await Qb({id:t,addErrorPathToParent:null,data:s,fields:r,fullData:n,operation:a,parentPassesCondition:!0,path:"",preferences:o,req:i,state:e}),e}return{}},Zb=({config:e,fields:t,i18n:n,schemaMap:r,schemaPath:a})=>{for(const o of t)switch(o.type){case"group":case"array":r.set(`${a}.${o.name}`,o.fields),Zb({config:e,fields:o.fields,i18n:n,schemaMap:r,schemaPath:`${a}.${o.name}`});break;case"collapsible":case"row":Zb({config:e,fields:o.fields,i18n:n,schemaMap:r,schemaPath:a});break;case"blocks":o.blocks.map((t=>{const i=`${a}.${o.name}.${t.slug}`;r.set(i,t.fields),Zb({config:e,fields:t.fields,i18n:n,schemaMap:r,schemaPath:i})}));break;case"richText":if(!o?.editor)throw new oh.MissingEditorProp(o);if("function"==typeof o.editor)throw new Error("Attempted to access unsanitized rich text editor.");"function"==typeof o.editor.generateSchemaMap&&o.editor.generateSchemaMap({config:e,i18n:n,schemaMap:r,schemaPath:`${a}.${o.name}`});break;case"tabs":o.tabs.map((t=>{const o=(0,jc.tabHasName)(t)?`${a}.${t.name}`:a;(0,jc.tabHasName)(t)&&r.set(o,t.fields),Zb({config:e,fields:t.fields,i18n:n,schemaMap:r,schemaPath:o})}))}};let ey=n.g._payload_fieldSchemaMap;ey||(ey=n.g._payload_fieldSchemaMap=null);const ty=e=>ey||(ey=(e=>{const{config:t,i18n:n}=e,r=new Map;return t.collections.forEach((e=>{Zb({config:t,fields:e.fields,i18n:n,schemaMap:r,schemaPath:e.slug})})),t.globals.forEach((e=>{Zb({config:t,fields:e.fields,i18n:n,schemaMap:r,schemaPath:e.slug})})),r})({config:e.payload.config,i18n:e.i18n}),ey),ny=async e=>{const{id:t,collectionConfig:n,globalConfig:r,locale:a,req:o}=e;try{const e=await(async({req:e})=>{const t=e.data,{collectionSlug:n,formState:r,globalSlug:a,locale:o,operation:i,schemaPath:s}=t,l=e.user?.collection,c=e.payload.config.admin.user;if(l){const t=e.payload.collections[l].config.access?.admin;if(t){if(!await t({req:e}))throw new Error("Unauthorized")}else if(c!==l)throw new Error("Unauthorized")}else if((await e.payload.find({collection:c,depth:0,limit:1,pagination:!1})).docs.length)throw new Error("Unauthorized");const u=ty(e),d=n?t.id:void 0;let f;if(1===s.split(".").length?f=e.payload.collections[s]?e.payload.collections[s].config.fields:e.payload.config.globals.find((e=>e.slug===s))?.fields:u.has(s)&&(f=u.get(s)),!f)throw new Error("Could not find field schema for given path");let p=t.docPreferences,m=t.data;const h={};if(!p){let t;if(n&&d&&(t=`collection-${n}-${d}`),a&&(t=`global-${a}`),t){const n=async()=>{const n=await e.payload.find({collection:"payload-preferences",depth:0,limit:1,where:{key:{equals:t}}});n?.docs?.[0]?.value&&(p=n.docs[0].value)};h.preferences=n()}}if(r&&(m=as(r,!0)),!m){const t=async()=>{let t;n&&d&&(t=await e.payload.findByID({id:d,collection:n,depth:0,draft:!0,fallbackLocale:null,locale:o,overrideAccess:!1,user:e.user})),a&&s===a&&(t=await e.payload.findGlobal({slug:a,depth:0,draft:!0,fallbackLocale:null,locale:o,overrideAccess:!1,user:e.user})),m=t};h.data=t()}Object.keys(h).length>0&&await Promise.all(Object.values(h));const g=await Jb({id:d,data:m,fieldSchema:f,operation:i,preferences:p||{fields:{}},req:e});return n&&r&&(e.payload.collections[n]?.config?.upload&&r.file&&(g.file=r.file),e.payload.collections[n]?.config?.auth&&!e.payload.collections[n].config.auth.disableLocalStrategy&&(r.password&&(g.password=r.password),r["confirm-password"]&&(g["confirm-password"]=r["confirm-password"]),r.email&&(g.email=r.email))),g})({req:{...o,data:{id:t,collectionSlug:n?.slug,globalSlug:r?.slug,locale:a?.code,operation:n&&t||r?"update":"create",schemaPath:n?.slug||r?.slug}}});return{data:as(e,!0),formState:e}}catch(e){return console.error("Error getting document data",e),{}}},ry=async e=>{const{id:t,collectionConfig:n,data:r={},globalConfig:a,req:o}=e;let i,s=!1;if(n)try{i=await(0,oh.docAccessOperation)({id:t?.toString(),collection:{config:n},req:{...o,data:r}}),n.versions?.drafts&&(s=await(0,oh.docAccessOperation)({id:t?.toString(),collection:{config:n},req:{...o,data:{...r,_status:"published"}}}).then((({update:e})=>e?.permission)))}catch(e){console.error(e)}if(a)try{i=await(0,oh.docAccessOperationGlobal)({globalConfig:a,req:{...o,data:r}}),a.versions?.drafts&&(s=await(0,oh.docAccessOperationGlobal)({globalConfig:a,req:{...o,data:{...r,_status:"published"}}}).then((({update:e})=>e?.permission)))}catch(e){console.error(e)}return{docPermissions:i,hasPublishPermission:s,hasSavePermission:Zi({collectionSlug:n?.slug,docPermissions:i,globalSlug:a?.slug,isEditing:es({id:t,collectionSlug:n?.slug,globalSlug:a?.slug})})}},ay=()=>{const{collectionSlug:e,globalSlug:n}=us(),{getComponentMap:r}=wn(),{Edit:a,actionsMap:i}=r({collectionSlug:e,globalSlug:n});return a?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Pg,{actions:i?.Edit?.Default}),a]}):null},oy=()=>(0,t.jsx)(ay,{}),iy=()=>{const{autoMode:e,setTheme:n,theme:r}=(0,Xm.DP)(),{t:a}=(0,Be.B)(),i=(0,o.useCallback)((e=>{n(e)}),[n]);return(0,t.jsx)(If,{label:a("general:adminTheme"),name:"theme",onChange:i,options:[{label:a("general:automatic"),value:"auto"},{label:a("general:light"),value:"light"},{label:a("general:dark"),value:"dark"}],value:e?"auto":r})},sy=e=>{const{languageOptions:n}=e,{i18n:r,switchLanguage:a}=(0,Be.B)();return(0,t.jsx)(_f,{inputId:"language-select",isClearable:!1,onChange:async e=>{await a(e.value)},options:n,value:n.find((e=>e.value===r.language))})},ly="payload-settings",cy=e=>{const{className:n,i18n:r,languageOptions:a}=e;return(0,t.jsxs)("div",{className:[ly,n].filter(Boolean).join(" "),children:[(0,t.jsx)("h3",{children:r.t("general:payloadSettings")}),(0,t.jsxs)("div",{className:`${ly}__language`,children:[(0,t.jsx)(Ns,{htmlFor:"language-select",label:r.t("general:language")}),(0,t.jsx)(sy,{languageOptions:a})]}),(0,t.jsx)(iy,{})]})},uy=({initialState:e,userSlug:n})=>{const{getFieldMap:r}=wn(),{routes:{admin:a,api:o},serverURL:s}=Ut(),{t:l}=(0,Be.B)(),c=r({collectionSlug:n}),u=i().useCallback((async({formState:e})=>Ji({apiRoute:o,body:{collectionSlug:n,formState:e,operation:"create",schemaPath:n},serverURL:s})),[o,n,s]);return(0,t.jsxs)(Ch,{action:`${s}${o}/${n}/first-register`,initialState:e,method:"POST",onChange:[u],redirect:a,validationOperation:"create",children:[(0,t.jsx)(fc,{autoComplete:"email",label:l("general:email"),name:"email",required:!0}),(0,t.jsx)(Ef,{autoComplete:"off",label:l("authentication:newPassword"),name:"password",required:!0}),(0,t.jsx)(sc,{}),(0,t.jsx)(ll,{fieldMap:c,operation:"create",path:"",readOnly:!1,schemaPath:n}),(0,t.jsx)(Lh,{children:l("general:create")})]})},dy="not-found",fy=Cv().default||Cv(),py=e=>{const{marginTop:n="large"}=e,{setStepNav:r}=hn(),{t:a}=(0,Be.B)(),{routes:{admin:i}}=Ut();return(0,o.useEffect)((()=>{r([{label:a("general:notFound")}])}),[r,a]),(0,t.jsx)("div",{className:[dy,n&&`${dy}--margin-top-${n}`].filter(Boolean).join(" "),children:(0,t.jsxs)(bl,{className:`${dy}__wrap`,children:[(0,t.jsx)("h1",{children:a("general:nothingFound")}),(0,t.jsx)("p",{children:a("general:sorryNotFound")}),(0,t.jsx)(Yt,{Link:fy,className:`${dy}__button`,el:"link",to:`${i}`,children:a("general:backToDashboard")})]})})},my=()=>(0,t.jsx)(py,{marginTop:"large"}),hy="minimize-maximize",gy=({className:e,isMinimized:n})=>{const r=[hy,n?`${hy}--minimized`:`${hy}--maximized`,e].filter(Boolean).join(" ");return(0,t.jsx)("svg",{className:r,height:"24",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:n?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),(0,t.jsx)("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),(0,t.jsx)("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),(0,t.jsx)("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]}):(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),(0,t.jsx)("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),(0,t.jsx)("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),(0,t.jsx)("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]})})},vy=({localeOptions:e,onChange:n})=>{const{t:r}=(0,Be.B)();return(0,t.jsx)(fp,{label:r("general:locale"),name:"locale",onChange:e=>n(e),options:e,path:"locale"})},by="{",yy="[",wy="}",xy="]",Py="query-inspector",jy=({type:e,comma:n=!1,position:r})=>{const a="end"===r?"object"===e?wy:xy:"object"===e?by:yy;return(0,t.jsxs)("span",{className:`${Py}__bracket ${Py}__bracket--position-${r}`,children:[a,"end"===r&&n?",":null]})},ky=({isEmpty:e=!1,object:n,objectKey:r,parentType:a="object",trailingComma:i=!1})=>{const s=n?Object.keys(n):[],l=s.length,[c,u]=o.useState(!0),d=e&&("object"===a||"array"===a);return(0,t.jsxs)("li",{className:d?`${Py}__row-line--nested`:"",children:[(0,t.jsxs)("button",{"aria-label":"toggle",className:`${Py}__list-toggle ${e?`${Py}__list-toggle--empty`:""}`,onClick:()=>u(!c),type:"button",children:[e?null:(0,t.jsx)(Tt,{className:`${Py}__toggle-row-icon ${Py}__toggle-row-icon--${c?"open":"closed"}`}),(0,t.jsxs)("span",{children:[r&&`"${r}": `,(0,t.jsx)(jy,{position:"start",type:a}),e?(0,t.jsx)(jy,{comma:i,position:"end",type:a}):null]})]}),(0,t.jsx)("ul",{className:`${Py}__json-children`,children:c&&s.map(((e,o)=>{let i=n[e],s="string";const c=o===l-1;if(null===i?s="null":i instanceof Date?(s="date",i=i.toISOString()):s=Array.isArray(i)?"array":"object"==typeof i?"object":"number"==typeof i?"number":"boolean"==typeof i?"boolean":"string","object"===s||"array"===s)return(0,t.jsx)(ky,{isEmpty:0===i.length||0===Object.keys(i).length,object:i,objectKey:"object"===a?e:void 0,parentType:s,trailingComma:!c},`${e}-${o}`);if("date"===s||"string"===s||"null"===s||"number"===s||"boolean"===s){const n=Boolean("object"===a&&e),l=[`${Py}__row-line`,`${Py}__value-type--${s}`,`${Py}__row-line--${r?"nested":"top"}`].filter(Boolean).join(" ");return(0,t.jsxs)("li",{className:l,children:[n?(0,t.jsx)("span",{children:`"${e}": `}):null,(0,t.jsx)("span",{className:`${Py}__value`,children:JSON.stringify(i)}),c?"":","]},`${e}-${o}`)}}))}),!e&&(0,t.jsx)("span",{children:(0,t.jsx)(jy,{comma:i,position:"end",type:a})})]})},Sy="query-inspector",Cy=()=>{const{id:e,collectionSlug:n,globalSlug:r,initialData:a}=us(),i=(0,eg.useSearchParams)(),{i18n:s,t:l}=(0,Be.B)(),{code:c}=ls(),{getComponentMap:u}=wn(),d=u({collectionSlug:n,globalSlug:r}),{collections:f,globals:p,localization:m,routes:{api:h},serverURL:g}=Ut(),v=n&&f.find((e=>e.slug===n)),b=r&&p.find((e=>e.slug===r)),y=m&&m.locales.map((e=>({label:e.label,value:e.code})));let w=!1,x="";v&&(w=Boolean(v.versions?.drafts),x=`/${n}/${e}`),b&&(w=Boolean(b.versions?.drafts),x=`/globals/${r}`);const[P,j]=o.useState(a),[k,S]=o.useState("true"===i.get("draft")),[C,M]=o.useState(i?.get("locale")||c),[_,O]=o.useState(i.get("depth")||"1"),[E,D]=o.useState(!0),[N,A]=o.useState(!1),T=`${g}${h}${x}?${new URLSearchParams({depth:_,draft:String(k),locale:C}).toString()}`;return o.useEffect((()=>{(async()=>{try{const e=await fetch(T,{credentials:E?"include":"omit",headers:{"Accept-Language":s.language},method:"GET"});try{const t=await e.json();j(t)}catch(e){Ct.error("Error parsing response"),console.error(e)}}catch(e){Ct.error("Error making request"),console.error(e)}})()}),[s.language,T,E]),(0,t.jsxs)(bl,{className:[Sy,N&&`${Sy}--fullscreen`].filter(Boolean).join(" "),right:!1,children:[(0,t.jsx)(gg,{collectionSlug:n,globalLabel:b?.label,globalSlug:r,id:e,pluralLabel:v?v?.labels?.plural:void 0,useAsTitle:v?v?.admin?.useAsTitle:void 0,view:"API"}),(0,t.jsx)(Pg,{actions:d?.actionsMap?.Edit?.API}),(0,t.jsxs)("div",{className:`${Sy}__configuration`,children:[(0,t.jsxs)("div",{className:`${Sy}__api-url`,children:[(0,t.jsxs)("span",{className:`${Sy}__label`,children:["API URL ",(0,t.jsx)(Dp,{value:T})]}),(0,t.jsx)("a",{href:T,rel:"noopener noreferrer",target:"_blank",children:T})]}),(0,t.jsx)(Ch,{initialState:{authenticated:{initialValue:E||!1,valid:!0,value:E||!1},depth:{initialValue:Number(_||0),valid:!0,value:Number(_||0)},draft:{initialValue:k||!1,valid:!0,value:k||!1},locale:{initialValue:C,valid:!0,value:C}},children:(0,t.jsxs)("div",{className:`${Sy}__form-fields`,children:[(0,t.jsxs)("div",{className:`${Sy}__filter-query-checkboxes`,children:[w&&(0,t.jsx)(Is,{label:l("version:draft"),name:"draft",onChange:()=>S(!k),path:"draft"}),(0,t.jsx)(Is,{label:l("authentication:authenticated"),name:"authenticated",onChange:()=>D(!E),path:"authenticated"})]}),y&&(0,t.jsx)(vy,{localeOptions:y,onChange:M}),(0,t.jsx)(Of,{label:l("general:depth"),max:10,min:0,name:"depth",onChange:e=>O(e?.toString()),path:"depth",step:1})]})})]}),(0,t.jsxs)("div",{className:`${Sy}__results-wrapper`,children:[(0,t.jsx)("div",{className:`${Sy}__toggle-fullscreen-button-container`,children:(0,t.jsx)("button",{"aria-label":"toggle fullscreen",className:`${Sy}__toggle-fullscreen-button`,onClick:()=>A(!N),type:"button",children:(0,t.jsx)(gy,{isMinimized:!N})})}),(0,t.jsx)("div",{className:`${Sy}__results`,children:(0,t.jsx)(ky,{object:P})})]})]})},My=()=>(0,t.jsx)(Cy,{}),_y=(0,o.createContext)({appIsReady:!1,breakpoint:void 0,breakpoints:void 0,fieldSchemaJSON:void 0,iframeHasLoaded:!1,iframeRef:void 0,isPopupOpen:!1,measuredDeviceSize:{height:0,width:0},openPopupWindow:()=>{},popupRef:void 0,previewWindowType:"iframe",setAppIsReady:()=>{},setBreakpoint:()=>{},setHeight:()=>{},setIframeHasLoaded:()=>{},setMeasuredDeviceSize:()=>{},setPreviewWindowType:()=>{},setSize:()=>{},setToolbarPosition:()=>{},setWidth:()=>{},setZoom:()=>{},size:{height:0,width:0},toolbarPosition:{x:0,y:0},url:void 0,zoom:1}),Oy=()=>(0,o.useContext)(_y),Ey=({collisionRect:e,droppableContainers:t,...n})=>{const r=t.find((({id:e})=>"live-preview-area"===e)),a=kr({...n,collisionRect:e,droppableContainers:[r]});if(0===a.length)return a;const o=r?.rect?.current;return e.top>=o.top&&e.left>=o.left&&e.bottom<=o.bottom&&e.right<=o.right?a:void 0},Dy=(e,t)=>{switch(t.type){case"width":return{...e,width:t.value};case"height":return{...e,height:t.value};default:return{...e,...t?.value||{}}}},Ny=({breakpoints:e,children:n,fieldSchema:r,isPopupOpen:a,openPopupWindow:s,popupRef:l,url:c})=>{const[u,d]=(0,o.useState)("iframe"),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(!1),g=i().useRef(null),[v,b]=(0,o.useState)(!1),[y,w]=(0,o.useState)(1),[x,P]=(0,o.useState)({x:0,y:0}),[j,k]=i().useReducer(Dy,{height:0,width:0}),[S,C]=(0,o.useState)({height:0,width:0}),[M,_]=i().useState("responsive"),[O]=(0,o.useState)((()=>(0,jc.fieldSchemaToJSON)(r))),E=(0,o.useCallback)((e=>{k({type:"width",value:e})}),[k]),D=(0,o.useCallback)((e=>{k({type:"height",value:e})}),[k]);(0,o.useEffect)((()=>{const t=e?.find((e=>e.name===M));t&&"responsive"!==M&&"custom"!==M&&"number"==typeof t?.width&&"number"==typeof t?.height&&k({type:"reset",value:{height:t.height,width:t.width}})}),[M,e]),(0,o.useEffect)((()=>{const e=e=>{c?.startsWith(e.origin)&&e.data&&"object"==typeof e.data&&"payload-live-preview"===e.data.type&&e.data.ready&&p(!0)};return window.addEventListener("message",e),h(!0),()=>{window.removeEventListener("message",e)}}),[c,m]);const N=(0,o.useCallback)((e=>{p(!1),d(e),"popup"===e&&s()}),[s]);return(0,o.useEffect)((()=>{(a?"popup":"iframe")!==u&&N("iframe")}),[u,a,N]),(0,t.jsx)(_y.Provider,{value:{appIsReady:f,breakpoint:M,breakpoints:e,fieldSchemaJSON:O,iframeHasLoaded:v,iframeRef:g,isPopupOpen:a,measuredDeviceSize:S,openPopupWindow:s,popupRef:l,previewWindowType:u,setAppIsReady:p,setBreakpoint:_,setHeight:D,setIframeHasLoaded:b,setMeasuredDeviceSize:C,setPreviewWindowType:N,setSize:k,setToolbarPosition:P,setWidth:E,setZoom:w,size:j,toolbarPosition:x,url:c,zoom:y},children:(0,t.jsx)(za,{collisionDetection:Ey,onDragEnd:e=>{if(e.over&&"live-preview-area"===e.over.id){const t={x:x.x+e.delta.x,y:x.y+e.delta.y};P(t)}},children:m&&n})})},Ay=e=>{const[t,n]=(0,o.useState)();return(0,o.useEffect)((()=>{let t;return e&&(t=new ResizeObserver((e=>{e.forEach((e=>{const{contentBoxSize:t,contentRect:r}=e;let a=0,o=0;if(t){const e=Array.isArray(t)?t[0]:t;if(e){const{blockSize:t,inlineSize:n}=e;a=n,o=t}}else if(r){const{height:e,width:t}=r;a=t,o=e}n({height:o,width:a})}))})),t.observe(e)),()=>{t&&t.unobserve(e)}}),[e]),{size:t}},Ty=e=>{const{children:n}=e,r=i().useRef(null),a=i().useRef(null),{breakpoint:s,setMeasuredDeviceSize:l,size:c,zoom:u}=Oy(),{size:d}=Ay(r.current),{size:f}=Ay(a.current);let p=!1;(0,o.useEffect)((()=>{d&&l(d)}),[d,l]);let m="0",h="0";if(s&&"responsive"!==s&&(m="-50%","number"==typeof u&&"number"==typeof c.width&&"number"==typeof c.height&&"number"==typeof d.width&&"number"==typeof d.height)){h="0 auto";const e=c.width/u,t=d.width*u,n=e-c.width;if(p=t>f.width,p)if(u>1){const e=d.width-f.width;m=e<0?e/2+"px":"0"}else m="0";else if(u>=1)m=n/2+"px";else{m=(f.width-t)/2+"px",h="0"}}let g=u?100/u+"%":"100%",v=u?100/u+"%":"100%";return"responsive"!==s&&(g=c?.width/("number"==typeof u?u:1)+"px",v=c?.height/("number"==typeof u?u:1)+"px"),(0,t.jsx)("div",{ref:a,style:{height:"100%",width:"100%"},children:(0,t.jsx)("div",{ref:r,style:{height:v,margin:h,transform:`translate3d(${m}, 0, 0)`,width:g},children:n})})},Ry=(0,o.forwardRef)(((e,n)=>{const{setIframeHasLoaded:r,url:a}=e,{zoom:o}=Oy();return(0,t.jsx)("iframe",{className:"live-preview-iframe",onLoad:()=>{r(!0)},ref:n,src:a,style:{transform:"number"==typeof o?`scale(${o}) `:void 0},title:a})})),Iy=e=>{const{axis:n}=e,{breakpoint:r,measuredDeviceSize:a,setBreakpoint:s,setSize:l,size:c,zoom:u}=Oy(),[d,f]=i().useState(("x"===n?a?.width:a?.height)||0),p=(0,o.useCallback)((e=>{let t=Number(e.target.value);t<0&&(t=0),f(t),s("custom"),l({type:"reset",value:{height:"y"===n?t:Number(a?.height.toFixed(0))*u,width:"x"===n?t:Number(a?.width.toFixed(0))*u}})}),[n,s,a,l,u]);return(0,o.useEffect)((()=>{"responsive"===r&&a&&f("x"===n?Number(a.width.toFixed(0))*u:Number(a.height.toFixed(0))*u),"responsive"!==r&&c&&f("x"===n?c.width:c.height)}),[r,n,a,c,u]),(0,t.jsx)("input",{className:"toolbar-input",min:0,name:"x"===n?"live-preview-width":"live-preview-height",onChange:p,step:1,type:"number",value:d||0})},Ly="live-preview-toolbar-controls",$y=[50,75,100,125,150,200],Wy=()=>{const{breakpoint:e,breakpoints:n,setBreakpoint:r,setPreviewWindowType:a,setZoom:o,url:s,zoom:l}=Oy(),{t:c}=(0,Be.B)(),u={label:c("general:custom"),value:"custom"};return(0,t.jsxs)("div",{className:Ly,children:[n?.length>0&&(0,t.jsx)(Ys,{button:(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("span",{children:n.find((t=>t.name==e))?.label??u.label})," ",(0,t.jsx)(Tt,{className:`${Ly}__chevron`})]}),className:`${Ly}__breakpoint`,horizontalAlign:"right",render:({close:a})=>(0,t.jsx)(Us,{children:(0,t.jsxs)(i().Fragment,{children:[n.map((n=>(0,t.jsx)(Gs,{active:n.name==e,onClick:()=>{r(n.name),a()},children:n.label},n.name))),"custom"===e&&(0,t.jsx)(Gs,{active:e==u.value,onClick:()=>{r(u.value),a()},children:u.label})]})}),showScrollbar:!0,verticalAlign:"bottom"}),(0,t.jsxs)("div",{className:`${Ly}__device-size`,children:[(0,t.jsx)(Iy,{axis:"x"}),(0,t.jsx)("span",{className:`${Ly}__size-divider`,children:(0,t.jsx)($t.u,{})}),(0,t.jsx)(Iy,{axis:"y"})]}),(0,t.jsx)(Ys,{button:(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)("span",{children:[100*l,"%"]})," ",(0,t.jsx)(Tt,{className:`${Ly}__chevron`})]}),className:`${Ly}__zoom`,horizontalAlign:"right",render:({close:e})=>(0,t.jsx)(Us,{children:(0,t.jsx)(i().Fragment,{children:$y.map((n=>(0,t.jsxs)(Gs,{active:100*l==n,onClick:()=>{o(n/100),e()},children:[n,"%"]},n)))})}),showScrollbar:!0,verticalAlign:"bottom"}),(0,t.jsx)("a",{className:`${Ly}__external`,href:s,onClick:e=>{e.preventDefault(),a("popup")},type:"button",children:(0,t.jsx)(It,{})})]})},Fy="live-preview-toolbar",zy=e=>{const{toolbarPosition:n}=Oy(),{attributes:r,listeners:a,setNodeRef:o,transform:i}=Va({id:"live-preview-toolbar"});return(0,t.jsxs)("div",{className:[Fy,`${Fy}--draggable`].join(" "),style:{left:`${n.x}px`,top:`${n.y}px`,...i?{transform:i?`translate3d(${i?.x||0}px, ${i?.y||0}px, 0)`:void 0}:{}},children:[(0,t.jsx)("button",{...a,...r,className:`${Fy}__drag-handle`,ref:o,type:"button",children:(0,t.jsx)(Js,{})}),(0,t.jsx)(Wy,{...e})]})},By=e=>(0,t.jsx)("div",{className:[Fy,`${Fy}--static`].join(" "),children:(0,t.jsx)(Wy,{...e})}),Hy=e=>{const{draggable:n}=e;return n?(0,t.jsx)(zy,{...e}):(0,t.jsx)(By,{...e})},Yy="live-preview-window",Vy=e=>{const{appIsReady:n,iframeHasLoaded:r,iframeRef:a,popupRef:s,previewWindowType:l,setIframeHasLoaded:c,url:u}=Oy(),{mostRecentUpdate:d}=On(),{breakpoint:f,fieldSchemaJSON:p}=Oy(),m=i().useRef(void 0),[h]=Ho();if((0,o.useEffect)((()=>{if(h&&window&&"postMessage"in window&&n){const e=as(h,!0),t=!m.current||m.current!==l;m.current=l;const n={type:"payload-live-preview",data:e,externallyUpdatedRelationship:d,fieldSchemaJSON:t?p:void 0};"popup"===l&&s.current&&s.current.postMessage(n,u),"iframe"===l&&a.current&&a.current.contentWindow?.postMessage(n,u)}}),[h,u,r,l,s,n,a,c,p,d]),(0,o.useEffect)((()=>{const e={type:"payload-document-event"};"popup"===l&&s.current&&s.current.postMessage(e,u),"iframe"===l&&a.current&&a.current.contentWindow?.postMessage(e,u)}),[d,a,s,l,u]),"iframe"===l)return(0,t.jsx)("div",{className:[Yy,f&&"responsive"!==f&&`${Yy}--has-breakpoint`].filter(Boolean).join(" "),children:(0,t.jsxs)("div",{className:`${Yy}__wrapper`,children:[(0,t.jsx)(Hy,{...e}),(0,t.jsx)("div",{className:`${Yy}__main`,children:(0,t.jsx)(Ty,{children:u?(0,t.jsx)(Ry,{ref:a,setIframeHasLoaded:c,url:u}):(0,t.jsx)(Ql.l,{height:"100%"})})})]})})},qy="live-preview",Uy=({apiRoute:e,collectionConfig:n,config:r,fieldMap:a,globalConfig:i,schemaPath:s,serverURL:l})=>{const{id:c,AfterDocument:u,AfterFields:d,BeforeDocument:f,BeforeFields:p,action:m,apiURL:h,collectionSlug:g,disableActions:v,disableLeaveWithoutSaving:b,docPermissions:y,getDocPreferences:w,globalSlug:x,hasPublishPermission:P,hasSavePermission:j,initialData:k,initialState:S,isEditing:C,isInitializing:M,onSave:_}=us(),O=c?"update":"create",{admin:{user:E}}=Ut(),{t:D}=(0,Be.B)(),{previewWindowType:N}=Oy(),{refreshCookieAsync:A,user:T}=sn(),{reportUpdate:R}=On(),I=(0,o.useCallback)((e=>{R({id:c,entitySlug:g,updatedAt:e?.result?.updatedAt||(new Date).toISOString()}),T&&g===E&&c===T.id&&A(),"function"==typeof _&&_({...e,operation:c?"update":"create"})}),[g,c,_,A,R,T,E]),L=(0,o.useCallback)((async({formState:t})=>{const n=await w();return Ji({apiRoute:e,body:{id:c,docPreferences:n,formState:t,operation:O,schemaPath:s},serverURL:l})}),[l,e,c,O,s,w]);return(0,t.jsx)(o.Fragment,{children:(0,t.jsx)(ps,{operation:O,children:(0,t.jsxs)(Ch,{action:m,className:`${qy}__form`,disabled:!j,initialState:S,isInitializing:M,method:c?"PATCH":"POST",onChange:[L],onSuccess:I,children:[(n&&!(n.versions?.drafts&&n.versions?.drafts?.autosave)||i&&!(i.versions?.drafts&&i.versions?.drafts?.autosave))&&!b&&(0,t.jsx)(og,{}),(0,t.jsx)(gg,{collectionSlug:g,globalLabel:i?.label,globalSlug:x,id:c,pluralLabel:n?n?.labels?.plural:void 0,useAsTitle:n?n?.admin?.useAsTitle:void 0,view:D("general:livePreview")}),(0,t.jsx)(vg,{collectionConfig:n,config:r,fallback:c?.toString()||"",globalConfig:i}),(0,t.jsx)(Qh,{apiURL:h,data:k,disableActions:v,hasPublishPermission:P,hasSavePermission:j,id:c,isEditing:C,permissions:y,slug:n?.slug||i?.slug}),(0,t.jsxs)("div",{className:[qy,"popup"===N&&`${qy}--detached`].filter(Boolean).join(" "),children:[(0,t.jsxs)("div",{className:[`${qy}__main`,"popup"===N&&`${qy}__main--popup-open`].filter(Boolean).join(" "),children:[f,(0,t.jsx)(Zh,{AfterFields:d,BeforeFields:p,docPermissions:y,fieldMap:a,forceSidebarWrap:!0,readOnly:!j,schemaPath:g||x}),u]}),(0,t.jsx)(Vy,{collectionSlug:g,globalSlug:x})]})]})})})},Gy=e=>{const{breakpoints:n,url:r}=e,{collectionSlug:a,globalSlug:i}=us(),s=Ut(),{isPopupOpen:l,openPopupWindow:c,popupRef:u}=(e=>{const{eventType:t,onMessage:n,url:r}=e,a=(0,o.useRef)(!1),[i,s]=(0,o.useState)(!1),{serverURL:l}=Ut(),c=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=async e=>{e.origin===window.location.origin&&e.origin===r&&e.origin===l&&("function"!=typeof n||e.data?.type!==t||a.current||(a.current=!0,await n(e.data?.searchParams),a.current=!1))};return i&&c.current&&window.addEventListener("message",e,!1),()=>{window.removeEventListener("message",e)}}),[n,t,r,l,i]);const u=(0,o.useCallback)((e=>{e&&e.preventDefault();const t={height:700,left:"auto",menubar:"no",popup:"yes",toolbar:"no",top:"auto",width:800},n=Object.entries(t).reduce(((e,[n,r])=>{let a=e;return"auto"===r?("top"===n?a+=`top=${Math.round(window.innerHeight/2-t.height/2)},`:"left"===n&&(a+=`left=${Math.round(window.innerWidth/2-t.width/2)},`),a):(a+=`${n}=${r},`,a)}),"").slice(0,-1),a=window.open(r,"_blank",n);c.current=a,s(!0)}),[r]);return(0,o.useEffect)((()=>{let e;return i?e=setInterval((function(){c.current.closed&&(clearInterval(e),s(!1))}),1e3):clearInterval(e),()=>{e&&clearInterval(e)}}),[i,c]),{isPopupOpen:i,openPopupWindow:u,popupRef:c}})({eventType:"payload-live-preview",url:r}),{collections:d,globals:f,routes:{api:p},serverURL:m}=s,h=a&&d.find((e=>e.slug===a)),g=i&&f.find((e=>e.slug===i)),v=a||i,{getComponentMap:b}=wn(),y=b({collectionSlug:a,globalSlug:i}),{getFieldMap:w}=wn(),x=w({collectionSlug:h?.slug,globalSlug:g?.slug});return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Pg,{actions:y?.actionsMap?.Edit?.LivePreview}),(0,t.jsx)(Ny,{breakpoints:n,fieldSchema:h?.fields||g?.fields,isPopupOpen:l,openPopupWindow:c,popupRef:u,url:r,children:(0,t.jsx)(Uy,{apiRoute:p,collectionConfig:h,config:s,fieldMap:x,globalConfig:g,schemaPath:v,serverURL:m})})]})},Ky=async e=>{const{initPageResult:n}=e,{collectionConfig:r,docID:a,globalConfig:o,locale:i,req:{payload:{config:{admin:{livePreview:s}}}={}}={}}=n;let l;try{r&&(l=await n.req.payload.findByID({id:a,collection:r.slug,depth:0,draft:!0,fallbackLocale:null})),o&&(l=await n.req.payload.findGlobal({slug:o.slug,depth:0,draft:!0,fallbackLocale:null}))}catch(e){(0,eg.notFound)()}let c=s;r&&(c={...c||{},...r.admin.livePreview||{}}),o&&(c={...c||{},...o.admin.livePreview||{}});const u=[...c?.breakpoints||[],{name:"responsive",height:"100%",label:"Responsive",width:"100%"}],d="function"==typeof c?.url?await c.url({collectionConfig:r,data:l,globalConfig:o,locale:i,payload:n.req.payload}):c?.url;return(0,t.jsx)(Gy,{breakpoints:u,initialData:l,url:d})},Xy=Cv().default||Cv(),Qy="unauthorized",Jy=({initPageResult:e})=>{const{req:{i18n:n,payload:{config:{admin:{routes:{logout:r}}}}}}=e;return(0,t.jsxs)(bl,{className:Qy,children:[(0,t.jsx)("h2",{children:n.t("error:unauthorized")}),(0,t.jsx)("p",{children:n.t("error:notAllowedToAccessPage")}),(0,t.jsx)(Yt,{Link:Xy,className:`${Qy}__button`,el:"link",to:r,children:n.t("authentication:logOut")})]})},Zy=({children:e})=>(0,t.jsx)("div",{className:"field-diff-label",children:e}),ew="nested-diff",tw=({comparison:e,diffComponents:n,disableGutter:r=!1,field:o,fieldMap:i,i18n:s,locale:l,locales:c,permissions:u,version:d})=>(0,t.jsxs)("div",{className:ew,children:["label"in o.fieldComponentProps&&o.fieldComponentProps.label&&"function"!=typeof o.fieldComponentProps.label&&(0,t.jsxs)(Zy,{children:[l&&(0,t.jsx)("span",{className:`${ew}__locale-label`,children:l}),(0,a.sC)(o.fieldComponentProps.label,s)]}),(0,t.jsx)("div",{className:[`${ew}__wrap`,!r&&`${ew}__wrap--gutter`].filter(Boolean).join(" "),children:(0,t.jsx)(aw,{comparison:e,diffComponents:n,fieldMap:i,fieldPermissions:u,i18n:s,locales:c,version:d})})]}),nw={radio:"WORDS_WITH_SPACE",relationship:"WORDS_WITH_SPACE",select:"WORDS_WITH_SPACE",upload:"WORDS_WITH_SPACE"},rw="render-field-diffs",aw=({comparison:e,diffComponents:n,fieldMap:r,fieldPermissions:a,i18n:o,locales:i,version:s})=>(0,t.jsx)("div",{className:rw,children:r?.map(((l,c)=>{if("name"in l&&"id"===l.name)return null;const u=n[l.type],d="richText"===l.type,f=nw[l.type]||"CHARS";if(u){if(l.isFieldAffectingData&&"name"in l){const p=l.name,m="code"===l.type||"json"===l.type,h=m?JSON.stringify(s?.[p]):s?.[p],g=m?JSON.stringify(e?.[p]):e?.[p],v=a?.[p]?.read?.permission,b=a?.[p]?.fields;if(!1===v)return null;const y={comparison:g,diffComponents:n,diffMethod:f,field:l,fieldMap:"fieldMap"in l.fieldComponentProps?l.fieldComponentProps?.fieldMap:r,fieldPermissions:b,i18n:o,isRichText:d,locales:i,version:h};return l.localized?(0,t.jsx)("div",{className:`${rw}__field`,children:i.map(((e,n)=>{const r=h?.[e],a=g?.[e],o={...y,comparison:a,version:r};return(0,t.jsx)("div",{className:`${rw}__locale`,children:(0,t.jsx)("div",{className:`${rw}__locale-value`,children:(0,t.jsx)(u,{...o,locale:e})})},[e,n].join("-"))}))},c):(0,t.jsx)("div",{className:`${rw}__field`,children:(0,t.jsx)(u,{...y})},c)}if("tabs"===l.type&&"fieldMap"in l.fieldComponentProps){const r=n.tabs;return(0,t.jsx)(r,{comparison:e,diffComponents:n,field:l,fieldMap:l.fieldComponentProps.fieldMap,i18n:o,locales:i,version:s},c)}if("fieldMap"in l.fieldComponentProps)return(0,t.jsx)(tw,{comparison:e,diffComponents:n,disableGutter:!0,field:l,fieldMap:l.fieldComponentProps.fieldMap,i18n:o,locales:i,permissions:a,version:s},c)}return null}))}),ow="iterable-diff",iw=({comparison:e,diffComponents:n,field:r,i18n:o,locale:s,locales:l,permissions:c,version:u})=>{const d=Array.isArray(u)?u.length:0,f=Array.isArray(e)?e.length:0,p=Math.max(d,f);return(0,t.jsxs)("div",{className:ow,children:["label"in r.fieldComponentProps&&r.fieldComponentProps.label&&"function"!=typeof r.fieldComponentProps.label&&(0,t.jsxs)(Zy,{children:[s&&(0,t.jsx)("span",{className:`${ow}__locale-label`,children:s}),(0,a.sC)(r.fieldComponentProps.label,o)]}),p>0&&(0,t.jsx)(i().Fragment,{children:Array.from(Array(p).keys()).map(((a,i)=>{const s=u?.[i]||{},d=e?.[i]||{};let f=[];if("array"===r.type&&"fieldMap"in r.fieldComponentProps&&(f=r.fieldComponentProps.fieldMap),"blocks"===r.type)if(f=[],s?.blockType===d?.blockType){const e="blocks"in r.fieldComponentProps&&r.fieldComponentProps.blocks?.find((e=>e.slug===s?.blockType))||{fieldMap:[]};f=[...f,...e.fieldMap]}else{const e="blocks"in r.fieldComponentProps&&r.fieldComponentProps.blocks?.find((e=>e.slug===s?.blockType))||{fieldMap:[]},t="blocks"in r.fieldComponentProps&&r.fieldComponentProps.blocks?.find((e=>e.slug===d?.blockType))||{fieldMap:[]};f=(0,jc.getUniqueListBy)([...f,...e.fieldMap,...t.fieldMap],"name")}return(0,t.jsx)("div",{className:`${ow}__wrap`,children:(0,t.jsx)(aw,{comparison:d,diffComponents:n,fieldMap:f,fieldPermissions:c,i18n:o,locales:l,version:s})},i)}))}),0===p&&(0,t.jsx)("div",{className:`${ow}__no-rows`,children:o.t("version:noRowsFound",{label:"labels"in r.fieldComponentProps&&r.fieldComponentProps.labels?.plural?(0,a.sC)(r.fieldComponentProps.labels.plural,o):o.t("general:rows")})})]})},sw={variables:{dark:{addedBackground:"var(--theme-success-900)",addedColor:"var(--theme-success-100)",diffViewerBackground:"transparent",diffViewerColor:"var(--theme-text)",emptyLineBackground:"var(--theme-elevation-50)",removedBackground:"var(--theme-error-900)",removedColor:"var(--theme-error-100)",wordAddedBackground:"var(--theme-success-800)",wordRemovedBackground:"var(--theme-error-800)"},light:{addedBackground:"var(--theme-success-100)",addedColor:"var(--theme-success-900)",diffViewerBackground:"transparent",diffViewerColor:"var(--theme-text)",emptyLineBackground:"var(--theme-elevation-50)",removedBackground:"var(--theme-error-100)",removedColor:"var(--theme-error-900)",wordAddedBackground:"var(--theme-success-200)",wordRemovedBackground:"var(--theme-error-200)"}}};var lw=n(42552);const cw=lw.Ay.default||lw.Ay,uw=({comparisonToRender:e,diffMethod:n,diffStyles:r,placeholder:a,versionToRender:o})=>(0,t.jsx)(cw,{compareMethod:lw.J7[n],hideLineNumbers:!0,newValue:void 0!==o?o:a,oldValue:e,showDiffOnly:!1,splitView:!0,styles:r}),dw="select-diff",fw=(e,t,n)=>n&&Array.isArray(e)?e.map((e=>t.find((t=>("string"==typeof t?t:t.value)===e))||String(e))):t.find((t=>("string"==typeof t?t:t.value)===e))||String(e),pw=(e,t)=>Array.isArray(e)?e.map((e=>"string"==typeof e?e:(0,a.sC)(e.label,t))).join(", "):"string"==typeof e?e:(0,a.sC)(e.label,t),mw=({comparison:e,diffMethod:n,field:r,i18n:o,locale:i,version:s})=>{let l="";s===e&&(l=`[${o.t("general:noValue")}]`);const c="options"in r.fieldComponentProps&&r.fieldComponentProps.options,u=void 0!==e?pw(fw(e,c,r.hasMany),o):l,d=void 0!==s?pw(fw(s,c,r.hasMany),o):l;return(0,t.jsxs)("div",{className:dw,children:[(0,t.jsxs)(Zy,{children:[i&&(0,t.jsx)("span",{className:`${dw}__locale-label`,children:i}),"label"in r&&(0,a.sC)(r.label||"",o)]}),(0,t.jsx)(uw,{comparisonToRender:u,diffMethod:n,diffStyles:sw,placeholder:l,versionToRender:d})]})},hw="tabs-diff",gw=({comparison:e,diffComponents:n,field:r,i18n:a,locale:o,locales:i,permissions:s,version:l})=>(0,t.jsx)("div",{className:hw,children:(0,t.jsx)("div",{className:`${hw}__wrap`,children:r.tabs.map(((c,u)=>"name"in c?(0,t.jsx)(tw,{comparison:e?.[c.name],diffComponents:n,field:r,fieldMap:c.fieldMap,i18n:a,locale:o,locales:i,permissions:s,version:l?.[c.name]},u):(0,t.jsx)(aw,{comparison:e,diffComponents:n,fieldMap:c.fieldMap,fieldPermissions:s,i18n:a,locales:i,version:l},u)))})}),vw=lw.Ay.default||lw.Ay,bw=({comparisonToRender:e,diffMethod:n,diffStyles:r,placeholder:a,versionToRender:o})=>(0,t.jsx)(vw,{compareMethod:lw.J7[n],hideLineNumbers:!0,newValue:void 0!==o?String(o):a,oldValue:void 0!==e?String(e):a,showDiffOnly:!1,splitView:!0,styles:r}),yw="text-diff",ww=({comparison:e,diffMethod:n,field:r,i18n:o,isRichText:i=!1,locale:s,version:l})=>{let c="";l===e&&(c=`[${o.t("general:noValue")}]`);let u=l,d=e;return i&&("object"==typeof l&&(u=JSON.stringify(l,null,2)),"object"==typeof e&&(d=JSON.stringify(e,null,2))),(0,t.jsxs)("div",{className:yw,children:[(0,t.jsxs)(Zy,{children:[s&&(0,t.jsx)("span",{className:`${yw}__locale-label`,children:s}),"label"in r.fieldComponentProps&&"function"!=typeof r.fieldComponentProps.label&&(0,a.sC)(r.fieldComponentProps.label||"",o)]}),(0,t.jsx)(bw,{comparisonToRender:d,diffMethod:n,diffStyles:sw,placeholder:c,versionToRender:u})]})},xw={array:iw,blocks:iw,checkbox:ww,code:ww,collapsible:tw,date:ww,email:ww,group:tw,json:ww,number:ww,point:ww,radio:mw,relationship:null,richText:ww,row:tw,select:mw,tabs:gw,text:ww,textarea:ww,upload:null},Pw="restore-version",jw="restore-version",kw=({className:e,collectionSlug:n,globalSlug:r,label:i,originalDocID:s,versionDate:l,versionID:c})=>{const{routes:{admin:u,api:d},serverURL:f}=Ut(),{toggleModal:p}=O(),[m,h]=(0,o.useState)(!1),g=(0,eg.useRouter)(),{i18n:v,t:b}=(0,Be.B)(),y=b("version:aboutToRestoreGlobal",{label:(0,a.sC)(i,v),versionDate:l});let w,x=`${f}${d}`;n&&(x=`${x}/${n}/versions/${c}`,w=`${u}/collections/${n}/${s}`),r&&(x=`${x}/globals/${r}/versions/${c}`,w=`${u}/globals/${r}`);const P=(0,o.useCallback)((async()=>{h(!0);const e=await mt.post(x,{headers:{"Accept-Language":v.language}});if(200===e.status){const t=await e.json();Ct.success(t.message),g.push(w)}else Ct.error(b("version:problemRestoringVersion"))}),[x,w,b,v,g]);return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Ml,{className:[Pw,e].filter(Boolean).join(" "),onClick:()=>p(jw),children:b("version:restoreThisVersion")}),(0,t.jsx)(ce,{className:`${Pw}__modal`,slug:jw,children:(0,t.jsxs)(Nb,{className:`${Pw}__modal-template`,children:[(0,t.jsx)("h1",{children:b("version:confirmVersionRestoration")}),(0,t.jsx)("p",{children:y}),(0,t.jsx)(Yt,{buttonStyle:"secondary",onClick:m?void 0:()=>p(jw),type:"button",children:b("general:cancel")}),(0,t.jsx)(Yt,{onClick:m?void 0:P,children:b(m?"version:restoring":"general:confirm")})]})})]})},Sw={label:"Most recent",value:"mostRecent"},Cw={label:"Most recently published",value:"published"},Mw="compare-version",_w=[Sw],Ow=e=>{const{baseURL:n,onChange:r,parentID:a,publishedDoc:s,value:l,versionID:c}=e,{admin:{dateFormat:u}}=Ut(),{docConfig:d}=us(),[f,p]=(0,o.useState)(_w),[m,h]=(0,o.useState)(1),[g,v]=(0,o.useState)(""),{i18n:b,t:y}=(0,Be.B)(),w=i().useRef(!1),x=(0,o.useCallback)((async({lastLoadedPage:e})=>{if(w.current)return;const t={depth:0,limit:10,page:e,where:{and:[{id:{not_equals:c}}]}};d.versions?.drafts&&t.where.and.push({latest:{not_equals:!0}}),a&&t.where.and.push({parent:{equals:a}});const r=ge().stringify(t),o=await fetch(`${n}?${r}`,{credentials:"include",headers:{"Accept-Language":b.language}});if(o.ok){const e=await o.json();e.docs.length>0&&(p((t=>[...t,...e.docs.map((e=>({label:Ki({date:e.updatedAt,i18n:b,pattern:u}),value:e.id})))])),e.hasNextPage||(w.current=!0),h(e.page))}else v(y("error:unspecific"))}),[u,n,a,c,y,b,d.versions?.drafts]);return(0,o.useEffect)((()=>{x({lastLoadedPage:1})}),[x]),(0,t.jsxs)("div",{className:[Ms,Mw,g&&"error-loading"].filter(Boolean).join(" "),children:[(0,t.jsx)("div",{className:`${Mw}__label`,children:y("version:compareVersion")}),!g&&(0,t.jsx)(_f,{isClearable:!1,isSearchable:!1,onChange:r,onMenuScrollToBottom:()=>{x({lastLoadedPage:m+1})},options:[..."published"===s?._status?[Cw]:[],...f],placeholder:y("version:selectVersionToCompare"),value:l}),g&&(0,t.jsx)("div",{className:`${Mw}__error-loading`,children:g})]})},Ew="select-version-locales",Dw=({onChange:e,options:n,value:r})=>{const{t:a}=(0,Be.B)(),{code:o}=ls(),i=e=>e.map((e=>"string"==typeof e.label?e:"string"!=typeof e.label&&e.label[o]?{label:e.label[o],value:e.value}:void 0));return(0,t.jsxs)("div",{className:Ew,children:[(0,t.jsx)("div",{className:`${Ew}__label`,children:a("version:showLocales")}),(0,t.jsx)(_f,{isMulti:!0,onChange:e,options:i(n),placeholder:a("version:selectLocales"),value:i(r)})]})},Nw=({id:e,collectionConfig:t,collectionSlug:n,doc:r,fieldMap:i,globalConfig:s,globalSlug:l,mostRecentDoc:c})=>{const u=Ut(),{setStepNav:d}=hn(),{i18n:f,t:p}=(0,Be.B)(),m=ls();return(0,o.useEffect)((()=>{let o=[];const{admin:{dateFormat:h},routes:{admin:g}}=u;if(n){let s="";const l=t?.admin?.useAsTitle||"id",u=t?.labels?.plural;if(c)if("id"!==l){const e=i.find((e=>{const{isFieldAffectingData:t}=e,n="name"in e?e.name:void 0;return Boolean(t&&n===l)}));s=e&&c[l]?e.localized?c[l]?.[m.code]:c[l]:`[${p("general:untitled")}]`}else s=c.id;o=[{label:(0,a.sC)(u,f),url:`${g}/collections/${n}`},{label:s,url:`${g}/collections/${n}/${e}`},{label:"Versions",url:`${g}/collections/${n}/${e}/versions`},{label:r?.createdAt?Ki({date:r.createdAt,i18n:f,pattern:h}):""}]}l&&(o=[{label:s.label,url:`${g}/globals/${s.slug}`},{label:"Versions",url:`${g}/globals/${s.slug}/versions`},{label:r?.createdAt?Ki({date:r.createdAt,i18n:f,pattern:h}):""}]),d(o)}),[u,d,n,l,r,c,e,m,p,f,t,i,s]),null},Aw="view-version",Tw=({doc:e,docPermissions:n,initialComparisonDoc:r,localeOptions:a,mostRecentDoc:i,publishedDoc:s,versionID:l})=>{const c=Ut(),{i18n:u}=(0,Be.B)(),{id:d,collectionSlug:f,globalSlug:p}=us(),{getComponentMap:m,getFieldMap:h}=wn(),g=m({collectionSlug:f,globalSlug:p}),[v]=(0,o.useState)((()=>h({collectionSlug:f,globalSlug:p}))),[b]=(0,o.useState)((()=>c.collections.find((e=>e.slug===f)))),[y]=(0,o.useState)((()=>c.globals.find((e=>e.slug===p)))),[w,x]=(0,o.useState)(a),[P,j]=(0,o.useState)(Sw),{admin:{dateFormat:k},localization:S,routes:{api:C},serverURL:M}=c,_=e?.createdAt?Ki({date:e.createdAt,i18n:u,pattern:k}):"",O=`${M}${C}/${p?"globals/":""}${f||p}${f?`/${d}`:""}`,E=`${M}${C}/${p?"globals/":""}${f||p}/versions`,D="mostRecent"===P?.value||"published"===P?.value?O:`${E}/${P.value}`,[{data:N}]=Kp(D,{initialData:r,initialParams:{depth:1,draft:"true",locale:"*"}}),A="mostRecent"===P?.value?i:"published"===P?.value?s:N?.version,T=n?.update?.permission;return(0,t.jsxs)("main",{className:Aw,children:[(0,t.jsx)(Pg,{actions:g?.actionsMap?.Edit?.Version}),(0,t.jsx)(Nw,{collectionConfig:b,collectionSlug:f,doc:e,fieldMap:v,globalConfig:y,globalSlug:p,id:d,mostRecentDoc:i}),(0,t.jsxs)(bl,{className:`${Aw}__wrap`,children:[(0,t.jsxs)("div",{className:`${Aw}__header-wrap`,children:[(0,t.jsx)("p",{className:`${Aw}__created-at`,children:u.t("version:versionCreatedOn",{version:u.t(e?.autosave?"version:autosavedVersion":"version:version")})}),(0,t.jsxs)("header",{className:`${Aw}__header`,children:[(0,t.jsx)("h2",{children:_}),T&&(0,t.jsx)(kw,{className:`${Aw}__restore`,collectionSlug:f,globalSlug:p,label:b?.labels.singular||y?.label,originalDocID:d,versionDate:_,versionID:l})]})]}),(0,t.jsxs)("div",{className:`${Aw}__controls`,children:[(0,t.jsx)(Ow,{baseURL:E,onChange:j,parentID:d,publishedDoc:s,value:P,versionID:l}),S&&(0,t.jsx)(Dw,{onChange:x,options:a,value:w})]}),e?.version&&(0,t.jsx)(aw,{comparison:A,diffComponents:xw,fieldMap:v,fieldPermissions:n?.fields,i18n:u,locales:w?w.map((({label:e})=>"string"==typeof e?e:void 0)):[],version:y?{...e?.version,createdAt:e?.version?.createdAt||e.createdAt,updatedAt:e?.version?.updatedAt||e.updatedAt}:e?.version})]})]})},Rw=async e=>{const{initPageResult:n,routeSegments:r}=e,{collectionConfig:a,docID:o,globalConfig:i,permissions:s,req:{payload:l,payload:{config:c}={},user:u}={}}=n,d=r[r.length-1],f=a?.slug,p=i?.slug,{localization:m}=c;let h,g,v,b,y;if(f){g=f,h=s.collections[f];try{v=await l.findVersionByID({id:d,collection:g,depth:1,locale:"*",overrideAccess:!1,user:u}),b=await l.findByID({id:o,collection:g,depth:1,draft:!1,locale:"*",overrideAccess:!1,user:u}),y=await l.findByID({id:o,collection:g,depth:1,draft:!0,locale:"*",overrideAccess:!1,user:u})}catch(e){return(0,eg.notFound)()}}if(p){g=p,h=s.globals[p];try{v=await l.findGlobalVersionByID({id:d,slug:g,depth:1,locale:"*",overrideAccess:!1,user:u}),b=await l.findGlobal({slug:g,depth:1,draft:!1,locale:"*",overrideAccess:!1,user:u}),y=await l.findGlobal({slug:g,depth:1,draft:!0,locale:"*",overrideAccess:!1,user:u})}catch(e){return(0,eg.notFound)()}}const w=m&&m?.locales&&m.locales.map((({code:e,label:t})=>({label:"string"==typeof t?t:"",value:e})));return v?(0,t.jsx)(Tw,{doc:v,docPermissions:h,initialComparisonDoc:y,localeOptions:w,mostRecentDoc:y,publishedDoc:b,versionID:d}):(0,eg.notFound)()},Iw=()=>{const{t:e}=(0,Be.B)(),{rowData:n}=um();return(0,t.jsxs)(o.Fragment,{children:[n?.autosave&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{children:e("version:autosave")})," "]}),"published"===n?.version._status&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Ml,{pillStyle:"success",children:e("version:published")})," "]}),"draft"===n?.version._status&&(0,t.jsx)(Ml,{children:e("version:draft")})]})},Lw=Cv().default||Cv(),$w=({collectionSlug:e,docID:n,globalSlug:r})=>{const{admin:{dateFormat:a},routes:{admin:o}}=Ut(),{i18n:i}=(0,Be.B)(),{cellData:s,rowData:l}=um(),c=l.id;let u;return e&&(u=`${o}/collections/${e}/${n}/versions/${c}`),r&&(u=`${o}/globals/${r}/versions/${c}`),(0,t.jsx)(Lw,{href:u,children:s&&Ki({date:s,i18n:i,pattern:a})})},Ww=()=>{const{cellData:e}=um();return(0,t.jsx)(o.Fragment,{children:e})},Fw=e=>{const{baseClass:n,columns:r,paginationLimits:a}=e,{getComponentMap:o}=wn(),{collectionSlug:s,globalSlug:l}=us(),{data:c,handlePerPageChange:u}=Zp(),d=o({collectionSlug:s,globalSlug:l}),f=(0,eg.useSearchParams)().get("limit"),{i18n:p}=(0,Be.B)(),m=c?.totalDocs||0;return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(Pg,{actions:d?.actionsMap?.Edit?.Versions}),(0,t.jsx)(Ve,{name:"versions",show:!c}),0===m&&(0,t.jsx)("div",{className:`${n}__no-versions`,children:p.t("version:noFurtherVersionsFound")}),m>0&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(gv,{columns:r,data:c?.docs,fieldMap:d?.fieldMap}),(0,t.jsxs)("div",{className:`${n}__page-controls`,children:[(0,t.jsx)(xv,{hasNextPage:c.hasNextPage,hasPrevPage:c.hasPrevPage,limit:c.limit,nextPage:c.nextPage,numberOfNeighbors:1,page:c.page,prevPage:c.prevPage,totalPages:c.totalPages}),c?.totalDocs>0&&(0,t.jsxs)(i().Fragment,{children:[(0,t.jsxs)("div",{className:`${n}__page-info`,children:[c.page*c.limit-(c.limit-1),"-",c.totalPages>1&&c.totalPages!==c.page?c.limit*c.page:c.totalDocs," ",p.t("general:of")," ",c.totalDocs]}),(0,t.jsx)(kv,{handleChange:u,limit:f?Number(f):10,limits:a})]})]})]})]})},zw="versions",Bw=async e=>{const{initPageResult:n,searchParams:r}=e,{collectionConfig:a,docID:o,globalConfig:s,req:{i18n:l,payload:c,payload:{config:u},user:d}}=n,f=a?.slug,p=s?.slug,{limit:m,page:h,sort:g}=r,{routes:{api:v},serverURL:b}=u;let y,w=(0,jc.isNumber)(m)?Number(m):void 0;if(f){w=w||a.admin.pagination.defaultLimit;try{y=await c.findVersions({collection:f,depth:0,limit:w,overrideAccess:!1,page:h?parseInt(h.toString(),10):void 0,sort:g,user:d,where:{parent:{equals:o}}})}catch(e){console.error(e)}}if(p){w=w||10;try{y=await c.findGlobalVersions({slug:p,depth:0,limit:w,overrideAccess:!1,page:h?parseInt(h,10):void 0,sort:g,user:d})}catch(e){console.error(e)}if(!y)return(0,eg.notFound)()}const x=(({collectionConfig:e,docID:n,globalConfig:r,i18n:{t:a}})=>{const o=e||r,i=[{name:"",type:"date",Label:"",accessor:"updatedAt",active:!0,components:{Cell:(0,t.jsx)($w,{collectionSlug:e?.slug,docID:n,globalSlug:r?.slug}),Heading:(0,t.jsx)(mm,{Label:a("general:updatedAt"),name:"updatedAt"})}},{name:"",type:"text",Label:"",accessor:"id",active:!0,components:{Cell:(0,t.jsx)(Ww,{}),Heading:(0,t.jsx)(mm,{Label:a("version:versionID"),disable:!0,name:"id"})}}];return(o?.versions?.drafts||o?.versions?.drafts&&o.versions.drafts?.autosave)&&i.push({name:"",type:"checkbox",Label:"",accessor:"_status",active:!0,components:{Cell:(0,t.jsx)(Iw,{}),Heading:(0,t.jsx)(mm,{Label:a("version:type"),disable:!0,name:"autosave"})}}),i})({collectionConfig:a,config:u,docID:o,globalConfig:s,i18n:l}),P=f?`${b}${v}/${f}/versions`:p?`${b}${v}/globals/${p}/versions`:"";return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)(gg,{collectionSlug:a?.slug,globalSlug:s?.slug,id:o,pluralLabel:a?.labels?.plural||s?.label,useAsTitle:a?.admin?.useAsTitle||s?.slug,view:l.t("version:versions")}),(0,t.jsx)("main",{className:zw,children:(0,t.jsx)(bl,{className:`${zw}__wrap`,children:(0,t.jsx)(em,{data:y,defaultLimit:w,defaultSort:g,modifySearchParams:!0,children:(0,t.jsx)(Fw,{baseClass:zw,columns:x,fetchURL:P,paginationLimits:a?.admin?.pagination?.limits})})})})]})},Hw=(e,t)=>"function"==typeof e?.Edit?e?.Edit:"object"==typeof e?.Edit&&e?.Edit?.[t]&&"function"==typeof e?.Edit?.[t]?e?.Edit?.[t]:e?.Edit?.[t]?"object"==typeof e?.Edit?.[t]&&"Component"in e.Edit[t]&&(0,jc.isReactComponentOrFunction)(e?.Edit?.[t].Component)&&e?.Edit?.[t].Component:null;function Yw(e,t){void 0===t&&(t={});for(var n=function(e){for(var t=[],n=0;n<e.length;){var r=e[n];if("*"!==r&&"+"!==r&&"?"!==r)if("\\"!==r)if("{"!==r)if("}"!==r)if(":"!==r)if("("!==r)t.push({type:"CHAR",index:n,value:e[n++]});else{var a=1,o="";if("?"===e[s=n+1])throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<e.length;)if("\\"!==e[s]){if(")"===e[s]){if(0==--a){s++;break}}else if("("===e[s]&&(a++,"?"!==e[s+1]))throw new TypeError("Capturing groups are not allowed at ".concat(s));o+=e[s++]}else o+=e[s++]+e[s++];if(a)throw new TypeError("Unbalanced pattern at ".concat(n));if(!o)throw new TypeError("Missing pattern at ".concat(n));t.push({type:"PATTERN",index:n,value:o}),n=s}else{for(var i="",s=n+1;s<e.length;){var l=e.charCodeAt(s);if(!(l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||95===l))break;i+=e[s++]}if(!i)throw new TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:i}),n=s}else t.push({type:"CLOSE",index:n,value:e[n++]});else t.push({type:"OPEN",index:n,value:e[n++]});else t.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});else t.push({type:"MODIFIER",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),t}(e),r=t.prefixes,a=void 0===r?"./":r,o="[^".concat(Vw(t.delimiter||"/#?"),"]+?"),i=[],s=0,l=0,c="",u=function(e){if(l<n.length&&n[l].type===e)return n[l++].value},d=function(e){var t=u(e);if(void 0!==t)return t;var r=n[l],a=r.type,o=r.index;throw new TypeError("Unexpected ".concat(a," at ").concat(o,", expected ").concat(e))},f=function(){for(var e,t="";e=u("CHAR")||u("ESCAPED_CHAR");)t+=e;return t};l<n.length;){var p=u("CHAR"),m=u("NAME"),h=u("PATTERN");if(m||h){var g=p||"";-1===a.indexOf(g)&&(c+=g,g=""),c&&(i.push(c),c=""),i.push({name:m||s++,prefix:g,suffix:"",pattern:h||o,modifier:u("MODIFIER")||""})}else{var v=p||u("ESCAPED_CHAR");if(v)c+=v;else if(c&&(i.push(c),c=""),u("OPEN")){g=f();var b=u("NAME")||"",y=u("PATTERN")||"",w=f();d("CLOSE"),i.push({name:b||(y?s++:""),pattern:b&&!y?o:y,prefix:g,suffix:w,modifier:u("MODIFIER")||""})}else d("END")}}return i}function Vw(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function qw(e){return e&&e.sensitive?"":"i"}function Uw(e,t,n){return function(e,t,n){void 0===n&&(n={});for(var r=n.strict,a=void 0!==r&&r,o=n.start,i=void 0===o||o,s=n.end,l=void 0===s||s,c=n.encode,u=void 0===c?function(e){return e}:c,d=n.delimiter,f=void 0===d?"/#?":d,p=n.endsWith,m="[".concat(Vw(void 0===p?"":p),"]|$"),h="[".concat(Vw(f),"]"),g=i?"^":"",v=0,b=e;v<b.length;v++){var y=b[v];if("string"==typeof y)g+=Vw(u(y));else{var w=Vw(u(y.prefix)),x=Vw(u(y.suffix));if(y.pattern)if(t&&t.push(y),w||x)if("+"===y.modifier||"*"===y.modifier){var P="*"===y.modifier?"?":"";g+="(?:".concat(w,"((?:").concat(y.pattern,")(?:").concat(x).concat(w,"(?:").concat(y.pattern,"))*)").concat(x,")").concat(P)}else g+="(?:".concat(w,"(").concat(y.pattern,")").concat(x,")").concat(y.modifier);else"+"===y.modifier||"*"===y.modifier?g+="((?:".concat(y.pattern,")").concat(y.modifier,")"):g+="(".concat(y.pattern,")").concat(y.modifier);else g+="(?:".concat(w).concat(x,")").concat(y.modifier)}}if(l)a||(g+="".concat(h,"?")),g+=n.endsWith?"(?=".concat(m,")"):"$";else{var j=e[e.length-1],k="string"==typeof j?h.indexOf(j[j.length-1])>-1:void 0===j;a||(g+="(?:".concat(h,"(?=").concat(m,"))?")),k||(g+="(?=".concat(h,"|").concat(m,")"))}return new RegExp(g,qw(n))}(Yw(e,n),t,n)}function Gw(e,t,n){return e instanceof RegExp?function(e,t){if(!t)return e;for(var n=/\((?:\?<(.*?)>)?(?!\?)/g,r=0,a=n.exec(e.source);a;)t.push({name:a[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),a=n.exec(e.source);return e}(e,t):Array.isArray(e)?function(e,t,n){var r=e.map((function(e){return Gw(e,t,n).source}));return new RegExp("(?:".concat(r.join("|"),")"),qw(n))}(e,t,n):Uw(e,t,n)}const Kw=({currentRoute:e,exact:t,path:n,sensitive:r,strict:a})=>{const o=Gw(n,[],{sensitive:r,strict:a}).exec(e),i=o?.[0]||n;return t?e===i:t?void 0:i.startsWith(e)},Xw=({baseRoute:e,currentRoute:t,views:n})=>{if("object"==typeof n?.Edit&&"function"!=typeof n?.Edit){const r=Object.entries(n.Edit).find((([,n])=>{if("object"==typeof n&&"function"!=typeof n&&"path"in n){const r=`${e}${n.path}`;return Kw({currentRoute:t,exact:!0,path:r})}return!1}))?.[1];if(r&&"Component"in r)return r.Component}return null},Qw=({collectionConfig:e,config:t,docPermissions:n,globalConfig:r,routeSegments:a})=>{let o=null,i=null,s=null;const{routes:{admin:l}}=t,c=e&&e?.admin?.components?.views||r&&r?.admin?.components?.views,u=e&&e?.admin?.livePreview||t?.admin?.livePreview?.collections?.includes(e?.slug)||r&&r?.admin?.livePreview||t?.admin?.livePreview?.globals?.includes(r?.slug);if(e){const t=e?.admin?.components?.views?.Edit,r="function"==typeof t?t:null;if(r&&(i=r),!r){const[t,r,d,f,p,...m]=a;if(n?.read?.permission)switch(a.length){case 3:if("create"===d)"create"in n&&n?.create?.permission?(i=Hw(c,"Default"),o=oy):s=Jy;else i=Hw(c,"Default"),o=oy;break;case 4:switch(f){case"api":!0!==e?.admin?.hideAPIURL&&(i=Hw(c,"API"),o=My);break;case"preview":u&&(o=Ky);break;case"versions":n?.readVersions?.permission?(i=Hw(c,"Versions"),o=Bw):s=Jy;break;default:{const e=[l,"collections",r,d].filter(Boolean).join("/"),t=[e,f,p,...m].filter(Boolean).join("/");i=Xw({baseRoute:e,currentRoute:t,views:c});break}}break;default:if("versions"===f)n?.readVersions?.permission?(i=Hw(c,"Version"),o=Rw):s=Jy;else{const e=[l,t,r,d].filter(Boolean).join("/"),n=[e,f,p,...m].filter(Boolean).join("/");i=Xw({baseRoute:e,currentRoute:n,views:c})}}else(0,eg.notFound)()}}if(r){const e=r?.admin?.components?.views?.Edit,t="function"==typeof e?e:null;if(t&&(i=t),!t){const[e,t,d,...f]=a;if(n?.read?.permission)switch(a.length){case 2:i=Hw(c,"Default"),o=oy;break;case 3:switch(d){case"api":!0!==r?.admin?.hideAPIURL&&(i=Hw(c,"API"),o=My);break;case"preview":u&&(o=Ky);break;case"versions":n?.readVersions?.permission?(i=Hw(c,"Versions"),o=Bw):s=Jy;break;default:n?.read?.permission?(i=Hw(c,"Default"),o=oy):s=Jy}break;default:if("versions"===d)n?.readVersions?.permission?(i=Hw(c,"Version"),o=Rw):s=Jy;else{const e=[l,"globals",t].filter(Boolean).join("/"),n=[e,d,...f].filter(Boolean).join("/");i=Xw({baseRoute:e,currentRoute:n,views:c})}}else(0,eg.notFound)()}}return{CustomView:i,DefaultView:o,ErrorView:s}},Jw=async({initPageResult:e,params:n,searchParams:r})=>{const{collectionConfig:a,docID:o,globalConfig:i,locale:s,permissions:l,req:c,req:{i18n:u,payload:d,payload:{config:f,config:{routes:{admin:p,api:m},serverURL:h}},user:g},visibleEntities:v}=e,b=Array.isArray(n?.segments)?n.segments:[],y=a?.slug||void 0,w=i?.slug||void 0,x=es({id:o,collectionSlug:y,globalSlug:w});let P,j,k,S,C,M;const{data:_,formState:O}=await ny({id:o,collectionConfig:a,globalConfig:i,locale:s,req:c}),{docPermissions:E,hasPublishPermission:D,hasSavePermission:N}=await ry({id:o,collectionConfig:a,data:_,globalConfig:i,req:c});if(a){v?.collections?.find((e=>e===y))||(0,eg.notFound)(),M=`${h}${m}/${y}${x?`/${o}`:""}`;const e=new URLSearchParams;a.versions?.drafts&&e.append("draft","true"),s?.code&&e.append("locale",s.code);const t=`?${e.toString()}`;C=`${h}${m}/${y}/${o}${t}`;const n=a?.admin?.components?.views?.Edit;if(P="function"==typeof n?n:null,!P){const e=Qw({collectionConfig:a,config:f,docPermissions:E,routeSegments:b});j=e?.CustomView,k=e?.DefaultView,S=e?.ErrorView}j||k||P||S||(S=my)}if(i){v?.globals?.find((e=>e===w))||(0,eg.notFound)(),M=`${h}${m}/globals/${w}`;const e=new URLSearchParams({locale:s?.code});i.versions?.drafts&&e.append("draft","true"),s?.code&&e.append("locale",s.code);const t=`?${e.toString()}`;C=`${h}${m}/${w}${t}`;const n=i?.admin?.components?.views?.Edit;if(P="function"==typeof n?n:null,!P){const e=Qw({config:f,docPermissions:E,globalConfig:i,routeSegments:b});j=e?.CustomView,k=e?.DefaultView,S=e?.ErrorView,j||k||P||S||(S=my)}}if(N&&(a?.versions?.drafts&&a?.versions?.drafts?.autosave||i?.versions?.drafts&&i?.versions?.drafts?.autosave)&&!(a?.versions?.drafts&&a?.versions?.drafts?.validate)&&!o&&y){const e=await d.create({collection:y,data:{},depth:0,draft:!0,fallbackLocale:null,locale:s?.code,req:c,user:g});if(e?.id){const t=`${h}${p}/collections/${y}/${e.id}`;(0,eg.redirect)(t)}else(0,eg.notFound)()}const A={initPageResult:e,params:n,routeSegments:b,searchParams:r};return(0,t.jsxs)(ds,{action:M,apiURL:C,collectionSlug:a?.slug,disableActions:!1,docPermissions:E,globalSlug:i?.slug,hasPublishPermission:D,hasSavePermission:N,id:o,initialData:_,initialState:O,isEditing:x,children:[!P&&(0,t.jsx)(Ub,{collectionConfig:a,config:d.config,globalConfig:i,i18n:u,permissions:l}),(0,t.jsx)(Nv,{permissions:l,user:g}),(0,t.jsx)(ys,{depth:1,children:(0,t.jsx)(Wf,{initialParams:{depth:0,"fallback-locale":"null",locale:s?.code,uploadEdits:void 0},children:S?(0,t.jsx)(S,{initPageResult:e,searchParams:r}):(0,t.jsx)(Rv,{CustomComponent:P||j,DefaultComponent:k,componentProps:A,serverOnlyProps:{i18n:u,locale:s,params:n,payload:d,permissions:l,searchParams:r,user:g}})})},`${y||w}${s?.code?`-${s?.code}`:""}`)]})},Zw=()=>{const e=Ut(),{admin:{user:n},routes:{api:r}}=e,{t:a}=(0,Be.B)(),[i,s]=(0,o.useState)(!1),l=e.collections?.find((e=>e?.slug===n)),c=l?.auth?.loginWithUsername,u=c?{username:{initialValue:"",valid:!0,value:void 0}}:{email:{initialValue:"",valid:!0,value:void 0}};return i?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("h1",{children:a("authentication:emailSent")}),(0,t.jsx)("p",{children:a("authentication:checkYourEmailForPasswordReset")})]}):(0,t.jsxs)(Ch,{action:`${r}/${n}/forgot-password`,handleResponse:(e,t,n)=>{e.json().then((()=>{s(!0),t(a("general:submissionSuccessful"))})).catch((()=>{n(a(c?"authentication:usernameNotValid":"authentication:emailNotValid"))}))},initialState:u,method:"POST",children:[(0,t.jsx)("h1",{children:a("authentication:forgotPassword")}),(0,t.jsx)("p",{children:a(c?"authentication:forgotPasswordUsernameInstructions":"authentication:forgotPasswordEmailInstructions")}),c?(0,t.jsx)(bp,{label:a("authentication:username"),name:"username",required:!0,validate:t=>(0,jc.text)(t,{name:"username",type:"text",data:{},preferences:{fields:{}},req:{payload:{config:e},t:a},required:!0,siblingData:{}})}):(0,t.jsx)(fc,{autoComplete:"email",label:a("general:email"),name:"email",required:!0,validate:e=>(0,jc.email)(e,{name:"email",type:"email",data:{},preferences:{fields:{}},req:{t:a},required:!0,siblingData:{}})}),(0,t.jsx)(Lh,{children:a("general:submit")})]})},ex=Cv().default||Cv(),tx=async({initPageResult:e,params:n,searchParams:r})=>{const{collectionConfig:a,locale:i,permissions:s,req:{i18n:l,locale:c,payload:u,payload:{config:d},query:f,user:p},visibleEntities:m}=e,h=a?.slug;let g;s?.collections?.[h]?.read?.permission||(0,eg.notFound)();const v=`${h}-list`;try{g=await(u.find({collection:"payload-preferences",depth:0,limit:1,user:p,where:{key:{equals:v}}})?.then((e=>e?.docs?.[0]?.value)))}catch(e){}const{routes:{admin:b}}=d;if(a){const{admin:{components:{views:{List:d}={}}={}}}=a;if(!m.collections.includes(h))return(0,eg.notFound)();let y=null;d&&"function"==typeof d?y=d:"object"==typeof d&&(0,jc.isReactComponentOrFunction)(d.Component)&&(y=d.Component);const w=(0,jc.isNumber)(f?.page)?Number(f.page):0,x=(0,oh.mergeListSearchAndWhere)({collectionConfig:a,query:{search:"string"==typeof f?.search?f.search:void 0,where:f?.where||void 0}}),P=(0,jc.isNumber)(f?.limit)?Number(f.limit):g?.limit||a.admin.pagination.defaultLimit,j=f?.sort&&"string"==typeof f.sort?f.sort:g?.sort||a.defaultSort||void 0,k=await u.find({collection:h,depth:0,draft:!0,fallbackLocale:null,limit:P,locale:c,overrideAccess:!1,page:w,sort:j,user:p,where:x||{}}),S={collectionSlug:h,listSearchableFields:a.admin.listSearchableFields};return(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Nv,{permissions:s,user:p}),(0,t.jsx)(Qp,{collectionConfig:(0,oh.createClientCollectionConfig)({collection:a,t:e.req.i18n.t}),collectionSlug:h,hasCreatePermission:s?.collections?.[h]?.create?.permission,newDocumentURL:`${b}/collections/${h}/create`,children:(0,t.jsx)(em,{data:k,defaultLimit:P||a?.admin?.pagination?.defaultLimit,defaultSort:j,modifySearchParams:!0,preferenceKey:v,children:(0,t.jsx)(Nm,{collectionSlug:h,enableRowSelections:!0,listPreferences:g,preferenceKey:v,children:(0,t.jsx)(Rv,{CustomComponent:y,DefaultComponent:Ov,componentProps:S,serverOnlyProps:{collectionConfig:a,data:k,hasCreatePermission:s?.collections?.[h]?.create?.permission,i18n:l,limit:P,listPreferences:g,locale:i,newDocumentURL:`${b}/collections/${h}/create`,params:n,payload:u,permissions:s,searchParams:r,user:p}})})})})]})}return(0,eg.notFound)()},nx=Cv().default||Cv(),rx=e=>{const{adminRoute:n,inactivity:r,redirect:a}=e,[s,l]=i().useState(void 0),{logOut:c}=sn(),{t:u}=(0,Be.B)();return(0,o.useEffect)((()=>{s||(l(!0),c())}),[s,c]),s?(0,t.jsxs)(o.Fragment,{children:[r&&(0,t.jsx)("h2",{children:u("authentication:loggedOutInactivity")}),!r&&(0,t.jsx)("h2",{children:u("authentication:loggedOutSuccessfully")}),(0,t.jsx)(Yt,{Link:nx,buttonStyle:"secondary",el:"link",url:`${n}/login${a&&a.length>0?`?redirect=${encodeURIComponent(a)}`:""}`,children:u("authentication:logBackIn")})]}):(0,t.jsx)(o.Fragment,{children:u("authentication:loggingOut")})},ax=({inactivity:e,initPageResult:n,searchParams:r})=>{const{req:{payload:{config:{routes:{admin:a}}}}}=n;return(0,t.jsx)("div",{className:"logout__wrap",children:(0,t.jsx)(rx,{adminRoute:a,inactivity:e,redirect:r.redirect})})},ox={"confirm-password":{initialValue:"",valid:!1,value:""},password:{initialValue:"",valid:!1,value:""}},ix=({token:e})=>{const n=(0,Be.B)(),{admin:{user:r},routes:{admin:a,api:o},serverURL:s}=Ut(),l=(0,eg.useRouter)(),{fetchFullUser:c}=sn(),u=i().useCallback((async e=>{e.token?(await c(),l.push(`${a}`)):(l.push(`${a}/login`),Ct.success(n.t("general:updatedSuccessfully")))}),[c,l,a,n]);return(0,t.jsxs)(Ch,{action:`${s}${o}/${r}/reset-password`,initialState:ox,method:"POST",onSuccess:u,children:[(0,t.jsx)(sx,{}),(0,t.jsx)(sc,{}),(0,t.jsx)(ol,{forceUsePathFromProps:!0,name:"token",value:e}),(0,t.jsx)(Lh,{children:n.t("authentication:resetPassword")})]})},sx=()=>{const{t:e}=(0,Be.B)(),{value:n}=Bo((([e])=>e&&e?.["confirm-password"]||null)),r=i().useCallback((t=>t?t===n||e("fields:passwordsDoNotMatch"):e("validation:required")),[n,e]);return(0,t.jsx)(Ef,{autoComplete:"off",label:e("authentication:newPassword"),name:"password",required:!0,validate:r})},lx="reset-password",cx=Cv().default||Cv(),ux=({initPageResult:e,params:n})=>{const{req:r}=e,{segments:[a,o]}=n,{i18n:i,payload:{config:s},user:l}=r,{admin:{routes:{account:c}},routes:{admin:u}}=s;return l?(0,t.jsx)(Nb,{className:lx,children:(0,t.jsxs)("div",{className:`${lx}__wrap`,children:[(0,t.jsx)("h1",{children:i.t("authentication:alreadyLoggedIn")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{0:({children:e})=>(0,t.jsx)(cx,{href:`${u}${c}`,children:e})},i18nKey:"authentication:loggedInChangePassword",t:i.t})}),(0,t.jsx)("br",{}),(0,t.jsx)(Yt,{Link:cx,buttonStyle:"secondary",el:"link",to:u,children:i.t("general:backToDashboard")})]})}):(0,t.jsx)(Nb,{className:lx,children:(0,t.jsxs)("div",{className:`${lx}__wrap`,children:[(0,t.jsx)("h1",{children:i.t("authentication:resetPassword")}),(0,t.jsx)(ix,{token:o})]})})},dx="verify",fx=async({initPageResult:e,params:n,searchParams:r})=>{const[a,o,s]=n.segments,{locale:l,permissions:c,req:u}=e,{i18n:d,payload:{config:f},payload:p,user:m}=u,{routes:{admin:h}}=f;let g;try{return await u.payload.verifyEmail({collection:a,token:s}),(0,eg.redirect)(`${h}/login`)}catch(e){202===e?.status&&(0,eg.redirect)(`${h}/login`),g=u.t("authentication:unableToVerify")}return(0,t.jsxs)(i().Fragment,{children:[(0,t.jsx)("div",{className:`${dx}__brand`,children:(0,t.jsx)(Yv,{i18n:d,locale:l,params:n,payload:p,permissions:c,searchParams:r,user:m})}),(0,t.jsx)("h2",{children:g})]})},px={account:"account",forgot:"forgot-password",login:Gv,reset:lx,verify:dx},mx={account:async({initPageResult:e,params:n,searchParams:r})=>{const{languageOptions:a,locale:o,permissions:i,req:s,req:{i18n:l,payload:c,payload:{config:u},user:d}}=e,{admin:{components:{views:{Account:f}={}}={},user:p},routes:{api:m},serverURL:h}=u,g=u.collections.find((e=>e.slug===p));if(g&&d?.id){const{docPermissions:u,hasPublishPermission:v,hasSavePermission:b}=await ry({id:d.id,collectionConfig:g,data:d,req:s}),{data:y,formState:w}=await ny({id:d.id,collectionConfig:g,locale:o,req:s}),x={initPageResult:e,params:n,routeSegments:[],searchParams:r};return(0,t.jsxs)(ds,{AfterFields:(0,t.jsx)(cy,{i18n:l,languageOptions:a}),action:`${h}${m}/${p}${d?.id?`/${d.id}`:""}`,apiURL:`${h}${m}/${p}${d?.id?`/${d.id}`:""}`,collectionSlug:p,docPermissions:u,hasPublishPermission:v,hasSavePermission:b,id:d?.id.toString(),initialData:y,initialState:w,isEditing:!0,children:[(0,t.jsx)(Ub,{collectionConfig:g,config:c.config,hideTabs:!0,i18n:l,permissions:i}),(0,t.jsx)(Nv,{permissions:i,user:d}),(0,t.jsx)(Wf,{initialParams:{depth:0,"fallback-locale":"null",locale:o?.code,uploadEdits:void 0},children:(0,t.jsx)(Rv,{CustomComponent:"function"==typeof f?f:void 0,DefaultComponent:oy,componentProps:x,serverOnlyProps:{i18n:l,locale:o,params:n,payload:c,permissions:i,searchParams:r,user:d}})})]})}return(0,eg.notFound)()},createFirstUser:async({initPageResult:e})=>{const{req:n,req:{payload:{config:{admin:{user:r}}}}}=e,a=[{name:"email",type:"email",label:n.t("general:emailAddress"),required:!0},{name:"password",type:"text",label:n.t("general:password"),required:!0},{name:"confirm-password",type:"text",label:n.t("authentication:confirmPassword"),required:!0}],o=await Jb({fieldSchema:a,operation:"create",preferences:{fields:{}},req:n});return(0,t.jsxs)("div",{className:"create-first-user",children:[(0,t.jsx)("h1",{children:n.t("general:welcome")}),(0,t.jsx)("p",{children:n.t("authentication:beginCreateFirstUser")}),(0,t.jsx)(uy,{initialState:o,userSlug:r})]})},forgot:({initPageResult:e})=>{const{req:{i18n:n,payload:{config:r},user:a}}=e,{admin:{routes:{account:i}},routes:{admin:s}}=r;return a?(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)("h1",{children:n.t("authentication:alreadyLoggedIn")}),(0,t.jsx)("p",{children:(0,t.jsx)(Eh,{elements:{0:({children:e})=>(0,t.jsx)(ex,{href:`${s}${i}`,children:e})},i18nKey:"authentication:loggedInChangePassword",t:n.t})}),(0,t.jsx)("br",{}),(0,t.jsx)(Yt,{Link:ex,buttonStyle:"secondary",el:"link",to:s,children:n.t("general:backToDashboard")})]}):(0,t.jsxs)(o.Fragment,{children:[(0,t.jsx)(Zw,{}),(0,t.jsx)(ex,{href:`${s}/login`,children:n.t("authentication:backToLogin")})]})},inactivity:e=>(0,t.jsx)(ax,{inactivity:!0,...e}),login:Kv,logout:ax,unauthorized:Jy},hx=({adminRoute:e,config:t,currentRoute:n,searchParams:r,segments:a})=>{let o,i,s=null;const l={config:t,route:n,searchParams:r},[c,u]=a,d="globals"===c,f="collections"===c;switch(a.length){case 0:n===e&&(s=Bv,o="dashboard",i="default",l.redirectUnauthenticatedUser=!0);break;case 1:{let r;if(t.admin.routes){const a=Object.entries(t.admin.routes).find((([,t])=>Kw({currentRoute:n,exact:!0,path:`${e}${t}`})));a&&(r=a[0])}mx[r]&&(s=mx[r],o=px[r],i="minimal","account"===r&&(l.redirectUnauthenticatedUser=!0,i="default"));break}case 2:"reset"===c&&(s=ux,o=px[u],i="minimal"),f?(l.redirectUnauthenticatedUser=!0,s=tx,o=`${u}-list`,i="default"):d&&(l.redirectUnauthenticatedUser=!0,s=Jw,o="global-edit",i="default");break;default:"verify"===u?(s=fx,o="verify",i="minimal"):f?(l.redirectUnauthenticatedUser=!0,s=Jw,o="collection-default-edit",i="default"):d&&(l.redirectUnauthenticatedUser=!0,s=Jw,o="global-edit",i="default")}return s||(s=(({config:e,currentRoute:t})=>{const{admin:{components:{views:n}},routes:{admin:r}}=e,a=t.replace(r,""),o=n&&"object"==typeof n&&Object.entries(n).find((([,e])=>{if("object"==typeof e)return Kw({currentRoute:a,exact:e.exact,path:e.path,sensitive:e.sensitive,strict:e.strict})}))?.[1];return"object"==typeof o?o.Component:null})({config:t,currentRoute:n})),{DefaultView:s,initPageOptions:l,templateClassName:o,templateType:i}},gx=async({config:e,params:n,searchParams:r})=>{const a=await e,{admin:{routes:{createFirstUser:i},user:s},routes:{admin:l}}=a,c=`${l}${Array.isArray(n.segments)?`/${n.segments.join("/")}`:""}`,u=Array.isArray(n.segments)?n.segments:[],{DefaultView:d,initPageOptions:f,templateClassName:p,templateType:m}=hx({adminRoute:l,config:a,currentRoute:c,searchParams:r,segments:u});let h=!1;d||(0,eg.notFound)();const g=await Ib(f);if(g){h=await(g?.req.payload.db.findOne({collection:s,req:g?.req})?.then((e=>!!e)));const e=`${l}${i}`,t=a.collections.find((({slug:e})=>e===s)),n=t?.auth?.disableLocalStrategy;n&&c===e&&(0,eg.redirect)(l),h||c===e||n||(0,eg.redirect)(e),h&&c===e&&(0,eg.redirect)(l)}const v=(0,t.jsx)(rh,{Component:d,serverOnlyProps:{initPageResult:g,params:n,searchParams:r}});return(0,t.jsxs)(o.Fragment,{children:[!m&&(0,t.jsx)(o.Fragment,{children:v}),"minimal"===m&&(0,t.jsx)(Nb,{className:p,children:v}),"default"===m&&(0,t.jsx)(Eb,{i18n:g?.req.i18n,locale:g?.locale,params:n,payload:g?.req.payload,permissions:g?.permissions,searchParams:r,user:g?.req.user,visibleEntities:{collections:g.visibleEntities?.collections,globals:g.visibleEntities?.globals},children:v})]})}})(),module.exports=r})();
|