decap-cms-core 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decap-cms-core.js +3 -3
- package/dist/decap-cms-core.js.map +1 -1
- package/dist/esm/bootstrap.js +2 -2
- package/dist/esm/components/UI/ErrorBoundary.js +2 -2
- package/dist/esm/constants/configSchema.js +6 -0
- package/dist/esm/lib/formatters.js +6 -4
- package/dist/esm/lib/urlHelper.js +26 -8
- package/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/constants/configSchema.js +2 -0
- package/src/lib/__tests__/formatters.spec.js +60 -0
- package/src/lib/__tests__/urlHelper.spec.js +7 -0
- package/src/lib/formatters.ts +15 -5
- package/src/lib/urlHelper.ts +33 -9
- package/src/types/redux.ts +3 -0
package/dist/decap-cms-core.js
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
`),cr.editorComponents=cr.editorComponents.delete(e.id))}cr.editorComponents=cr.editorComponents.set(t.id,t)},getEditorComponents:vr,registerRemarkPlugin:function(e){cr.remarkPlugins.push(e)},getRemarkPlugins:br,registerWidgetValueSerializer:function(e,t){cr.widgetValueSerializers[e]=t},getWidgetValueSerializer:wr,registerBackend:function(e,t){e&&t?cr.backends[e]?console.error(`Backend [${e}] already registered. Please choose a different name.`):cr.backends[e]={init:(...e)=>new t(...e)}:console.error("Backend parameters invalid. example: CMS.registerBackend('myBackend', BackendClass)")},getBackend:xr,registerMediaLibrary:function(e,t){if(cr.mediaLibraries.find(t=>e.name===t.name))throw new Error(`A media library named ${e.name} has already been registered.`);cr.mediaLibraries.push({...e,options:t})},getMediaLibrary:Sr,registerLocale:function(e,t){e&&t?cr.locales[e]=t:console.error("Locale parameters invalid. example: CMS.registerLocale('locale', phrases)")},getLocale:Er,registerEventListener:function({name:e,handler:t},n={}){kr(e),cr.eventHandlers[e].push({handler:t,options:n})},removeEventListener:function({name:e,handler:t}){kr(e),cr.eventHandlers[e]=t?cr.eventHandlers[e].filter(e=>e.handler!==t):[]},getEventListeners:function(e){return kr(e),[...cr.eventHandlers[e]]},invokeEvent:_r,registerCustomFormat:function(e,t,n){cr.formats[e]={extension:t,formatter:n}},getCustomFormats:function(){return cr.formats},getCustomFormatsExtensions:Cr,getCustomFormatsFormatters:Or};function dr(){return cr.previewStyles}function pr(e){return cr.templates[e]}function hr(e,t,n,r={}){if(Array.isArray(e))e.forEach(e=>{"object"!=typeof e?console.error(`Cannot register widget: ${e}`):hr(e)});else if("string"==typeof e){const o="string"==typeof t?cr.widgets[t].control:t;cr.widgets[e]={control:o,preview:n,schema:r}}else if("object"==typeof e){const{name:t,controlComponent:n,previewComponent:r,schema:o={},allowMapValue:i,globalStyles:a,...s}=e;if(cr.widgets[t]&&console.warn(nr`
|
|
12
12
|
Multiple widgets registered with name "${t}". Only the last widget registered with
|
|
13
13
|
this name will be used.
|
|
14
|
-
`),!n)throw Error(`Widget "${t}" registered without \`controlComponent\`.`);cr.widgets[t]={control:n,preview:r,schema:o,globalStyles:a,allowMapValue:i,...s}}else console.error("`registerWidget` failed, called with incorrect arguments.")}function gr(e){return cr.widgets[e]}function mr(){return Wt(Object.entries(cr.widgets),e=>e.map(([e,t])=>({name:e,...t})))}function yr(e){return gr(e||"string")||gr("unknown")}function vr(){return cr.editorComponents}function br(){return cr.remarkPlugins}function wr(e){return cr.widgetValueSerializers[e]}function xr(e){return cr.backends[e]}function Sr(e){return cr.mediaLibraries.find(t=>t.name===e)}function kr(e){if(!lr.includes(e))throw new Error(`Invalid event name '${e}'`)}async function _r({name:e,data:t}){kr(e);const n=cr.eventHandlers[e];let r={...t};for(const{handler:e,options:o}of n){const n=await e(r,o);if(void 0!==n){const e=r.entry.set("data",n);r={...t,entry:e}}}return r.entry.get("data")}function Er(e){return cr.locales[e]}function Cr(){return Object.entries(cr.formats).reduce(function(e,[t,{extension:n}]){return{...e,[t]:n}},{})}function Or(){return Object.entries(cr.formats).reduce(function(e,[t,{formatter:n}]){return{...e,[t]:n}},{})}const Tr=["yaml-frontmatter","toml-frontmatter","json-frontmatter"],Pr={yml:"yml",yaml:"yml",toml:"toml",json:"json",frontmatter:"md","json-frontmatter":"md","toml-frontmatter":"md","yaml-frontmatter":"md"},Mr={yml:vn,yaml:vn,toml:Tn,json:Pn,md:$n,markdown:$n,html:$n};function Rr(e,t){const n={yml:vn,yaml:vn,toml:Tn,json:Pn,frontmatter:$n,"json-frontmatter":zn(t),"toml-frontmatter":Bn(t),"yaml-frontmatter":Fn(t),...Or()};if(e in n)return n[e];throw new Error(`No formatter available with name: ${e}`)}function Ar(e,t){const n=e.get("frontmatter_delimiter"),r=(o=n,Ge.List.isList(o)?n.toArray():n);var o;const i=e.get("format");if(i)return Rr(i,r);const a=t&&t.path;if(a){const e=a.split(".").pop();if(e)return on()(Mr,e)}const s=e.get("extension");return s?on()(Mr,s):Rr("frontmatter",r)}var Ir=__webpack_require__(52743),Dr=__webpack_require__.n(Ir),jr=__webpack_require__(90959),Lr=__webpack_require__.n(jr),Nr=__webpack_require__(3514),$r=__webpack_require__.n(Nr);const Fr="simple",Br="editorial_workflow",zr=(0,Ge.OrderedMap)({DRAFT:"draft",PENDING_REVIEW:"pending_review",PENDING_PUBLISH:"pending_publish"});(0,Ge.Map)({[zr.get("DRAFT")]:"Draft",[zr.get("PENDING_REVIEW")]:"Waiting for Review",[zr.get("PENDING_PUBLISH")]:"Waiting to go live"});var Ur=__webpack_require__(11601),qr=__webpack_require__.n(Ur),Wr=__webpack_require__(68678),Hr=__webpack_require__(67156),Vr=__webpack_require__.n(Hr);const Kr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Gr;const Yr=new Uint8Array(16);function Qr(){if(!Gr&&(Gr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Gr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gr(Yr)}const Jr=[];for(let e=0;e<256;++e)Jr.push((e+256).toString(16).slice(1));const Xr=function(e,t,n){if(Kr.randomUUID&&!t&&!e)return Kr.randomUUID();const r=(e=e||{}).random||(e.rng||Qr)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return Jr[e[t+0]]+Jr[e[t+1]]+Jr[e[t+2]]+Jr[e[t+3]]+"-"+Jr[e[t+4]]+Jr[e[t+5]]+"-"+Jr[e[t+6]]+Jr[e[t+7]]+"-"+Jr[e[t+8]]+Jr[e[t+9]]+"-"+Jr[e[t+10]]+Jr[e[t+11]]+Jr[e[t+12]]+Jr[e[t+13]]+Jr[e[t+14]]+Jr[e[t+15]]}(r)};var Zr=__webpack_require__(87809),eo=__webpack_require__.n(Zr),to=__webpack_require__(83985),no=__webpack_require__.n(to);const ro="file_based_collection",oo="folder_based_collection",io="commit_author",ao="commit_date";var so=__webpack_require__(48110);const lo=["title","path"],uo=["title","date","author","description"],co={title:{type:"string",secondaryTypes:[],synonyms:["title","name","label","headline","header"],defaultPreview:e=>(0,so.jsx)("h1",null,e),fallbackToFirstField:!0,showError:!0},shortTitle:{type:"string",secondaryTypes:[],synonyms:["short_title","shortTitle","short"],defaultPreview:e=>(0,so.jsx)("h2",null,e),fallbackToFirstField:!1,showError:!1},author:{type:"string",secondaryTypes:[],synonyms:["author","name","by","byline","owner"],defaultPreview:e=>(0,so.jsx)("strong",null,e),fallbackToFirstField:!1,showError:!1},date:{type:"datetime",secondaryTypes:["date"],synonyms:["date","publishDate","publish_date"],defaultPreview:e=>e,fallbackToFirstField:!1,showError:!1},description:{type:"string",secondaryTypes:["text","markdown"],synonyms:["shortDescription","short_description","shortdescription","description","intro","introduction","brief","content","biography","bio","summary"],defaultPreview:e=>e,fallbackToFirstField:!1,showError:!1},image:{type:"image",secondaryTypes:[],synonyms:["image","thumbnail","thumb","picture","avatar","photo","cover","hero","logo"],defaultPreview:e=>e,fallbackToFirstField:!1,showError:!1}};var fo=__webpack_require__(47354),po=__webpack_require__.n(fo),ho=__webpack_require__(56622),go=__webpack_require__.n(ho);let mo=function(e){return e.Ascending="Ascending",e.Descending="Descending",e.None="None",e}({});var yo=__webpack_require__(62879),vo=__webpack_require__.n(yo),bo=__webpack_require__(14098),wo=__webpack_require__.n(bo),xo=__webpack_require__(17426),So=__webpack_require__.n(xo),ko=__webpack_require__(75442),_o=__webpack_require__(51048),Eo=__webpack_require__.n(_o),Co=__webpack_require__(69465),Oo=__webpack_require__(89361),To=__webpack_require__.n(Oo),Po=__webpack_require__(8138),Mo=__webpack_require__.n(Po);function Ro(e,t){return function(e,t){return`${t?"/#":""}${e}`}(`/collections/${e}/new`,t)}function Ao(e,t){const n=ko.parse(e,!0);return n.query={...n.query,...t},ko.format(n)}const Io=/[\w\-.~]/i,Do=/[\xA0-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFEF}\u{10000}-\u{1FFFD}\u{20000}-\u{2FFFD}\u{30000}-\u{3FFFD}\u{40000}-\u{4FFFD}\u{50000}-\u{5FFFD}\u{60000}-\u{6FFFD}\u{70000}-\u{7FFFD}\u{80000}-\u{8FFFD}\u{90000}-\u{9FFFD}\u{A0000}-\u{AFFFD}\u{B0000}-\u{BFFFD}\u{C0000}-\u{CFFFD}\u{D0000}-\u{DFFFD}\u{E1000}-\u{EFFFD}]/u;function jo(e){return Io.test(e)}function Lo(e){return Io.test(e)||Do.test(e)}function No(e,t){let
|
|
14
|
+
`),!n)throw Error(`Widget "${t}" registered without \`controlComponent\`.`);cr.widgets[t]={control:n,preview:r,schema:o,globalStyles:a,allowMapValue:i,...s}}else console.error("`registerWidget` failed, called with incorrect arguments.")}function gr(e){return cr.widgets[e]}function mr(){return Wt(Object.entries(cr.widgets),e=>e.map(([e,t])=>({name:e,...t})))}function yr(e){return gr(e||"string")||gr("unknown")}function vr(){return cr.editorComponents}function br(){return cr.remarkPlugins}function wr(e){return cr.widgetValueSerializers[e]}function xr(e){return cr.backends[e]}function Sr(e){return cr.mediaLibraries.find(t=>t.name===e)}function kr(e){if(!lr.includes(e))throw new Error(`Invalid event name '${e}'`)}async function _r({name:e,data:t}){kr(e);const n=cr.eventHandlers[e];let r={...t};for(const{handler:e,options:o}of n){const n=await e(r,o);if(void 0!==n){const e=r.entry.set("data",n);r={...t,entry:e}}}return r.entry.get("data")}function Er(e){return cr.locales[e]}function Cr(){return Object.entries(cr.formats).reduce(function(e,[t,{extension:n}]){return{...e,[t]:n}},{})}function Or(){return Object.entries(cr.formats).reduce(function(e,[t,{formatter:n}]){return{...e,[t]:n}},{})}const Tr=["yaml-frontmatter","toml-frontmatter","json-frontmatter"],Pr={yml:"yml",yaml:"yml",toml:"toml",json:"json",frontmatter:"md","json-frontmatter":"md","toml-frontmatter":"md","yaml-frontmatter":"md"},Mr={yml:vn,yaml:vn,toml:Tn,json:Pn,md:$n,markdown:$n,html:$n};function Rr(e,t){const n={yml:vn,yaml:vn,toml:Tn,json:Pn,frontmatter:$n,"json-frontmatter":zn(t),"toml-frontmatter":Bn(t),"yaml-frontmatter":Fn(t),...Or()};if(e in n)return n[e];throw new Error(`No formatter available with name: ${e}`)}function Ar(e,t){const n=e.get("frontmatter_delimiter"),r=(o=n,Ge.List.isList(o)?n.toArray():n);var o;const i=e.get("format");if(i)return Rr(i,r);const a=t&&t.path;if(a){const e=a.split(".").pop();if(e)return on()(Mr,e)}const s=e.get("extension");return s?on()(Mr,s):Rr("frontmatter",r)}var Ir=__webpack_require__(52743),Dr=__webpack_require__.n(Ir),jr=__webpack_require__(90959),Lr=__webpack_require__.n(jr),Nr=__webpack_require__(3514),$r=__webpack_require__.n(Nr);const Fr="simple",Br="editorial_workflow",zr=(0,Ge.OrderedMap)({DRAFT:"draft",PENDING_REVIEW:"pending_review",PENDING_PUBLISH:"pending_publish"});(0,Ge.Map)({[zr.get("DRAFT")]:"Draft",[zr.get("PENDING_REVIEW")]:"Waiting for Review",[zr.get("PENDING_PUBLISH")]:"Waiting to go live"});var Ur=__webpack_require__(11601),qr=__webpack_require__.n(Ur),Wr=__webpack_require__(68678),Hr=__webpack_require__(67156),Vr=__webpack_require__.n(Hr);const Kr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Gr;const Yr=new Uint8Array(16);function Qr(){if(!Gr&&(Gr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Gr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gr(Yr)}const Jr=[];for(let e=0;e<256;++e)Jr.push((e+256).toString(16).slice(1));const Xr=function(e,t,n){if(Kr.randomUUID&&!t&&!e)return Kr.randomUUID();const r=(e=e||{}).random||(e.rng||Qr)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return Jr[e[t+0]]+Jr[e[t+1]]+Jr[e[t+2]]+Jr[e[t+3]]+"-"+Jr[e[t+4]]+Jr[e[t+5]]+"-"+Jr[e[t+6]]+Jr[e[t+7]]+"-"+Jr[e[t+8]]+Jr[e[t+9]]+"-"+Jr[e[t+10]]+Jr[e[t+11]]+Jr[e[t+12]]+Jr[e[t+13]]+Jr[e[t+14]]+Jr[e[t+15]]}(r)};var Zr=__webpack_require__(87809),eo=__webpack_require__.n(Zr),to=__webpack_require__(83985),no=__webpack_require__.n(to);const ro="file_based_collection",oo="folder_based_collection",io="commit_author",ao="commit_date";var so=__webpack_require__(48110);const lo=["title","path"],uo=["title","date","author","description"],co={title:{type:"string",secondaryTypes:[],synonyms:["title","name","label","headline","header"],defaultPreview:e=>(0,so.jsx)("h1",null,e),fallbackToFirstField:!0,showError:!0},shortTitle:{type:"string",secondaryTypes:[],synonyms:["short_title","shortTitle","short"],defaultPreview:e=>(0,so.jsx)("h2",null,e),fallbackToFirstField:!1,showError:!1},author:{type:"string",secondaryTypes:[],synonyms:["author","name","by","byline","owner"],defaultPreview:e=>(0,so.jsx)("strong",null,e),fallbackToFirstField:!1,showError:!1},date:{type:"datetime",secondaryTypes:["date"],synonyms:["date","publishDate","publish_date"],defaultPreview:e=>e,fallbackToFirstField:!1,showError:!1},description:{type:"string",secondaryTypes:["text","markdown"],synonyms:["shortDescription","short_description","shortdescription","description","intro","introduction","brief","content","biography","bio","summary"],defaultPreview:e=>e,fallbackToFirstField:!1,showError:!1},image:{type:"image",secondaryTypes:[],synonyms:["image","thumbnail","thumb","picture","avatar","photo","cover","hero","logo"],defaultPreview:e=>e,fallbackToFirstField:!1,showError:!1}};var fo=__webpack_require__(47354),po=__webpack_require__.n(fo),ho=__webpack_require__(56622),go=__webpack_require__.n(ho);let mo=function(e){return e.Ascending="Ascending",e.Descending="Descending",e.None="None",e}({});var yo=__webpack_require__(62879),vo=__webpack_require__.n(yo),bo=__webpack_require__(14098),wo=__webpack_require__.n(bo),xo=__webpack_require__(17426),So=__webpack_require__.n(xo),ko=__webpack_require__(75442),_o=__webpack_require__(51048),Eo=__webpack_require__.n(_o),Co=__webpack_require__(69465),Oo=__webpack_require__(89361),To=__webpack_require__.n(Oo),Po=__webpack_require__(8138),Mo=__webpack_require__.n(Po);function Ro(e,t){return function(e,t){return`${t?"/#":""}${e}`}(`/collections/${e}/new`,t)}function Ao(e,t){const n=ko.parse(e,!0);return n.query={...n.query,...t},ko.format(n)}const Io=/[\w\-.~]/i,Do=/[\xA0-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFEF}\u{10000}-\u{1FFFD}\u{20000}-\u{2FFFD}\u{30000}-\u{3FFFD}\u{40000}-\u{4FFFD}\u{50000}-\u{5FFFD}\u{60000}-\u{6FFFD}\u{70000}-\u{7FFFD}\u{80000}-\u{8FFFD}\u{90000}-\u{9FFFD}\u{A0000}-\u{AFFFD}\u{B0000}-\u{BFFFD}\u{C0000}-\u{CFFFD}\u{D0000}-\u{DFFFD}\u{E1000}-\u{EFFFD}]/u;function jo(e){return Io.test(e)}function Lo(e){return Io.test(e)||Do.test(e)}function No(e,t){const{replacement:n,preserveSlashes:r}=t;let o;if("unicode"===e)o=Lo;else{if("ascii"!==e)throw new Error('`options.encoding` must be "unicode" or "ascii".');o=jo}if(!Array.from(n).every(o))throw new Error("The replacement character(s) (options.replacement) is itself unsafe.");return(e,t=0,i=[e])=>r&&"/"===e&&0!==t&&t!==i.length-1||o(e)?e:n}function $o(e,t){const{replacement:n="",encoding:r="unicode",preserveSlashes:o}=t||{};if(!Mo()(e))throw new Error("The input slug must be a string.");if(!Mo()(n))throw new Error("`options.replacement` must be a string.");return Array.from(e).map(No(r,{replacement:n,preserveSlashes:o})).join("")}function Fo(e,t){const{encoding:n="unicode",sanitize_replacement:r=""}=t||{};return No(n,{replacement:r})(e)}function Bo(e,t,n){if(!Mo()(e))throw new Error("The input slug must be a string.");const{encoding:r,clean_accents:o,sanitize_replacement:i}=t||{},a=vo()([...o?[Co.TF]:[],wo()($o,{replacement:i,encoding:r,preserveSlashes:n}),n?e=>e.split("/").filter(Boolean).map(e=>To()(e,{replacement:i})).join("/"):wo()(To(),{replacement:i})])(e),s=new RegExp(`(?:${no()(i)})+`,"g"),l=new RegExp(`${no()(i)}$`),u=new RegExp(`^${no()(i)}`);return a.replace(s,i).replace(u,"").replace(l,"")}const{compileStringTemplate:zo,parseDateFromEntry:Uo,parseDateFromEntryData:qo,SLUG_MISSING_REQUIRED_DATE:Wo,keyToPathArray:Ho,addFileTemplateFields:Vo}=dn.stringTemplate,Ko={create:"Create {{collection}} “{{slug}}”",update:"Update {{collection}} “{{slug}}”",delete:"Delete {{collection}} “{{slug}}”",uploadMedia:"Upload “{{path}}”",deleteMedia:"Delete “{{path}}”",openAuthoring:"{{message}}"},Go=/\{\{([^}]+)\}\}/g;function Yo(e,t,{slug:n,path:r,collection:o,authorLogin:i,authorName:a,authorEmail:s},l){const u={...Ko,...t.backend.commit_messages||{}};let c="";t.backend.signoff_commits&&(a?s?c=`\n\nSigned-off-by: ${a} <${s}>\n`:console.warn("Option signoff_commits is enabled, but author email is unknown"):console.warn("Option signoff_commits is enabled, but author name is unknown"));const f=u[e].replace(Go,(e,t)=>{switch(t){case"slug":return n||"";case"path":return r||"";case"collection":return o?o.get("label_singular")||o.get("label"):"";case"author-login":return i||"";case"author-name":return a||"";default:return console.warn(`Ignoring unknown variable “${t}” in commit message template.`),""}});return l?u.openAuthoring.replace(Go,(e,t)=>{switch(t){case"message":return f;case"author-login":return i||"";case"author-name":return a||"";default:return console.warn(`Ignoring unknown variable “${t}” in open authoring message template.`),""}})+c:f+c}function Qo(e){return e.trim().toLocaleLowerCase().replace(/[']/g,"").replace(/[.]/g,"-")}function Jo(e,t,n){return r=>t&&t.includes(r)?r:vo()([e=>String(e),Qo,wo()(Bo,e,n)])(r)}function Xo(e,t,n,r,o){if(!e)return;const i=So()(e,"/"),a=t.get("type")===ro?$l(t,r.get("slug")):void 0,s=a?.get("preview_path")??t.get("preview_path");if(!s)return e;let l=r.get("data");l=Vo(r.get("path"),l,t.get("folder"));const u=(a?.get("preview_path_date_field")??t.get("preview_path_date_field"))||Yl(t,"date"),c=Uo(r,u),f=!!(t.get("preview_path_preserve_slashes")??t.has("nested")),d=Jo(o,[l.get("dirname")],f);let p;try{p=zo(s,c,n,l,d)}catch(e){if(e instanceof Error&&e.name===Wo)return console.error(rr`
|
|
15
15
|
Collection "${t.get("name")}" configuration error:
|
|
16
16
|
\`preview_path_date_field\` must be a field with a valid date. Ignoring \`preview_path\`.
|
|
17
|
-
`),i;throw e}return`${i}/${Lr()(d," /")}`}function Zo(e,t,n,r,o,i){if(!t||!t.get("data"))return e;let a=t.get("data").set(o,r);a=Vo(t.get("path"),a,n.get("folder"));const s=Uo(t,Yl(n,"date"))||null,l=a.getIn(Ho(Gl(n))),u=Jo(i,[r,a.get("dirname")]);return zo(e,s,l,a,u)}var ei=__webpack_require__(46343),ti=__webpack_require__.n(ei),ni=__webpack_require__(22563),ri=__webpack_require__.n(ni);function oi(e,t="",n="",r={}){return{collection:e,slug:t,path:n,partial:r.partial||!1,raw:r.raw||"",data:r.data||{},label:r.label||null,isModification:ri()(r.isModification)?r.isModification:null,mediaFiles:r.mediaFiles||[],author:r.author||"",updatedOn:r.updatedOn||"",status:r.status||"",meta:r.meta||{},i18n:r.i18n||{}}}const{fetchWithTimeout:ii}=cn.unsentRequest;class ai{constructor(e){if(this.config=e,null==e.get("applicationID")||null==e.get("apiKey"))throw"The Algolia search integration needs the credentials (applicationID and apiKey) in the integration configuration.";this.applicationID=e.get("applicationID"),this.apiKey=e.get("apiKey");const t=e.get("indexPrefix");this.indexPrefix=t?`${t}-`:"",this.searchURL=`https://${this.applicationID}-dsn.algolia.net/1`,this.entriesCache={collection:null,page:null,entries:[]}}requestHeaders(e={}){return{"X-Algolia-API-Key":this.apiKey,"X-Algolia-Application-Id":this.applicationID,"Content-Type":"application/json",...e}}parseJsonResponse(e){return e.json().then(t=>e.ok?t:Promise.reject(t))}urlFor(e,t){const n=[];if(t.params)for(const e in t.params)n.push(`${e}=${encodeURIComponent(t.params[e])}`);return n.length&&(e+=`?${n.join("&")}`),e}request(e,t={}){const n=this.requestHeaders(t.headers||{}),r=this.urlFor(e,t);return ii(r,{...t,headers:n}).then(e=>{const t=e.headers.get("Content-Type");return t&&t.match(/json/)?this.parseJsonResponse(e):e.text()})}search(e,t,n){const r=e.map(e=>({indexName:`${this.indexPrefix}${e}`,params:`query=${t}&page=${n}`}));return this.request(`${this.searchURL}/indexes/*/queries`,{method:"POST",body:JSON.stringify({requests:r})}).then(t=>{const r=t.results.map((t,n)=>t.hits.map(t=>{const r=t.path.split("/").pop().replace(/\.[^.]+$/,"");return oi(e[n],r,t.path,{data:t.data,partial:!0})}));return{entries:Gt()(r),pagination:n}})}searchBy(e,t,n){return this.request(`${this.searchURL}/indexes/${this.indexPrefix}${t}`,{params:{restrictSearchableAttributes:e,query:n}})}listEntries(e,t){return this.entriesCache.collection===e&&this.entriesCache.page===t?Promise.resolve({page:this.entriesCache.page,entries:this.entriesCache.entries}):this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:{page:t}}).then(t=>{const n=t.hits.map(t=>{const n=ql(e,t.path);return oi(e.get("name"),n,t.path,{data:t.data,partial:!0})});return this.entriesCache={collection:e,pagination:t.page,entries:n},{entries:n,pagination:t.page}})}async listAllEntries(e){const t={hitsPerPage:1e3};let n=await this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:t}),{nbPages:r=0,hits:o,page:i}=n;for(i+=1;i<r;)n=await this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:{...t,page:i}}),o=[...o,...n.hits],i+=1;const a=o.map(t=>{const n=ql(e,t.path);return oi(e.get("name"),n,t.path,{data:t.data,partial:!0})});return a}getEntry(e,t){return this.searchBy("slug",e.get("name"),t).then(n=>{const r=n.hits.filter(e=>e.slug===t)[0];return oi(e.get("name"),t,r.path,{data:r.data,partial:!0})})}}var si=__webpack_require__(16735),li=__webpack_require__.n(si);const{fetchWithTimeout:ui}=cn.unsentRequest;class ci{constructor(e,t){if(this.config=e,null==e.get("getSignedFormURL"))throw"The AssetStore integration needs the getSignedFormURL in the integration configuration.";this.getToken=t,this.shouldConfirmUpload=e.get("shouldConfirmUpload",!1),this.getSignedFormURL=So()(e.get("getSignedFormURL"),"/")}parseJsonResponse(e){return e.json().then(t=>e.ok?t:Promise.reject(t))}urlFor(e,t){const n=[];if(t.params)for(const e in t.params)n.push(`${e}=${encodeURIComponent(t.params[e])}`);return n.length&&(e+=`?${n.join("&")}`),e}requestHeaders(e={}){return{...e}}confirmRequest(e){this.getToken().then(t=>this.request(`${this.getSignedFormURL}/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({state:"uploaded"})}))}async request(e,t={}){const n=this.requestHeaders(t.headers||{}),r=this.urlFor(e,t),o=await ui(r,{...t,headers:n}),i=o.headers.get("Content-Type");return i&&i.match(/json/)?await this.parseJsonResponse(o):o.text()}async retrieve(e,t,n){const r=li()({search:e,page:t,filter:n?"private":"public"},e=>!!e),o=Ao(this.getSignedFormURL,r),i={"Content-Type":"application/json",Authorization:`Bearer ${await this.getToken()}`},a=(await this.request(o,{headers:i})).map(({id:e,name:t,size:n,url:r})=>({id:e,name:t,size:n,displayURL:r,url:r,path:r}));return a}delete(e){const t=`${this.getSignedFormURL}/${e}`;return this.getToken().then(e=>this.request(t,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}}))}async upload(e,t=!1){const n={name:e.name,size:e.size};e.type&&(n.content_type=e.type),t&&(n.visibility="private");try{const t=await this.getToken(),r=await this.request(this.getSignedFormURL,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)}),o=r.form.url,i=r.form.fields,{id:a,name:s,size:l,url:u}=r.asset,c=new FormData;return Object.keys(i).forEach(e=>c.append(e,i[e])),c.append("file",e,e.name),await this.request(o,{method:"POST",body:c}),this.shouldConfirmUpload&&await this.confirmRequest(a),{success:!0,asset:{id:a,name:s,size:l,displayURL:u,url:u,path:u}}}catch(e){throw console.error(e),e}}}const fi=function(){let e=null;return(t,n,r)=>(e||(e=function(e,t){let n=(0,Ge.Map)({});return e.get("providers").forEach((e,r)=>{switch(r){case"algolia":n=n.set("algolia",new ai(e));break;case"assetStore":n=n.set("assetStore",new ci(e,t))}}),n}(t,n)),e.get(r))}(),di="SEARCH_ENTRIES_REQUEST",pi="SEARCH_ENTRIES_SUCCESS",hi="SEARCH_ENTRIES_FAILURE",gi="QUERY_REQUEST",mi="QUERY_SUCCESS",yi="QUERY_FAILURE",vi="SEARCH_CLEAR",bi="CLEAR_REQUESTS";function wi(){return{type:vi}}function xi(e,t,n,r,o,i){return async(a,s)=>{const l=s(),u=uc(l.config),c=Qc(l,t,"search"),f=l.collections.find(e=>e.get("name")===t);a({type:bi});const d=`${t}-${n.join()}-${r}-${o}-${i}`,p=l.search.requests.find(({id:e})=>e==d),h=p?p.queryResponse:c?fi(l.integrations,u.getToken,c).searchBy(n.map(e=>`data.${e}`),t,r):u.query(f,n,r,o,i);a(function(e,t){return{type:gi,payload:{searchTerm:e,request:t}}}(r,p?void 0:{id:d,expires:new Date((new Date).getTime()+1e4),queryResponse:h}));try{const t=await h;return a(function(e,t){return{type:mi,payload:{namespace:e,hits:t}}}(e,t.hits))}catch(e){return a(function(e){return{type:yi,payload:{error:e}}}(e))}}}function Si(e,t){return new cn.Cursor(e.getIn(["cursorsByType","collectionEntries",t]))}var ki=__webpack_require__(3668),_i=__webpack_require__.n(ki);function Ei(e,t,n){let r=t.reduce((t,r)=>{const o=r.get("name"),i=e.get(o),a=wr(r.get("widget")),s=r.get("fields");return s&&Ge.List.isList(i)?t.set(o,i.map(e=>Ei(e,s,n))):s&&Ge.Map.isMap(i)?t.set(o,Ei(i,s,n)):a&&!_i()(i)?t.set(o,a[n](i)):_i()(i)?t:t.set(o,i)},(0,Ge.Map)());return r=e.mergeDeep(r),r}const Ci="PRESENCE",Oi="CUSTOM";function Ti({predicate:e,run:t}){return{type:Ke,predicate:e,run:t}}async function Pi(e,t,n=3e4){let r=!1;const o=new Promise(n=>{e(Ti(t(n)))}),i=new Promise(e=>{setTimeout(()=>{r?e():(console.warn("Wait Action timed out"),e(null))},n)});return await Promise.race([o.then(e=>(r=!0,e)).catch(null),i])}const Mi="NOTIFICATION_SEND",Ri="NOTIFICATION_DISMISS",Ai="NOTIFICATION_CLEAR";function Ii(e){return{type:Mi,payload:e}}function Di(e){return{type:Ri,id:e}}const ji="MEDIA_LIBRARY_OPEN",Li="MEDIA_LIBRARY_CLOSE",Ni="MEDIA_LIBRARY_CREATE",$i="MEDIA_INSERT",Fi="MEDIA_REMOVE_INSERTED",Bi="MEDIA_LOAD_REQUEST",zi="MEDIA_LOAD_SUCCESS",Ui="MEDIA_LOAD_FAILURE",qi="MEDIA_PERSIST_REQUEST",Wi="MEDIA_PERSIST_SUCCESS",Hi="MEDIA_PERSIST_FAILURE",Vi="MEDIA_DELETE_REQUEST",Ki="MEDIA_DELETE_SUCCESS",Gi="MEDIA_DELETE_FAILURE",Yi="MEDIA_DISPLAY_URL_REQUEST",Qi="MEDIA_DISPLAY_URL_SUCCESS",Ji="MEDIA_DISPLAY_URL_FAILURE";function Xi(e){return(t,n)=>{const r=n().mediaLibrary.get("externalLibrary");r&&r.onClearControl({id:e})}}function Zi(e){return(t,n)=>{const r=n().mediaLibrary.get("externalLibrary");r&&r.onRemoveControl({id:e})}}function ea(e={}){return(t,n)=>{const r=n().mediaLibrary.get("externalLibrary");if(r){const{controlID:t,value:n,config:o=(0,Ge.Map)(),allowMultiple:i,forImage:a}=e;r.show({id:t,value:n,config:o.toJS(),allowMultiple:i,imagesOnly:a})}t(function(e){return{type:ji,payload:e}}(e))}}function ta(e,t){return(n,r)=>{const o=r(),i=o.config,a=o.entryDraft.get("entry"),s=o.entryDraft.getIn(["entry","collection"]),l=o.collections.get(s);n(function(e){return{type:$i,payload:{mediaPath:e}}}(e=Array.isArray(e)?e.map(e=>Al(i,l,e,a,t)):Al(i,l,e,a,t)))}}function na(e){return{type:Fi,payload:{controlID:e}}}function ra(e={}){const{delay:t=0,query:n="",page:r=1,privateUpload:o}=e;return async(e,i)=>{const a=i(),s=uc(a.config),l=Qc(a,null,"assetStore");if(l){const t=fi(a.integrations,s.getToken,l);e(la(r));try{const i=await t.retrieve(n,r,o);return e(ua(i,{page:r,canPaginate:!0,dynamicSearch:!0,dynamicSearchQuery:n,privateUpload:o}))}catch(t){return e(ca({privateUpload:o}))}}function u(){return s.getMedia().then(t=>e(ua(t))).catch(t=>{console.error(t),404===t.status?(console.log("This 404 was expected and handled appropriately."),e(ua([]))):e(ca())})}return e(la(r)),t>0?new Promise(e=>{setTimeout(()=>e(u()),t)}):u()}}function oa({id:e,file:t,assetProxy:n,draft:r}){return{id:e,name:(0,cn.basename)(n.path),displayURL:n.url,draft:r,file:t,size:t.size,url:n.url,path:n.path,field:n.field}}function ia(e,t={}){const{privateUpload:n,field:r}=t;return async(t,o)=>{const i=o(),a=uc(i.config),s=Qc(i,null,"assetStore"),l=va(i,r),u=Bo(e.name.toLowerCase(),i.config.slug),c=l.find(e=>e.name.toLowerCase()===u),f=Il(i.entryDraft);if(!s&&c){if(!window.confirm(`${c.name} already exists. Do you want to replace it?`))return;await t(aa(c,{privateUpload:n}))}!s&&f||t({type:qi});try{let o,l;if(s)try{const t=fi(i.integrations,a.getToken,s),r=await t.upload(e,n);o=Cn({url:r.asset.url,path:r.asset.url})}catch(t){o=Cn({file:e,path:u})}else{if(n)throw new Error("The Private Upload option is only available for Asset Store Integration");{const t=i.entryDraft.get("entry"),n=i.collections.get(t?.get("collection")),a=Rl(i.config,n,t,u,r);o=Cn({file:e,path:a,field:r})}}if(t(Oa(o)),s)l=oa({id:await(0,cn.getBlobSHA)(e),file:e,assetProxy:o,draft:!1});else{if(f)return l=oa({id:await(0,cn.getBlobSHA)(e),file:e,assetProxy:o,draft:f}),t(function(e){return{type:Ls,payload:e}}(l));l=await a.persistMedia(i.config,o)}return t(function(e,t={}){const{privateUpload:n}=t;return{type:Wi,payload:{file:e,privateUpload:n}}}(l,{privateUpload:n}))}catch(e){return console.error(e),t(Ii({message:`Failed to persist media: ${e}`,type:"error",dismissAfter:8e3})),t(function(e={}){const{privateUpload:t}=e;return{type:Hi,payload:{privateUpload:t}}}({privateUpload:n}))}}}function aa(e,t={}){const{privateUpload:n}=t;return async(t,r)=>{const o=r(),i=uc(o.config),a=Qc(o,null,"assetStore");if(a){const r=fi(o.integrations,i.getToken,a);t(fa());try{return await r.delete(e.id),t(da(e,{privateUpload:n}))}catch(e){return console.error(e),t(Ii({message:`Failed to delete media: ${e.message}`,type:"error",dismissAfter:8e3})),t(pa({privateUpload:n}))}}try{if(e.draft)t(Ta(e.path)),t(Ks({id:e.id}));else{const n=Il(o.entryDraft);t(fa()),t(Ta(e.path)),await i.deleteMedia(o.config,e.path),t(da(e)),n&&t(Ks({id:e.id}))}}catch(e){return console.error(e),t(Ii({message:`Failed to delete media: ${e.message}`,type:"error",dismissAfter:8e3})),t(pa())}}}function sa(e){return async(t,n)=>{const{displayURL:r,id:o}=e,i=n(),a=ba(i,o);if(!o||!r||a.get("url")||a.get("isFetching")||a.get("err"))return Promise.resolve();if("string"==typeof r)return t(ha(o)),void t(ga(o,r));try{const e=uc(i.config);t(ha(o));const n=await e.getMediaDisplayURL(r);if(!n)throw new Error("No display URL was returned!");t(ga(o,n))}catch(e){console.error(e),t(function(e,t){return{type:Ji,payload:{key:e,err:t}}}(o,e))}}}function la(e){return{type:Bi,payload:{page:e}}}function ua(e,t={}){return{type:zi,payload:{files:e,...t}}}function ca(e={}){const{privateUpload:t}=e;return{type:Ui,payload:{privateUpload:t}}}function fa(){return{type:Vi}}function da(e,t={}){const{privateUpload:n}=t;return{type:Ki,payload:{file:e,privateUpload:n}}}function pa(e={}){const{privateUpload:t}=e;return{type:Gi,payload:{privateUpload:t}}}function ha(e){return{type:Yi,payload:{key:e}}}function ga(e,t){return{type:Qi,payload:{key:e,url:t}}}async function ma(e,t){!1===t.mediaLibrary.get("isLoading")||t.mediaLibrary.get("externalLibrary")||await Pi(e,e=>({predicate:({type:e})=>e===zi||e===Ui,run:()=>e()}))}const ya={isVisible:!1,showMediaButton:!0,controlMedia:(0,Ge.Map)(),displayURLs:(0,Ge.Map)(),config:(0,Ge.Map)()};function va(e,t){const{mediaLibrary:n,entryDraft:r}=e,o=Il(e.entryDraft),i=Qc(e,null,"assetStore");let a;if(o&&!i){const n=r.getIn(["entry","mediaFiles"],(0,Ge.List)()).toJS(),o=r.get("entry"),i=e.collections.get(o?.get("collection")),s=Ml(e.config,i,o,t);a=n.filter(e=>(0,fn.dirname)(e.path)===s).map(e=>({key:e.id,...e}))}else a=n.get("files")||[];return a}function ba(e,t){return e.mediaLibrary.getIn(["displayURLs",t],(0,Ge.Map)())}const wa="ADD_ASSETS",xa="ADD_ASSET",Sa="REMOVE_ASSET",ka="LOAD_ASSET_REQUEST",_a="LOAD_ASSET_SUCCESS",Ea="LOAD_ASSET_FAILURE";function Ca(e){return{type:wa,payload:e}}function Oa(e){return{type:xa,payload:e}}function Ta(e){return{type:Sa,payload:e}}const Pa=Cn({path:"empty.svg",file:new File(['<svg xmlns="http://www.w3.org/2000/svg"></svg>'],"empty.svg",{type:"image/svg+xml"})});function Ma(e,t,n){return function(r,o){return e(Ra({collection:t,entry:n,path:r,field:o}))}}function Ra({collection:e,entry:t,path:n,field:r}){return(o,i)=>{if(!n)return Pa;const a=i(),s=Rl(a.config,e,t,n,r);let{asset:l,isLoading:u,error:c}=a.medias[s]||{};return u?Pa:l||((0,cn.isAbsolutePath)(s)||c?(l=Cn({path:s,url:n}),o(Oa(l))):(o(function(e){return async(t,n)=>{try{t({type:ka,payload:{path:e}}),await ma(t,n());const i=(r=n(),o=e,va(r).find(e=>e.path===o));if(i){const r=await async function(e,t,n){const r=ba(t,n.id);let o;if(r.get("url"))o=r.get("url");else if(r.get("err"))o=null;else{const t=n.id,i=Pi(e,e=>({predicate:({type:e,payload:n})=>(e===Qi||e===Ji)&&n.key===t,run:(t,n,r)=>e(r.payload.url)}));r.get("isFetching")||e(sa(n)),o=await i??null}return o}(t,n(),i);t(Oa(Cn({path:e,url:r||e})))}else{const{url:r}=await async function(e,t){const n=uc(e.config),{url:r}=await n.getMediaFile(t);return{url:r}}(n(),e);t(Oa(Cn({path:e,url:r})))}t(function(e){return{type:_a,payload:{path:e}}}(e))}catch(n){t(function(e,t){return{type:Ea,payload:{path:e,error:t}}}(e,n))}var r,o}}(s)),l=Pa),l)}}const Aa=function(e){void 0===e&&(e={}),pe||ie(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),r=n.getUserConfirmation,o=void 0===r?he:r,i=n.hashType,a=void 0===i?"slash":i,s=e.basename?ue(ae(e.basename)):"",l=me[a],u=l.encodePath,c=l.decodePath;function f(){var e=c(ve());return s&&(e=le(e,s)),fe(e)}var d=de();function p(e){h(C,e),C.length=t.length,d.notifyListeners(C.location,C.action)}var g=!1,m=null;function y(){var e=ve(),t=u(e);if(e!==t)be(t);else{var n=f(),r=C.location;if(!g&&function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash}(r,n))return;if(m===ce(n))return;m=null,function(e){if(g)g=!1,p();else{d.confirmTransitionTo(e,"POP",o,function(t){t?p({action:"POP",location:e}):function(e){var t=C.location,n=x.lastIndexOf(ce(t));-1===n&&(n=0);var r=x.lastIndexOf(ce(e));-1===r&&(r=0);var o=n-r;o&&(g=!0,S(o))}(e)})}}(n)}}var v=ve(),b=u(v);v!==b&&be(b);var w=f(),x=[ce(w)];function S(e){t.go(e)}var k=0;function _(e){1===(k+=e)&&1===e?window.addEventListener(ge,y):0===k&&window.removeEventListener(ge,y)}var E=!1,C={length:t.length,action:"POP",location:w,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=ye(window.location.href)),n+"#"+u(s+ce(e))},push:function(e,t){var n="PUSH",r=fe(e,void 0,void 0,C.location);d.confirmTransitionTo(r,n,o,function(e){if(e){var t=ce(r),o=u(s+t);if(ve()!==o){m=t,function(e){window.location.hash=e}(o);var i=x.lastIndexOf(ce(C.location)),a=x.slice(0,i+1);a.push(t),x=a,p({action:n,location:r})}else p()}})},replace:function(e,t){var n="REPLACE",r=fe(e,void 0,void 0,C.location);d.confirmTransitionTo(r,n,o,function(e){if(e){var t=ce(r),o=u(s+t);ve()!==o&&(m=t,be(o));var i=x.indexOf(ce(C.location));-1!==i&&(x[i]=t),p({action:n,location:r})}})},go:S,goBack:function(){S(-1)},goForward:function(){S(1)},block:function(e){void 0===e&&(e=!1);var t=d.setPrompt(e);return E||(_(1),E=!0),function(){return E&&(E=!1,_(-1)),t()}},listen:function(e){var t=d.appendListener(e);return _(1),function(){_(-1),t()}}};return C}();function Ia(e){return Aa.push(`/collections/${e}`)}function Da(e){return Aa.replace(`/collections/${e}/new`)}function ja(e,t){return Aa.replace(`/collections/${e}/entries/${t}`)}const La="UNPUBLISHED_ENTRY_REQUEST",Na="UNPUBLISHED_ENTRY_SUCCESS",$a="UNPUBLISHED_ENTRY_REDIRECT",Fa="UNPUBLISHED_ENTRIES_REQUEST",Ba="UNPUBLISHED_ENTRIES_SUCCESS",za="UNPUBLISHED_ENTRY_PERSIST_REQUEST",Ua="UNPUBLISHED_ENTRY_PERSIST_SUCCESS",qa="UNPUBLISHED_ENTRY_PERSIST_FAILURE",Wa="UNPUBLISHED_ENTRY_STATUS_CHANGE_REQUEST",Ha="UNPUBLISHED_ENTRY_STATUS_CHANGE_SUCCESS",Va="UNPUBLISHED_ENTRY_STATUS_CHANGE_FAILURE",Ka="UNPUBLISHED_ENTRY_PUBLISH_REQUEST",Ga="UNPUBLISHED_ENTRY_PUBLISH_SUCCESS",Ya="UNPUBLISHED_ENTRY_PUBLISH_FAILURE",Qa="UNPUBLISHED_ENTRY_DELETE_SUCCESS";function Ja(e,t){return{type:Ba,payload:{entries:e,pages:t}}}function Xa(e,t){return{type:za,payload:{collection:e.get("name"),slug:t}}}function Za(e,t){return{type:Ua,payload:{collection:e.get("name"),entry:t}}}function es(e,t,n){return{type:qa,payload:{error:e,collection:t.get("name"),slug:n},error:e}}function ts(e,t){return async(n,r)=>{const o=r(),i=uc(o.config);if(!on()(o.editorialWorkflow.toJS(),"pages.ids",!1))try{const{entries:e,pagination:t}=await i.unpublishedEntries(o.collections);n(Ja(e,t))}catch(e){}n(function(e,t){return{type:La,payload:{collection:e.get("name"),slug:t}}}(e,t));try{const r=await i.unpublishedEntry(o,e,t),a=await Promise.all(r.mediaFiles.filter(e=>e.draft).map(({url:e,file:t,path:n})=>Cn({path:n,url:e,file:t})));n(Ca(a)),n(function(e,t){return{type:Na,payload:{collection:e.get("name"),entry:t}}}(e,r)),n(Hs(r))}catch(r){r.name===cn.EDITORIAL_WORKFLOW_ERROR&&r.notUnderEditorialWorkflow?(n(function(e,t){return{type:$a,payload:{collection:e.get("name"),slug:t}}}(e,t)),n(Gs(e,t))):n(Ii({message:{key:"ui.toast.onFailToLoadEntries",details:r},type:"error",dismissAfter:8e3}))}}}function ns(e){return(t,n)=>{const r=n(),o=uc(r.config),i=on()(r.editorialWorkflow.toJS(),"pages.ids",!1);r.config.publish_mode!==Br||i||(t({type:Fa}),o.unpublishedEntries(e).then(e=>t(Ja(e.entries,e.pagination))).catch(e=>{t(Ii({message:{key:"ui.toast.onFailToLoadEntries",details:e},type:"error",dismissAfter:8e3})),t(function(e){return{type:"UNPUBLISHED_ENTRIES_FAILURE",error:"Failed to load entries",payload:e}}(e)),Promise.reject(e)}))}}function rs(e,t,n,r){return(o,i)=>{if(n===r)return;const a=i(),s=uc(a.config);o(function(e,t){return{type:Wa,payload:{collection:e,slug:t}}}(e,t)),s.updateUnpublishedEntryStatus(e,t,r).then(()=>{o(Ii({message:{key:"ui.toast.entryUpdated"},type:"success",dismissAfter:4e3})),o(function(e,t,n){return{type:Ha,payload:{collection:e,slug:t,newStatus:n}}}(e,t,r))}).catch(n=>{o(Ii({message:{key:"ui.toast.onFailToUpdateStatus",details:n},type:"error",dismissAfter:8e3})),o(function(e,t){return{type:Va,payload:{collection:e,slug:t}}}(e,t))})}}function os(e,t){return(n,r)=>{const o=r(),i=uc(o.config);return n(function(e,t){return{type:"UNPUBLISHED_ENTRY_DELETE_REQUEST",payload:{collection:e,slug:t}}}(e,t)),i.deleteUnpublishedEntry(e,t).then(()=>{n(Ii({message:{key:"ui.toast.onDeleteUnpublishedChanges"},type:"success",dismissAfter:4e3})),n(function(e,t){return{type:Qa,payload:{collection:e,slug:t}}}(e,t))}).catch(r=>{n(Ii({message:{key:"ui.toast.onDeleteUnpublishedChanges",details:r},type:"error",dismissAfter:8e3})),n(function(e,t){return{type:"UNPUBLISHED_ENTRY_DELETE_FAILURE",payload:{collection:e,slug:t}}}(e,t))})}}function is(e,t){return async(n,r)=>{const o=r(),i=o.collections,a=uc(o.config),s=Gc(o,e,t);n(function(e,t){return{type:Ka,payload:{collection:e,slug:t}}}(e,t));try{await a.publishUnpublishedEntry(s),n(ra()),n(Ii({message:{key:"ui.toast.entryPublished"},type:"success",dismissAfter:4e3})),n(function(e,t){return{type:Ga,payload:{collection:e,slug:t}}}(e,t));const r=i.get(e);if(!r.has("nested"))return n(Gs(r,t));{n(Xs(r));const e=oc(r,s.get("path"));Gs(r,e),t!==e&&Il(o.entryDraft)&&ja(r.get("name"),e)}}catch(r){n(Ii({message:{key:"ui.toast.onFailToPublishEntry",details:r},type:"error",dismissAfter:8e3})),n(function(e,t){return{type:Ya,payload:{collection:e,slug:t}}}(e,t))}}}const as=(0,Ge.Map)({entry:(0,Ge.Map)(),fieldsMetaData:(0,Ge.Map)(),fieldsErrors:(0,Ge.Map)(),hasChanged:!1,key:""});function ss(e,t){if(!Xl(e))return;const n=t.getIn(["entry","meta"]),r=n&&n.get("path"),o=on()(e.toJS(),["meta","path","index_file"]),i=Bl(e);return r&&(0,fn.join)(e.get("folder"),r,`${o}.${i}`)}const ls="ENTRY_REQUEST",us="ENTRY_SUCCESS",cs="ENTRY_FAILURE",fs="ENTRIES_REQUEST",ds="ENTRIES_SUCCESS",ps="ENTRIES_FAILURE",hs="SORT_ENTRIES_REQUEST",gs="SORT_ENTRIES_SUCCESS",ms="SORT_ENTRIES_FAILURE",ys="FILTER_ENTRIES_REQUEST",vs="FILTER_ENTRIES_SUCCESS",bs="FILTER_ENTRIES_FAILURE",ws="GROUP_ENTRIES_REQUEST",xs="GROUP_ENTRIES_SUCCESS",Ss="GROUP_ENTRIES_FAILURE",ks="DRAFT_CREATE_FROM_ENTRY",_s="DRAFT_CREATE_EMPTY",Es="DRAFT_DISCARD",Cs="DRAFT_CHANGE_FIELD",Os="DRAFT_VALIDATION_ERRORS",Ts="DRAFT_CLEAR_ERRORS",Ps="DRAFT_LOCAL_BACKUP_RETRIEVED",Ms="DRAFT_CREATE_FROM_LOCAL_BACKUP",Rs="DRAFT_CREATE_DUPLICATE_FROM_ENTRY",As="ENTRY_PERSIST_REQUEST",Is="ENTRY_PERSIST_SUCCESS",Ds="ENTRY_PERSIST_FAILURE",js="ENTRY_DELETE_SUCCESS",Ls="ADD_DRAFT_ENTRY_MEDIA_FILE",Ns="REMOVE_DRAFT_ENTRY_MEDIA_FILE",$s="CHANGE_VIEW_STYLE";function Fs(e){return{type:fs,payload:{collection:e.get("name")}}}function Bs(e,t,n,r,o=!0){return{type:ds,payload:{collection:e.get("name"),entries:t,page:n,cursor:cn.Cursor.create(r),append:o}}}function zs(e,t){return{type:ps,error:"Failed to load entries",payload:t.toString(),meta:{collection:e.get("name")}}}async function Us(e,t){const n=uc(e.config),r=Qc(e,t.get("name"),"listEntries"),o=r?fi(e.integrations,n.getToken,r):n;return await o.listAllEntries(t)}function qs(e,t,n=mo.Ascending){return async(r,o)=>{const i=o(),a=El(i.entries,e.get("name"));if(r({type:hs,payload:{collection:e.get("name"),key:t,direction:n}}),!a)try{const o=await Us(i,e);r({type:gs,payload:{collection:e.get("name"),key:t,direction:n,entries:o}})}catch(o){r({type:ms,payload:{collection:e.get("name"),key:t,direction:n,error:o}})}}}function Ws(e,t){return{type:js,payload:{collectionName:e.get("name"),entrySlug:t}}}function Hs(e){return{type:ks,payload:{entry:e}}}function Vs(e){return{type:Ts,payload:{uniqueFieldId:e}}}function Ks({id:e}){return{type:Ns,payload:{id:e}}}function Gs(e,t){return async(n,r)=>{await ma(n,r()),n(function(e,t){return{type:ls,payload:{collection:e.get("name"),slug:t}}}(e,t));try{const o=await Ys(r(),e,t);n(function(e,t){return{type:us,payload:{collection:e.get("name"),entry:t}}}(e,o)),n(Hs(o))}catch(r){n(Ii({message:{details:r.message,key:"ui.toast.onFailToLoadEntries"},type:"error",dismissAfter:8e3})),n(function(e,t,n){return{type:cs,payload:{error:e,collection:t.get("name"),slug:n}}}(r,e,t))}}}async function Ys(e,t,n){const r=uc(e.config);return await r.getEntry(e,t,n)}const Qs=(0,Ge.fromJS)({append_next:{action:"next",append:!0}});function Js(e){return cn.Cursor.create(e).updateStore("actions",e=>e.union(Qs.filter(t=>e.has(t.get("action"))).keySeq()))}function Xs(e,t=0){return async(n,r)=>{if(e.get("isFetching"))return;const o=r(),i=wl(o.entries,e.get("name"));if(i&&i.length>0){const t=i[0];return n(qs(e,t.get("key"),t.get("direction")))}const a=function(e){const t=e.get("sortable_fields").toArray().find(e=>void 0!==e.get("default_sort"));if(!t)return null;const n=t.get("field"),r=t.get("default_sort");let o;return o=!0===r||"asc"===r?"asc":"desc"===r?"desc":"asc",{field:n,direction:o}}(e);if(a){const t="desc"===a.direction?mo.Descending:mo.Ascending;return n(qs(e,a.field,t))}const s=uc(o.config),l=Qc(o,e.get("name"),"listEntries"),u=l?fi(o.integrations,s.getToken,l):s,c=!!(t&&!isNaN(t)&&t>0);n(Fs(e));try{const r=e.has("nested")||nu(e);let o=await(r?u.listAllEntries(e).then(e=>({entries:e})):u.listEntries(e,t));o={...o,cursor:l?cn.Cursor.create({actions:["next"],meta:{usingOldPaginationAPI:!0},data:{nextPage:t+1}}):cn.Cursor.create(o.cursor)},n(Bs(e,o.cursor.meta.get("usingOldPaginationAPI")?o.entries.reverse():o.entries,o.pagination,Js(o.cursor),c))}catch(t){return n(Ii({message:{details:t,key:"ui.toast.onFailToLoadEntries"},type:"error",dismissAfter:8e3})),Promise.reject(n(zs(e,t)))}}}function Zs(e,t=()=>!1){return e.reduce((e,n)=>{const r=e,o=n;if(t(o))return r;const i=o.get("field")||o.get("fields"),a="list"==o.get("widget"),s=o.get("name"),l=o.get("default",null);if(Ge.List.isList(i)||Ge.Map.isMap(i)){if(a&&Ge.List.isList(l))r[s]=l;else{const e=Ge.List.isList(i)?i:(0,Ge.List)([i]),n=a?[Zs(e,t)]:Zs(e,t);u=n,[[{}],{}].some(e=>ti()(u,e))||(r[s]=n)}return r}var u;return null!==l&&(r[s]=l),r},{})}function el({entry:e}){return e.get("mediaFiles").toArray().filter(e=>e.get("draft")).map(e=>Cn({path:e.get("path"),file:e.get("file"),url:e.get("url"),field:e.get("field")}))}function tl(e,t){const n=Fl(e,t.get("slug"));function r(e){return function(e,t){return Ei(e,t,"serialize")}(e,n)}const o=r(t.get("data"));let i=t.set("data",o);return nu(e)&&(i=function(e,t,n){const{locales:r,defaultLocale:o}=ru(e);return r.filter(e=>e!==o).forEach(e=>{const r=su(e);t=t.setIn(r,n(t.getIn(r)))}),t}(e,i,r)),i}function nl(e,t,n){return{error:{type:Oi,message:n(`editor.editorControlPane.widget.${t}`,{path:e})}}}const rl="VIEW_STYLE_LIST",ol="VIEW_STYLE_GRID",{keyToPathArray:il}=dn.stringTemplate;let al,sl,ll,ul,cl;const fl="decap-cms.entries.sort",dl="decap-cms.entries.viewStyle";function pl(e){return e?e.replace(/([^:]\/)\/+/g,"$1"):e}const hl=po()(()=>{const e=localStorage.getItem(fl);if(e)try{const t=JSON.parse(e);let n=(0,Ge.Map)();return Object.entries(t).forEach(([e,t])=>{let r=(0,Ge.OrderedMap)();nn()(Object.values(t),["index"]).forEach(e=>{const{key:t,direction:n}=e;r=r.set(t,(0,Ge.fromJS)({key:t,direction:n}))}),n=n.set(e,r)}),n}catch(e){return(0,Ge.Map)()}return(0,Ge.Map)()});function gl(e){if(e){const t={};e.keySeq().forEach(n=>{const r=n;e.get(r).valueSeq().toJS().map((e,t)=>({...e,index:t})).forEach(e=>{sn()(t,[r,e.key],e)})}),localStorage.setItem(fl,JSON.stringify(t))}else localStorage.removeItem(fl)}const ml=po()(()=>localStorage.getItem(dl)||(localStorage.setItem(dl,rl),rl));function yl(e,t){const n=e.get("sort");return n?.get(t)}function vl(e,t){const n=e.get("filter");return n?.get(t)||(0,Ge.Map)()}function bl(e,t){const n=e.get("group");return n?.get(t)||(0,Ge.Map)()}function wl(e,t){const n=yl(e,t),r=n?.valueSeq().filter(e=>e?.get("direction")!==mo.None).toArray()||[];return r}function xl(e,t,n){return e.getIn(["entities",`${t}.${n}`])}function Sl(e,t){return e.getIn(["pages",t,"ids"],(0,Ge.List)())}function kl(e,t){const n=Sl(e,t),r=n&&n.map(n=>xl(e,t,n));return r}function _l(e,t){const n=t.get("name");let r=kl(e,n);const o=wl(e,n);if(o&&o.length>0){const e=o.map(e=>function(e,t){return t===ao?"updatedOn":t!==io||Vl(e,t)?`data.${t}`:"author"}(t,e.get("key"))),n=o.map(e=>e.get("direction")===mo.Ascending?"asc":"desc");r=(0,Ge.fromJS)(go()(r.toJS(),e,n))}const i=function(e,t){const n=vl(e,t),r=n?.valueSeq().filter(e=>!0===e?.get("active")).toArray()||[];return r}(e,n);return i&&i.length>0&&(r=r.filter(e=>{const t=i.every(t=>{const n=t.get("pattern"),r=t.get("field"),o=(e.get("data")||(0,Ge.Map)()).getIn(il(r));return void 0!==o&&new RegExp(String(n)).test(String(o))});return t}).toList()),r}function El(e,t){return e.getIn(["pages",t,"isFetching"],!1)}function Cl(e,t){const n=e.find(e=>e?.get("name")===t);return n}function Ol(e,t,n,r){if(!t)return!1;if(r&&r.has(e))return!0;if(t.has("files")){const r=Cl(t.get("files"),n);if(r&&r.has(e))return!0}return!!t.has(e)}function Tl(e,t,n,r,o,i,a){const s=i.filter(e=>e===o)[0];if(s)return Zo(s.has(e)?s.get(e):`{{${e}}}`,r,n,a,e,t.slug);for(let s of i){s.has(e)||(s=s.set(e,`{{${e}}}`));const i=Zo(s.get(e),r,n,a,e,t.slug);let l=null;if(s.has("fields")?l=Tl(e,t,n,r,o,s.get("fields").toArray(),i):s.has("field")?l=Tl(e,t,n,r,o,[s.get("field")],i):s.has("types")&&(l=Tl(e,t,n,r,o,s.get("types").toArray(),i)),null!=l)return l}return null}function Pl(e,t,n,r,o){let i=t[e];if(n.has(e)||(n=n.set(e,`{{${e}}}`)),n.has("files")){i=Zo(n.get(e),r,n,i,e,t.slug);let a=Cl(n.get("files"),r?.get("slug"));if(a&&(a.has(e)||(a=a.set(e,`{{${e}}}`)),i=Zo(a.get(e),r,n,i,e,t.slug),o)){const s=Tl(e,t,n,r,o,a.get("fields").toArray(),i);null!==s&&(i=s)}}else if(i=Zo(n.get(e),r,n,i,e,t.slug),o){const a=Tl(e,t,n,r,o,n.get("fields").toArray(),i);null!==a&&(i=a)}return i}function Ml(e,t,n,r){const o="media_folder";let i=e[o];if(Ol(o,t,n?.get("slug"),r)){const a=Pl(o,e,t,n,r);if(a.startsWith("/"))i=(0,fn.join)(a);else{const e=n?.get("path");i=e?(0,fn.join)((0,fn.dirname)(e),a):t.get("folder")}}return en()(i,"/")}function Rl(e,t,n,r,o){if((0,cn.isAbsolutePath)(r))return r;const i=Ml(e,t,n,o);return(0,fn.join)(i,(0,cn.basename)(r))}function Al(e,t,n,r,o){if((0,cn.isAbsolutePath)(n))return n;const i="public_folder";let a=pl(e[i]);return Ol(i,t,r?.get("slug"),o)&&(a=pl(Pl(i,e,t,r,o))),(0,cn.isAbsolutePath)(a)?function(e,...t){return Eo()(e,...t)}(a,(0,cn.basename)(n)):(0,fn.join)(a,(0,cn.basename)(n))}function Il(e){const t=e.get("entry");return t&&!t.isEmpty()}const{keyToPathArray:Dl}=dn.stringTemplate,jl=(0,Ge.fromJS)({}),Ll={[oo]:{entryExtension(e){const t=e.get("extension")||on()({...Pr,...Cr()},e.get("format")||"frontmatter");if(!t)throw new Error(`No extension found for format ${e.get("format")}`);return t.replace(/^\./,"")},fields:e=>e.get("fields"),entryPath(e,t){return`${e.get("folder").replace(/\/$/,"")}/${t}.${this.entryExtension(e)}`},entrySlug(e,t){const n=e.get("folder").replace(/\/$/,""),r=t.split(n+"/").pop()?.replace(new RegExp(`\\.${no()(this.entryExtension(e))}$`),"");return r},allowNewEntries:e=>e.get("create"),allowDeletion:e=>e.get("delete",!0),templateName:e=>e.get("name")},[ro]:{fileForEntry(e,t){const n=e.get("files");return n&&n.filter(e=>e?.get("name")===t).get(0)},fields(e,t){const n=this.fileForEntry(e,t);return n&&n.get("fields")},entryPath(e,t){const n=this.fileForEntry(e,t);return n&&n.get("file")},entrySlug(e,t){const n=e.get("files").filter(e=>e?.get("file")===t).get(0);return n&&n.get("name")},entryLabel(e,t){const n=this.fileForEntry(e,t);return n&&n.get("label")},allowNewEntries:()=>!1,allowDeletion:e=>e.get("delete",!1),templateName:(e,t)=>t}};function Nl(e){const t=e.reduce((e,t)=>{if(t.has("media_folder")&&(e=[...e,t]),t.has("fields")){const n=t.get("fields")?.toArray();e=[...e,...Nl(n)]}else if(t.has("field")){const n=t.get("field");e=[...e,...Nl([n])]}else if(t.has("types")){const n=t.get("types")?.toArray();e=[...e,...Nl(n)]}return e},[]);return t}function $l(e,t){return e.get("files")?.toArray().find(e=>e.get("name")===t)}function Fl(e,t){return Ll[e.get("type")].fields(e,t)}function Bl(e){return Ll[oo].entryExtension(e)}function zl(e,t){return Ll[ro].entryLabel(e,t)}function Ul(e,t){return Ll[e.get("type")].entryPath(e,t)}function ql(e,t){return Ll[e.get("type")].entrySlug(e,t)}function Wl(e){return Ll[e.get("type")].allowDeletion(e)}function Hl(e,t=""){let n=e.map(e=>`${t}${e.get("name")}`);return e.forEach((e,t)=>{if(e.has("fields")){const r=e.get("fields")?.toArray();n=[...n,...Hl(r,`${n[t]}.`)]}else if(e.has("field")){const r=e.get("field");n=[...n,...Hl([r],`${n[t]}.`)]}else if(e.has("types")){const r=e.get("types")?.toArray();n=[...n,...Hl(r,`${n[t]}.`)]}}),n}function Vl(e,t){const n=Dl(t);let r,o,i=e.get("fields",(0,Ge.List)()).toArray();for(;(r=n.shift())&&i;)o=i.find(e=>e.get("name")===r),o?.has("fields")?i=o?.get("fields")?.toArray():o?.has("field")?i=[o?.get("field")]:o?.has("types")&&(i=o?.get("types")?.toArray());return o}function Kl(e,t,n=()=>!1){return n()||(e=e.map(e=>{const r=t(e);return n()?r:r.has("fields")?r.set("fields",Kl(r.get("fields"),t,n)):r.has("field")?r.set("field",Kl((0,Ge.List)([r.get("field")]),t,n).get(0)):r.has("types")?r.set("types",Kl(r.get("types"),t,n)):r}).toList()),e}function Gl(e){const t=e.get("identifier_field"),n=t?[t,...lo]:[...lo],r=Hl(e.get("fields",(0,Ge.List)()).toArray());return n.find(e=>r.find(t=>t.toLowerCase().trim()===e.toLowerCase().trim()))}function Yl(e,t){if("title"===t&&e.get("identifier_field"))return Gl(e);const n=co[t],r=e.get("fields");let o;if(!r||!n)return null;const i=r.filter(e=>e?.get("widget","string")===n.type).map(e=>e?.get("name"));if(o=i.filter(e=>-1!==n.synonyms.indexOf(e)),o&&o.size>0)return o.first();const a=r.filter(e=>-1!==n.secondaryTypes.indexOf(e?.get("widget","string"))).map(e=>e?.get("name"));return o=a.filter(e=>-1!==n.synonyms.indexOf(e)),o&&o.size>0?o.first():n.fallbackToFirstField&&i.size>0?i.first():(n.showError&&(s=`The Field ${t} is missing for the collection “${e.get("name")}”`,l=`Decap CMS tries to infer the entry ${t} automatically, but one couldn't be found for entries of the collection “${e.get("name")}”. Please check your site configuration.`,console.error(`%c ⛔ ${s}\n%c${l}\n\n`,"color: black; font-weight: bold; font-size: 16px; line-height: 50px;","color: black;")),null);var s,l}function Ql(e,t){const n=e.get("summary");if(n)return function(e,t,n){let r=t.get("data");const o=Uo(t,Yl(n,"date"))||null,i=r.getIn(Ho(Gl(n)));return r=Vo(t.get("path"),r,n.get("folder")),t.get("author")&&!Vl(n,io)&&(r=r.set(io,t.get("author"))),t.get("updatedOn")&&!Vl(n,ao)&&(r=r.set(ao,t.get("updatedOn"))),zo(e,o,i,r)}(n,t,e);if(e.get("type")==ro){const n=zl(e,t.get("slug"));if(n)return n}const r=t.get("data"),o=Yl(e,"title"),i=o&&r.getIn(Dl(o));return i||"title"===o?i:r.getIn(Dl("title"))}function Jl(e,t,n){let r=uo.map(r=>{const o=Yl(e,r);return!t.isGitBackend()||"author"!==r||o||n?o:io}).filter(Boolean);return t.isGitBackend()&&!n&&(r=[ao,...r]),r.map(e=>({field:e}))}function Xl(e){return e.has("folder")&&e.get("type")===oo&&e.has("meta")&&e.get("meta")?.has("path")}const Zl="i18n";let eu=function(e){return e.MULTIPLE_FOLDERS="multiple_folders",e.MULTIPLE_FILES="multiple_files",e.SINGLE_FILE="single_file",e}({}),tu=function(e){return e.TRANSLATE="translate",e.DUPLICATE="duplicate",e.NONE="none",e}({});function nu(e){return e.has(Zl)}function ru(e){if(!nu(e))return{};const{structure:t,locales:n,default_locale:r}=e.get(Zl).toJS();return{structure:t,locales:n,defaultLocale:r}}function ou(e,t,n){return t!==n&&e.get(Zl)===tu.TRANSLATE}function iu(e,t,n){return t!==n&&e.get(Zl)===tu.DUPLICATE}function au(e,t,n){return t!==n&&e.get(Zl)===tu.NONE}function su(e){return[Zl,e,"data"]}function lu(e,t){return e!==t?su(e):["data"]}function uu(e,t,n,r,o){switch(e){case eu.MULTIPLE_FOLDERS:return n.replace(`/${r}`,`/${o}/${r}`);case eu.MULTIPLE_FILES:return n.replace(new RegExp(`${no()(t)}$`),`${o}.${t}`);case eu.SINGLE_FILE:default:return n}}function cu(e,t,n){switch(e){case eu.MULTIPLE_FOLDERS:{const e=n.split("/");return e.pop(),e.pop()}case eu.MULTIPLE_FILES:return n.slice(0,-`.${t}`.length).split(".").pop();case eu.SINGLE_FILE:default:return""}}function fu(e,t,n,r){const{structure:o,locales:i}=ru(e);return o===eu.SINGLE_FILE?[n]:i.map(e=>uu(o,t,n,r,e))}function du(e,t,n){switch(e){case eu.MULTIPLE_FOLDERS:return t.replace(`${n}/`,"");case eu.MULTIPLE_FILES:return t.replace(`.${n}`,"");case eu.SINGLE_FILE:default:return t}}function pu(e,t,n,r){let o=r.find(e=>e.locale===n);o||(o=r[0],console.warn(`Could not locale entry for default locale '${n}'`));const i=r.filter(e=>e.locale!==o.locale).reduce((t,{locale:n,value:r})=>{const i=su(n);return o&&function(e,t,n){void 0!==e.get("fields")&&e.get("fields").forEach(e=>{e&&e.get(Zl)===tu.DUPLICATE&&(t.data[e.get("name")]||(t.data[e.get("name")]=n.data[e.get("name")]))})}(e,r,o.value),sn()(t,i,r.data)},{}),a=du(t,o.value.path,n),s=ql(e,a);return{...o.value,raw:"",...i,path:a,slug:s}}function hu(e,t,n){const r=e.data[t]||{},o=n.filter(e=>e!==t).map(t=>({locale:t,value:e.data[t]})).filter(e=>e.value).reduce((e,t)=>({...e,[t.locale]:{data:t.value}}),{});return{...e,data:r,i18n:o,raw:""}}function gu(e,t,n){const{structure:r,defaultLocale:o,locales:i}=ru(e);if(r===eu.SINGLE_FILE)return n.map(e=>hu(e,o,i));const a=eo()(n.map(e=>({locale:cu(r,t,e.path),value:e})),({locale:e,value:t})=>du(r,t.path,e));return Object.values(a).reduce((t,n)=>[...t,pu(e,r,o,n)],[])}function mu(e,t,n,r,o=[t.get("name")]){const i=e.getIn(["entry","data",...o]);return t.get(Zl)===tu.DUPLICATE&&n.filter(e=>e!==r).forEach(t=>{e=e.setIn(["entry",...lu(t,r),...o],i)}),t.has("field")&&!Ge.List.isList(i)?[t.get("field")].forEach(t=>{e=mu(e,t,n,r,[...o,t.get("name")])}):t.has("fields")&&!Ge.List.isList(i)&&t.get("fields").toArray().forEach(t=>{e=mu(e,t,n,r,[...o,t.get("name")])}),e}const yu={type:"string",minLength:2,maxLength:10,pattern:"^[a-zA-Z-_]+$"},vu={type:"object",properties:{structure:{type:"string",enum:Object.values(eu)},locales:{type:"array",minItems:1,items:yu,uniqueItems:!0},default_locale:yu}},bu={...vu,required:["structure","locales"]},wu={oneOf:[{type:"boolean"},vu]},xu={oneOf:[{type:"boolean"},{type:"string",enum:Object.values(tu)}]};function Su(){const e=Xr();return{$id:`fields_${e}`,type:"array",minItems:1,items:{$id:`field_${e}`,type:"object",properties:{name:{type:"string"},label:{type:"string"},widget:{type:"string"},required:{type:"boolean"},i18n:xu,hint:{type:"string"},pattern:{type:"array",minItems:2,items:[{oneOf:[{type:"string"},{instanceof:"RegExp"}]},{type:"string"}]},field:{$ref:`field_${e}`},fields:{$ref:`fields_${e}`},types:{$ref:`fields_${e}`}},select:{$data:"0/widget"},selectCases:{...Eu()},required:["name"]},uniqueItemProperties:["name"]}}const ku={type:"array",minItems:1,items:{type:"object",properties:{label:{type:"string"},field:{type:"string"},pattern:{oneOf:[{type:"boolean"},{type:"string"}]}},additionalProperties:!1,required:["label","field","pattern"]}},_u={type:"array",minItems:1,items:{type:"object",properties:{label:{type:"string"},field:{type:"string"},pattern:{type:"string"}},additionalProperties:!1,required:["label","field"]}};function Eu(){const e=mr().map(e=>({[e.name]:e.schema}));return Object.assign(...e)}class Cu extends Error{constructor(e,...t){const n=e.map(({message:e,instancePath:t})=>{const n=t.slice(1).split("/").map(e=>e.match(/^\d+$/)?`[${e}]`:`.${e}`).join("").slice(1);return`${n?`'${n}'`:"config"} ${e}`}).join("\n");super(n,...t),this.errors=e,this.message=n}toString(){return this.message}}function Ou(e){const t=(e.integrations||[]).reduce((t,n)=>{const{hooks:r,collections:o,provider:i,...a}=n;if(t.providers[i]={...a},!o)return r.forEach(e=>{t.hooks[e]=i}),t;const s="*"===o?e.collections.map(e=>e.name):o;return s.forEach(e=>{r.forEach(n=>{t.hooks[e]?t.hooks[e][n]=i:t.hooks[e]={[n]:i}})}),t},{providers:{},hooks:{}});return(0,Ge.fromJS)(t)}const Tu=(0,Ge.fromJS)({providers:{},hooks:{}});function Pu(e,t,n){return t?e.getIn(["hooks",t,n],!1):e.getIn(["hooks",n],!1)}const Mu="CONFIG_REQUEST",Ru="CONFIG_SUCCESS",Au="CONFIG_FAILURE";function Iu(e){return"types"in e||"field"in e}function Du(e,t){return e.map(e=>{const n=t(e);return function(e){return"fields"in e}(n)?{...n,fields:Du(n.fields,t)}:Iu(n)&&n.field?{...n,field:Du([n.field],t)[0]}:Iu(n)&&n.types?{...n,types:Du(n.types,t)}:n})}function ju(e){return"media_folder"in e&&!("public_folder"in e)?{...e,public_folder:e.media_folder}:e}const Lu={dateFormat:"date_format",timeFormat:"time_format",pickerUtc:"picker_utc",editorComponents:"editor_components",valueType:"value_type",valueField:"value_field",searchFields:"search_fields",displayFields:"display_fields",optionsLength:"options_length"};function Nu(e){const t=Object.keys(Lu).filter(t=>t in e).map(t=>{const n=Lu[t];return console.warn(`Field ${e.name} is using a deprecated configuration '${t}'. Please use '${n}'`),{[n]:e[t]}});return Object.assign({},e,...t)}function $u(e){return!0===e[Zl]?{...e,[Zl]:tu.TRANSLATE}:!1!==e[Zl]&&e[Zl]?e:{...e,[Zl]:tu.NONE}}function Fu(e,t){if("boolean"==typeof e)return t;{const n=e.locales||t.locales,r=e.default_locale||n[0],o=Dr()(t,e);return o.locales=n,o.default_locale=r,Uu(o),o}}function Bu(e,t){return Du(e,t?$u:e=>{const t={...e};return delete t[Zl],t})}function zu(e){if(e&&e.structure!==eu.SINGLE_FILE)throw new Error(`i18n configuration for files collections is limited to ${eu.SINGLE_FILE} structure`)}function Uu(e){if(e&&e.default_locale&&!e.locales.includes(e.default_locale))throw new Error(`i18n locales '${e.locales.join(", ")}' are missing the default locale ${e.default_locale}`)}function qu(e,t){return!!Pu(Ou((0,Ge.fromJS)(e)),t.name,"listEntries")}function Wu(e){return{type:Ru,payload:e}}function Hu(e){return{type:Au,error:"Error loading config",payload:e}}function Vu(e={},t){return window.CMS_CONFIG?Wu(window.CMS_CONFIG):async n=>{n({type:Mu});try{const r=function(){const e=document.querySelector('link[rel="cms-config-url"]');return e&&{"text/yaml":"yaml","application/x-yaml":"yaml"}[e.type]&&e.href?(console.log(`Using config file path: "${e.href}"`),e.href):"config.yml"}(),o=!$r()(e),i=!1===e.load_config_file?{}:await async function(e,t){const n=await fetch(e,{credentials:"same-origin"}).catch(e=>e);if(n instanceof Error||200!==n.status){if(t)return{};const e=n instanceof Error?n.message:n.status;throw new Error(`Failed to load config.yml (${e})`)}const r=n.headers.get("Content-Type")||"Not-Found";return-1===r.indexOf("yaml")&&(console.log(`Response for ${e} was not yaml. (Content-Type: ${r})`),t)?{}:function(e){const t=hn().parse(e,{maxAliasCount:-1,prettyErrors:!0,merge:!0});if("undefined"!=typeof window&&"string"==typeof window.CMS_ENV&&t[window.CMS_ENV]){const e=Object.keys(t[window.CMS_ENV]);for(const n of e)t[n]=t[window.CMS_ENV][n]}return t}(await n.text())}(r,o),a=Dr()(i,e);!function(e){const t=new(qr())({allErrors:!0,$data:!0,strict:!1});if((0,Wr.uniqueItemProperties)(t),(0,Wr.select)(t),(0,Wr.instanceof)(t),(0,Wr.prohibited)(t),Vr()(t),!t.validate({type:"object",properties:{backend:{type:"object",properties:{name:{type:"string",examples:["test-repo"]},auth_scope:{type:"string",examples:["repo","public_repo"],enum:["repo","public_repo"]},cms_label_prefix:{type:"string",minLength:1},open_authoring:{type:"boolean",examples:[!0]}},required:["name"]},local_backend:{oneOf:[{type:"boolean"},{type:"object",properties:{url:{type:"string",examples:["http://localhost:8081/api/v1"]},allowed_hosts:{type:"array",items:{type:"string"}}},additionalProperties:!1}]},locale:{type:"string",examples:["en","fr","de"]},i18n:bu,site_url:{type:"string",examples:["https://example.com"]},display_url:{type:"string",examples:["https://example.com"]},logo_url:{type:"string",examples:["https://example.com/images/logo.svg"]},logo:{type:"object",properties:{src:{type:"string",examples:["https://example.com/images/logo.svg"]},show_in_header:{type:"boolean"}},required:["src"]},show_preview_links:{type:"boolean"},media_folder:{type:"string",examples:["assets/uploads"]},public_folder:{type:"string",examples:["/uploads"]},media_folder_relative:{type:"boolean"},media_library:{type:"object",properties:{name:{type:"string",examples:["uploadcare"]},config:{type:"object"}},required:["name"]},publish_mode:{type:"string",enum:["simple","editorial_workflow",""],examples:["editorial_workflow"]},slug:{type:"object",properties:{encoding:{type:"string",enum:["unicode","ascii"]},clean_accents:{type:"boolean"}}},issue_reports:{type:"object",properties:{url:{type:"string",examples:["https://example.com/report-issue"]}}},collections:{type:"array",minItems:1,items:{type:"object",properties:{name:{type:"string"},label:{type:"string"},label_singular:{type:"string"},description:{type:"string"},folder:{type:"string"},files:{type:"array",items:{type:"object",properties:{name:{type:"string"},label:{type:"string"},label_singular:{type:"string"},description:{type:"string"},file:{type:"string"},preview_path:{type:"string"},preview_path_date_field:{type:"string"},fields:Su()},required:["name","label","file","fields"]},uniqueItemProperties:["name"]},identifier_field:{type:"string"},summary:{type:"string"},slug:{type:"string"},path:{type:"string"},preview_path:{type:"string"},preview_path_date_field:{type:"string"},create:{type:"boolean"},publish:{type:"boolean"},hide:{type:"boolean"},editor:{type:"object",properties:{preview:{type:"boolean"}}},format:{type:"string"},extension:{type:"string"},frontmatter_delimiter:{type:["string","array"],minItems:2,maxItems:2,items:{type:"string"}},fields:Su(),sortable_fields:{type:"array",items:{oneOf:[{type:"string"},{type:"object",properties:{field:{type:"string"},label:{type:"string"},default_sort:{oneOf:[{type:"boolean"},{type:"string",enum:["asc","desc"]}]}},required:["field"],additionalProperties:!1}]}},sortableFields:{type:"array",items:{type:"string"}},view_filters:ku,view_groups:_u,nested:{type:"object",properties:{depth:{type:"number",minimum:1,maximum:1e3},subfolders:{type:"boolean"},summary:{type:"string"}},required:["depth"]},meta:{type:"object",properties:{path:{type:"object",properties:{label:{type:"string"},widget:{type:"string"},index_file:{type:"string"}},required:["label","widget","index_file"]}},additionalProperties:!1,minProperties:1},i18n:wu},required:["name","label"],oneOf:[{required:["files"]},{required:["folder","fields"]}],not:{required:["sortable_fields","sortableFields"]},if:{required:["extension"]},then:{if:{properties:{extension:{enum:Object.keys(Mr)}}},else:{required:["format"]}},dependencies:{frontmatter_delimiter:{properties:{format:{enum:Tr}},required:["format"]}}},uniqueItemProperties:["name"]},editor:{type:"object",properties:{preview:{type:"boolean"}}}},required:["backend","collections"],anyOf:[{required:["media_folder"]},{required:["media_library"]}]},e)){const e=t.errors.map(e=>{switch(e.keyword){case"uniqueItemProperties":{const t=e.instancePath||"";let n=e;return t.endsWith("/fields")?n={...e,message:"fields names must be unique"}:t.endsWith("/files")?n={...e,message:"files names must be unique"}:t.endsWith("/collections")&&(n={...e,message:"collections names must be unique"}),n}case"instanceof":{const t=e.instancePath||"";let n=e;return/fields\/\d+\/pattern\/\d+/.test(t)&&(n={...e,message:"must be a regular expression"}),n}default:return e}});throw console.error("Config Errors",e),new Cu(e)}e.collections&&e.collections.forEach((e,t)=>{if(e.sortable_fields&&e.sortable_fields.filter(e=>"object"==typeof e&&void 0!==e.default_sort).length>1){const e={instancePath:`/collections/${t}/sortable_fields`,message:"only one sortable field can have the default_sort property"};throw console.error("Config Errors",[e]),new Cu([e])}})}(a);const s=function(e){const{collections:t=[]}=e,n=t.map(e=>{const{fields:t,files:n}=e;let r=e;if(t){const e=Du(t,Nu);r={...r,fields:e}}if(n){const e=n.map(e=>{const t=Du(e.fields,Nu);return{...e,fields:t}});r={...r,files:e}}if(r.sortableFields){const{sortableFields:t,...n}=r;r={...n,sortable_fields:t},console.warn(`Collection ${e.name} is using a deprecated configuration 'sortableFields'. Please use 'sortable_fields'`)}var o;return r.sortable_fields&&(r={...r,sortable_fields:(o=r.sortable_fields,o.map(e=>"string"==typeof e?{field:e,default_sort:void 0}:e))}),r});return{...e,collections:n}}(await async function(e){if(!e.local_backend)return e;const{proxyUrl:t,publish_modes:n,type:r}=await async function(e){if(!["localhost","127.0.0.1",..."boolean"==typeof e?[]:e?.allowed_hosts||[]].includes(location.hostname)||!e)return{};const t="http://localhost:8081/api/v1",n=!0===e?t:e.url||t.replace("localhost",location.hostname);try{console.log(`Looking for Decap CMS Proxy Server at '${n}'`);const e=await fetch(`${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"info"})}),{repo:t,publish_modes:r,type:o}=await e.json();return"string"==typeof t&&Array.isArray(r)&&"string"==typeof o?(console.log(`Detected Decap CMS Proxy Server at '${n}' with repo: '${t}'`),{proxyUrl:n,publish_modes:r,type:o}):(console.log(`Decap CMS Proxy Server not detected at '${n}'`),{})}catch{return console.log(`Decap CMS Proxy Server not detected at '${n}'`),{}}}(e.local_backend);return t?Wt(e,e=>{e.backend.name="proxy",e.backend.proxy_url=t,e.publish_mode&&(e.publish_mode=function(e,t,n){if(e.publish_mode&&t&&!t.includes(e.publish_mode)){const r=t[0];return console.log(`'${e.publish_mode}' is not supported by '${n}' backend, switching to '${r}'`),r}return e.publish_mode}(e,n,r))}):e}(a)),l=Wt(s,e=>{e.publish_mode=e.publish_mode||Fr,e.slug=e.slug||{},e.collections=e.collections||[],!e.display_url&&e.site_url&&(e.display_url=e.site_url);const t=`/${Lr()(e.media_folder,"/")}`;"public_folder"in e||(e.public_folder=t),"encoding"in e.slug||(e.slug.encoding="unicode"),"clean_accents"in e.slug||(e.slug.clean_accents=!1),"sanitize_replacement"in e.slug||(e.slug.sanitize_replacement="-");const n=e[Zl];n&&(n.default_locale=n.default_locale||n.locales[0]),Uu(n);const r=lc(e);for(const t of e.collections){"publish"in t||(t.publish=!0);let o=t[Zl];n&&o?(o=Fu(o,n),t[Zl]=o):(o=void 0,delete t[Zl]),t.fields&&(t.fields=Bu(t.fields,Boolean(o)));const{folder:i,files:a,view_filters:s,view_groups:l,meta:u}=t;if(i&&(t.type=oo,t.path&&!t.media_folder&&(t.media_folder=""),"media_folder"in t&&!("public_folder"in t)&&(t.public_folder=t.media_folder),t.fields&&(t.fields=Du(t.fields,ju)),t.folder=en()(i,"/"),u&&u.path)){const e={name:"path",meta:!0,required:!0,...u.path};t.fields=[e,...t.fields||[]]}if(a){t.type=ro,zu(o),delete t.nested,delete t.meta;for(const e of a){e.file=Lr()(e.file,"/"),"media_folder"in e&&!("public_folder"in e)&&(e.public_folder=e.media_folder),e.fields&&(e.fields=Du(e.fields,ju));let t=e[Zl];t&&o?(t=Fu(t,o),e[Zl]=t):(t=void 0,delete e[Zl]),zu(t),e.fields&&(e.fields=Bu(e.fields,Boolean(t)))}}t.sortable_fields||(t.sortable_fields=Jl((0,Ge.fromJS)(t),r,qu(e,t))),t.view_filters=(s||[]).map(e=>({...e,id:`${e.field}__${e.pattern}`})),t.view_groups=(l||[]).map(e=>({...e,id:`${e.field}__${e.pattern}`})),e.editor&&!t.editor&&(t.editor={preview:e.editor.preview})}});n(Wu(l)),"function"==typeof t&&t()}catch(e){throw n(Hu(e)),e}}}function Ku(e){return e.locale||"en"}function Gu(e){return e.publish_mode===Br}const Yu=Wt((e,t)=>{switch(t.type){case Mu:e.isFetching=!0;break;case Ru:return{...t.payload,isFetching:!1,error:void 0};case Au:e.isFetching=!1,e.error=t.payload.toString()}},{isFetching:!0}),{extractTemplateVars:Qu,dateParsers:Ju,expandPath:Xu}=dn.stringTemplate;class Zu{storageKey="decap-cms-user";retrieve(){const e=window.localStorage.getItem(this.storageKey);return e&&JSON.parse(e)}store(e){window.localStorage.setItem(this.storageKey,JSON.stringify(e))}logout(){window.localStorage.removeItem(this.storageKey)}}function ec(e,t){const n="backup";return e?`${n}.${e}${t?`.${t}`:""}`:n}function tc(e,t){const n=on()(t.data,e);if(n)return String(n);{const n=e.split(".")[0];return t[n]?t[n]:""}}function nc(e){return t=>e.reduce((e,n)=>{const r=tc(n,t);return r?`${e} ${r}`:e},"")}function rc(e,t){return e.score>t.score?-1:e.score<t.score?1:0}function oc(e,t){const n=e.get("folder",""),r=t.toLowerCase().replace(n.toLowerCase(),"");return(0,fn.join)((0,fn.dirname)(en()(r,"/")),(0,fn.basename)(r,(0,fn.extname)(t)))}function ic(e,t){return Xl(t)?(0,fn.dirname)(e).slice(t.get("folder").length+1)||"/":e}function ac(e){let t;return t=e.get("nested")?.get("depth")||(0,cn.getPathDepth)(e.get("path","")),nu(e)&&(t=function(e,t){const{structure:n}=ru(e);return n===eu.MULTIPLE_FOLDERS?t+1:t}(e,t)),t}class sc{constructor(e,{backendName:t,authStore:n,config:r}){if(this.deleteAnonymousBackup(),this.config=r,this.implementation=e.init(this.config,{useWorkflow:Gu(this.config),updateUserCredentials:this.updateUserCredentials,initialWorkflowStatus:zr.first()}),this.backendName=t,this.authStore=n,null===this.implementation)throw new Error("Cannot instantiate a Backend with no implementation");this.backupSync=(0,cn.asyncLock)()}async status(){let e={auth:{status:!0},api:{status:!0,statusPage:""}};for(let t=1;t<=3;t++){if(e=await this.implementation.status(),Object.values(e).every(e=>!0===e.status))return e;await new Promise(e=>setTimeout(e,1e3*t))}return e}currentUser(){if(this.user)return this.user;const e=this.authStore.retrieve();return e&&e.backendName===this.backendName?Promise.resolve(this.implementation.restoreUser(e)).then(e=>(this.user={...e,backendName:this.backendName},this.authStore.store(this.user),this.user)):Promise.resolve(null)}isGitBackend(){return this.implementation.isGitBackend?.()||!1}updateUserCredentials=e=>{const t=this.authStore.retrieve();if(t&&t.backendName===this.backendName)return this.user={...t,...e},this.authStore.store(this.user),this.user};authComponent(){return this.implementation.authComponent()}authenticate(e){return this.implementation.authenticate(e).then(e=>(this.user={...e,backendName:this.backendName},this.authStore&&this.authStore.store(this.user),this.user))}async logout(){try{await this.implementation.logout()}catch(e){console.warn("Error during logout",e.message)}finally{this.user=null,this.authStore&&this.authStore.logout()}}getToken=()=>this.implementation.getToken();async entryExist(e,t,n,r){const o=r&&await this.implementation.unpublishedEntry({collection:e.get("name"),slug:n}).catch(e=>e.name===cn.EDITORIAL_WORKFLOW_ERROR&&e.notUnderEditorialWorkflow?Promise.resolve(!1):Promise.reject(e));return o||await this.implementation.getEntry(t).then(({data:e})=>e).catch(()=>Promise.resolve(!1))}async generateUniqueSlug(e,t,n,r,o){const i=n.slug;let a;a=o?oc(e,o):function(e,t,n){const r=e.get("slug")||"{{slug}}",o=t.getIn(Ho(Gl(e)));if(!o)throw new Error("Collection must have a field name that is a valid entry identifier, or must have `identifier_field` set");const i=Jo(n),a=qo(t,Yl(e,"date"))||new Date(Date.now()),s=zo(r,a,o,t,i);if(e.has("path")){const n=Qo(e.get("path"));return zo(n,a,s,t,e=>e===s?e:i(e))}return s}(e,t,i);let s=1,l=a;for(;r.includes(l)||await this.entryExist(e,Ul(e,l),l,Gu(n));)l=`${a}${Fo(" ",i)}${s++}`;return l}processEntries(e,t){const n=e.map(e=>oi(t.get("name"),ql(t,e.file.path),e.file.path,{raw:e.data||"",label:e.file.label,author:e.file.author,updatedOn:e.file.updatedOn,meta:{path:ic(e.file.path,t)}})).map(this.entryWithFormat(t)),r=t.get("filter"),o=r?this.filterEntries({entries:n},r):n;if(nu(t)){const e=Bl(t);return gu(t,e,o)}return o}async listEntries(e){const t=Bl(e);let n;const r=e.get("type");if(r===oo)n=()=>{const n=ac(e);return this.implementation.entriesByFolder(e.get("folder"),t,n)};else{if(r!==ro)throw new Error(`Unknown collection type: ${r}`);{const t=e.get("files").map(e=>({path:e.get("file"),label:e.get("label")})).toArray();n=()=>this.implementation.entriesByFiles(t)}}const o=await n(),i=cn.Cursor.create(o[cn.CURSOR_COMPATIBILITY_SYMBOL]).wrapData({cursorType:"collectionEntries",collection:e});return{entries:this.processEntries(o,e),pagination:i.meta?.get("page"),cursor:i}}async listAllEntries(e){if(e.get("folder")&&this.implementation.allEntriesByFolder){const t=ac(e),n=Bl(e);return this.implementation.allEntriesByFolder(e.get("folder"),n,t,function(e){let t="";return e.get("path")&&(t=`${e.get("folder")}/${e.get("path")}`.replace(/{{.*}}/gm,"(.*)")),nu(e)&&(t=function(e,{defaultLocale:t,structure:n}){return n===eu.MULTIPLE_FOLDERS?`${t}\\/${e}`:n===eu.MULTIPLE_FILES?`${e}\\.${t}\\..*`:e}(t,ru(e))),t?new RegExp(t):void 0}(e)).then(t=>this.processEntries(t,e))}const t=await this.listEntries(e),{entries:n}=t;let{cursor:r}=t;for(;r&&r.actions.includes("next");){const{entries:e,cursor:t}=await this.traverseCursor(r,"next");n.push(...e),r=t}return n}async search(e,t){const n=[],r=e.map(async e=>{const n=e.get("summary",""),r=Qu(n);let o=[];e.get("type")===ro?e.get("files")?.forEach(e=>{const t=e.get("fields").map(e=>e.get("name")).toArray();o=[...o,...t]}):o=[Yl(e,"title"),Yl(e,"shortTitle"),Yl(e,"author"),...r.map(t=>Ju[t]?Yl(e,"date"):t)];const i=o.filter(Boolean),a=await this.listAllEntries(e);return ln.filter(t,a,{extract:nc(Xt()(i))})}).map(e=>e.catch(e=>(n.push(e),[]))),o=await Promise.all(r).then(e=>Gt()(e));if(n.length>0)throw new Error({message:"Errors occurred while searching entries locally!",errors:n});const i=o.filter(({score:e})=>e>5).sort(rc).map(e=>e.original);return{entries:i}}async query(e,t,n,r,o){let i=await this.listAllEntries(e);r&&(i=i.filter(e=>e.slug===r));const a=function(e,t){const n=e.reduce((e,n)=>{const r=t.reduce((e,t)=>{const r=Xu({data:n.data,path:t});return e.push(...r),e},[]);for(let t=0;t<r.length;t++)e.push({...n,field:r[t]});return e},[]);return n}(i,t);let s=ln.filter(n,a,{extract:e=>tc(e.field,e)}).sort(rc).map(e=>e.original);void 0!==o&&o>0&&(s=s.slice(0,o));const l=function(e){const t=e.map(e=>e.field),n={},r=e.reduce((e,t)=>{if(!e[t.slug]){const{field:r,...o}=t;e[t.slug]=o,n[t.slug]=(0,Ge.Set)()}const r=t.field.split(".");let o=e[t.slug].data;for(let e=0;e<r.length;e++)if(o=o[r[e]],Array.isArray(o)){const o=r.slice(0,e+1).join(".");n[t.slug]=n[t.slug].add(o)}return e},{});return Object.keys(r).forEach(e=>{const o=r[e].data;for(const r of n[e].toArray()){const e=on()(o,r),n=e.filter((e,n)=>t.some(e=>`${e}.`.startsWith(`${r}.${n}.`)));n.sort((n,o)=>{const i=e.indexOf(n),a=e.indexOf(o),s=`${r}.${i}.`,l=`${r}.${a}.`,u=t.findIndex(e=>`${e}.`.startsWith(s)),c=t.findIndex(e=>`${e}.`.startsWith(l));return u-c}),sn()(o,r,n)}}),Object.values(r)}(s);return{query:n,hits:l}}traverseCursor(e,t){const[n,r]=e.unwrapData(),o=n.get("collection");return this.implementation.traverseCursor(r,t).then(async({entries:e,cursor:t})=>({entries:this.processEntries(e,o),cursor:cn.Cursor.create(t).wrapData({cursorType:"collectionEntries",collection:o})}))}async getLocalDraftBackup(e,t){const n=ec(e.get("name"),t),r=await cn.localForage.getItem(n);if(!r||!r.raw.trim())return{};const{raw:o,path:i}=r;let{mediaFiles:a=[]}=r;a=a.map(e=>e.file?{...e,url:URL.createObjectURL(e.file)}:e);const s=zl(e,t),l=n=>this.entryWithFormat(e)(oi(e.get("name"),t,i,{raw:n,label:s,mediaFiles:a,meta:{path:ic(i,e)}})),u=l(o);if(nu(e)&&r.i18n){const e=function(e,t){const n=Object.entries(e).reduce((e,[n,{raw:r}])=>{const o=t(r);return{...e,[n]:{data:o.data}}},{});return n}(r.i18n,l);u.i18n=e}return{entry:u}}async persistLocalDraftBackup(e,t){try{await this.backupSync.acquire();const n=ec(t.get("name"),e.get("slug")),r=this.entryToRaw(t,e);if(!r.trim())return;const o=await Promise.all(e.get("mediaFiles").toJS().map(async e=>{if(e.url?.startsWith("blob:")){const t=await fetch(e.url).then(e=>e.blob());return{...e,file:(0,cn.blobToFileObj)(e.name,t)}}return e}));let i;return nu(t)&&(i=function(e,t,n){const{locales:r,defaultLocale:o}=ru(e),i=r.filter(e=>e!==o).reduce((e,r)=>{const i=lu(r,o),a=t.getIn(i);if(!a)return e;const s=t.set("data",a);return{...e,[r]:{raw:n(s)}}},{});return i}(t,e,e=>this.entryToRaw(t,e))),await cn.localForage.setItem(n,{raw:r,path:e.get("path"),mediaFiles:o,...i&&{i18n:i}}),await cn.localForage.setItem(ec(),r)}catch(e){console.warn("persistLocalDraftBackup",e)}finally{this.backupSync.release()}}async deleteLocalDraftBackup(e,t){try{return await this.backupSync.acquire(),await cn.localForage.removeItem(ec(e.get("name"),t)),t&&await cn.localForage.removeItem(ec(e.get("name"))),await this.deleteAnonymousBackup()}catch(e){console.warn("deleteLocalDraftBackup",e)}finally{this.backupSync.release()}}deleteAnonymousBackup(){return cn.localForage.removeItem(ec())}async getEntry(e,t,n){const r=Ul(t,n),o=zl(t,n),i=Bl(t),a=async r=>{const i=await this.implementation.getEntry(r);let a=oi(t.get("name"),n,i.file.path,{raw:i.data,label:o,mediaFiles:[],meta:{path:ic(i.file.path,t)}});return a=this.entryWithFormat(t)(a),a=await this.processEntry(e,t,a),a};let s;return s=nu(t)?await async function(e,t,n,r,o){const{structure:i,locales:a,defaultLocale:s}=ru(e);let l;if(i===eu.SINGLE_FILE)l=hu(await o(n),s,a);else{const u=await Promise.allSettled(a.map(async e=>{const a=uu(i,t,n,r,e);return{value:await o(a),locale:e}})),c=u.map(e=>"fulfilled"===e.status?e.value:void 0).filter(e=>void 0!==e);if(0===c.length){const[e=new Error("No entry values found for any locale")]=u.map(e=>"rejected"===e.status?e.reason:void 0).filter(e=>void 0!==e);throw e}l=pu(e,i,s,c)}return l}(t,i,r,n,a):await a(r),s}getMedia(){return this.implementation.getMedia()}getMediaFile(e){return this.implementation.getMediaFile(e)}getMediaDisplayURL(e){if(this.implementation.getMediaDisplayURL)return this.implementation.getMediaDisplayURL(e);const t=new Error("getMediaDisplayURL is not implemented by the current backend, but the backend returned a displayURL which was not a string!");return t.displayURL=e,Promise.reject(t)}entryWithFormat(e){return t=>{const n=Ar(e,t);if(t&&void 0!==t.raw){const e=n&&Vt()(n.fromFile.bind(n,t.raw))||{};return Qt()(e)&&console.error(e),Object.assign(t,{data:Qt()(e)?{}:e})}return n.fromFile(t)}}async processUnpublishedEntry(e,t,n){const{slug:r}=t;let o;if(e.get("type")===ro){const t=e.get("files").find(e=>e?.get("name")===r);o=(0,fn.extname)(t.get("file"))}else o=Bl(e);const i=[];if(n){const n=t.diffs.filter(e=>!e.path.endsWith(o)),a=await Promise.all(n.map(t=>this.implementation.unpublishedEntryMediaFile(e.get("name"),r,t.path,t.id)));i.push(...a.map(e=>({...e,draft:!0})))}const a=nn()(t.diffs.filter(e=>e.path.endsWith(o)),e=>e.path.length),s=(n,o,a)=>{const s=oi(e.get("name"),r,o,{raw:n,isModification:!a,label:e&&zl(e,r),mediaFiles:i,updatedOn:t.updatedAt,author:t.pullRequestAuthor,status:t.status,meta:{path:ic(o,e)}});return this.entryWithFormat(e)(s)},l=async n=>{const r=await this.implementation.unpublishedEntryDataFile(e.get("name"),t.slug,n.path,n.id);return s(r,n.path,n.newFile)};if(a.length<=0){const t=await this.implementation.getEntry(Ul(e,r));return s(t.data,t.file.path,!1)}if(nu(e)){const t=Ul(e,r),n=function(e,t,n,r,o){const{structure:i}=ru(e);return i===eu.SINGLE_FILE?o:fu(e,t,n,r).reduce((e,t)=>{const n=o.find(e=>e.path===t);return n?[...e,n]:[...e,{path:t,id:"",newFile:!1}]},[])}(e,o,t,r,a);let i=await Promise.all(n.map(e=>l(e).catch(()=>null)));return i=i.filter(Boolean),(await gu(e,o,i))[0]}return await l(a[0])}async unpublishedEntries(e){const t=await this.implementation.unpublishedEntries(),n=(await Promise.all(t.map(async t=>{const n=await this.implementation.unpublishedEntry({id:t}),r=n.collection,o=e.find(e=>e.get("name")===r);return o?await this.processUnpublishedEntry(o,n,!1):(console.warn(`Missing collection '${r}' for unpublished entry '${t}'`),null)}))).filter(Boolean);return{pagination:0,entries:n}}async processEntry(e,t,n){const r=Pu(e.integrations,null,"assetStore"),o=function(e,t,n){const r=function(e,t){return e.has("folder")?Nl(e.get("fields").toArray()):e.has("files")?Nl($l(e,t)?.get("fields").toArray()||[]):[]}(t,n.get("slug")),o=r.map(r=>Ml(e,t,n,r));return t.has("files")&&$l(t,n.get("slug"))&&o.unshift(Ml(e,t,n,void 0)),t.has("media_folder")&&(t=t.delete("files"),o.unshift(Ml(e,t,n,void 0))),(0,Ge.Set)(o).toArray()}(e.config,t,(0,Ge.fromJS)(n));if(o.length>0&&!r){const e=await Promise.all(o.map(e=>this.implementation.getMedia(e)));n.mediaFiles=n.mediaFiles.concat(...e)}else n.mediaFiles=n.mediaFiles.concat(e.mediaLibrary.get("files")||[]);return n}async unpublishedEntry(e,t,n){const r=await this.implementation.unpublishedEntry({collection:t.get("name"),slug:n});let o=await this.processUnpublishedEntry(t,r,!0);return o=await this.processEntry(e,t,o),o}getDeploy(e,t,n){const r=this.config.site_url;if(r&&!1!==this.config.show_preview_links)return{url:Xo(r,e,t,n,this.config.slug),status:"SUCCESS"}}async getDeployPreview(e,t,n,{maxAttempts:r=1,interval:o=5e3,signal:i}={}){if(!this.implementation.getDeployPreview||!1===this.config.show_preview_links)return;let a,s=0;for(;!a&&s<r;){if(i?.aborted)return;s++,a=await this.implementation.getDeployPreview(e.get("name"),t),a||await new Promise(e=>setTimeout(()=>e(void 0),o))}return a?{url:Xo(a.url,e,t,n,this.config.slug),status:a.status?a.status.toUpperCase():""}:void 0}async persistEntry({config:e,collection:t,entryDraft:n,assetProxies:r,usedSlugs:o,unpublished:i=!1,status:a}){const s=await this.invokePreSaveEvent(n.get("entry"));let l;l=void 0===s.get("data")?s&&n.setIn(["entry","data"],s)||n:s&&n.setIn(["entry"],s)||n;const u=l.getIn(["entry","newRecord"])||!1,c=Gu(e),f=ss(t,l);let d;if(u){if(!function(e){return Ll[e.get("type")].allowNewEntries(e)}(t))throw new Error("Not allowed to create new entries in this collection");const n=await this.generateUniqueSlug(t,l.getIn(["entry","data"]),e,o,f),i=f||Ul(t,n);d={path:i,slug:n,raw:this.entryToRaw(t,l.get("entry"))},function(e,t,n,r,o){e.map(e=>{const i=e.path,a=Rl(t,n,r.get("entry").set("path",o),i,e.field);e.path=a})}(r,e,t,l,i)}else{const e=l.getIn(["entry","slug"]),n=l.getIn(["entry","path"]);d={path:n,slug:f&&!c?oc(t,f):e,raw:this.entryToRaw(t,l.get("entry")),newPath:f===n?void 0:f}}const{slug:p,path:h,newPath:g}=d;let m=[d];if(nu(t)){const e=Bl(t);m=function(e,t,n,r,o,i,a){const{structure:s,defaultLocale:l,locales:u}=ru(e);if(s===eu.SINGLE_FILE){const e=u.reduce((e,t)=>{const r=lu(t,l);return e.set(t,n.getIn(r))},(0,Ge.Map)({})),c=n.set("data",e);return[{path:uu(s,t,o,i,u[0]),slug:i,raw:r(c),...a&&{newPath:uu(s,t,a,i,u[0])}}]}return u.map(e=>{const u=lu(e,l),c=n.set("data",n.getIn(u));return{path:uu(s,t,o,i,e),slug:i,raw:c.get("data")?r(c):"",...a&&{newPath:uu(s,t,a,i,e)}}}).filter(e=>e.raw)}(t,e,l.get("entry"),e=>this.entryToRaw(t,e),h,p,g)}const y=await this.currentUser(),v={newEntry:u,commitMessage:Yo(u?"create":"update",e,{collection:t,slug:p,path:h,authorLogin:y.login,authorName:y.name,authorEmail:y.email},y.useOpenAuthoring),collectionName:t.get("name"),useWorkflow:c,unpublished:i,status:a};return c||await this.invokePrePublishEvent(l.get("entry")),await this.implementation.persistEntry({dataFiles:m,assets:r},v),await this.invokePostSaveEvent(l.get("entry")),c||await this.invokePostPublishEvent(l.get("entry")),p}async invokeEventWithEntry(e,t){const{login:n,name:r}=await this.currentUser();return await _r({name:e,data:{entry:t,author:{login:n,name:r}}})}async invokePrePublishEvent(e){await this.invokeEventWithEntry("prePublish",e)}async invokePostPublishEvent(e){await this.invokeEventWithEntry("postPublish",e)}async invokePreUnpublishEvent(e){await this.invokeEventWithEntry("preUnpublish",e)}async invokePostUnpublishEvent(e){await this.invokeEventWithEntry("postUnpublish",e)}async invokePreSaveEvent(e){return await this.invokeEventWithEntry("preSave",e)}async invokePostSaveEvent(e){await this.invokeEventWithEntry("postSave",e)}async persistMedia(e,t){const n=await this.currentUser(),r={commitMessage:Yo("uploadMedia",e,{path:t.path,authorLogin:n.login,authorName:n.name,authorEmail:n.email},n.useOpenAuthoring)};return this.implementation.persistMedia(t,r)}async deleteEntry(e,t,n){const r=e.config,o=Ul(t,n),i=Bl(t);if(!Wl(t))throw new Error("Not allowed to delete entries in this collection");const a=await this.currentUser(),s=Yo("delete",r,{collection:t,slug:n,path:o,authorLogin:a.login,authorName:a.name,authorEmail:a.email},a.useOpenAuthoring),l=xl(e.entries,t.get("name"),n);await this.invokePreUnpublishEvent(l);let u=[o];nu(t)&&(u=fu(t,i,o,n)),await this.implementation.deleteFiles(u,s),await this.invokePostUnpublishEvent(l)}async deleteMedia(e,t){const n=await this.currentUser(),r=Yo("deleteMedia",e,{path:t,authorLogin:n.login,authorName:n.name,authorEmail:n.email},n.useOpenAuthoring);return this.implementation.deleteFiles([t],r)}persistUnpublishedEntry(e){return this.persistEntry({...e,unpublished:!0})}updateUnpublishedEntryStatus(e,t,n){return this.implementation.updateUnpublishedEntryStatus(e,t,n)}async publishUnpublishedEntry(e){const t=e.get("collection"),n=e.get("slug");await this.invokePrePublishEvent(e),await this.implementation.publishUnpublishedEntry(t,n),await this.invokePostPublishEvent(e)}deleteUnpublishedEntry(e,t){return this.implementation.deleteUnpublishedEntry(e,t)}entryToRaw(e,t){const n=Ar(e,t.toJS()),r=this.fieldsOrder(e,t),o=function(e,t){let n=[];if(e.has("folder"))n=e.get("fields").toArray();else if(e.has("files")){const r=e.get("files").find(e=>e?.get("name")===t.get("slug"));n=r.get("fields").toArray()}const r={};return Hl(n).forEach(t=>{const n=Vl(e,t);n?.has("comment")&&(r[t]=n.get("comment"))}),r}(e,t);let i=n.toFile(t.get("data").toJS(),r,o);return"\n"!=i.slice(-1)&&(i+="\n"),i}fieldsOrder(e,t){if(e.get("fields"))return e.get("fields").map(e=>e.get("name")).toArray();const n=(e.get("files")||(0,Ge.List)()).filter(e=>e.get("name")===t.get("slug")).get(0);if(null==n)throw new Error(`No file found for ${t.get("slug")} in ${e.get("name")}`);return n.get("fields").map(e=>e.get("name")).toArray()}filterEntries(e,t){return e.entries.filter(e=>{const n=e.data[t.get("field")];return Array.isArray(n)?n.includes(t.get("value")):n===t.get("value")})}}function lc(e){if(!e.backend.name)throw new Error("No backend defined in configuration");const{name:t}=e.backend,n=new Zu,r=xr(t);if(r)return new sc(r,{backendName:t,authStore:n,config:e});throw new Error(`Backend not found: ${t}`)}const uc=function(){let e;return t=>e||(e=lc(t))}(),cc="AUTH_REQUEST",fc="AUTH_SUCCESS",dc="AUTH_FAILURE",pc="AUTH_REQUEST_DONE",hc="USE_OPEN_AUTHORING",gc="LOGOUT";function mc(){return{type:cc}}function yc(e){return{type:fc,payload:e}}function vc(e){return{type:dc,error:"Failed to authenticate",payload:e}}function bc(){return{type:hc}}function wc(){return(e,t)=>{const n=t(),r=uc(n.config);Promise.resolve(r.logout()).then(()=>{e({type:gc}),e({type:Ai})})}}const xc=Wt((e,t)=>{switch(t.type){case cc:e.isFetching=!0;break;case fc:e.user=t.payload;break;case dc:e.error=t.payload&&t.payload.toString();break;case pc:e.isFetching=!1;break;case gc:e.user=void 0,e.isFetching=!1}},{isFetching:!1,user:void 0,error:void 0});var Sc=__webpack_require__(62162),kc=__webpack_require__.n(Sc);const _c={isFetching:!1,term:"",collections:[],page:0,entryIds:[],queryHits:{},error:void 0,requests:[]},Ec=Wt((e,t)=>{switch(t.type){case vi:return _c;case di:{const{page:n,searchTerm:r,searchCollections:o}=t.payload;e.isFetching=!0,e.term=r,e.collections=o,e.page=n;break}case pi:{const{entries:n,page:r}=t.payload,o=n.map(e=>({collection:e.collection,slug:e.slug}));e.isFetching=!1,e.page=r,e.entryIds=!r||isNaN(r)||0===r?o:e.entryIds.concat(o);break}case hi:{const{error:n}=t.payload;e.isFetching=!1,e.error=n;break}case gi:{const{searchTerm:n,request:r}=t.payload;e.isFetching=!0,e.term=n,r&&e.requests.push(r);break}case bi:e.requests=e.requests.filter(e=>e.expires>=new Date);break;case mi:{const{namespace:n,hits:r}=t.payload;e.isFetching=!1,e.queryHits[n]=r;break}case yi:{const{error:n}=t.payload;e.isFetching=!1,e.error=n}}},_c),Cc=Ec;function Oc(e){return Object.values(e).some(e=>e.isLoading)}const Tc=Wt((e,t)=>{switch(t.type){case wa:t.payload.forEach(t=>{e[t.path]={asset:t,isLoading:!1,error:null}});break;case xa:{const n=t.payload;e[n.path]={asset:n,isLoading:!1,error:null};break}case Sa:{const n=t.payload;delete e[n];break}case ka:{const{path:n}=t.payload;e[n]=e[n]||{},e[n].isLoading=!0;break}case _a:{const{path:n}=t.payload;e[n]=e[n]||{},e[n].isLoading=!1,e[n].error=null;break}case Ea:{const{path:n,error:r}=t.payload;e[n]=e[n]||{},e[n].isLoading=!1,e[n].error=r}}},{}),Pc="DEPLOY_PREVIEW_REQUEST",Mc="DEPLOY_PREVIEW_SUCCESS",Rc="DEPLOY_PREVIEW_FAILURE";function Ac(e,t){return{type:Rc,payload:{collection:e,slug:t}}}const Ic=Wt((e,t)=>{switch(t.type){case Pc:{const{collection:n,slug:r}=t.payload;e[`${n}.${r}`]={isFetching:!0,status:"PENDING"};break}case Mc:{const{collection:n,slug:r,url:o,status:i}=t.payload,a=`${n}.${r}`;e[a].isFetching=!1,e[a].url=o,e[a].status=i;break}case Rc:{const{collection:n,slug:r}=t.payload,o=`${n}.${r}`;e[o].isFetching=!1,e[o].url=void 0,e[o].status="PENDING";break}}},{}),Dc=Ic,jc=["DEPLOY_PREVIEW","STATUS_REQUEST","STATUS_SUCCESS","STATUS_FAILURE"];function Lc(e){return jc.some(t=>e.type.includes(t))}const Nc=Wt((e,t)=>{!Lc(t)&&t.type.includes("REQUEST")?e.isFetching=!0:Lc(t)||!t.type.includes("SUCCESS")&&!t.type.includes("FAILURE")?t.type===hc&&(e.useOpenAuthoring=!0):e.isFetching=!1},{isFetching:!1,useOpenAuthoring:!1}),$c="STATUS_REQUEST",Fc="STATUS_SUCCESS",Bc="STATUS_FAILURE";function zc(e){return{type:Fc,payload:{status:e}}}const Uc=Wt((e,t)=>{switch(t.type){case $c:e.isFetching=!0;break;case Fc:e.isFetching=!1,e.status=t.payload.status;break;case Bc:e.isFetching=!1,e.error=t.payload.error}},{isFetching:!1,status:{auth:{status:!0},api:{status:!0,statusPage:""}},error:void 0}),qc=Wt((e,t)=>{switch(t.type){case Ai:e.notifications=[];break;case Ri:e.notifications=e.notifications.filter(e=>e.id!==t.id);break;case Mi:e.notifications=[...e.notifications,{id:Xr(),...t.payload}]}},{notifications:[]}),Wc={auth:xc,config:Yu,collections:function(e=jl,t){if(t.type===Ru){const e=t.payload.collections;let n=(0,Ge.OrderedMap)({});return e.forEach(e=>{n=n.set(e.name,(0,Ge.fromJS)(e))}),n}return e},search:Cc,integrations:function(e=Tu,t){return t.type===Ru?Ou(t.payload):e},entries:function(e=(0,Ge.Map)({entities:(0,Ge.Map)(),pages:(0,Ge.Map)(),sort:hl(),viewStyle:ml()}),t){switch(t.type){case ls:{const n=t.payload;return e.setIn(["entities",`${n.collection}.${n.slug}`,"isFetching"],!0)}case us:{const n=t.payload;return al=n.collection,cl=n.entry.slug,e.withMutations(e=>{e.setIn(["entities",`${al}.${cl}`],(0,Ge.fromJS)(n.entry));const t=e.getIn(["pages",al,"ids"],(0,Ge.List)());t.includes(cl)||e.setIn(["pages",al,"ids"],t.unshift(cl))})}case fs:{const n=t.payload,r=e.withMutations(e=>{e.setIn(["pages",n.collection,"isFetching"],!0)});return r}case ds:{const n=t.payload;return al=n.collection,sl=n.entries,ll=n.append,ul=n.page,e.withMutations(e=>{sl.forEach(t=>e.setIn(["entities",`${al}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1)));const t=(0,Ge.List)(sl.map(e=>e.slug));e.setIn(["pages",al],(0,Ge.Map)({page:ul,ids:ll?e.getIn(["pages",al,"ids"],(0,Ge.List)()).concat(t):t}))})}case ps:return e.setIn(["pages",t.meta.collection,"isFetching"],!1);case cs:{const n=t.payload;return e.withMutations(e=>{e.setIn(["entities",`${n.collection}.${n.slug}`,"isFetching"],!1),e.setIn(["entities",`${n.collection}.${n.slug}`,"error"],n.error.message)})}case pi:{const n=t.payload;return sl=n.entries,e.withMutations(e=>{sl.forEach(t=>e.setIn(["entities",`${t.collection}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1)))})}case js:{const n=t.payload;return e.withMutations(e=>{e.deleteIn(["entities",`${n.collectionName}.${n.entrySlug}`]),e.updateIn(["pages",n.collectionName,"ids"],e=>e.filter(e=>e!==n.entrySlug))})}case hs:{const n=t.payload,{collection:r,key:o,direction:i}=n,a=e.withMutations(e=>{const t=(0,Ge.OrderedMap)({[o]:(0,Ge.Map)({key:o,direction:i})});e.setIn(["sort",r],t),e.setIn(["pages",r,"isFetching"],!0),e.deleteIn(["pages",r,"page"])});return gl(a.get("sort")),a}case xs:case vs:case gs:{const n=t.payload,{collection:r,entries:o}=n;sl=o;const i=e.withMutations(e=>{sl.forEach(t=>e.setIn(["entities",`${t.collection}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1))),e.setIn(["pages",r,"isFetching"],!1);const t=(0,Ge.List)(sl.map(e=>e.slug));e.setIn(["pages",r],(0,Ge.Map)({page:1,ids:t}))});return i}case ms:{const n=t.payload,{collection:r,key:o}=n,i=e.withMutations(e=>{e.deleteIn(["sort",r,o]),e.setIn(["pages",r,"isFetching"],!1)});return gl(i.get("sort")),i}case ys:{const n=t.payload,{collection:r,filter:o}=n,i=e.withMutations(e=>{const t=e.getIn(["filter",r,o.id],(0,Ge.fromJS)(o));e.setIn(["filter",r,t.get("id")],t.set("active",!t.get("active")))});return i}case bs:{const n=t.payload,{collection:r,filter:o}=n,i=e.withMutations(e=>{e.deleteIn(["filter",r,o.id]),e.setIn(["pages",r,"isFetching"],!1)});return i}case ws:{const n=t.payload,{collection:r,group:o}=n,i=e.withMutations(e=>{const t=e.getIn(["group",r,o.id],(0,Ge.fromJS)(o));e.deleteIn(["group",r]),e.setIn(["group",r,t.get("id")],t.set("active",!t.get("active")))});return i}case Ss:{const n=t.payload,{collection:r,group:o}=n,i=e.withMutations(e=>{e.deleteIn(["group",r,o.id]),e.setIn(["pages",r,"isFetching"],!1)});return i}case $s:{const r=t.payload,{style:o}=r,i=e.withMutations(e=>{e.setIn(["viewStyle"],o)});return(n=i.get("viewStyle"))?localStorage.setItem(dl,n):localStorage.removeItem(dl),i}default:return e}var n},cursors:function(e=(0,Ge.fromJS)({cursorsByType:{collectionEntries:{}}}),t){switch(t.type){case ds:return e.setIn(["cursorsByType","collectionEntries",t.payload.collection],cn.Cursor.create(t.payload.cursor).store);case vs:case xs:case gs:return e.deleteIn(["cursorsByType","collectionEntries",t.payload.collection]);default:return e}},editorialWorkflow:function(e=(0,Ge.Map)(),t){switch(t.type){case Ru:return(t.payload&&t.payload.publish_mode)===Br?(0,Ge.Map)({entities:(0,Ge.Map)(),pages:(0,Ge.Map)()}):e;case La:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isFetching"],!0);case $a:return e.deleteIn(["entities",`${t.payload.collection}.${t.payload.slug}`]);case Na:return e.setIn(["entities",`${t.payload.collection}.${t.payload.entry.slug}`],(0,Ge.fromJS)(t.payload.entry));case Fa:return e.setIn(["pages","isFetching"],!0);case Ba:return e.withMutations(e=>{t.payload.entries.forEach(t=>e.setIn(["entities",`${t.collection}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1))),e.set("pages",(0,Ge.Map)({...t.payload.pages,ids:(0,Ge.List)(t.payload.entries.map(e=>e.slug))}))});case za:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isPersisting"],!0);case Ua:return e.withMutations(e=>{e.setIn(["entities",`${t.payload.collection}.${t.payload.entry.get("slug")}`],(0,Ge.fromJS)(t.payload.entry)),e.deleteIn(["entities",`${t.payload.collection}.${t.payload.entry.get("slug")}`,"isPersisting"]),e.updateIn(["pages","ids"],(0,Ge.List)(),e=>e.push(t.payload.entry.get("slug")))});case qa:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isPersisting"],!1);case Wa:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isUpdatingStatus"],!0);case Ha:return e.withMutations(e=>{e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"status"],t.payload.newStatus),e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isUpdatingStatus"],!1)});case Va:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isUpdatingStatus"],!1);case Ka:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isPublishing"],!0);case Ga:case Qa:return e.deleteIn(["entities",`${t.payload.collection}.${t.payload.slug}`]);default:return e}},entryDraft:function(e=(0,Ge.Map)(),t){switch(t.type){case ks:return e.withMutations(e=>{e.set("entry",(0,Ge.fromJS)(t.payload.entry)),e.setIn(["entry","newRecord"],!1),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!1),e.set("key",Xr())});case _s:return e.withMutations(e=>{e.set("entry",(0,Ge.fromJS)(t.payload)),e.setIn(["entry","newRecord"],!0),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!1),e.set("key",Xr())});case Ms:return e.withMutations(e=>{const t=e.get("localBackup").get("entry");e.delete("localBackup"),e.set("entry",t),e.setIn(["entry","newRecord"],!t.get("path")),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!0),e.set("key",Xr())});case Rs:return e.withMutations(e=>{e.set("entry",(0,Ge.fromJS)(t.payload)),e.setIn(["entry","newRecord"],!0),e.set("mediaFiles",(0,Ge.List)()),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!0)});case Es:return as;case Ps:{const{entry:n}=t.payload,r=new Ge.Map({entry:(0,Ge.fromJS)(n)});return e.set("localBackup",r)}case Cs:return e.withMutations(e=>{const{field:n,value:r,metadata:o,entries:i,i18n:a}=t.payload,s=n.get("name"),l=n.get("meta"),u=a&&lu(a.currentLocale,a.defaultLocale)||["data"];l?e.setIn(["entry","meta",s],r):(e.setIn(["entry",...u,s],r),a&&(e=mu(e,n,a.locales,a.defaultLocale))),e.mergeDeepIn(["fieldsMetaData"],(0,Ge.fromJS)(o));const c=e.getIn(["entry",...u]),f=e.getIn(["entry","meta"]);e.set("hasChanged",!i.some(e=>c.equals(e.get(...u)))||!i.some(e=>f.equals(e.get("meta"))))});case Os:return 0===t.payload.errors.length?e.deleteIn(["fieldsErrors",t.payload.uniquefieldId]):e.setIn(["fieldsErrors",t.payload.uniquefieldId],t.payload.errors);case Ts:{const{uniqueFieldId:n}=t.payload;return e.deleteIn(["fieldsErrors",n])}case As:case za:return e.setIn(["entry","isPersisting"],!0);case Ds:case qa:return e.deleteIn(["entry","isPersisting"]);case Wa:return e.setIn(["entry","isUpdatingStatus"],!0);case Va:case Ha:return e.deleteIn(["entry","isUpdatingStatus"]);case Ka:return e.setIn(["entry","isPublishing"],!0);case Ga:case Ya:return e.deleteIn(["entry","isPublishing"]);case Is:case Ua:return e.withMutations(e=>{e.deleteIn(["entry","isPersisting"]),e.set("hasChanged",!1),e.getIn(["entry","slug"])||e.setIn(["entry","slug"],t.payload.slug)});case js:return e.withMutations(e=>{e.deleteIn(["entry","isPersisting"]),e.set("hasChanged",!1)});case Ls:return e.withMutations(e=>{const n=e.getIn(["entry","mediaFiles"]);e.setIn(["entry","mediaFiles"],n.filterNot(e=>e.get("id")===t.payload.id).insert(0,(0,Ge.fromJS)(t.payload))),e.set("hasChanged",!0)});case Ns:return e.withMutations(e=>{const n=e.getIn(["entry","mediaFiles"]);e.setIn(["entry","mediaFiles"],n.filterNot(e=>e.get("id")===t.payload.id)),e.set("hasChanged",!0)});default:return e}},medias:Tc,mediaLibrary:function(e=(0,Ge.Map)(ya),t){switch(t.type){case Ni:return e.withMutations(e=>{e.set("externalLibrary",t.payload),e.set("showMediaButton",t.payload.enableStandalone())});case ji:{const{controlID:n,forImage:r,privateUpload:o,config:i,field:a,value:s,replaceIndex:l}=t.payload,u=i||(0,Ge.Map)();return e.get("privateUpload")!==o?(0,Ge.Map)({isVisible:!0,forImage:r,controlID:n,canInsert:!!n,privateUpload:o,config:u,controlMedia:(0,Ge.Map)(),displayURLs:(0,Ge.Map)(),field:a,value:s,replaceIndex:l}):e.withMutations(e=>{e.set("isVisible",!0),e.set("forImage",r??!1),e.set("controlID",n??""),e.set("canInsert",!!n),e.set("privateUpload",o),e.set("config",u),e.set("field",a??""),e.set("value",""==s&&u.get("multiple")?[]:s??""),e.set("replaceIndex",l??!1)})}case Li:return e.set("isVisible",!1);case $i:{const{mediaPath:n}=t.payload,r=e.get("controlID"),o=e.get("value");if(!Array.isArray(o))return e.withMutations(e=>{e.setIn(["controlMedia",r],n)});const i=e.get("replaceIndex"),a=Array.isArray(n)?n:[n],s=o;return"number"==typeof i?s[i]=a[0]:s.push(...a),e.withMutations(e=>{e.setIn(["controlMedia",r],s)})}case Fi:{const n=t.payload.controlID;return e.setIn(["controlMedia",n],"")}case Bi:return e.withMutations(e=>{e.set("isLoading",!0),e.set("isPaginating",t.payload.page>1)});case zi:{const{files:n=[],page:r,canPaginate:o,dynamicSearch:i,dynamicSearchQuery:a,privateUpload:s}=t.payload;if(e.get("privateUpload")!==s)return e;const l=n.map(e=>({...e,key:Xr()}));return e.withMutations(e=>{if(e.set("isLoading",!1),e.set("isPaginating",!1),e.set("page",r??1),e.set("hasNextPage",!!(o&&n.length>0)),e.set("dynamicSearch",i??!1),e.set("dynamicSearchQuery",a??""),e.set("dynamicSearchActive",!!a),r&&r>1){const t=e.get("files").concat(l);e.set("files",t)}else e.set("files",l)})}case Ui:return e.get("privateUpload")!==t.payload.privateUpload?e:e.set("isLoading",!1);case qi:return e.set("isPersisting",!0);case Wi:{const{file:n,privateUpload:r}=t.payload;return e.get("privateUpload")!==r?e:e.withMutations(e=>{const t=[{...n,key:Xr()},...e.get("files")];e.set("files",t),e.set("isPersisting",!1)})}case Hi:return e.get("privateUpload")!==t.payload.privateUpload?e:e.set("isPersisting",!1);case Vi:return e.set("isDeleting",!0);case Ki:{const{file:n,privateUpload:r}=t.payload,{key:o,id:i}=n;return e.get("privateUpload")!==r?e:e.withMutations(e=>{const t=e.get("files").filter(e=>o?e.key!==o:e.id!==i);e.set("files",t),e.deleteIn(["displayURLs",i]),e.set("isDeleting",!1)})}case Gi:return e.get("privateUpload")!==t.payload.privateUpload?e:e.set("isDeleting",!1);case Yi:return e.setIn(["displayURLs",t.payload.key,"isFetching"],!0);case Qi:{const n=["displayURLs",t.payload.key];return e.setIn([...n,"isFetching"],!1).setIn([...n,"url"],t.payload.url)}case Ji:{const n=["displayURLs",t.payload.key];return e.setIn([...n,"isFetching"],!1).setIn([...n,"err"],t.payload.err||!0).deleteIn([...n,"url"])}default:return e}},deploys:Dc,globalUI:Nc,status:Uc,notifications:qc};function Hc(e,t,n){return xl(e.entries,t,n)}function Vc(e,t){return Sl(e.entries,t)}function Kc(e,t,n){return function(e,t,n){return e[`${t}.${n}`]}(e.deploys,t,n)}function Gc(e,t,n){return function(e,t,n){return e&&e.getIn(["entities",`${t}.${n}`])}(e.editorialWorkflow,t,n)}function Yc(e,t){return function(e,t){return e?e.get("entities").filter(e=>e.get("status")===t).valueSeq():null}(e.editorialWorkflow,t)}function Qc(e,t,n){return Pu(e.integrations,t,n)}const Jc=(0,Ue.y$)((0,Ue.HY)({...Wc}),(0,qe.tY)((0,Ue.Tw)(Ve,({dispatch:e,getState:t})=>{let n=[];return r=>o=>{if(o.type===Ke)return n.push(o),null;const i=r(o);return function(r){const o=[],i=[];for(const e of n)e.predicate(r)?o.push(e):i.push(e);n=i;for(const n of o)n.run(e,t,r)}(o),i}})));var Xc=__webpack_require__(82451),Zc=__webpack_require__.n(Xc);function ef(e){return Zc()({},Er("en"),Er(e))}function tf(e){var t=null;return function(){return null==t&&(t=e()),t}}function nf(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,r.key,r)}}function rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var of=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rf(this,"entered",[]),rf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}var t,n;return t=e,n=[{key:"enter",value:function(e){var t=this,n=this.entered.length;return this.entered=function(e,t){var n=new Set,r=function(e){return n.add(e)};e.forEach(r),t.forEach(r);var o=[];return n.forEach(function(e){return o.push(e)}),o}(this.entered.filter(function(n){return t.isNodeInDocument(n)&&(!n.contains||n.contains(e))}),[e]),0===n&&this.entered.length>0}},{key:"leave",value:function(e){var t,n,r=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),n=e,t.filter(function(e){return e!==n})),r>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}],n&&nf(t.prototype,n),e}(),af=tf(function(){return/firefox/i.test(navigator.userAgent)}),sf=tf(function(){return Boolean(window.safari)});function lf(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,r.key,r)}}function uf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cf=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),uf(this,"xs",void 0),uf(this,"ys",void 0),uf(this,"c1s",void 0),uf(this,"c2s",void 0),uf(this,"c3s",void 0);for(var r=t.length,o=[],i=0;i<r;i++)o.push(i);o.sort(function(e,n){return t[e]<t[n]?-1:1});for(var a,s,l=[],u=[],c=[],f=0;f<r-1;f++)a=t[f+1]-t[f],s=n[f+1]-n[f],u.push(a),l.push(s),c.push(s/a);for(var d=[c[0]],p=0;p<u.length-1;p++){var h=c[p],g=c[p+1];if(h*g<=0)d.push(0);else{a=u[p];var m=u[p+1],y=a+m;d.push(3*y/((y+m)/h+(y+a)/g))}}d.push(c[c.length-1]);for(var v,b=[],w=[],x=0;x<d.length-1;x++){v=c[x];var S=d[x],k=1/u[x],_=S+d[x+1]-v-v;b.push((v-S-_)*k),w.push(_*k*k)}this.xs=t,this.ys=n,this.c1s=d,this.c2s=b,this.c3s=w}var t,n;return t=e,n=[{key:"interpolate",value:function(e){var t=this.xs,n=this.ys,r=this.c1s,o=this.c2s,i=this.c3s,a=t.length-1;if(e===t[a])return n[a];for(var s,l=0,u=i.length-1;l<=u;){var c=t[s=Math.floor(.5*(l+u))];if(c<e)l=s+1;else{if(!(c>e))return n[s];u=s-1}}var f=e-t[a=Math.max(0,u)],d=f*f;return n[a]+r[a]*f+o[a]*d+i[a]*f*d}}],n&&lf(t.prototype,n),e}();function ff(e){var t=1===e.nodeType?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function df(e){return{x:e.clientX,y:e.clientY}}var pf,hf="__NATIVE_FILE__",gf="__NATIVE_URL__",mf="__NATIVE_TEXT__",yf="__NATIVE_HTML__";function vf(e,t,n){var r=t.reduce(function(t,n){return t||e.getData(n)},"");return null!=r?r:n}function bf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wf=(bf(pf={},hf,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),bf(pf,yf,{exposeProperties:{html:function(e,t){return vf(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),bf(pf,gf,{exposeProperties:{urls:function(e,t){return vf(e,t,"").split("\n")},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),bf(pf,mf,{exposeProperties:{text:function(e,t){return vf(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),pf);function xf(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,r.key,r)}}function Sf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kf=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Sf(this,"item",void 0),Sf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}var t,n;return t=e,(n=[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(t,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var t=this;if(e){var n={};Object.keys(this.config.exposeProperties).forEach(function(r){n[r]={value:t.config.exposeProperties[r](e,t.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,n)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,t){return t===e.getSourceId()}},{key:"endDrag",value:function(){}}])&&xf(t.prototype,n),e}();function _f(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(wf).filter(function(e){return wf[e].matchesTypes.some(function(e){return t.indexOf(e)>-1})})[0]||null}function Ef(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,r.key,r)}}function Cf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Of=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Cf(this,"ownerDocument",null),Cf(this,"globalContext",void 0),Cf(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=n}var t,n;return t=e,(n=[{key:"window",get:function(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}},{key:"document",get:function(){var e;return null!==(e=this.globalContext)&&void 0!==e&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}}])&&Ef(t.prototype,n),e}();function Tf(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 Pf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tf(Object(n),!0).forEach(function(t){Rf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mf(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,r.key,r)}}function Rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Af=function(){function t(e,n,r){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Rf(this,"options",void 0),Rf(this,"actions",void 0),Rf(this,"monitor",void 0),Rf(this,"registry",void 0),Rf(this,"enterLeaveCounter",void 0),Rf(this,"sourcePreviewNodes",new Map),Rf(this,"sourcePreviewNodeOptions",new Map),Rf(this,"sourceNodes",new Map),Rf(this,"sourceNodeOptions",new Map),Rf(this,"dragStartSourceIds",null),Rf(this,"dropTargetIds",[]),Rf(this,"dragEnterTargetIds",[]),Rf(this,"currentNativeSource",null),Rf(this,"currentNativeHandle",null),Rf(this,"currentDragSourceNode",null),Rf(this,"altKeyPressed",!1),Rf(this,"mouseMoveTimeoutTimer",null),Rf(this,"asyncEndDragFrameId",null),Rf(this,"dragOverTargetIds",null),Rf(this,"lastClientOffset",null),Rf(this,"hoverRafId",null),Rf(this,"getSourceClientOffset",function(e){var t=o.sourceNodes.get(e);return t&&ff(t)||null}),Rf(this,"endDragNativeItem",function(){o.isDraggingNativeItem()&&(o.actions.endDrag(),o.currentNativeHandle&&o.registry.removeSource(o.currentNativeHandle),o.currentNativeHandle=null,o.currentNativeSource=null)}),Rf(this,"isNodeInDocument",function(e){return Boolean(e&&o.document&&o.document.body&&o.document.body.contains(e))}),Rf(this,"endDragIfSourceWasRemovedFromDOM",function(){var e=o.currentDragSourceNode;null==e||o.isNodeInDocument(e)||o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()}),Rf(this,"handleTopDragStartCapture",function(){o.clearCurrentDragSourceNode(),o.dragStartSourceIds=[]}),Rf(this,"handleTopDragStart",function(e){if(!e.defaultPrevented){var t=o.dragStartSourceIds;o.dragStartSourceIds=null;var n=df(e);o.monitor.isDragging()&&o.actions.endDrag(),o.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:o.getSourceClientOffset,clientOffset:n});var r=e.dataTransfer,i=_f(r);if(o.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){var a=o.monitor.getSourceId(),s=o.sourceNodes.get(a),l=o.sourcePreviewNodes.get(a)||s;if(l){var u=o.getCurrentSourcePreviewNodeOptions(),c=function(e,t,n,r,o){var i,a,s="IMG"===(i=t).nodeName&&(af()||!(null!==(a=document.documentElement)&&void 0!==a&&a.contains(i))),l=ff(s?e:t),u={x:n.x-l.x,y:n.y-l.y},c=e.offsetWidth,f=e.offsetHeight,d=r.anchorX,p=r.anchorY,h=function(e,t,n,r){var o=e?t.width:n,i=e?t.height:r;return sf()&&e&&(i/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:i}}(s,t,c,f),g=h.dragPreviewWidth,m=h.dragPreviewHeight,y=o.offsetX,v=o.offsetY,b=0===v||v;return{x:0===y||y?y:new cf([0,.5,1],[u.x,u.x/c*g,u.x+g-c]).interpolate(d),y:b?v:function(){var e=new cf([0,.5,1],[u.y,u.y/f*m,u.y+m-f]).interpolate(p);return sf()&&s&&(e+=(window.devicePixelRatio-1)*m),e}()}}(s,l,n,{anchorX:u.anchorX,anchorY:u.anchorY},{offsetX:u.offsetX,offsetY:u.offsetY});r.setDragImage(l,c.x,c.y)}}try{null==r||r.setData("application/json",{})}catch(e){}o.setCurrentDragSourceNode(e.target),o.getCurrentSourcePreviewNodeOptions().captureDraggingState?o.actions.publishDragSource():setTimeout(function(){return o.actions.publishDragSource()},0)}else if(i)o.beginDragNativeItem(i);else{if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}}),Rf(this,"handleTopDragEndCapture",function(){o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()}),Rf(this,"handleTopDragEnterCapture",function(e){if(o.dragEnterTargetIds=[],o.enterLeaveCounter.enter(e.target)&&!o.monitor.isDragging()){var t=e.dataTransfer,n=_f(t);n&&o.beginDragNativeItem(n,t)}}),Rf(this,"handleTopDragEnter",function(e){var t=o.dragEnterTargetIds;o.dragEnterTargetIds=[],o.monitor.isDragging()&&(o.altKeyPressed=e.altKey,t.length>0&&o.actions.hover(t,{clientOffset:df(e)}),t.some(function(e){return o.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())))}),Rf(this,"handleTopDragOverCapture",function(){o.dragOverTargetIds=[]}),Rf(this,"handleTopDragOver",function(e){var t=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));o.altKeyPressed=e.altKey,o.lastClientOffset=df(e),null===o.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(o.hoverRafId=requestAnimationFrame(function(){o.monitor.isDragging()&&o.actions.hover(t||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null})),(t||[]).some(function(e){return o.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))}),Rf(this,"handleTopDragLeaveCapture",function(e){o.isDraggingNativeItem()&&e.preventDefault(),o.enterLeaveCounter.leave(e.target)&&o.isDraggingNativeItem()&&setTimeout(function(){return o.endDragNativeItem()},0)}),Rf(this,"handleTopDropCapture",function(e){var t;o.dropTargetIds=[],o.isDraggingNativeItem()?(e.preventDefault(),null===(t=o.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):_f(e.dataTransfer)&&e.preventDefault(),o.enterLeaveCounter.reset()}),Rf(this,"handleTopDrop",function(e){var t=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(t,{clientOffset:df(e)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()}),Rf(this,"handleSelectStart",function(e){var t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))}),this.options=new Of(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new of(this.isNodeInDocument)}var n,r;return n=t,(r=[{key:"profile",value:function(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,t=this.rootElement;void 0!==t&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(e=this.window)||void 0===e||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,t,n){var r=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){r.sourcePreviewNodes.delete(e),r.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,t,n){var r=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);var o=function(t){return r.handleDragStart(t,e)},i=function(e){return r.handleSelectStart(e)};return t.setAttribute("draggable","true"),t.addEventListener("dragstart",o),t.addEventListener("selectstart",i),function(){r.sourceNodes.delete(e),r.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",o),t.removeEventListener("selectstart",i),t.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,t){var n=this,r=function(t){return n.handleDragEnter(t,e)},o=function(t){return n.handleDragOver(t,e)},i=function(t){return n.handleDrop(t,e)};return t.addEventListener("dragenter",r),t.addEventListener("dragover",o),t.addEventListener("drop",i),function(){t.removeEventListener("dragenter",r),t.removeEventListener("dragover",o),t.removeEventListener("drop",i)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return Pf({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return Pf({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var t=this.monitor.getItemType();return Object.keys(e).some(function(n){return e[n]===t})}},{key:"beginDragNativeItem",value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){var n=new kf(wf[e]);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var e;return null===(e=t.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",t.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}},{key:"handleDragStart",value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}},{key:"handleDragEnter",value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:"handleDragOver",value:function(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:"handleDrop",value:function(e,t){this.dropTargetIds.unshift(t)}}])&&Mf(n.prototype,r),t}(),If=function(e,t,n){return new Af(e,t,n)};function Df(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(i=new Error(t.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw i.framesToPop=1,i}}function jf(e,t,n){var r=n.getRegistry(),o=r.addTarget(e,t);return[o,function(){return r.removeTarget(o)}]}function Lf(e,t,n){var r=n.getRegistry(),o=r.addSource(e,t);return[o,function(){return r.removeSource(o)}]}function Nf(e){var t={};return Object.keys(e).forEach(function(r){var o=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var i=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(0,n.isValidElement)(t)){var o=t;return e(o,r),o}var i=t;!function(e){if("string"!=typeof e.type){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}(i);var a=r?function(t){return e(t,r)}:e;return function(e,t){var r=e.ref;return Df("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,n.cloneElement)(e,{ref:function(e){$f(r,e),$f(t,e)}}):(0,n.cloneElement)(e,{ref:t})}(i,a)}}(o);t[r]=function(){return i}}}),t}function $f(e,t){"function"==typeof e?e(t):e.current=t}function Ff(e){return Ff="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},Ff(e)}function Bf(e){return null!==e&&"object"===Ff(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function zf(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!s(u))return!1;var c=e[u],f=t[u];if(!1===(o=n?n.call(r,c,f,u):void 0)||void 0===o&&c!==f)return!1}return!0}function Uf(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,r.key,r)}}function qf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wf=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qf(this,"hooks",Nf({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,Bf(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,Bf(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),qf(this,"handlerId",null),qf(this,"dragSourceRef",null),qf(this,"dragSourceNode",void 0),qf(this,"dragSourceOptionsInternal",null),qf(this,"dragSourceUnsubscribe",void 0),qf(this,"dragPreviewRef",null),qf(this,"dragPreviewNode",void 0),qf(this,"dragPreviewOptionsInternal",null),qf(this,"dragPreviewUnsubscribe",void 0),qf(this,"lastConnectedHandlerId",null),qf(this,"lastConnectedDragSource",null),qf(this,"lastConnectedDragSourceOptions",null),qf(this,"lastConnectedDragPreview",null),qf(this,"lastConnectedDragPreviewOptions",null),qf(this,"backend",void 0),this.backend=t}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();t&&this.disconnectDragPreview(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!zf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!zf(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}])&&Uf(t.prototype,n),e}();function Hf(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,r.key,r)}}function Vf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Kf=!1,Gf=!1,Yf=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Vf(this,"internalMonitor",void 0),Vf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){Df(!Kf,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Kf=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Kf=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;Df(!Gf,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Gf=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Gf=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&Hf(t.prototype,n),e}();function Qf(e){return Qf="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},Qf(e)}function Jf(e){var t=e.current;return null==t?null:t.decoratedRef?t.decoratedRef.current:t}function Xf(e){return"function"==typeof e}function Zf(){}function ed(e){if(!function(e){return"object"===Qf(e)&&null!==e}(e))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function td(e,t){return"string"==typeof e||"symbol"===Qf(e)||!!t&&Array.isArray(e)&&e.every(function(e){return td(e,!1)})}var nd=__webpack_require__(31085),rd=(0,n.createContext)({dragDropManager:void 0});function od(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function id(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,r.key,r)}}function ad(e,t,n){return t&&id(e.prototype,t),n&&id(e,n),e}function sd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ld=function(){function e(t){od(this,e),sd(this,"isDisposed",!1),sd(this,"action",void 0),this.action=Xf(t)?t:Zf}return ad(e,[{key:"dispose",value:function(){this.isDisposed||(this.action(),this.isDisposed=!0)}}],[{key:"isDisposable",value:function(e){return Boolean(e&&Xf(e.dispose))}},{key:"_fixup",value:function(t){return e.isDisposable(t)?t:e.empty}},{key:"create",value:function(t){return new e(t)}}]),e}();sd(ld,"empty",{dispose:Zf});var ud=function(){function e(){od(this,e),sd(this,"isDisposed",!1),sd(this,"disposables",void 0);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.disposables=n}return ad(e,[{key:"add",value:function(e){this.isDisposed?e.dispose():this.disposables.push(e)}},{key:"remove",value:function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),e.dispose())}return t}},{key:"clear",value:function(){if(!this.isDisposed){for(var e=this.disposables.length,t=new Array(e),n=0;n<e;n++)t[n]=this.disposables[n];this.disposables=[];for(var r=0;r<e;r++)t[r].dispose()}}},{key:"dispose",value:function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;n<e;n++)t[n]=this.disposables[n];this.disposables=[];for(var r=0;r<e;r++)t[r].dispose()}}}]),e}(),cd=function(){function e(){od(this,e),sd(this,"isDisposed",!1),sd(this,"current",void 0)}return ad(e,[{key:"getDisposable",value:function(){return this.current}},{key:"setDisposable",value:function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e,n&&n.dispose()}t&&e&&e.dispose()}},{key:"dispose",value:function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=void 0,e&&e.dispose()}}}]),e}();function fd(e){return fd="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},fd(e)}function dd(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 pd(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,r.key,r)}}function hd(e,t){return hd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},hd(e,t)}function gd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function md(e){return md=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},md(e)}function yd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vd(e){var t=e.DecoratedComponent,r=e.createHandler,o=e.createMonitor,i=e.createConnector,a=e.registerHandler,s=e.containerDisplayName,l=e.getType,u=e.collect,c=e.options.arePropsEqual,f=void 0===c?zf:c,d=t,p=t.displayName||t.name||"Component",h=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}}),t&&hd(e,t)}(m,e);var t,s,c,h,g=(c=m,h=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=md(c);if(h){var n=md(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===fd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return gd(e)}(this,e)});function m(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,m),yd(gd(t=g.call(this,e)),"decoratedRef",(0,n.createRef)()),yd(gd(t),"handlerId",void 0),yd(gd(t),"manager",void 0),yd(gd(t),"handlerMonitor",void 0),yd(gd(t),"handlerConnector",void 0),yd(gd(t),"handler",void 0),yd(gd(t),"disposable",void 0),yd(gd(t),"currentType",void 0),yd(gd(t),"handleChange",function(){var e=t.getCurrentState();zf(e,t.state)||t.setState(e)}),t.disposable=new cd,t.receiveProps(e),t.dispose(),t}return t=m,s=[{key:"getHandlerId",value:function(){return this.handlerId}},{key:"getDecoratedComponentInstance",value:function(){return Df(this.decoratedRef.current,"In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()"),this.decoratedRef.current}},{key:"shouldComponentUpdate",value:function(e,t){return!f(e,this.props)||!zf(t,this.state)}},{key:"componentDidMount",value:function(){this.disposable=new cd,this.currentType=void 0,this.receiveProps(this.props),this.handleChange()}},{key:"componentDidUpdate",value:function(e){f(this.props,e)||(this.receiveProps(this.props),this.handleChange())}},{key:"componentWillUnmount",value:function(){this.dispose()}},{key:"receiveProps",value:function(e){this.handler&&(this.handler.receiveProps(e),this.receiveType(l(e)))}},{key:"receiveType",value:function(e){if(this.handlerMonitor&&this.manager&&this.handlerConnector&&e!==this.currentType){this.currentType=e;var t=function(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dd(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)?dd(e,t):void 0}}(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.")}()}(a(e,this.handler,this.manager),2),n=t[0],r=t[1];this.handlerId=n,this.handlerMonitor.receiveHandlerId(n),this.handlerConnector.receiveHandlerId(n);var o=this.manager.getMonitor().subscribeToStateChange(this.handleChange,{handlerIds:[n]});this.disposable.setDisposable(new ud(new ld(o),new ld(r)))}}},{key:"dispose",value:function(){this.disposable.dispose(),this.handlerConnector&&this.handlerConnector.receiveHandlerId(null)}},{key:"getCurrentState",value:function(){return this.handlerConnector?u(this.handlerConnector.hooks,this.handlerMonitor,this.props):{}}},{key:"render",value:function(){var e=this;return(0,nd.jsx)(rd.Consumer,{children:function(t){var n,r,o=t.dragDropManager;return e.receiveDragDropManager(o),"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(function(){var t;return null===(t=e.handlerConnector)||void 0===t?void 0:t.reconnect()}),(0,nd.jsx)(d,Object.assign({},e.props,e.getCurrentState(),{ref:(n=d,(r=n)&&r.prototype&&"function"==typeof r.prototype.render||function(e){var t;return"Symbol(react.forward_ref)"===(null==e||null===(t=e.$$typeof)||void 0===t?void 0:t.toString())}(n)?e.decoratedRef:null)}),void 0)}},void 0)}},{key:"receiveDragDropManager",value:function(e){void 0===this.manager&&(Df(void 0!==e,"Could not find the drag and drop manager in the context of %s. Make sure to render a DndProvider component in your top-level component. Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context",p,p),void 0!==e&&(this.manager=e,this.handlerMonitor=o(e),this.handlerConnector=i(e.getBackend()),this.handler=r(this.handlerMonitor,this.decoratedRef)))}}],s&&pd(t.prototype,s),m}(n.Component);return yd(h,"DecoratedComponent",t),yd(h,"displayName","".concat(s,"(").concat(p,")")),y()(h,t)}function bd(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,r.key,r)}}function wd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xd=["canDrag","beginDrag","isDragging","endDrag"],Sd=["beginDrag"],kd=function(){function e(t,n,r){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),wd(this,"props",null),wd(this,"spec",void 0),wd(this,"monitor",void 0),wd(this,"ref",void 0),wd(this,"beginDrag",function(){if(o.props)return o.spec.beginDrag(o.props,o.monitor,o.ref.current)}),this.spec=t,this.monitor=n,this.ref=r}var t,n;return t=e,(n=[{key:"receiveProps",value:function(e){this.props=e}},{key:"canDrag",value:function(){return!!this.props&&(!this.spec.canDrag||this.spec.canDrag(this.props,this.monitor))}},{key:"isDragging",value:function(e,t){return!!this.props&&(this.spec.isDragging?this.spec.isDragging(this.props,this.monitor):t===e.getSourceId())}},{key:"endDrag",value:function(){this.props&&this.spec.endDrag&&this.spec.endDrag(this.props,this.monitor,Jf(this.ref))}}])&&bd(t.prototype,n),e}();function _d(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,r.key,r)}}function Ed(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Cd=!1,Od=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ed(this,"internalMonitor",void 0),Ed(this,"targetId",null),this.internalMonitor=t.getMonitor()}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;Df(!Cd,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Cd=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Cd=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&_d(t.prototype,n),e}();function Td(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,r.key,r)}}function Pd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Md=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pd(this,"hooks",Nf({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,Bf(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),Pd(this,"handlerId",null),Pd(this,"dropTargetRef",null),Pd(this,"dropTargetNode",void 0),Pd(this,"dropTargetOptionsInternal",null),Pd(this,"unsubscribeDropTarget",void 0),Pd(this,"lastConnectedHandlerId",null),Pd(this,"lastConnectedDropTarget",null),Pd(this,"lastConnectedDropTargetOptions",null),Pd(this,"backend",void 0),this.backend=t}var t,n;return t=e,(n=[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!zf(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}])&&Td(t.prototype,n),e}();function Rd(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,r.key,r)}}function Ad(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Id=["canDrop","hover","drop"],Dd=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ad(this,"props",null),Ad(this,"spec",void 0),Ad(this,"monitor",void 0),Ad(this,"ref",void 0),this.spec=t,this.monitor=n,this.ref=r}var t,n;return t=e,(n=[{key:"receiveProps",value:function(e){this.props=e}},{key:"receiveMonitor",value:function(e){this.monitor=e}},{key:"canDrop",value:function(){return!this.spec.canDrop||this.spec.canDrop(this.props,this.monitor)}},{key:"hover",value:function(){this.spec.hover&&this.props&&this.spec.hover(this.props,this.monitor,Jf(this.ref))}},{key:"drop",value:function(){if(this.spec.drop)return this.spec.drop(this.props,this.monitor,this.ref.current)}}])&&Rd(t.prototype,n),e}();var jd="dnd-core/INIT_COORDS",Ld="dnd-core/BEGIN_DRAG",Nd="dnd-core/PUBLISH_DRAG_SOURCE",$d="dnd-core/HOVER",Fd="dnd-core/DROP",Bd="dnd-core/END_DRAG";function zd(e,t){return{type:jd,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Ud(e){return Ud="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},Ud(e)}function qd(e){return"object"===Ud(e)}var Wd={type:jd,payload:{clientOffset:null,sourceClientOffset:null}};function Hd(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},r=n.publishSource,o=void 0===r||r,i=n.clientOffset,a=n.getSourceClientOffset,s=e.getMonitor(),l=e.getRegistry();e.dispatch(zd(i)),function(e,t,n){Df(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){Df(n.getSource(e),"Expected sourceIds to be registered.")})}(t,s,l);var u=function(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}(t,s);if(null!==u){var c=null;if(i){if(!a)throw new Error("getSourceClientOffset must be defined");!function(e){Df("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(a),c=a(u)}e.dispatch(zd(i,c));var f=l.getSource(u).beginDrag(s,u);if(null!=f){!function(e){Df(qd(e),"Item must be an object.")}(f),l.pinSource(u);var d=l.getSourceType(u);return{type:Ld,payload:{itemType:d,item:f,sourceId:u,clientOffset:i||null,sourceClientOffset:c||null,isSourcePublic:!!o}}}}else e.dispatch(Wd)}}function Vd(e){return function(){if(e.getMonitor().isDragging())return{type:Nd}}}function Kd(e,t){return null===t?null===e:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Gd(e){return function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).clientOffset;!function(e){Df(Array.isArray(e),"Expected targetIds to be an array.")}(t);var r=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(e,t,n){Df(t.isDragging(),"Cannot call hover while not dragging."),Df(!t.didDrop(),"Cannot call hover after drop.");for(var r=0;r<e.length;r++){var o=e[r];Df(e.lastIndexOf(o)===r,"Expected targetIds to be unique in the passed array."),Df(n.getTarget(o),"Expected targetIds to be registered.")}}(r,o,i),function(e,t,n){for(var r=e.length-1;r>=0;r--){var o=e[r];Kd(t.getTargetType(o),n)||e.splice(r,1)}}(r,i,o.getItemType()),function(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}(r,o,i),{type:$d,payload:{targetIds:r,clientOffset:n||null}}}}function Yd(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 Qd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yd(Object(n),!0).forEach(function(t){Jd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xd(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();!function(e){Df(e.isDragging(),"Cannot call drop while not dragging."),Df(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(n);var o=function(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(n);o.forEach(function(o,i){var a=function(e,t,n,r){var o=n.getTarget(e),i=o?o.drop(r,e):void 0;return function(e){Df(void 0===e||qd(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:r.getDropResult()),i}(o,i,r,n),s={type:Fd,payload:{dropResult:Qd(Qd({},t),a)}};e.dispatch(s)})}}function Zd(e){return function(){var t=e.getMonitor(),n=e.getRegistry();!function(e){Df(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var r=t.getSourceId();return null!=r&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Bd}}}function ep(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,r.key,r)}}function tp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var np=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),tp(this,"store",void 0),tp(this,"monitor",void 0),tp(this,"backend",void 0),tp(this,"isSetUp",!1),tp(this,"handleRefCountChange",function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}var t,n;return t=e,n=[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,t=this.store.dispatch,n=function(e){return{beginDrag:Hd(e),publishDragSource:Vd(e),hover:Gd(e),drop:Xd(e),endDrag:Zd(e)}}(this);return Object.keys(n).reduce(function(r,o){var i,a=n[o];return r[o]=(i=a,function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var a=i.apply(e,r);void 0!==a&&t(a)}),r},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}],n&&ep(t.prototype,n),e}(),rp=function(e,t){return e===t};function op(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 ip(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?op(Object(n),!0).forEach(function(t){ap(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):op(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ap(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sp={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function lp(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sp,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case jd:case Ld:return{initialSourceClientOffset:o.sourceClientOffset,initialClientOffset:o.clientOffset,clientOffset:o.clientOffset};case $d:return e=n.clientOffset,t=o.clientOffset,!e&&!t||e&&t&&e.x===t.x&&e.y===t.y?n:ip(ip({},n),{},{clientOffset:o.clientOffset});case Bd:case Fd:return sp;default:return n}}var up="dnd-core/ADD_SOURCE",cp="dnd-core/ADD_TARGET",fp="dnd-core/REMOVE_SOURCE",dp="dnd-core/REMOVE_TARGET";function pp(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 hp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pp(Object(n),!0).forEach(function(t){gp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mp={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function yp(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mp,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case Ld:return hp(hp({},n),{},{itemType:o.itemType,item:o.item,sourceId:o.sourceId,isSourcePublic:o.isSourcePublic,dropResult:null,didDrop:!1});case Nd:return hp(hp({},n),{},{isSourcePublic:!0});case $d:return hp(hp({},n),{},{targetIds:o.targetIds});case dp:return-1===n.targetIds.indexOf(o.targetId)?n:hp(hp({},n),{},{targetIds:(e=n.targetIds,t=o.targetId,e.filter(function(e){return e!==t}))});case Fd:return hp(hp({},n),{},{dropResult:o.dropResult,didDrop:!0,targetIds:[]});case Bd:return hp(hp({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function vp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case up:case cp:return e+1;case fp:case dp:return e-1;default:return e}}var bp=[],wp=[];function xp(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case $d:break;case up:case cp:case dp:case fp:return bp;default:return wp}var t=e.payload,n=t.targetIds,r=void 0===n?[]:n,o=t.prevTargetIds,i=void 0===o?[]:o,a=function(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var o=[];return n.forEach(function(e,t){1===e&&o.push(t)}),o}(r,i),s=a.length>0||!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rp;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}(r,i);if(!s)return bp;var l=i[i.length-1],u=r[r.length-1];return l!==u&&(l&&a.push(l),u&&a.push(u)),a}function Sp(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)+1}function kp(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 _p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kp(Object(n),!0).forEach(function(t){Ep(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ep(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cp(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:xp(n.dirtyHandlerIds,{type:r.type,payload:_p(_p({},r.payload),{},{prevTargetIds:(e=n,t=[],"dragOperation.targetIds".split(".").reduce(function(e,n){return e&&e[n]?e[n]:t||null},e))})}),dragOffset:lp(n.dragOffset,r),refCount:vp(n.refCount,r),dragOperation:yp(n.dragOperation,r),stateId:Sp(n.stateId)}}function Op(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Tp(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,r.key,r)}}function Pp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}bp.__IS_NONE__=!0,wp.__IS_ALL__=!0;var Mp,Rp=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pp(this,"store",void 0),Pp(this,"registry",void 0),this.store=t,this.registry=n}var t,n;return t=e,n=[{key:"subscribeToStateChange",value:function(e){var t=this,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0}).handlerIds;Df("function"==typeof e,"listener must be a function."),Df(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");var r=this.store.getState().stateId;return this.store.subscribe(function(){var o=t.store.getState(),i=o.stateId;try{var a=i===r||i===r+1&&!function(e,t){if(e===bp)return!1;if(e===wp||void 0===t)return!0;var n,r=(n=e,t.filter(function(e){return n.indexOf(e)>-1}));return r.length>0}(o.dirtyHandlerIds,n);a||e()}finally{r=i}})}},{key:"subscribeToOffsetChange",value:function(e){var t=this;Df("function"==typeof e,"listener must be a function.");var n=this.store.getState().dragOffset;return this.store.subscribe(function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return Df(t,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&t.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return Df(t,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&Kd(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}},{key:"isDragging",value:function(){return Boolean(this.getItemType())}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return Df(t,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}},{key:"isOverTarget",value:function(e){if(!e)return!1;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var n=this.registry.getTargetType(e),r=this.getItemType();if(r&&!Kd(n,r))return!1;var o=this.getTargetIds();if(!o.length)return!1;var i=o.indexOf(e);return t?i===o.length-1:i>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return t=(e=this.store.getState().dragOffset).clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset,t&&n&&r?Op(function(e,t){return{x:e.x+t.x,y:e.y+t.y}}(t,r),n):null;var e,t,n,r}},{key:"getDifferenceFromInitialOffset",value:function(){return t=(e=this.store.getState().dragOffset).clientOffset,n=e.initialClientOffset,t&&n?Op(t,n):null;var e,t,n}}],n&&Tp(t.prototype,n),e}(),Ap=0;function Ip(e){return Ip="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},Ip(e)}function Dp(e,t){t&&Array.isArray(e)?e.forEach(function(e){return Dp(e,!1)}):Df("string"==typeof e||"symbol"===Ip(e),t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(Mp||(Mp={}));const jp=void 0!==__webpack_require__.g?__webpack_require__.g:self,Lp=jp.MutationObserver||jp.WebKitMutationObserver;function Np(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const $p="function"==typeof Lp?function(e){let t=1;const n=new Lp(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:Np;class Fp{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Bp=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=$p(this.flush),this.requestErrorThrow=Np(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},zp=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new Fp(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(Bp.registerPendingError);function Up(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,r.key,r)}}function qp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wp(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hp(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)?Hp(e,t):void 0}}(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 Hp(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 Vp(e){switch(e[0]){case"S":return Mp.SOURCE;case"T":return Mp.TARGET;default:Df(!1,"Cannot parse handler ID: ".concat(e))}}function Kp(e,t){var n=e.entries(),r=!1;do{var o=n.next(),i=o.done;if(Wp(o.value,2)[1]===t)return!0;r=!!i}while(!r);return!1}var Gp=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qp(this,"types",new Map),qp(this,"dragSources",new Map),qp(this,"dropTargets",new Map),qp(this,"pinnedSourceId",null),qp(this,"pinnedSource",null),qp(this,"store",void 0),this.store=t}var t,n;return t=e,n=[{key:"addSource",value:function(e,t){Dp(e),function(e){Df("function"==typeof e.canDrag,"Expected canDrag to be a function."),Df("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),Df("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);var n=this.addHandler(Mp.SOURCE,e,t);return this.store.dispatch(function(e){return{type:up,payload:{sourceId:e}}}(n)),n}},{key:"addTarget",value:function(e,t){Dp(e,!0),function(e){Df("function"==typeof e.canDrop,"Expected canDrop to be a function."),Df("function"==typeof e.hover,"Expected hover to be a function."),Df("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);var n=this.addHandler(Mp.TARGET,e,t);return this.store.dispatch(function(e){return{type:cp,payload:{targetId:e}}}(n)),n}},{key:"containsHandler",value:function(e){return Kp(this.dragSources,e)||Kp(this.dropTargets,e)}},{key:"getSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Df(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return Df(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return Df(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return Df(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return Vp(e)===Mp.SOURCE}},{key:"isTargetId",value:function(e){return Vp(e)===Mp.TARGET}},{key:"removeSource",value:function(e){var t,n=this;Df(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:fp,payload:{sourceId:e}}}(e)),t=function(){n.dragSources.delete(e),n.types.delete(e)},Bp.enqueueTask(zp.create(t))}},{key:"removeTarget",value:function(e){Df(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:dp,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);Df(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){Df(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,n){var r=function(e){var t=(Ap++).toString();switch(e){case Mp.SOURCE:return"S".concat(t);case Mp.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}(e);return this.types.set(r,t),e===Mp.SOURCE?this.dragSources.set(r,n):e===Mp.TARGET&&this.dropTargets.set(r,n),r}}],n&&Up(t.prototype,n),e}();function Yp(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(t=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,(0,Ue.y$)(Cp,t&&n&&n({name:"dnd-core",instanceId:"dnd-core"}))),a=new Rp(i,new Gp(i)),s=new np(i,a),l=e(s,r,o);return s.receiveBackend(l),s}var Qp=["children"];function Jp(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}var Xp=0,Zp=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),eh=(0,n.memo)(function(e){var t=e.children,r=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t;return o[Zp]||(o[Zp]={dragDropManager:Yp(e,t,n,r)}),o[Zp]}(e.backend,e.context,e.options,e.debugMode);return[t,!e.context]}(function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Qp)),o=function(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jp(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)?Jp(e,t):void 0}}(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.")}()}(r,2),i=o[0],a=o[1];return(0,n.useEffect)(function(){if(a){var e=th();return++Xp,function(){0===--Xp&&(e[Zp]=null)}}},[]),(0,nd.jsx)(rd.Provider,Object.assign({value:i},{children:t}),void 0)});function th(){return void 0!==__webpack_require__.g?__webpack_require__.g:window}function nh({namespace:e,...t}){const n=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e;"function"!=typeof e&&(Df(td(e),'Expected "type" provided as the first argument to DragSource to be a string, or a function that returns a string given the current props. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',e),o=function(){return e}),Df(ed(t),'Expected "spec" provided as the second argument to DragSource to be a plain object. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',t);var i=function(e){return Object.keys(e).forEach(function(t){Df(xd.indexOf(t)>-1,'Expected the drag source specification to only have some of the following keys: %s. Instead received a specification with an unexpected "%s" key. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',xd.join(", "),t),Df("function"==typeof e[t],"Expected %s in the drag source specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source",t,t,e[t])}),Sd.forEach(function(t){Df("function"==typeof e[t],"Expected %s in the drag source specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source",t,t,e[t])}),function(t,n){return new kd(e,t,n)}}(t);return Df("function"==typeof n,'Expected "collect" provided as the third argument to DragSource to be a function that returns a plain object of props to inject. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',n),Df(ed(r),'Expected "options" provided as the fourth argument to DragSource to be a plain object when specified. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',n),function(e){return vd({containerDisplayName:"DragSource",createHandler:i,registerHandler:Lf,createConnector:function(e){return new Wf(e)},createMonitor:function(e){return new Yf(e)},DecoratedComponent:e,getType:o,collect:n,options:r})}}(e,{beginDrag:({children:e,isDragging:t,connectDragComponent:n,...r})=>r},e=>({connectDragComponent:e.dragSource()}))(({children:e,connectDragComponent:t})=>e(t));return r().createElement(n,t,t.children)}function rh({onDrop:e,namespace:t,...n}){const o=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e;"function"!=typeof e&&(Df(td(e,!0),'Expected "type" provided as the first argument to DropTarget to be a string, an array of strings, or a function that returns either given the current props. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',e),o=function(){return e}),Df(ed(t),'Expected "spec" provided as the second argument to DropTarget to be a plain object. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',t);var i=function(e){return Object.keys(e).forEach(function(t){Df(Id.indexOf(t)>-1,'Expected the drop target specification to only have some of the following keys: %s. Instead received a specification with an unexpected "%s" key. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',Id.join(", "),t),Df("function"==typeof e[t],"Expected %s in the drop target specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target",t,t,e[t])}),function(t,n){return new Dd(e,t,n)}}(t);return Df("function"==typeof n,'Expected "collect" provided as the third argument to DropTarget to be a function that returns a plain object of props to inject. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',n),Df(ed(r),'Expected "options" provided as the fourth argument to DropTarget to be a plain object when specified. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',n),function(e){return vd({containerDisplayName:"DropTarget",createHandler:i,registerHandler:jf,createMonitor:function(e){return new Od(e)},createConnector:function(e){return new Md(e)},DecoratedComponent:e,getType:o,collect:n,options:r})}}(t,{drop(t,n){e(n.getItem())}},(e,t)=>({connectDropTarget:e.dropTarget(),isHovered:t.isOver()}))(({children:e,connectDropTarget:t,isHovered:n})=>e(t,{isHovered:n}));return r().createElement(o,n,n.children)}nh.propTypes={namespace:a().any.isRequired,children:a().func.isRequired},rh.propTypes={onDrop:a().func.isRequired,namespace:a().any.isRequired,children:a().func.isRequired};var oh={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function ih(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var ah=/[A-Z]|^ms/g,sh=/_EMO_([^_]+?)_([^]*?)_EMO_/g,lh=function(e){return 45===e.charCodeAt(1)},uh=function(e){return null!=e&&"boolean"!=typeof e},ch=ih(function(e){return lh(e)?e:e.replace(ah,"-$&").toLowerCase()}),fh=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(sh,function(e,t,n){return ph={name:t,styles:n,next:ph},t})}return 1===oh[e]||lh(e)||"number"!=typeof t||0===t?t:t+"px"};function dh(e,t,n){if(null==n)return"";var r=n;if(void 0!==r.__emotion_styles)return r;switch(typeof n){case"boolean":return"";case"object":var o=n;if(1===o.anim)return ph={name:o.name,styles:o.styles,next:ph},o.name;var i=n;if(void 0!==i.styles){var a=i.next;if(void 0!==a)for(;void 0!==a;)ph={name:a.name,styles:a.styles,next:ph},a=a.next;return i.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=dh(e,t,n[o])+";";else for(var i in n){var a=n[i];if("object"!=typeof a){var s=a;null!=t&&void 0!==t[s]?r+=i+"{"+t[s]+"}":uh(s)&&(r+=ch(i)+":"+fh(i,s)+";")}else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var l=dh(e,t,a);switch(i){case"animation":case"animationName":r+=ch(i)+":"+l+";";break;default:r+=i+"{"+l+"}"}}else for(var u=0;u<a.length;u++)uh(a[u])&&(r+=ch(i)+":"+fh(i,a[u])+";")}return r}(e,t,n);case"function":if(void 0!==e){var s=ph,l=n(e);return ph=s,dh(e,t,l)}}var u=n;if(null==t)return u;var c=t[u];return void 0!==c?c:u}var ph,hh=/label:\s*([^\s;{]+)\s*(;|$)/g,gh=!!n.useInsertionEffect&&n.useInsertionEffect,mh=gh||function(e){return e()};gh||n.useLayoutEffect;var yh=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},vh=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,bh=ih(function(e){return vh.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),wh=function(e){return"theme"!==e},xh=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?bh:wh},Sh=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},kh=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return yh(t,n,r),mh(function(){return function(e,t,n){yh(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)}),null},_h=function e(t,r){var o,i,a=t.__emotion_real===t,s=a&&t.__emotion_base||t;void 0!==r&&(o=r.label,i=r.target);var l=Sh(t,r,a),u=l||xh(s),c=!u("as");return function(){var f=arguments,d=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&d.push("label:"+o+";"),null==f[0]||void 0===f[0].raw)d.push.apply(d,f);else{var p=f[0];d.push(p[0]);for(var g=f.length,m=1;m<g;m++)d.push(f[m],p[m])}var y=(0,so.withEmotionCache)(function(e,t,r){var o,a,f,p,h=c&&e.as||s,g="",m=[],y=e;if(null==e.theme){for(var v in y={},e)y[v]=e[v];y.theme=n.useContext(so.ThemeContext)}"string"==typeof e.className?(o=t.registered,a=m,f=e.className,p="",f.split(" ").forEach(function(e){void 0!==o[e]?a.push(o[e]+";"):e&&(p+=e+" ")}),g=p):null!=e.className&&(g=e.className+" ");var b=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,o="";ph=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,o+=dh(n,t,i)):o+=i[0];for(var a=1;a<e.length;a++)o+=dh(n,t,e[a]),r&&(o+=i[a]);hh.lastIndex=0;for(var s,l="";null!==(s=hh.exec(o));)l+="-"+s[1];var u=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+l;return{name:u,styles:o,next:ph}}(d.concat(m),t.registered,y);g+=t.key+"-"+b.name,void 0!==i&&(g+=" "+i);var w=c&&void 0===l?xh(h):u,x={};for(var S in e)c&&"as"===S||w(S)&&(x[S]=e[S]);return x.className=g,r&&(x.ref=r),n.createElement(n.Fragment,null,n.createElement(kh,{cache:t,serialized:b,isStringTag:"string"==typeof h}),n.createElement(h,x))});return y.displayName=void 0!==o?o:"Styled("+("string"==typeof s?s:s.displayName||s.name||"Component")+")",y.defaultProps=t.defaultProps,y.__emotion_real=y,y.__emotion_base=s,y.__emotion_styles=d,y.__emotion_forwardProp=l,Object.defineProperty(y,"toString",{value:function(){return"."+i}}),y.withComponent=function(t,n){return e(t,h({},r,n,{shouldForwardProp:Sh(y,n,!0)})).apply(void 0,d)},y}},Eh=__webpack_require__(20685),Ch=__webpack_require__.n(Eh);function Oh({title:e,config:t}){const n=t?.issue_reports?.url??"https://github.com/decaporg/decap-cms/issues/new";try{const r=function({config:e}){let t="";"string"==typeof DECAP_CMS_VERSION?t=`decap-cms@${DECAP_CMS_VERSION}`:"string"==typeof DECAP_CMS_APP_VERSION&&(t=`decap-cms-app@${DECAP_CMS_APP_VERSION}`);const n=function({version:e,provider:t,browser:n,config:r}){return`\n**Describe the bug**\n\n**To Reproduce**\n\n**Expected behavior**\n\n**Screenshots**\n\n**Applicable Versions:**\n - Decap CMS version: \`${e}\`\n - Git provider: \`${t}\`\n - Browser version: \`${n}\`\n\n**CMS configuration**\n\`\`\`\n${r}\n\`\`\`\n\n**Additional context**\n`}({version:t,provider:e.backend.name,browser:navigator.userAgent,config:hn().stringify(e)});return n}({config:t}),o=new URLSearchParams;return o.append("title",Ch()(e,{length:100})),o.append("body",Ch()(r,{length:4e3,omission:"\n..."})),o.append("labels","type: bug"),`${n}?${o.toString()}`}catch(e){return console.log(e),`${n}?template=bug_report.md`}}const Th=_h("div",{target:"emw4gx72",label:"ErrorBoundaryContainer"})("padding:40px;h1{font-size:28px;color:",Be.colors.text,";}h2{font-size:20px;}strong{color:",Be.colors.textLead,";font-weight:500;}hr{width:200px;margin:30px 0;border:0;height:1px;background-color:",Be.colors.text,";}a{color:",Be.colors.active,";}"),Ph=_h("span",{target:"emw4gx71",label:"PrivacyWarning"})("color:",Be.colors.text,";"),Mh=_h("button",{target:"emw4gx70",label:"CopyButton"})(Be.buttons.button,";",Be.buttons.default,";",Be.buttons.gray,";display:block;margin:12px 0;");function Rh({entry:e,t}){return console.log(e),(0,so.jsx)(r().Fragment,null,(0,so.jsx)("hr",null),(0,so.jsx)("h2",null,t("ui.errorBoundary.recoveredEntry.heading")),(0,so.jsx)("strong",null,t("ui.errorBoundary.recoveredEntry.warning")),(0,so.jsx)(Mh,{onClick:()=>navigator.clipboard.writeText(e)},t("ui.errorBoundary.recoveredEntry.copyButtonLabel")),(0,so.jsx)("pre",null,(0,so.jsx)("code",null,e)))}class Ah extends r().Component{static propTypes={children:a().node,t:a().func.isRequired,config:a().object.isRequired};state={hasError:!1,errorMessage:"",errorTitle:"",backup:""};static getDerivedStateFromError(e){return console.error(e),{hasError:!0,errorMessage:e.stack||e.toString(),errorTitle:e.toString()}}componentDidMount(){a().checkPropTypes(Ah.propTypes,this.props,"prop","ErrorBoundary")}shouldComponentUpdate(e,t){return!this.props.showBackup||this.state.errorMessage!==t.errorMessage||this.state.backup!==t.backup}async componentDidUpdate(){if(this.props.showBackup){const e=await cn.localForage.getItem("backup");e&&console.log(e),this.setState({backup:e})}}render(){const{hasError:e,errorMessage:t,backup:n,errorTitle:o}=this.state,{showBackup:i,t:a}=this.props;return e?(0,so.jsx)(Th,null,(0,so.jsx)("h1",null,a("ui.errorBoundary.title")),(0,so.jsx)("p",null,(0,so.jsx)("span",null,a("ui.errorBoundary.details")),(0,so.jsx)("a",{href:Oh({title:o,config:this.props.config}),target:"_blank",rel:"noopener noreferrer","data-testid":"issue-url"},a("ui.errorBoundary.reportIt"))),(0,so.jsx)("p",null,a("ui.errorBoundary.privacyWarning").split("\n").map((e,t)=>(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Ph,{key:t},e),(0,so.jsx)("br",null)))),(0,so.jsx)("hr",null),(0,so.jsx)("h2",null,a("ui.errorBoundary.detailsHeading")),(0,so.jsx)("p",null,t),n&&i&&(0,so.jsx)(Rh,{entry:n,t:a})):this.props.children}}const Ih=(0,ze.Tl)()(Ah);function Dh({label:e,imagesOnly:t,onChange:n,disabled:r,className:o}){return(0,so.jsx)("label",{tabIndex:"0",className:`nc-fileUploadButton ${o||""}`},(0,so.jsx)("span",null,e),(0,so.jsx)("input",{type:"file",accept:t?"image/*":"*/*",onChange:n,disabled:r}))}Dh.propTypes={className:a().string,label:a().string.isRequired,imagesOnly:a().bool,onChange:a().func.isRequired,disabled:a().bool};var jh=__webpack_require__(70373),Lh=__webpack_require__.n(jh),Nh={name:"1o9c9d2-ReactModalGlobalStyles",styles:".ReactModal__Body--open{overflow:hidden;};label:ReactModalGlobalStyles;"};function $h(){return(0,so.jsx)(so.Global,{styles:Nh})}const Fh=`\n ${Be.shadows.dropDeep};\n background-color: #fff;\n border-radius: ${Be.lengths.borderRadius};\n height: 80%;\n text-align: center;\n max-width: 2200px;\n padding: 20px;\n\n &:focus {\n outline: none;\n }\n `,Bh=`\n z-index: ${Be.zIndex.zIndex99999};\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n background-color: rgba(0, 0, 0, 0);\n transition: background-color ${Be.transitions.main}, opacity ${Be.transitions.main};\n `;class zh extends r().Component{static propTypes={children:a().node.isRequired,isOpen:a().bool.isRequired,className:a().string,onClose:a().func.isRequired};componentDidMount(){a().checkPropTypes(zh.propTypes,this.props,"prop","Modal"),Lh().setAppElement("#nc-root")}render(){const{isOpen:e,children:t,className:n,onClose:o}=this.props;return(0,so.jsx)(r().Fragment,null,(0,so.jsx)($h,null),(0,so.jsx)(so.ClassNames,null,({css:r,cx:i})=>(0,so.jsx)(Lh(),{isOpen:e,onRequestClose:o,closeTimeoutMS:300,className:{base:i(r`
|
|
17
|
+
`),i;throw e}return`${i}/${Lr()(p," /")}`}function Zo(e,t,n,r,o,i){if(!t||!t.get("data"))return e;let a=t.get("data").set(o,r);a=Vo(t.get("path"),a,n.get("folder"));const s=Uo(t,Yl(n,"date"))||null,l=a.getIn(Ho(Gl(n))),u=Jo(i,[r,a.get("dirname")]);return zo(e,s,l,a,u)}var ei=__webpack_require__(46343),ti=__webpack_require__.n(ei),ni=__webpack_require__(22563),ri=__webpack_require__.n(ni);function oi(e,t="",n="",r={}){return{collection:e,slug:t,path:n,partial:r.partial||!1,raw:r.raw||"",data:r.data||{},label:r.label||null,isModification:ri()(r.isModification)?r.isModification:null,mediaFiles:r.mediaFiles||[],author:r.author||"",updatedOn:r.updatedOn||"",status:r.status||"",meta:r.meta||{},i18n:r.i18n||{}}}const{fetchWithTimeout:ii}=cn.unsentRequest;class ai{constructor(e){if(this.config=e,null==e.get("applicationID")||null==e.get("apiKey"))throw"The Algolia search integration needs the credentials (applicationID and apiKey) in the integration configuration.";this.applicationID=e.get("applicationID"),this.apiKey=e.get("apiKey");const t=e.get("indexPrefix");this.indexPrefix=t?`${t}-`:"",this.searchURL=`https://${this.applicationID}-dsn.algolia.net/1`,this.entriesCache={collection:null,page:null,entries:[]}}requestHeaders(e={}){return{"X-Algolia-API-Key":this.apiKey,"X-Algolia-Application-Id":this.applicationID,"Content-Type":"application/json",...e}}parseJsonResponse(e){return e.json().then(t=>e.ok?t:Promise.reject(t))}urlFor(e,t){const n=[];if(t.params)for(const e in t.params)n.push(`${e}=${encodeURIComponent(t.params[e])}`);return n.length&&(e+=`?${n.join("&")}`),e}request(e,t={}){const n=this.requestHeaders(t.headers||{}),r=this.urlFor(e,t);return ii(r,{...t,headers:n}).then(e=>{const t=e.headers.get("Content-Type");return t&&t.match(/json/)?this.parseJsonResponse(e):e.text()})}search(e,t,n){const r=e.map(e=>({indexName:`${this.indexPrefix}${e}`,params:`query=${t}&page=${n}`}));return this.request(`${this.searchURL}/indexes/*/queries`,{method:"POST",body:JSON.stringify({requests:r})}).then(t=>{const r=t.results.map((t,n)=>t.hits.map(t=>{const r=t.path.split("/").pop().replace(/\.[^.]+$/,"");return oi(e[n],r,t.path,{data:t.data,partial:!0})}));return{entries:Gt()(r),pagination:n}})}searchBy(e,t,n){return this.request(`${this.searchURL}/indexes/${this.indexPrefix}${t}`,{params:{restrictSearchableAttributes:e,query:n}})}listEntries(e,t){return this.entriesCache.collection===e&&this.entriesCache.page===t?Promise.resolve({page:this.entriesCache.page,entries:this.entriesCache.entries}):this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:{page:t}}).then(t=>{const n=t.hits.map(t=>{const n=ql(e,t.path);return oi(e.get("name"),n,t.path,{data:t.data,partial:!0})});return this.entriesCache={collection:e,pagination:t.page,entries:n},{entries:n,pagination:t.page}})}async listAllEntries(e){const t={hitsPerPage:1e3};let n=await this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:t}),{nbPages:r=0,hits:o,page:i}=n;for(i+=1;i<r;)n=await this.request(`${this.searchURL}/indexes/${this.indexPrefix}${e.get("name")}`,{params:{...t,page:i}}),o=[...o,...n.hits],i+=1;const a=o.map(t=>{const n=ql(e,t.path);return oi(e.get("name"),n,t.path,{data:t.data,partial:!0})});return a}getEntry(e,t){return this.searchBy("slug",e.get("name"),t).then(n=>{const r=n.hits.filter(e=>e.slug===t)[0];return oi(e.get("name"),t,r.path,{data:r.data,partial:!0})})}}var si=__webpack_require__(16735),li=__webpack_require__.n(si);const{fetchWithTimeout:ui}=cn.unsentRequest;class ci{constructor(e,t){if(this.config=e,null==e.get("getSignedFormURL"))throw"The AssetStore integration needs the getSignedFormURL in the integration configuration.";this.getToken=t,this.shouldConfirmUpload=e.get("shouldConfirmUpload",!1),this.getSignedFormURL=So()(e.get("getSignedFormURL"),"/")}parseJsonResponse(e){return e.json().then(t=>e.ok?t:Promise.reject(t))}urlFor(e,t){const n=[];if(t.params)for(const e in t.params)n.push(`${e}=${encodeURIComponent(t.params[e])}`);return n.length&&(e+=`?${n.join("&")}`),e}requestHeaders(e={}){return{...e}}confirmRequest(e){this.getToken().then(t=>this.request(`${this.getSignedFormURL}/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({state:"uploaded"})}))}async request(e,t={}){const n=this.requestHeaders(t.headers||{}),r=this.urlFor(e,t),o=await ui(r,{...t,headers:n}),i=o.headers.get("Content-Type");return i&&i.match(/json/)?await this.parseJsonResponse(o):o.text()}async retrieve(e,t,n){const r=li()({search:e,page:t,filter:n?"private":"public"},e=>!!e),o=Ao(this.getSignedFormURL,r),i={"Content-Type":"application/json",Authorization:`Bearer ${await this.getToken()}`},a=(await this.request(o,{headers:i})).map(({id:e,name:t,size:n,url:r})=>({id:e,name:t,size:n,displayURL:r,url:r,path:r}));return a}delete(e){const t=`${this.getSignedFormURL}/${e}`;return this.getToken().then(e=>this.request(t,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}}))}async upload(e,t=!1){const n={name:e.name,size:e.size};e.type&&(n.content_type=e.type),t&&(n.visibility="private");try{const t=await this.getToken(),r=await this.request(this.getSignedFormURL,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)}),o=r.form.url,i=r.form.fields,{id:a,name:s,size:l,url:u}=r.asset,c=new FormData;return Object.keys(i).forEach(e=>c.append(e,i[e])),c.append("file",e,e.name),await this.request(o,{method:"POST",body:c}),this.shouldConfirmUpload&&await this.confirmRequest(a),{success:!0,asset:{id:a,name:s,size:l,displayURL:u,url:u,path:u}}}catch(e){throw console.error(e),e}}}const fi=function(){let e=null;return(t,n,r)=>(e||(e=function(e,t){let n=(0,Ge.Map)({});return e.get("providers").forEach((e,r)=>{switch(r){case"algolia":n=n.set("algolia",new ai(e));break;case"assetStore":n=n.set("assetStore",new ci(e,t))}}),n}(t,n)),e.get(r))}(),di="SEARCH_ENTRIES_REQUEST",pi="SEARCH_ENTRIES_SUCCESS",hi="SEARCH_ENTRIES_FAILURE",gi="QUERY_REQUEST",mi="QUERY_SUCCESS",yi="QUERY_FAILURE",vi="SEARCH_CLEAR",bi="CLEAR_REQUESTS";function wi(){return{type:vi}}function xi(e,t,n,r,o,i){return async(a,s)=>{const l=s(),u=uc(l.config),c=Qc(l,t,"search"),f=l.collections.find(e=>e.get("name")===t);a({type:bi});const d=`${t}-${n.join()}-${r}-${o}-${i}`,p=l.search.requests.find(({id:e})=>e==d),h=p?p.queryResponse:c?fi(l.integrations,u.getToken,c).searchBy(n.map(e=>`data.${e}`),t,r):u.query(f,n,r,o,i);a(function(e,t){return{type:gi,payload:{searchTerm:e,request:t}}}(r,p?void 0:{id:d,expires:new Date((new Date).getTime()+1e4),queryResponse:h}));try{const t=await h;return a(function(e,t){return{type:mi,payload:{namespace:e,hits:t}}}(e,t.hits))}catch(e){return a(function(e){return{type:yi,payload:{error:e}}}(e))}}}function Si(e,t){return new cn.Cursor(e.getIn(["cursorsByType","collectionEntries",t]))}var ki=__webpack_require__(3668),_i=__webpack_require__.n(ki);function Ei(e,t,n){let r=t.reduce((t,r)=>{const o=r.get("name"),i=e.get(o),a=wr(r.get("widget")),s=r.get("fields");return s&&Ge.List.isList(i)?t.set(o,i.map(e=>Ei(e,s,n))):s&&Ge.Map.isMap(i)?t.set(o,Ei(i,s,n)):a&&!_i()(i)?t.set(o,a[n](i)):_i()(i)?t:t.set(o,i)},(0,Ge.Map)());return r=e.mergeDeep(r),r}const Ci="PRESENCE",Oi="CUSTOM";function Ti({predicate:e,run:t}){return{type:Ke,predicate:e,run:t}}async function Pi(e,t,n=3e4){let r=!1;const o=new Promise(n=>{e(Ti(t(n)))}),i=new Promise(e=>{setTimeout(()=>{r?e():(console.warn("Wait Action timed out"),e(null))},n)});return await Promise.race([o.then(e=>(r=!0,e)).catch(null),i])}const Mi="NOTIFICATION_SEND",Ri="NOTIFICATION_DISMISS",Ai="NOTIFICATION_CLEAR";function Ii(e){return{type:Mi,payload:e}}function Di(e){return{type:Ri,id:e}}const ji="MEDIA_LIBRARY_OPEN",Li="MEDIA_LIBRARY_CLOSE",Ni="MEDIA_LIBRARY_CREATE",$i="MEDIA_INSERT",Fi="MEDIA_REMOVE_INSERTED",Bi="MEDIA_LOAD_REQUEST",zi="MEDIA_LOAD_SUCCESS",Ui="MEDIA_LOAD_FAILURE",qi="MEDIA_PERSIST_REQUEST",Wi="MEDIA_PERSIST_SUCCESS",Hi="MEDIA_PERSIST_FAILURE",Vi="MEDIA_DELETE_REQUEST",Ki="MEDIA_DELETE_SUCCESS",Gi="MEDIA_DELETE_FAILURE",Yi="MEDIA_DISPLAY_URL_REQUEST",Qi="MEDIA_DISPLAY_URL_SUCCESS",Ji="MEDIA_DISPLAY_URL_FAILURE";function Xi(e){return(t,n)=>{const r=n().mediaLibrary.get("externalLibrary");r&&r.onClearControl({id:e})}}function Zi(e){return(t,n)=>{const r=n().mediaLibrary.get("externalLibrary");r&&r.onRemoveControl({id:e})}}function ea(e={}){return(t,n)=>{const r=n().mediaLibrary.get("externalLibrary");if(r){const{controlID:t,value:n,config:o=(0,Ge.Map)(),allowMultiple:i,forImage:a}=e;r.show({id:t,value:n,config:o.toJS(),allowMultiple:i,imagesOnly:a})}t(function(e){return{type:ji,payload:e}}(e))}}function ta(e,t){return(n,r)=>{const o=r(),i=o.config,a=o.entryDraft.get("entry"),s=o.entryDraft.getIn(["entry","collection"]),l=o.collections.get(s);n(function(e){return{type:$i,payload:{mediaPath:e}}}(e=Array.isArray(e)?e.map(e=>Al(i,l,e,a,t)):Al(i,l,e,a,t)))}}function na(e){return{type:Fi,payload:{controlID:e}}}function ra(e={}){const{delay:t=0,query:n="",page:r=1,privateUpload:o}=e;return async(e,i)=>{const a=i(),s=uc(a.config),l=Qc(a,null,"assetStore");if(l){const t=fi(a.integrations,s.getToken,l);e(la(r));try{const i=await t.retrieve(n,r,o);return e(ua(i,{page:r,canPaginate:!0,dynamicSearch:!0,dynamicSearchQuery:n,privateUpload:o}))}catch(t){return e(ca({privateUpload:o}))}}function u(){return s.getMedia().then(t=>e(ua(t))).catch(t=>{console.error(t),404===t.status?(console.log("This 404 was expected and handled appropriately."),e(ua([]))):e(ca())})}return e(la(r)),t>0?new Promise(e=>{setTimeout(()=>e(u()),t)}):u()}}function oa({id:e,file:t,assetProxy:n,draft:r}){return{id:e,name:(0,cn.basename)(n.path),displayURL:n.url,draft:r,file:t,size:t.size,url:n.url,path:n.path,field:n.field}}function ia(e,t={}){const{privateUpload:n,field:r}=t;return async(t,o)=>{const i=o(),a=uc(i.config),s=Qc(i,null,"assetStore"),l=va(i,r),u=Bo(e.name.toLowerCase(),i.config.slug),c=l.find(e=>e.name.toLowerCase()===u),f=Il(i.entryDraft);if(!s&&c){if(!window.confirm(`${c.name} already exists. Do you want to replace it?`))return;await t(aa(c,{privateUpload:n}))}!s&&f||t({type:qi});try{let o,l;if(s)try{const t=fi(i.integrations,a.getToken,s),r=await t.upload(e,n);o=Cn({url:r.asset.url,path:r.asset.url})}catch(t){o=Cn({file:e,path:u})}else{if(n)throw new Error("The Private Upload option is only available for Asset Store Integration");{const t=i.entryDraft.get("entry"),n=i.collections.get(t?.get("collection")),a=Rl(i.config,n,t,u,r);o=Cn({file:e,path:a,field:r})}}if(t(Oa(o)),s)l=oa({id:await(0,cn.getBlobSHA)(e),file:e,assetProxy:o,draft:!1});else{if(f)return l=oa({id:await(0,cn.getBlobSHA)(e),file:e,assetProxy:o,draft:f}),t(function(e){return{type:Ls,payload:e}}(l));l=await a.persistMedia(i.config,o)}return t(function(e,t={}){const{privateUpload:n}=t;return{type:Wi,payload:{file:e,privateUpload:n}}}(l,{privateUpload:n}))}catch(e){return console.error(e),t(Ii({message:`Failed to persist media: ${e}`,type:"error",dismissAfter:8e3})),t(function(e={}){const{privateUpload:t}=e;return{type:Hi,payload:{privateUpload:t}}}({privateUpload:n}))}}}function aa(e,t={}){const{privateUpload:n}=t;return async(t,r)=>{const o=r(),i=uc(o.config),a=Qc(o,null,"assetStore");if(a){const r=fi(o.integrations,i.getToken,a);t(fa());try{return await r.delete(e.id),t(da(e,{privateUpload:n}))}catch(e){return console.error(e),t(Ii({message:`Failed to delete media: ${e.message}`,type:"error",dismissAfter:8e3})),t(pa({privateUpload:n}))}}try{if(e.draft)t(Ta(e.path)),t(Ks({id:e.id}));else{const n=Il(o.entryDraft);t(fa()),t(Ta(e.path)),await i.deleteMedia(o.config,e.path),t(da(e)),n&&t(Ks({id:e.id}))}}catch(e){return console.error(e),t(Ii({message:`Failed to delete media: ${e.message}`,type:"error",dismissAfter:8e3})),t(pa())}}}function sa(e){return async(t,n)=>{const{displayURL:r,id:o}=e,i=n(),a=ba(i,o);if(!o||!r||a.get("url")||a.get("isFetching")||a.get("err"))return Promise.resolve();if("string"==typeof r)return t(ha(o)),void t(ga(o,r));try{const e=uc(i.config);t(ha(o));const n=await e.getMediaDisplayURL(r);if(!n)throw new Error("No display URL was returned!");t(ga(o,n))}catch(e){console.error(e),t(function(e,t){return{type:Ji,payload:{key:e,err:t}}}(o,e))}}}function la(e){return{type:Bi,payload:{page:e}}}function ua(e,t={}){return{type:zi,payload:{files:e,...t}}}function ca(e={}){const{privateUpload:t}=e;return{type:Ui,payload:{privateUpload:t}}}function fa(){return{type:Vi}}function da(e,t={}){const{privateUpload:n}=t;return{type:Ki,payload:{file:e,privateUpload:n}}}function pa(e={}){const{privateUpload:t}=e;return{type:Gi,payload:{privateUpload:t}}}function ha(e){return{type:Yi,payload:{key:e}}}function ga(e,t){return{type:Qi,payload:{key:e,url:t}}}async function ma(e,t){!1===t.mediaLibrary.get("isLoading")||t.mediaLibrary.get("externalLibrary")||await Pi(e,e=>({predicate:({type:e})=>e===zi||e===Ui,run:()=>e()}))}const ya={isVisible:!1,showMediaButton:!0,controlMedia:(0,Ge.Map)(),displayURLs:(0,Ge.Map)(),config:(0,Ge.Map)()};function va(e,t){const{mediaLibrary:n,entryDraft:r}=e,o=Il(e.entryDraft),i=Qc(e,null,"assetStore");let a;if(o&&!i){const n=r.getIn(["entry","mediaFiles"],(0,Ge.List)()).toJS(),o=r.get("entry"),i=e.collections.get(o?.get("collection")),s=Ml(e.config,i,o,t);a=n.filter(e=>(0,fn.dirname)(e.path)===s).map(e=>({key:e.id,...e}))}else a=n.get("files")||[];return a}function ba(e,t){return e.mediaLibrary.getIn(["displayURLs",t],(0,Ge.Map)())}const wa="ADD_ASSETS",xa="ADD_ASSET",Sa="REMOVE_ASSET",ka="LOAD_ASSET_REQUEST",_a="LOAD_ASSET_SUCCESS",Ea="LOAD_ASSET_FAILURE";function Ca(e){return{type:wa,payload:e}}function Oa(e){return{type:xa,payload:e}}function Ta(e){return{type:Sa,payload:e}}const Pa=Cn({path:"empty.svg",file:new File(['<svg xmlns="http://www.w3.org/2000/svg"></svg>'],"empty.svg",{type:"image/svg+xml"})});function Ma(e,t,n){return function(r,o){return e(Ra({collection:t,entry:n,path:r,field:o}))}}function Ra({collection:e,entry:t,path:n,field:r}){return(o,i)=>{if(!n)return Pa;const a=i(),s=Rl(a.config,e,t,n,r);let{asset:l,isLoading:u,error:c}=a.medias[s]||{};return u?Pa:l||((0,cn.isAbsolutePath)(s)||c?(l=Cn({path:s,url:n}),o(Oa(l))):(o(function(e){return async(t,n)=>{try{t({type:ka,payload:{path:e}}),await ma(t,n());const i=(r=n(),o=e,va(r).find(e=>e.path===o));if(i){const r=await async function(e,t,n){const r=ba(t,n.id);let o;if(r.get("url"))o=r.get("url");else if(r.get("err"))o=null;else{const t=n.id,i=Pi(e,e=>({predicate:({type:e,payload:n})=>(e===Qi||e===Ji)&&n.key===t,run:(t,n,r)=>e(r.payload.url)}));r.get("isFetching")||e(sa(n)),o=await i??null}return o}(t,n(),i);t(Oa(Cn({path:e,url:r||e})))}else{const{url:r}=await async function(e,t){const n=uc(e.config),{url:r}=await n.getMediaFile(t);return{url:r}}(n(),e);t(Oa(Cn({path:e,url:r})))}t(function(e){return{type:_a,payload:{path:e}}}(e))}catch(n){t(function(e,t){return{type:Ea,payload:{path:e,error:t}}}(e,n))}var r,o}}(s)),l=Pa),l)}}const Aa=function(e){void 0===e&&(e={}),pe||ie(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),r=n.getUserConfirmation,o=void 0===r?he:r,i=n.hashType,a=void 0===i?"slash":i,s=e.basename?ue(ae(e.basename)):"",l=me[a],u=l.encodePath,c=l.decodePath;function f(){var e=c(ve());return s&&(e=le(e,s)),fe(e)}var d=de();function p(e){h(C,e),C.length=t.length,d.notifyListeners(C.location,C.action)}var g=!1,m=null;function y(){var e=ve(),t=u(e);if(e!==t)be(t);else{var n=f(),r=C.location;if(!g&&function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash}(r,n))return;if(m===ce(n))return;m=null,function(e){if(g)g=!1,p();else{d.confirmTransitionTo(e,"POP",o,function(t){t?p({action:"POP",location:e}):function(e){var t=C.location,n=x.lastIndexOf(ce(t));-1===n&&(n=0);var r=x.lastIndexOf(ce(e));-1===r&&(r=0);var o=n-r;o&&(g=!0,S(o))}(e)})}}(n)}}var v=ve(),b=u(v);v!==b&&be(b);var w=f(),x=[ce(w)];function S(e){t.go(e)}var k=0;function _(e){1===(k+=e)&&1===e?window.addEventListener(ge,y):0===k&&window.removeEventListener(ge,y)}var E=!1,C={length:t.length,action:"POP",location:w,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=ye(window.location.href)),n+"#"+u(s+ce(e))},push:function(e,t){var n="PUSH",r=fe(e,void 0,void 0,C.location);d.confirmTransitionTo(r,n,o,function(e){if(e){var t=ce(r),o=u(s+t);if(ve()!==o){m=t,function(e){window.location.hash=e}(o);var i=x.lastIndexOf(ce(C.location)),a=x.slice(0,i+1);a.push(t),x=a,p({action:n,location:r})}else p()}})},replace:function(e,t){var n="REPLACE",r=fe(e,void 0,void 0,C.location);d.confirmTransitionTo(r,n,o,function(e){if(e){var t=ce(r),o=u(s+t);ve()!==o&&(m=t,be(o));var i=x.indexOf(ce(C.location));-1!==i&&(x[i]=t),p({action:n,location:r})}})},go:S,goBack:function(){S(-1)},goForward:function(){S(1)},block:function(e){void 0===e&&(e=!1);var t=d.setPrompt(e);return E||(_(1),E=!0),function(){return E&&(E=!1,_(-1)),t()}},listen:function(e){var t=d.appendListener(e);return _(1),function(){_(-1),t()}}};return C}();function Ia(e){return Aa.push(`/collections/${e}`)}function Da(e){return Aa.replace(`/collections/${e}/new`)}function ja(e,t){return Aa.replace(`/collections/${e}/entries/${t}`)}const La="UNPUBLISHED_ENTRY_REQUEST",Na="UNPUBLISHED_ENTRY_SUCCESS",$a="UNPUBLISHED_ENTRY_REDIRECT",Fa="UNPUBLISHED_ENTRIES_REQUEST",Ba="UNPUBLISHED_ENTRIES_SUCCESS",za="UNPUBLISHED_ENTRY_PERSIST_REQUEST",Ua="UNPUBLISHED_ENTRY_PERSIST_SUCCESS",qa="UNPUBLISHED_ENTRY_PERSIST_FAILURE",Wa="UNPUBLISHED_ENTRY_STATUS_CHANGE_REQUEST",Ha="UNPUBLISHED_ENTRY_STATUS_CHANGE_SUCCESS",Va="UNPUBLISHED_ENTRY_STATUS_CHANGE_FAILURE",Ka="UNPUBLISHED_ENTRY_PUBLISH_REQUEST",Ga="UNPUBLISHED_ENTRY_PUBLISH_SUCCESS",Ya="UNPUBLISHED_ENTRY_PUBLISH_FAILURE",Qa="UNPUBLISHED_ENTRY_DELETE_SUCCESS";function Ja(e,t){return{type:Ba,payload:{entries:e,pages:t}}}function Xa(e,t){return{type:za,payload:{collection:e.get("name"),slug:t}}}function Za(e,t){return{type:Ua,payload:{collection:e.get("name"),entry:t}}}function es(e,t,n){return{type:qa,payload:{error:e,collection:t.get("name"),slug:n},error:e}}function ts(e,t){return async(n,r)=>{const o=r(),i=uc(o.config);if(!on()(o.editorialWorkflow.toJS(),"pages.ids",!1))try{const{entries:e,pagination:t}=await i.unpublishedEntries(o.collections);n(Ja(e,t))}catch(e){}n(function(e,t){return{type:La,payload:{collection:e.get("name"),slug:t}}}(e,t));try{const r=await i.unpublishedEntry(o,e,t),a=await Promise.all(r.mediaFiles.filter(e=>e.draft).map(({url:e,file:t,path:n})=>Cn({path:n,url:e,file:t})));n(Ca(a)),n(function(e,t){return{type:Na,payload:{collection:e.get("name"),entry:t}}}(e,r)),n(Hs(r))}catch(r){r.name===cn.EDITORIAL_WORKFLOW_ERROR&&r.notUnderEditorialWorkflow?(n(function(e,t){return{type:$a,payload:{collection:e.get("name"),slug:t}}}(e,t)),n(Gs(e,t))):n(Ii({message:{key:"ui.toast.onFailToLoadEntries",details:r},type:"error",dismissAfter:8e3}))}}}function ns(e){return(t,n)=>{const r=n(),o=uc(r.config),i=on()(r.editorialWorkflow.toJS(),"pages.ids",!1);r.config.publish_mode!==Br||i||(t({type:Fa}),o.unpublishedEntries(e).then(e=>t(Ja(e.entries,e.pagination))).catch(e=>{t(Ii({message:{key:"ui.toast.onFailToLoadEntries",details:e},type:"error",dismissAfter:8e3})),t(function(e){return{type:"UNPUBLISHED_ENTRIES_FAILURE",error:"Failed to load entries",payload:e}}(e)),Promise.reject(e)}))}}function rs(e,t,n,r){return(o,i)=>{if(n===r)return;const a=i(),s=uc(a.config);o(function(e,t){return{type:Wa,payload:{collection:e,slug:t}}}(e,t)),s.updateUnpublishedEntryStatus(e,t,r).then(()=>{o(Ii({message:{key:"ui.toast.entryUpdated"},type:"success",dismissAfter:4e3})),o(function(e,t,n){return{type:Ha,payload:{collection:e,slug:t,newStatus:n}}}(e,t,r))}).catch(n=>{o(Ii({message:{key:"ui.toast.onFailToUpdateStatus",details:n},type:"error",dismissAfter:8e3})),o(function(e,t){return{type:Va,payload:{collection:e,slug:t}}}(e,t))})}}function os(e,t){return(n,r)=>{const o=r(),i=uc(o.config);return n(function(e,t){return{type:"UNPUBLISHED_ENTRY_DELETE_REQUEST",payload:{collection:e,slug:t}}}(e,t)),i.deleteUnpublishedEntry(e,t).then(()=>{n(Ii({message:{key:"ui.toast.onDeleteUnpublishedChanges"},type:"success",dismissAfter:4e3})),n(function(e,t){return{type:Qa,payload:{collection:e,slug:t}}}(e,t))}).catch(r=>{n(Ii({message:{key:"ui.toast.onDeleteUnpublishedChanges",details:r},type:"error",dismissAfter:8e3})),n(function(e,t){return{type:"UNPUBLISHED_ENTRY_DELETE_FAILURE",payload:{collection:e,slug:t}}}(e,t))})}}function is(e,t){return async(n,r)=>{const o=r(),i=o.collections,a=uc(o.config),s=Gc(o,e,t);n(function(e,t){return{type:Ka,payload:{collection:e,slug:t}}}(e,t));try{await a.publishUnpublishedEntry(s),n(ra()),n(Ii({message:{key:"ui.toast.entryPublished"},type:"success",dismissAfter:4e3})),n(function(e,t){return{type:Ga,payload:{collection:e,slug:t}}}(e,t));const r=i.get(e);if(!r.has("nested"))return n(Gs(r,t));{n(Xs(r));const e=oc(r,s.get("path"));Gs(r,e),t!==e&&Il(o.entryDraft)&&ja(r.get("name"),e)}}catch(r){n(Ii({message:{key:"ui.toast.onFailToPublishEntry",details:r},type:"error",dismissAfter:8e3})),n(function(e,t){return{type:Ya,payload:{collection:e,slug:t}}}(e,t))}}}const as=(0,Ge.Map)({entry:(0,Ge.Map)(),fieldsMetaData:(0,Ge.Map)(),fieldsErrors:(0,Ge.Map)(),hasChanged:!1,key:""});function ss(e,t){if(!Xl(e))return;const n=t.getIn(["entry","meta"]),r=n&&n.get("path"),o=on()(e.toJS(),["meta","path","index_file"]),i=Bl(e);return r&&(0,fn.join)(e.get("folder"),r,`${o}.${i}`)}const ls="ENTRY_REQUEST",us="ENTRY_SUCCESS",cs="ENTRY_FAILURE",fs="ENTRIES_REQUEST",ds="ENTRIES_SUCCESS",ps="ENTRIES_FAILURE",hs="SORT_ENTRIES_REQUEST",gs="SORT_ENTRIES_SUCCESS",ms="SORT_ENTRIES_FAILURE",ys="FILTER_ENTRIES_REQUEST",vs="FILTER_ENTRIES_SUCCESS",bs="FILTER_ENTRIES_FAILURE",ws="GROUP_ENTRIES_REQUEST",xs="GROUP_ENTRIES_SUCCESS",Ss="GROUP_ENTRIES_FAILURE",ks="DRAFT_CREATE_FROM_ENTRY",_s="DRAFT_CREATE_EMPTY",Es="DRAFT_DISCARD",Cs="DRAFT_CHANGE_FIELD",Os="DRAFT_VALIDATION_ERRORS",Ts="DRAFT_CLEAR_ERRORS",Ps="DRAFT_LOCAL_BACKUP_RETRIEVED",Ms="DRAFT_CREATE_FROM_LOCAL_BACKUP",Rs="DRAFT_CREATE_DUPLICATE_FROM_ENTRY",As="ENTRY_PERSIST_REQUEST",Is="ENTRY_PERSIST_SUCCESS",Ds="ENTRY_PERSIST_FAILURE",js="ENTRY_DELETE_SUCCESS",Ls="ADD_DRAFT_ENTRY_MEDIA_FILE",Ns="REMOVE_DRAFT_ENTRY_MEDIA_FILE",$s="CHANGE_VIEW_STYLE";function Fs(e){return{type:fs,payload:{collection:e.get("name")}}}function Bs(e,t,n,r,o=!0){return{type:ds,payload:{collection:e.get("name"),entries:t,page:n,cursor:cn.Cursor.create(r),append:o}}}function zs(e,t){return{type:ps,error:"Failed to load entries",payload:t.toString(),meta:{collection:e.get("name")}}}async function Us(e,t){const n=uc(e.config),r=Qc(e,t.get("name"),"listEntries"),o=r?fi(e.integrations,n.getToken,r):n;return await o.listAllEntries(t)}function qs(e,t,n=mo.Ascending){return async(r,o)=>{const i=o(),a=El(i.entries,e.get("name"));if(r({type:hs,payload:{collection:e.get("name"),key:t,direction:n}}),!a)try{const o=await Us(i,e);r({type:gs,payload:{collection:e.get("name"),key:t,direction:n,entries:o}})}catch(o){r({type:ms,payload:{collection:e.get("name"),key:t,direction:n,error:o}})}}}function Ws(e,t){return{type:js,payload:{collectionName:e.get("name"),entrySlug:t}}}function Hs(e){return{type:ks,payload:{entry:e}}}function Vs(e){return{type:Ts,payload:{uniqueFieldId:e}}}function Ks({id:e}){return{type:Ns,payload:{id:e}}}function Gs(e,t){return async(n,r)=>{await ma(n,r()),n(function(e,t){return{type:ls,payload:{collection:e.get("name"),slug:t}}}(e,t));try{const o=await Ys(r(),e,t);n(function(e,t){return{type:us,payload:{collection:e.get("name"),entry:t}}}(e,o)),n(Hs(o))}catch(r){n(Ii({message:{details:r.message,key:"ui.toast.onFailToLoadEntries"},type:"error",dismissAfter:8e3})),n(function(e,t,n){return{type:cs,payload:{error:e,collection:t.get("name"),slug:n}}}(r,e,t))}}}async function Ys(e,t,n){const r=uc(e.config);return await r.getEntry(e,t,n)}const Qs=(0,Ge.fromJS)({append_next:{action:"next",append:!0}});function Js(e){return cn.Cursor.create(e).updateStore("actions",e=>e.union(Qs.filter(t=>e.has(t.get("action"))).keySeq()))}function Xs(e,t=0){return async(n,r)=>{if(e.get("isFetching"))return;const o=r(),i=wl(o.entries,e.get("name"));if(i&&i.length>0){const t=i[0];return n(qs(e,t.get("key"),t.get("direction")))}const a=function(e){const t=e.get("sortable_fields").toArray().find(e=>void 0!==e.get("default_sort"));if(!t)return null;const n=t.get("field"),r=t.get("default_sort");let o;return o=!0===r||"asc"===r?"asc":"desc"===r?"desc":"asc",{field:n,direction:o}}(e);if(a){const t="desc"===a.direction?mo.Descending:mo.Ascending;return n(qs(e,a.field,t))}const s=uc(o.config),l=Qc(o,e.get("name"),"listEntries"),u=l?fi(o.integrations,s.getToken,l):s,c=!!(t&&!isNaN(t)&&t>0);n(Fs(e));try{const r=e.has("nested")||nu(e);let o=await(r?u.listAllEntries(e).then(e=>({entries:e})):u.listEntries(e,t));o={...o,cursor:l?cn.Cursor.create({actions:["next"],meta:{usingOldPaginationAPI:!0},data:{nextPage:t+1}}):cn.Cursor.create(o.cursor)},n(Bs(e,o.cursor.meta.get("usingOldPaginationAPI")?o.entries.reverse():o.entries,o.pagination,Js(o.cursor),c))}catch(t){return n(Ii({message:{details:t,key:"ui.toast.onFailToLoadEntries"},type:"error",dismissAfter:8e3})),Promise.reject(n(zs(e,t)))}}}function Zs(e,t=()=>!1){return e.reduce((e,n)=>{const r=e,o=n;if(t(o))return r;const i=o.get("field")||o.get("fields"),a="list"==o.get("widget"),s=o.get("name"),l=o.get("default",null);if(Ge.List.isList(i)||Ge.Map.isMap(i)){if(a&&Ge.List.isList(l))r[s]=l;else{const e=Ge.List.isList(i)?i:(0,Ge.List)([i]),n=a?[Zs(e,t)]:Zs(e,t);u=n,[[{}],{}].some(e=>ti()(u,e))||(r[s]=n)}return r}var u;return null!==l&&(r[s]=l),r},{})}function el({entry:e}){return e.get("mediaFiles").toArray().filter(e=>e.get("draft")).map(e=>Cn({path:e.get("path"),file:e.get("file"),url:e.get("url"),field:e.get("field")}))}function tl(e,t){const n=Fl(e,t.get("slug"));function r(e){return function(e,t){return Ei(e,t,"serialize")}(e,n)}const o=r(t.get("data"));let i=t.set("data",o);return nu(e)&&(i=function(e,t,n){const{locales:r,defaultLocale:o}=ru(e);return r.filter(e=>e!==o).forEach(e=>{const r=su(e);t=t.setIn(r,n(t.getIn(r)))}),t}(e,i,r)),i}function nl(e,t,n){return{error:{type:Oi,message:n(`editor.editorControlPane.widget.${t}`,{path:e})}}}const rl="VIEW_STYLE_LIST",ol="VIEW_STYLE_GRID",{keyToPathArray:il}=dn.stringTemplate;let al,sl,ll,ul,cl;const fl="decap-cms.entries.sort",dl="decap-cms.entries.viewStyle";function pl(e){return e?e.replace(/([^:]\/)\/+/g,"$1"):e}const hl=po()(()=>{const e=localStorage.getItem(fl);if(e)try{const t=JSON.parse(e);let n=(0,Ge.Map)();return Object.entries(t).forEach(([e,t])=>{let r=(0,Ge.OrderedMap)();nn()(Object.values(t),["index"]).forEach(e=>{const{key:t,direction:n}=e;r=r.set(t,(0,Ge.fromJS)({key:t,direction:n}))}),n=n.set(e,r)}),n}catch(e){return(0,Ge.Map)()}return(0,Ge.Map)()});function gl(e){if(e){const t={};e.keySeq().forEach(n=>{const r=n;e.get(r).valueSeq().toJS().map((e,t)=>({...e,index:t})).forEach(e=>{sn()(t,[r,e.key],e)})}),localStorage.setItem(fl,JSON.stringify(t))}else localStorage.removeItem(fl)}const ml=po()(()=>localStorage.getItem(dl)||(localStorage.setItem(dl,rl),rl));function yl(e,t){const n=e.get("sort");return n?.get(t)}function vl(e,t){const n=e.get("filter");return n?.get(t)||(0,Ge.Map)()}function bl(e,t){const n=e.get("group");return n?.get(t)||(0,Ge.Map)()}function wl(e,t){const n=yl(e,t),r=n?.valueSeq().filter(e=>e?.get("direction")!==mo.None).toArray()||[];return r}function xl(e,t,n){return e.getIn(["entities",`${t}.${n}`])}function Sl(e,t){return e.getIn(["pages",t,"ids"],(0,Ge.List)())}function kl(e,t){const n=Sl(e,t),r=n&&n.map(n=>xl(e,t,n));return r}function _l(e,t){const n=t.get("name");let r=kl(e,n);const o=wl(e,n);if(o&&o.length>0){const e=o.map(e=>function(e,t){return t===ao?"updatedOn":t!==io||Vl(e,t)?`data.${t}`:"author"}(t,e.get("key"))),n=o.map(e=>e.get("direction")===mo.Ascending?"asc":"desc");r=(0,Ge.fromJS)(go()(r.toJS(),e,n))}const i=function(e,t){const n=vl(e,t),r=n?.valueSeq().filter(e=>!0===e?.get("active")).toArray()||[];return r}(e,n);return i&&i.length>0&&(r=r.filter(e=>{const t=i.every(t=>{const n=t.get("pattern"),r=t.get("field"),o=(e.get("data")||(0,Ge.Map)()).getIn(il(r));return void 0!==o&&new RegExp(String(n)).test(String(o))});return t}).toList()),r}function El(e,t){return e.getIn(["pages",t,"isFetching"],!1)}function Cl(e,t){const n=e.find(e=>e?.get("name")===t);return n}function Ol(e,t,n,r){if(!t)return!1;if(r&&r.has(e))return!0;if(t.has("files")){const r=Cl(t.get("files"),n);if(r&&r.has(e))return!0}return!!t.has(e)}function Tl(e,t,n,r,o,i,a){const s=i.filter(e=>e===o)[0];if(s)return Zo(s.has(e)?s.get(e):`{{${e}}}`,r,n,a,e,t.slug);for(let s of i){s.has(e)||(s=s.set(e,`{{${e}}}`));const i=Zo(s.get(e),r,n,a,e,t.slug);let l=null;if(s.has("fields")?l=Tl(e,t,n,r,o,s.get("fields").toArray(),i):s.has("field")?l=Tl(e,t,n,r,o,[s.get("field")],i):s.has("types")&&(l=Tl(e,t,n,r,o,s.get("types").toArray(),i)),null!=l)return l}return null}function Pl(e,t,n,r,o){let i=t[e];if(n.has(e)||(n=n.set(e,`{{${e}}}`)),n.has("files")){i=Zo(n.get(e),r,n,i,e,t.slug);let a=Cl(n.get("files"),r?.get("slug"));if(a&&(a.has(e)||(a=a.set(e,`{{${e}}}`)),i=Zo(a.get(e),r,n,i,e,t.slug),o)){const s=Tl(e,t,n,r,o,a.get("fields").toArray(),i);null!==s&&(i=s)}}else if(i=Zo(n.get(e),r,n,i,e,t.slug),o){const a=Tl(e,t,n,r,o,n.get("fields").toArray(),i);null!==a&&(i=a)}return i}function Ml(e,t,n,r){const o="media_folder";let i=e[o];if(Ol(o,t,n?.get("slug"),r)){const a=Pl(o,e,t,n,r);if(a.startsWith("/"))i=(0,fn.join)(a);else{const e=n?.get("path");i=e?(0,fn.join)((0,fn.dirname)(e),a):t.get("folder")}}return en()(i,"/")}function Rl(e,t,n,r,o){if((0,cn.isAbsolutePath)(r))return r;const i=Ml(e,t,n,o);return(0,fn.join)(i,(0,cn.basename)(r))}function Al(e,t,n,r,o){if((0,cn.isAbsolutePath)(n))return n;const i="public_folder";let a=pl(e[i]);return Ol(i,t,r?.get("slug"),o)&&(a=pl(Pl(i,e,t,r,o))),(0,cn.isAbsolutePath)(a)?function(e,...t){return Eo()(e,...t)}(a,(0,cn.basename)(n)):(0,fn.join)(a,(0,cn.basename)(n))}function Il(e){const t=e.get("entry");return t&&!t.isEmpty()}const{keyToPathArray:Dl}=dn.stringTemplate,jl=(0,Ge.fromJS)({}),Ll={[oo]:{entryExtension(e){const t=e.get("extension")||on()({...Pr,...Cr()},e.get("format")||"frontmatter");if(!t)throw new Error(`No extension found for format ${e.get("format")}`);return t.replace(/^\./,"")},fields:e=>e.get("fields"),entryPath(e,t){return`${e.get("folder").replace(/\/$/,"")}/${t}.${this.entryExtension(e)}`},entrySlug(e,t){const n=e.get("folder").replace(/\/$/,""),r=t.split(n+"/").pop()?.replace(new RegExp(`\\.${no()(this.entryExtension(e))}$`),"");return r},allowNewEntries:e=>e.get("create"),allowDeletion:e=>e.get("delete",!0),templateName:e=>e.get("name")},[ro]:{fileForEntry(e,t){const n=e.get("files");return n&&n.filter(e=>e?.get("name")===t).get(0)},fields(e,t){const n=this.fileForEntry(e,t);return n&&n.get("fields")},entryPath(e,t){const n=this.fileForEntry(e,t);return n&&n.get("file")},entrySlug(e,t){const n=e.get("files").filter(e=>e?.get("file")===t).get(0);return n&&n.get("name")},entryLabel(e,t){const n=this.fileForEntry(e,t);return n&&n.get("label")},allowNewEntries:()=>!1,allowDeletion:e=>e.get("delete",!1),templateName:(e,t)=>t}};function Nl(e){const t=e.reduce((e,t)=>{if(t.has("media_folder")&&(e=[...e,t]),t.has("fields")){const n=t.get("fields")?.toArray();e=[...e,...Nl(n)]}else if(t.has("field")){const n=t.get("field");e=[...e,...Nl([n])]}else if(t.has("types")){const n=t.get("types")?.toArray();e=[...e,...Nl(n)]}return e},[]);return t}function $l(e,t){return e.get("files")?.toArray().find(e=>e.get("name")===t)}function Fl(e,t){return Ll[e.get("type")].fields(e,t)}function Bl(e){return Ll[oo].entryExtension(e)}function zl(e,t){return Ll[ro].entryLabel(e,t)}function Ul(e,t){return Ll[e.get("type")].entryPath(e,t)}function ql(e,t){return Ll[e.get("type")].entrySlug(e,t)}function Wl(e){return Ll[e.get("type")].allowDeletion(e)}function Hl(e,t=""){let n=e.map(e=>`${t}${e.get("name")}`);return e.forEach((e,t)=>{if(e.has("fields")){const r=e.get("fields")?.toArray();n=[...n,...Hl(r,`${n[t]}.`)]}else if(e.has("field")){const r=e.get("field");n=[...n,...Hl([r],`${n[t]}.`)]}else if(e.has("types")){const r=e.get("types")?.toArray();n=[...n,...Hl(r,`${n[t]}.`)]}}),n}function Vl(e,t){const n=Dl(t);let r,o,i=e.get("fields",(0,Ge.List)()).toArray();for(;(r=n.shift())&&i;)o=i.find(e=>e.get("name")===r),o?.has("fields")?i=o?.get("fields")?.toArray():o?.has("field")?i=[o?.get("field")]:o?.has("types")&&(i=o?.get("types")?.toArray());return o}function Kl(e,t,n=()=>!1){return n()||(e=e.map(e=>{const r=t(e);return n()?r:r.has("fields")?r.set("fields",Kl(r.get("fields"),t,n)):r.has("field")?r.set("field",Kl((0,Ge.List)([r.get("field")]),t,n).get(0)):r.has("types")?r.set("types",Kl(r.get("types"),t,n)):r}).toList()),e}function Gl(e){const t=e.get("identifier_field"),n=t?[t,...lo]:[...lo],r=Hl(e.get("fields",(0,Ge.List)()).toArray());return n.find(e=>r.find(t=>t.toLowerCase().trim()===e.toLowerCase().trim()))}function Yl(e,t){if("title"===t&&e.get("identifier_field"))return Gl(e);const n=co[t],r=e.get("fields");let o;if(!r||!n)return null;const i=r.filter(e=>e?.get("widget","string")===n.type).map(e=>e?.get("name"));if(o=i.filter(e=>-1!==n.synonyms.indexOf(e)),o&&o.size>0)return o.first();const a=r.filter(e=>-1!==n.secondaryTypes.indexOf(e?.get("widget","string"))).map(e=>e?.get("name"));return o=a.filter(e=>-1!==n.synonyms.indexOf(e)),o&&o.size>0?o.first():n.fallbackToFirstField&&i.size>0?i.first():(n.showError&&(s=`The Field ${t} is missing for the collection “${e.get("name")}”`,l=`Decap CMS tries to infer the entry ${t} automatically, but one couldn't be found for entries of the collection “${e.get("name")}”. Please check your site configuration.`,console.error(`%c ⛔ ${s}\n%c${l}\n\n`,"color: black; font-weight: bold; font-size: 16px; line-height: 50px;","color: black;")),null);var s,l}function Ql(e,t){const n=e.get("summary");if(n)return function(e,t,n){let r=t.get("data");const o=Uo(t,Yl(n,"date"))||null,i=r.getIn(Ho(Gl(n)));return r=Vo(t.get("path"),r,n.get("folder")),t.get("author")&&!Vl(n,io)&&(r=r.set(io,t.get("author"))),t.get("updatedOn")&&!Vl(n,ao)&&(r=r.set(ao,t.get("updatedOn"))),zo(e,o,i,r)}(n,t,e);if(e.get("type")==ro){const n=zl(e,t.get("slug"));if(n)return n}const r=t.get("data"),o=Yl(e,"title"),i=o&&r.getIn(Dl(o));return i||"title"===o?i:r.getIn(Dl("title"))}function Jl(e,t,n){let r=uo.map(r=>{const o=Yl(e,r);return!t.isGitBackend()||"author"!==r||o||n?o:io}).filter(Boolean);return t.isGitBackend()&&!n&&(r=[ao,...r]),r.map(e=>({field:e}))}function Xl(e){return e.has("folder")&&e.get("type")===oo&&e.has("meta")&&e.get("meta")?.has("path")}const Zl="i18n";let eu=function(e){return e.MULTIPLE_FOLDERS="multiple_folders",e.MULTIPLE_FILES="multiple_files",e.SINGLE_FILE="single_file",e}({}),tu=function(e){return e.TRANSLATE="translate",e.DUPLICATE="duplicate",e.NONE="none",e}({});function nu(e){return e.has(Zl)}function ru(e){if(!nu(e))return{};const{structure:t,locales:n,default_locale:r}=e.get(Zl).toJS();return{structure:t,locales:n,defaultLocale:r}}function ou(e,t,n){return t!==n&&e.get(Zl)===tu.TRANSLATE}function iu(e,t,n){return t!==n&&e.get(Zl)===tu.DUPLICATE}function au(e,t,n){return t!==n&&e.get(Zl)===tu.NONE}function su(e){return[Zl,e,"data"]}function lu(e,t){return e!==t?su(e):["data"]}function uu(e,t,n,r,o){switch(e){case eu.MULTIPLE_FOLDERS:return n.replace(`/${r}`,`/${o}/${r}`);case eu.MULTIPLE_FILES:return n.replace(new RegExp(`${no()(t)}$`),`${o}.${t}`);case eu.SINGLE_FILE:default:return n}}function cu(e,t,n){switch(e){case eu.MULTIPLE_FOLDERS:{const e=n.split("/");return e.pop(),e.pop()}case eu.MULTIPLE_FILES:return n.slice(0,-`.${t}`.length).split(".").pop();case eu.SINGLE_FILE:default:return""}}function fu(e,t,n,r){const{structure:o,locales:i}=ru(e);return o===eu.SINGLE_FILE?[n]:i.map(e=>uu(o,t,n,r,e))}function du(e,t,n){switch(e){case eu.MULTIPLE_FOLDERS:return t.replace(`${n}/`,"");case eu.MULTIPLE_FILES:return t.replace(`.${n}`,"");case eu.SINGLE_FILE:default:return t}}function pu(e,t,n,r){let o=r.find(e=>e.locale===n);o||(o=r[0],console.warn(`Could not locale entry for default locale '${n}'`));const i=r.filter(e=>e.locale!==o.locale).reduce((t,{locale:n,value:r})=>{const i=su(n);return o&&function(e,t,n){void 0!==e.get("fields")&&e.get("fields").forEach(e=>{e&&e.get(Zl)===tu.DUPLICATE&&(t.data[e.get("name")]||(t.data[e.get("name")]=n.data[e.get("name")]))})}(e,r,o.value),sn()(t,i,r.data)},{}),a=du(t,o.value.path,n),s=ql(e,a);return{...o.value,raw:"",...i,path:a,slug:s}}function hu(e,t,n){const r=e.data[t]||{},o=n.filter(e=>e!==t).map(t=>({locale:t,value:e.data[t]})).filter(e=>e.value).reduce((e,t)=>({...e,[t.locale]:{data:t.value}}),{});return{...e,data:r,i18n:o,raw:""}}function gu(e,t,n){const{structure:r,defaultLocale:o,locales:i}=ru(e);if(r===eu.SINGLE_FILE)return n.map(e=>hu(e,o,i));const a=eo()(n.map(e=>({locale:cu(r,t,e.path),value:e})),({locale:e,value:t})=>du(r,t.path,e));return Object.values(a).reduce((t,n)=>[...t,pu(e,r,o,n)],[])}function mu(e,t,n,r,o=[t.get("name")]){const i=e.getIn(["entry","data",...o]);return t.get(Zl)===tu.DUPLICATE&&n.filter(e=>e!==r).forEach(t=>{e=e.setIn(["entry",...lu(t,r),...o],i)}),t.has("field")&&!Ge.List.isList(i)?[t.get("field")].forEach(t=>{e=mu(e,t,n,r,[...o,t.get("name")])}):t.has("fields")&&!Ge.List.isList(i)&&t.get("fields").toArray().forEach(t=>{e=mu(e,t,n,r,[...o,t.get("name")])}),e}const yu={type:"string",minLength:2,maxLength:10,pattern:"^[a-zA-Z-_]+$"},vu={type:"object",properties:{structure:{type:"string",enum:Object.values(eu)},locales:{type:"array",minItems:1,items:yu,uniqueItems:!0},default_locale:yu}},bu={...vu,required:["structure","locales"]},wu={oneOf:[{type:"boolean"},vu]},xu={oneOf:[{type:"boolean"},{type:"string",enum:Object.values(tu)}]};function Su(){const e=Xr();return{$id:`fields_${e}`,type:"array",minItems:1,items:{$id:`field_${e}`,type:"object",properties:{name:{type:"string"},label:{type:"string"},widget:{type:"string"},required:{type:"boolean"},i18n:xu,hint:{type:"string"},pattern:{type:"array",minItems:2,items:[{oneOf:[{type:"string"},{instanceof:"RegExp"}]},{type:"string"}]},field:{$ref:`field_${e}`},fields:{$ref:`fields_${e}`},types:{$ref:`fields_${e}`}},select:{$data:"0/widget"},selectCases:{...Eu()},required:["name"]},uniqueItemProperties:["name"]}}const ku={type:"array",minItems:1,items:{type:"object",properties:{label:{type:"string"},field:{type:"string"},pattern:{oneOf:[{type:"boolean"},{type:"string"}]}},additionalProperties:!1,required:["label","field","pattern"]}},_u={type:"array",minItems:1,items:{type:"object",properties:{label:{type:"string"},field:{type:"string"},pattern:{type:"string"}},additionalProperties:!1,required:["label","field"]}};function Eu(){const e=mr().map(e=>({[e.name]:e.schema}));return Object.assign(...e)}class Cu extends Error{constructor(e,...t){const n=e.map(({message:e,instancePath:t})=>{const n=t.slice(1).split("/").map(e=>e.match(/^\d+$/)?`[${e}]`:`.${e}`).join("").slice(1);return`${n?`'${n}'`:"config"} ${e}`}).join("\n");super(n,...t),this.errors=e,this.message=n}toString(){return this.message}}function Ou(e){const t=(e.integrations||[]).reduce((t,n)=>{const{hooks:r,collections:o,provider:i,...a}=n;if(t.providers[i]={...a},!o)return r.forEach(e=>{t.hooks[e]=i}),t;const s="*"===o?e.collections.map(e=>e.name):o;return s.forEach(e=>{r.forEach(n=>{t.hooks[e]?t.hooks[e][n]=i:t.hooks[e]={[n]:i}})}),t},{providers:{},hooks:{}});return(0,Ge.fromJS)(t)}const Tu=(0,Ge.fromJS)({providers:{},hooks:{}});function Pu(e,t,n){return t?e.getIn(["hooks",t,n],!1):e.getIn(["hooks",n],!1)}const Mu="CONFIG_REQUEST",Ru="CONFIG_SUCCESS",Au="CONFIG_FAILURE";function Iu(e){return"types"in e||"field"in e}function Du(e,t){return e.map(e=>{const n=t(e);return function(e){return"fields"in e}(n)?{...n,fields:Du(n.fields,t)}:Iu(n)&&n.field?{...n,field:Du([n.field],t)[0]}:Iu(n)&&n.types?{...n,types:Du(n.types,t)}:n})}function ju(e){return"media_folder"in e&&!("public_folder"in e)?{...e,public_folder:e.media_folder}:e}const Lu={dateFormat:"date_format",timeFormat:"time_format",pickerUtc:"picker_utc",editorComponents:"editor_components",valueType:"value_type",valueField:"value_field",searchFields:"search_fields",displayFields:"display_fields",optionsLength:"options_length"};function Nu(e){const t=Object.keys(Lu).filter(t=>t in e).map(t=>{const n=Lu[t];return console.warn(`Field ${e.name} is using a deprecated configuration '${t}'. Please use '${n}'`),{[n]:e[t]}});return Object.assign({},e,...t)}function $u(e){return!0===e[Zl]?{...e,[Zl]:tu.TRANSLATE}:!1!==e[Zl]&&e[Zl]?e:{...e,[Zl]:tu.NONE}}function Fu(e,t){if("boolean"==typeof e)return t;{const n=e.locales||t.locales,r=e.default_locale||n[0],o=Dr()(t,e);return o.locales=n,o.default_locale=r,Uu(o),o}}function Bu(e,t){return Du(e,t?$u:e=>{const t={...e};return delete t[Zl],t})}function zu(e){if(e&&e.structure!==eu.SINGLE_FILE)throw new Error(`i18n configuration for files collections is limited to ${eu.SINGLE_FILE} structure`)}function Uu(e){if(e&&e.default_locale&&!e.locales.includes(e.default_locale))throw new Error(`i18n locales '${e.locales.join(", ")}' are missing the default locale ${e.default_locale}`)}function qu(e,t){return!!Pu(Ou((0,Ge.fromJS)(e)),t.name,"listEntries")}function Wu(e){return{type:Ru,payload:e}}function Hu(e){return{type:Au,error:"Error loading config",payload:e}}function Vu(e={},t){return window.CMS_CONFIG?Wu(window.CMS_CONFIG):async n=>{n({type:Mu});try{const r=function(){const e=document.querySelector('link[rel="cms-config-url"]');return e&&{"text/yaml":"yaml","application/x-yaml":"yaml"}[e.type]&&e.href?(console.log(`Using config file path: "${e.href}"`),e.href):"config.yml"}(),o=!$r()(e),i=!1===e.load_config_file?{}:await async function(e,t){const n=await fetch(e,{credentials:"same-origin"}).catch(e=>e);if(n instanceof Error||200!==n.status){if(t)return{};const e=n instanceof Error?n.message:n.status;throw new Error(`Failed to load config.yml (${e})`)}const r=n.headers.get("Content-Type")||"Not-Found";return-1===r.indexOf("yaml")&&(console.log(`Response for ${e} was not yaml. (Content-Type: ${r})`),t)?{}:function(e){const t=hn().parse(e,{maxAliasCount:-1,prettyErrors:!0,merge:!0});if("undefined"!=typeof window&&"string"==typeof window.CMS_ENV&&t[window.CMS_ENV]){const e=Object.keys(t[window.CMS_ENV]);for(const n of e)t[n]=t[window.CMS_ENV][n]}return t}(await n.text())}(r,o),a=Dr()(i,e);!function(e){const t=new(qr())({allErrors:!0,$data:!0,strict:!1});if((0,Wr.uniqueItemProperties)(t),(0,Wr.select)(t),(0,Wr.instanceof)(t),(0,Wr.prohibited)(t),Vr()(t),!t.validate({type:"object",properties:{backend:{type:"object",properties:{name:{type:"string",examples:["test-repo"]},auth_scope:{type:"string",examples:["repo","public_repo"],enum:["repo","public_repo"]},cms_label_prefix:{type:"string",minLength:1},open_authoring:{type:"boolean",examples:[!0]}},required:["name"]},local_backend:{oneOf:[{type:"boolean"},{type:"object",properties:{url:{type:"string",examples:["http://localhost:8081/api/v1"]},allowed_hosts:{type:"array",items:{type:"string"}}},additionalProperties:!1}]},locale:{type:"string",examples:["en","fr","de"]},i18n:bu,site_url:{type:"string",examples:["https://example.com"]},display_url:{type:"string",examples:["https://example.com"]},logo_url:{type:"string",examples:["https://example.com/images/logo.svg"]},logo:{type:"object",properties:{src:{type:"string",examples:["https://example.com/images/logo.svg"]},show_in_header:{type:"boolean"}},required:["src"]},show_preview_links:{type:"boolean"},media_folder:{type:"string",examples:["assets/uploads"]},public_folder:{type:"string",examples:["/uploads"]},media_folder_relative:{type:"boolean"},media_library:{type:"object",properties:{name:{type:"string",examples:["uploadcare"]},config:{type:"object"}},required:["name"]},publish_mode:{type:"string",enum:["simple","editorial_workflow",""],examples:["editorial_workflow"]},slug:{type:"object",properties:{encoding:{type:"string",enum:["unicode","ascii"]},clean_accents:{type:"boolean"}}},issue_reports:{type:"object",properties:{url:{type:"string",examples:["https://example.com/report-issue"]}}},collections:{type:"array",minItems:1,items:{type:"object",properties:{name:{type:"string"},label:{type:"string"},label_singular:{type:"string"},description:{type:"string"},folder:{type:"string"},files:{type:"array",items:{type:"object",properties:{name:{type:"string"},label:{type:"string"},label_singular:{type:"string"},description:{type:"string"},file:{type:"string"},preview_path:{type:"string"},preview_path_date_field:{type:"string"},preview_path_preserve_slashes:{type:"boolean"},fields:Su()},required:["name","label","file","fields"]},uniqueItemProperties:["name"]},identifier_field:{type:"string"},summary:{type:"string"},slug:{type:"string"},path:{type:"string"},preview_path:{type:"string"},preview_path_date_field:{type:"string"},preview_path_preserve_slashes:{type:"boolean"},create:{type:"boolean"},publish:{type:"boolean"},hide:{type:"boolean"},editor:{type:"object",properties:{preview:{type:"boolean"}}},format:{type:"string"},extension:{type:"string"},frontmatter_delimiter:{type:["string","array"],minItems:2,maxItems:2,items:{type:"string"}},fields:Su(),sortable_fields:{type:"array",items:{oneOf:[{type:"string"},{type:"object",properties:{field:{type:"string"},label:{type:"string"},default_sort:{oneOf:[{type:"boolean"},{type:"string",enum:["asc","desc"]}]}},required:["field"],additionalProperties:!1}]}},sortableFields:{type:"array",items:{type:"string"}},view_filters:ku,view_groups:_u,nested:{type:"object",properties:{depth:{type:"number",minimum:1,maximum:1e3},subfolders:{type:"boolean"},summary:{type:"string"}},required:["depth"]},meta:{type:"object",properties:{path:{type:"object",properties:{label:{type:"string"},widget:{type:"string"},index_file:{type:"string"}},required:["label","widget","index_file"]}},additionalProperties:!1,minProperties:1},i18n:wu},required:["name","label"],oneOf:[{required:["files"]},{required:["folder","fields"]}],not:{required:["sortable_fields","sortableFields"]},if:{required:["extension"]},then:{if:{properties:{extension:{enum:Object.keys(Mr)}}},else:{required:["format"]}},dependencies:{frontmatter_delimiter:{properties:{format:{enum:Tr}},required:["format"]}}},uniqueItemProperties:["name"]},editor:{type:"object",properties:{preview:{type:"boolean"}}}},required:["backend","collections"],anyOf:[{required:["media_folder"]},{required:["media_library"]}]},e)){const e=t.errors.map(e=>{switch(e.keyword){case"uniqueItemProperties":{const t=e.instancePath||"";let n=e;return t.endsWith("/fields")?n={...e,message:"fields names must be unique"}:t.endsWith("/files")?n={...e,message:"files names must be unique"}:t.endsWith("/collections")&&(n={...e,message:"collections names must be unique"}),n}case"instanceof":{const t=e.instancePath||"";let n=e;return/fields\/\d+\/pattern\/\d+/.test(t)&&(n={...e,message:"must be a regular expression"}),n}default:return e}});throw console.error("Config Errors",e),new Cu(e)}e.collections&&e.collections.forEach((e,t)=>{if(e.sortable_fields&&e.sortable_fields.filter(e=>"object"==typeof e&&void 0!==e.default_sort).length>1){const e={instancePath:`/collections/${t}/sortable_fields`,message:"only one sortable field can have the default_sort property"};throw console.error("Config Errors",[e]),new Cu([e])}})}(a);const s=function(e){const{collections:t=[]}=e,n=t.map(e=>{const{fields:t,files:n}=e;let r=e;if(t){const e=Du(t,Nu);r={...r,fields:e}}if(n){const e=n.map(e=>{const t=Du(e.fields,Nu);return{...e,fields:t}});r={...r,files:e}}if(r.sortableFields){const{sortableFields:t,...n}=r;r={...n,sortable_fields:t},console.warn(`Collection ${e.name} is using a deprecated configuration 'sortableFields'. Please use 'sortable_fields'`)}var o;return r.sortable_fields&&(r={...r,sortable_fields:(o=r.sortable_fields,o.map(e=>"string"==typeof e?{field:e,default_sort:void 0}:e))}),r});return{...e,collections:n}}(await async function(e){if(!e.local_backend)return e;const{proxyUrl:t,publish_modes:n,type:r}=await async function(e){if(!["localhost","127.0.0.1",..."boolean"==typeof e?[]:e?.allowed_hosts||[]].includes(location.hostname)||!e)return{};const t="http://localhost:8081/api/v1",n=!0===e?t:e.url||t.replace("localhost",location.hostname);try{console.log(`Looking for Decap CMS Proxy Server at '${n}'`);const e=await fetch(`${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"info"})}),{repo:t,publish_modes:r,type:o}=await e.json();return"string"==typeof t&&Array.isArray(r)&&"string"==typeof o?(console.log(`Detected Decap CMS Proxy Server at '${n}' with repo: '${t}'`),{proxyUrl:n,publish_modes:r,type:o}):(console.log(`Decap CMS Proxy Server not detected at '${n}'`),{})}catch{return console.log(`Decap CMS Proxy Server not detected at '${n}'`),{}}}(e.local_backend);return t?Wt(e,e=>{e.backend.name="proxy",e.backend.proxy_url=t,e.publish_mode&&(e.publish_mode=function(e,t,n){if(e.publish_mode&&t&&!t.includes(e.publish_mode)){const r=t[0];return console.log(`'${e.publish_mode}' is not supported by '${n}' backend, switching to '${r}'`),r}return e.publish_mode}(e,n,r))}):e}(a)),l=Wt(s,e=>{e.publish_mode=e.publish_mode||Fr,e.slug=e.slug||{},e.collections=e.collections||[],!e.display_url&&e.site_url&&(e.display_url=e.site_url);const t=`/${Lr()(e.media_folder,"/")}`;"public_folder"in e||(e.public_folder=t),"encoding"in e.slug||(e.slug.encoding="unicode"),"clean_accents"in e.slug||(e.slug.clean_accents=!1),"sanitize_replacement"in e.slug||(e.slug.sanitize_replacement="-");const n=e[Zl];n&&(n.default_locale=n.default_locale||n.locales[0]),Uu(n);const r=lc(e);for(const t of e.collections){"publish"in t||(t.publish=!0);let o=t[Zl];n&&o?(o=Fu(o,n),t[Zl]=o):(o=void 0,delete t[Zl]),t.fields&&(t.fields=Bu(t.fields,Boolean(o)));const{folder:i,files:a,view_filters:s,view_groups:l,meta:u}=t;if(i&&(t.type=oo,t.path&&!t.media_folder&&(t.media_folder=""),"media_folder"in t&&!("public_folder"in t)&&(t.public_folder=t.media_folder),t.fields&&(t.fields=Du(t.fields,ju)),t.folder=en()(i,"/"),u&&u.path)){const e={name:"path",meta:!0,required:!0,...u.path};t.fields=[e,...t.fields||[]]}if(a){t.type=ro,zu(o),delete t.nested,delete t.meta;for(const e of a){e.file=Lr()(e.file,"/"),"media_folder"in e&&!("public_folder"in e)&&(e.public_folder=e.media_folder),e.fields&&(e.fields=Du(e.fields,ju));let t=e[Zl];t&&o?(t=Fu(t,o),e[Zl]=t):(t=void 0,delete e[Zl]),zu(t),e.fields&&(e.fields=Bu(e.fields,Boolean(t)))}}t.sortable_fields||(t.sortable_fields=Jl((0,Ge.fromJS)(t),r,qu(e,t))),t.view_filters=(s||[]).map(e=>({...e,id:`${e.field}__${e.pattern}`})),t.view_groups=(l||[]).map(e=>({...e,id:`${e.field}__${e.pattern}`})),e.editor&&!t.editor&&(t.editor={preview:e.editor.preview})}});n(Wu(l)),"function"==typeof t&&t()}catch(e){throw n(Hu(e)),e}}}function Ku(e){return e.locale||"en"}function Gu(e){return e.publish_mode===Br}const Yu=Wt((e,t)=>{switch(t.type){case Mu:e.isFetching=!0;break;case Ru:return{...t.payload,isFetching:!1,error:void 0};case Au:e.isFetching=!1,e.error=t.payload.toString()}},{isFetching:!0}),{extractTemplateVars:Qu,dateParsers:Ju,expandPath:Xu}=dn.stringTemplate;class Zu{storageKey="decap-cms-user";retrieve(){const e=window.localStorage.getItem(this.storageKey);return e&&JSON.parse(e)}store(e){window.localStorage.setItem(this.storageKey,JSON.stringify(e))}logout(){window.localStorage.removeItem(this.storageKey)}}function ec(e,t){const n="backup";return e?`${n}.${e}${t?`.${t}`:""}`:n}function tc(e,t){const n=on()(t.data,e);if(n)return String(n);{const n=e.split(".")[0];return t[n]?t[n]:""}}function nc(e){return t=>e.reduce((e,n)=>{const r=tc(n,t);return r?`${e} ${r}`:e},"")}function rc(e,t){return e.score>t.score?-1:e.score<t.score?1:0}function oc(e,t){const n=e.get("folder",""),r=t.toLowerCase().replace(n.toLowerCase(),"");return(0,fn.join)((0,fn.dirname)(en()(r,"/")),(0,fn.basename)(r,(0,fn.extname)(t)))}function ic(e,t){return Xl(t)?(0,fn.dirname)(e).slice(t.get("folder").length+1)||"/":e}function ac(e){let t;return t=e.get("nested")?.get("depth")||(0,cn.getPathDepth)(e.get("path","")),nu(e)&&(t=function(e,t){const{structure:n}=ru(e);return n===eu.MULTIPLE_FOLDERS?t+1:t}(e,t)),t}class sc{constructor(e,{backendName:t,authStore:n,config:r}){if(this.deleteAnonymousBackup(),this.config=r,this.implementation=e.init(this.config,{useWorkflow:Gu(this.config),updateUserCredentials:this.updateUserCredentials,initialWorkflowStatus:zr.first()}),this.backendName=t,this.authStore=n,null===this.implementation)throw new Error("Cannot instantiate a Backend with no implementation");this.backupSync=(0,cn.asyncLock)()}async status(){let e={auth:{status:!0},api:{status:!0,statusPage:""}};for(let t=1;t<=3;t++){if(e=await this.implementation.status(),Object.values(e).every(e=>!0===e.status))return e;await new Promise(e=>setTimeout(e,1e3*t))}return e}currentUser(){if(this.user)return this.user;const e=this.authStore.retrieve();return e&&e.backendName===this.backendName?Promise.resolve(this.implementation.restoreUser(e)).then(e=>(this.user={...e,backendName:this.backendName},this.authStore.store(this.user),this.user)):Promise.resolve(null)}isGitBackend(){return this.implementation.isGitBackend?.()||!1}updateUserCredentials=e=>{const t=this.authStore.retrieve();if(t&&t.backendName===this.backendName)return this.user={...t,...e},this.authStore.store(this.user),this.user};authComponent(){return this.implementation.authComponent()}authenticate(e){return this.implementation.authenticate(e).then(e=>(this.user={...e,backendName:this.backendName},this.authStore&&this.authStore.store(this.user),this.user))}async logout(){try{await this.implementation.logout()}catch(e){console.warn("Error during logout",e.message)}finally{this.user=null,this.authStore&&this.authStore.logout()}}getToken=()=>this.implementation.getToken();async entryExist(e,t,n,r){const o=r&&await this.implementation.unpublishedEntry({collection:e.get("name"),slug:n}).catch(e=>e.name===cn.EDITORIAL_WORKFLOW_ERROR&&e.notUnderEditorialWorkflow?Promise.resolve(!1):Promise.reject(e));return o||await this.implementation.getEntry(t).then(({data:e})=>e).catch(()=>Promise.resolve(!1))}async generateUniqueSlug(e,t,n,r,o){const i=n.slug;let a;a=o?oc(e,o):function(e,t,n){const r=e.get("slug")||"{{slug}}",o=t.getIn(Ho(Gl(e)));if(!o)throw new Error("Collection must have a field name that is a valid entry identifier, or must have `identifier_field` set");const i=Jo(n),a=qo(t,Yl(e,"date"))||new Date(Date.now()),s=zo(r,a,o,t,i);if(e.has("path")){const n=Qo(e.get("path"));return zo(n,a,s,t,e=>e===s?e:i(e))}return s}(e,t,i);let s=1,l=a;for(;r.includes(l)||await this.entryExist(e,Ul(e,l),l,Gu(n));)l=`${a}${Fo(" ",i)}${s++}`;return l}processEntries(e,t){const n=e.map(e=>oi(t.get("name"),ql(t,e.file.path),e.file.path,{raw:e.data||"",label:e.file.label,author:e.file.author,updatedOn:e.file.updatedOn,meta:{path:ic(e.file.path,t)}})).map(this.entryWithFormat(t)),r=t.get("filter"),o=r?this.filterEntries({entries:n},r):n;if(nu(t)){const e=Bl(t);return gu(t,e,o)}return o}async listEntries(e){const t=Bl(e);let n;const r=e.get("type");if(r===oo)n=()=>{const n=ac(e);return this.implementation.entriesByFolder(e.get("folder"),t,n)};else{if(r!==ro)throw new Error(`Unknown collection type: ${r}`);{const t=e.get("files").map(e=>({path:e.get("file"),label:e.get("label")})).toArray();n=()=>this.implementation.entriesByFiles(t)}}const o=await n(),i=cn.Cursor.create(o[cn.CURSOR_COMPATIBILITY_SYMBOL]).wrapData({cursorType:"collectionEntries",collection:e});return{entries:this.processEntries(o,e),pagination:i.meta?.get("page"),cursor:i}}async listAllEntries(e){if(e.get("folder")&&this.implementation.allEntriesByFolder){const t=ac(e),n=Bl(e);return this.implementation.allEntriesByFolder(e.get("folder"),n,t,function(e){let t="";return e.get("path")&&(t=`${e.get("folder")}/${e.get("path")}`.replace(/{{.*}}/gm,"(.*)")),nu(e)&&(t=function(e,{defaultLocale:t,structure:n}){return n===eu.MULTIPLE_FOLDERS?`${t}\\/${e}`:n===eu.MULTIPLE_FILES?`${e}\\.${t}\\..*`:e}(t,ru(e))),t?new RegExp(t):void 0}(e)).then(t=>this.processEntries(t,e))}const t=await this.listEntries(e),{entries:n}=t;let{cursor:r}=t;for(;r&&r.actions.includes("next");){const{entries:e,cursor:t}=await this.traverseCursor(r,"next");n.push(...e),r=t}return n}async search(e,t){const n=[],r=e.map(async e=>{const n=e.get("summary",""),r=Qu(n);let o=[];e.get("type")===ro?e.get("files")?.forEach(e=>{const t=e.get("fields").map(e=>e.get("name")).toArray();o=[...o,...t]}):o=[Yl(e,"title"),Yl(e,"shortTitle"),Yl(e,"author"),...r.map(t=>Ju[t]?Yl(e,"date"):t)];const i=o.filter(Boolean),a=await this.listAllEntries(e);return ln.filter(t,a,{extract:nc(Xt()(i))})}).map(e=>e.catch(e=>(n.push(e),[]))),o=await Promise.all(r).then(e=>Gt()(e));if(n.length>0)throw new Error({message:"Errors occurred while searching entries locally!",errors:n});const i=o.filter(({score:e})=>e>5).sort(rc).map(e=>e.original);return{entries:i}}async query(e,t,n,r,o){let i=await this.listAllEntries(e);r&&(i=i.filter(e=>e.slug===r));const a=function(e,t){const n=e.reduce((e,n)=>{const r=t.reduce((e,t)=>{const r=Xu({data:n.data,path:t});return e.push(...r),e},[]);for(let t=0;t<r.length;t++)e.push({...n,field:r[t]});return e},[]);return n}(i,t);let s=ln.filter(n,a,{extract:e=>tc(e.field,e)}).sort(rc).map(e=>e.original);void 0!==o&&o>0&&(s=s.slice(0,o));const l=function(e){const t=e.map(e=>e.field),n={},r=e.reduce((e,t)=>{if(!e[t.slug]){const{field:r,...o}=t;e[t.slug]=o,n[t.slug]=(0,Ge.Set)()}const r=t.field.split(".");let o=e[t.slug].data;for(let e=0;e<r.length;e++)if(o=o[r[e]],Array.isArray(o)){const o=r.slice(0,e+1).join(".");n[t.slug]=n[t.slug].add(o)}return e},{});return Object.keys(r).forEach(e=>{const o=r[e].data;for(const r of n[e].toArray()){const e=on()(o,r),n=e.filter((e,n)=>t.some(e=>`${e}.`.startsWith(`${r}.${n}.`)));n.sort((n,o)=>{const i=e.indexOf(n),a=e.indexOf(o),s=`${r}.${i}.`,l=`${r}.${a}.`,u=t.findIndex(e=>`${e}.`.startsWith(s)),c=t.findIndex(e=>`${e}.`.startsWith(l));return u-c}),sn()(o,r,n)}}),Object.values(r)}(s);return{query:n,hits:l}}traverseCursor(e,t){const[n,r]=e.unwrapData(),o=n.get("collection");return this.implementation.traverseCursor(r,t).then(async({entries:e,cursor:t})=>({entries:this.processEntries(e,o),cursor:cn.Cursor.create(t).wrapData({cursorType:"collectionEntries",collection:o})}))}async getLocalDraftBackup(e,t){const n=ec(e.get("name"),t),r=await cn.localForage.getItem(n);if(!r||!r.raw.trim())return{};const{raw:o,path:i}=r;let{mediaFiles:a=[]}=r;a=a.map(e=>e.file?{...e,url:URL.createObjectURL(e.file)}:e);const s=zl(e,t),l=n=>this.entryWithFormat(e)(oi(e.get("name"),t,i,{raw:n,label:s,mediaFiles:a,meta:{path:ic(i,e)}})),u=l(o);if(nu(e)&&r.i18n){const e=function(e,t){const n=Object.entries(e).reduce((e,[n,{raw:r}])=>{const o=t(r);return{...e,[n]:{data:o.data}}},{});return n}(r.i18n,l);u.i18n=e}return{entry:u}}async persistLocalDraftBackup(e,t){try{await this.backupSync.acquire();const n=ec(t.get("name"),e.get("slug")),r=this.entryToRaw(t,e);if(!r.trim())return;const o=await Promise.all(e.get("mediaFiles").toJS().map(async e=>{if(e.url?.startsWith("blob:")){const t=await fetch(e.url).then(e=>e.blob());return{...e,file:(0,cn.blobToFileObj)(e.name,t)}}return e}));let i;return nu(t)&&(i=function(e,t,n){const{locales:r,defaultLocale:o}=ru(e),i=r.filter(e=>e!==o).reduce((e,r)=>{const i=lu(r,o),a=t.getIn(i);if(!a)return e;const s=t.set("data",a);return{...e,[r]:{raw:n(s)}}},{});return i}(t,e,e=>this.entryToRaw(t,e))),await cn.localForage.setItem(n,{raw:r,path:e.get("path"),mediaFiles:o,...i&&{i18n:i}}),await cn.localForage.setItem(ec(),r)}catch(e){console.warn("persistLocalDraftBackup",e)}finally{this.backupSync.release()}}async deleteLocalDraftBackup(e,t){try{return await this.backupSync.acquire(),await cn.localForage.removeItem(ec(e.get("name"),t)),t&&await cn.localForage.removeItem(ec(e.get("name"))),await this.deleteAnonymousBackup()}catch(e){console.warn("deleteLocalDraftBackup",e)}finally{this.backupSync.release()}}deleteAnonymousBackup(){return cn.localForage.removeItem(ec())}async getEntry(e,t,n){const r=Ul(t,n),o=zl(t,n),i=Bl(t),a=async r=>{const i=await this.implementation.getEntry(r);let a=oi(t.get("name"),n,i.file.path,{raw:i.data,label:o,mediaFiles:[],meta:{path:ic(i.file.path,t)}});return a=this.entryWithFormat(t)(a),a=await this.processEntry(e,t,a),a};let s;return s=nu(t)?await async function(e,t,n,r,o){const{structure:i,locales:a,defaultLocale:s}=ru(e);let l;if(i===eu.SINGLE_FILE)l=hu(await o(n),s,a);else{const u=await Promise.allSettled(a.map(async e=>{const a=uu(i,t,n,r,e);return{value:await o(a),locale:e}})),c=u.map(e=>"fulfilled"===e.status?e.value:void 0).filter(e=>void 0!==e);if(0===c.length){const[e=new Error("No entry values found for any locale")]=u.map(e=>"rejected"===e.status?e.reason:void 0).filter(e=>void 0!==e);throw e}l=pu(e,i,s,c)}return l}(t,i,r,n,a):await a(r),s}getMedia(){return this.implementation.getMedia()}getMediaFile(e){return this.implementation.getMediaFile(e)}getMediaDisplayURL(e){if(this.implementation.getMediaDisplayURL)return this.implementation.getMediaDisplayURL(e);const t=new Error("getMediaDisplayURL is not implemented by the current backend, but the backend returned a displayURL which was not a string!");return t.displayURL=e,Promise.reject(t)}entryWithFormat(e){return t=>{const n=Ar(e,t);if(t&&void 0!==t.raw){const e=n&&Vt()(n.fromFile.bind(n,t.raw))||{};return Qt()(e)&&console.error(e),Object.assign(t,{data:Qt()(e)?{}:e})}return n.fromFile(t)}}async processUnpublishedEntry(e,t,n){const{slug:r}=t;let o;if(e.get("type")===ro){const t=e.get("files").find(e=>e?.get("name")===r);o=(0,fn.extname)(t.get("file"))}else o=Bl(e);const i=[];if(n){const n=t.diffs.filter(e=>!e.path.endsWith(o)),a=await Promise.all(n.map(t=>this.implementation.unpublishedEntryMediaFile(e.get("name"),r,t.path,t.id)));i.push(...a.map(e=>({...e,draft:!0})))}const a=nn()(t.diffs.filter(e=>e.path.endsWith(o)),e=>e.path.length),s=(n,o,a)=>{const s=oi(e.get("name"),r,o,{raw:n,isModification:!a,label:e&&zl(e,r),mediaFiles:i,updatedOn:t.updatedAt,author:t.pullRequestAuthor,status:t.status,meta:{path:ic(o,e)}});return this.entryWithFormat(e)(s)},l=async n=>{const r=await this.implementation.unpublishedEntryDataFile(e.get("name"),t.slug,n.path,n.id);return s(r,n.path,n.newFile)};if(a.length<=0){const t=await this.implementation.getEntry(Ul(e,r));return s(t.data,t.file.path,!1)}if(nu(e)){const t=Ul(e,r),n=function(e,t,n,r,o){const{structure:i}=ru(e);return i===eu.SINGLE_FILE?o:fu(e,t,n,r).reduce((e,t)=>{const n=o.find(e=>e.path===t);return n?[...e,n]:[...e,{path:t,id:"",newFile:!1}]},[])}(e,o,t,r,a);let i=await Promise.all(n.map(e=>l(e).catch(()=>null)));return i=i.filter(Boolean),(await gu(e,o,i))[0]}return await l(a[0])}async unpublishedEntries(e){const t=await this.implementation.unpublishedEntries(),n=(await Promise.all(t.map(async t=>{const n=await this.implementation.unpublishedEntry({id:t}),r=n.collection,o=e.find(e=>e.get("name")===r);return o?await this.processUnpublishedEntry(o,n,!1):(console.warn(`Missing collection '${r}' for unpublished entry '${t}'`),null)}))).filter(Boolean);return{pagination:0,entries:n}}async processEntry(e,t,n){const r=Pu(e.integrations,null,"assetStore"),o=function(e,t,n){const r=function(e,t){return e.has("folder")?Nl(e.get("fields").toArray()):e.has("files")?Nl($l(e,t)?.get("fields").toArray()||[]):[]}(t,n.get("slug")),o=r.map(r=>Ml(e,t,n,r));return t.has("files")&&$l(t,n.get("slug"))&&o.unshift(Ml(e,t,n,void 0)),t.has("media_folder")&&(t=t.delete("files"),o.unshift(Ml(e,t,n,void 0))),(0,Ge.Set)(o).toArray()}(e.config,t,(0,Ge.fromJS)(n));if(o.length>0&&!r){const e=await Promise.all(o.map(e=>this.implementation.getMedia(e)));n.mediaFiles=n.mediaFiles.concat(...e)}else n.mediaFiles=n.mediaFiles.concat(e.mediaLibrary.get("files")||[]);return n}async unpublishedEntry(e,t,n){const r=await this.implementation.unpublishedEntry({collection:t.get("name"),slug:n});let o=await this.processUnpublishedEntry(t,r,!0);return o=await this.processEntry(e,t,o),o}getDeploy(e,t,n){const r=this.config.site_url;if(r&&!1!==this.config.show_preview_links)return{url:Xo(r,e,t,n,this.config.slug),status:"SUCCESS"}}async getDeployPreview(e,t,n,{maxAttempts:r=1,interval:o=5e3,signal:i}={}){if(!this.implementation.getDeployPreview||!1===this.config.show_preview_links)return;let a,s=0;for(;!a&&s<r;){if(i?.aborted)return;s++,a=await this.implementation.getDeployPreview(e.get("name"),t),a||await new Promise(e=>setTimeout(()=>e(void 0),o))}return a?{url:Xo(a.url,e,t,n,this.config.slug),status:a.status?a.status.toUpperCase():""}:void 0}async persistEntry({config:e,collection:t,entryDraft:n,assetProxies:r,usedSlugs:o,unpublished:i=!1,status:a}){const s=await this.invokePreSaveEvent(n.get("entry"));let l;l=void 0===s.get("data")?s&&n.setIn(["entry","data"],s)||n:s&&n.setIn(["entry"],s)||n;const u=l.getIn(["entry","newRecord"])||!1,c=Gu(e),f=ss(t,l);let d;if(u){if(!function(e){return Ll[e.get("type")].allowNewEntries(e)}(t))throw new Error("Not allowed to create new entries in this collection");const n=await this.generateUniqueSlug(t,l.getIn(["entry","data"]),e,o,f),i=f||Ul(t,n);d={path:i,slug:n,raw:this.entryToRaw(t,l.get("entry"))},function(e,t,n,r,o){e.map(e=>{const i=e.path,a=Rl(t,n,r.get("entry").set("path",o),i,e.field);e.path=a})}(r,e,t,l,i)}else{const e=l.getIn(["entry","slug"]),n=l.getIn(["entry","path"]);d={path:n,slug:f&&!c?oc(t,f):e,raw:this.entryToRaw(t,l.get("entry")),newPath:f===n?void 0:f}}const{slug:p,path:h,newPath:g}=d;let m=[d];if(nu(t)){const e=Bl(t);m=function(e,t,n,r,o,i,a){const{structure:s,defaultLocale:l,locales:u}=ru(e);if(s===eu.SINGLE_FILE){const e=u.reduce((e,t)=>{const r=lu(t,l);return e.set(t,n.getIn(r))},(0,Ge.Map)({})),c=n.set("data",e);return[{path:uu(s,t,o,i,u[0]),slug:i,raw:r(c),...a&&{newPath:uu(s,t,a,i,u[0])}}]}return u.map(e=>{const u=lu(e,l),c=n.set("data",n.getIn(u));return{path:uu(s,t,o,i,e),slug:i,raw:c.get("data")?r(c):"",...a&&{newPath:uu(s,t,a,i,e)}}}).filter(e=>e.raw)}(t,e,l.get("entry"),e=>this.entryToRaw(t,e),h,p,g)}const y=await this.currentUser(),v={newEntry:u,commitMessage:Yo(u?"create":"update",e,{collection:t,slug:p,path:h,authorLogin:y.login,authorName:y.name,authorEmail:y.email},y.useOpenAuthoring),collectionName:t.get("name"),useWorkflow:c,unpublished:i,status:a};return c||await this.invokePrePublishEvent(l.get("entry")),await this.implementation.persistEntry({dataFiles:m,assets:r},v),await this.invokePostSaveEvent(l.get("entry")),c||await this.invokePostPublishEvent(l.get("entry")),p}async invokeEventWithEntry(e,t){const{login:n,name:r}=await this.currentUser();return await _r({name:e,data:{entry:t,author:{login:n,name:r}}})}async invokePrePublishEvent(e){await this.invokeEventWithEntry("prePublish",e)}async invokePostPublishEvent(e){await this.invokeEventWithEntry("postPublish",e)}async invokePreUnpublishEvent(e){await this.invokeEventWithEntry("preUnpublish",e)}async invokePostUnpublishEvent(e){await this.invokeEventWithEntry("postUnpublish",e)}async invokePreSaveEvent(e){return await this.invokeEventWithEntry("preSave",e)}async invokePostSaveEvent(e){await this.invokeEventWithEntry("postSave",e)}async persistMedia(e,t){const n=await this.currentUser(),r={commitMessage:Yo("uploadMedia",e,{path:t.path,authorLogin:n.login,authorName:n.name,authorEmail:n.email},n.useOpenAuthoring)};return this.implementation.persistMedia(t,r)}async deleteEntry(e,t,n){const r=e.config,o=Ul(t,n),i=Bl(t);if(!Wl(t))throw new Error("Not allowed to delete entries in this collection");const a=await this.currentUser(),s=Yo("delete",r,{collection:t,slug:n,path:o,authorLogin:a.login,authorName:a.name,authorEmail:a.email},a.useOpenAuthoring),l=xl(e.entries,t.get("name"),n);await this.invokePreUnpublishEvent(l);let u=[o];nu(t)&&(u=fu(t,i,o,n)),await this.implementation.deleteFiles(u,s),await this.invokePostUnpublishEvent(l)}async deleteMedia(e,t){const n=await this.currentUser(),r=Yo("deleteMedia",e,{path:t,authorLogin:n.login,authorName:n.name,authorEmail:n.email},n.useOpenAuthoring);return this.implementation.deleteFiles([t],r)}persistUnpublishedEntry(e){return this.persistEntry({...e,unpublished:!0})}updateUnpublishedEntryStatus(e,t,n){return this.implementation.updateUnpublishedEntryStatus(e,t,n)}async publishUnpublishedEntry(e){const t=e.get("collection"),n=e.get("slug");await this.invokePrePublishEvent(e),await this.implementation.publishUnpublishedEntry(t,n),await this.invokePostPublishEvent(e)}deleteUnpublishedEntry(e,t){return this.implementation.deleteUnpublishedEntry(e,t)}entryToRaw(e,t){const n=Ar(e,t.toJS()),r=this.fieldsOrder(e,t),o=function(e,t){let n=[];if(e.has("folder"))n=e.get("fields").toArray();else if(e.has("files")){const r=e.get("files").find(e=>e?.get("name")===t.get("slug"));n=r.get("fields").toArray()}const r={};return Hl(n).forEach(t=>{const n=Vl(e,t);n?.has("comment")&&(r[t]=n.get("comment"))}),r}(e,t);let i=n.toFile(t.get("data").toJS(),r,o);return"\n"!=i.slice(-1)&&(i+="\n"),i}fieldsOrder(e,t){if(e.get("fields"))return e.get("fields").map(e=>e.get("name")).toArray();const n=(e.get("files")||(0,Ge.List)()).filter(e=>e.get("name")===t.get("slug")).get(0);if(null==n)throw new Error(`No file found for ${t.get("slug")} in ${e.get("name")}`);return n.get("fields").map(e=>e.get("name")).toArray()}filterEntries(e,t){return e.entries.filter(e=>{const n=e.data[t.get("field")];return Array.isArray(n)?n.includes(t.get("value")):n===t.get("value")})}}function lc(e){if(!e.backend.name)throw new Error("No backend defined in configuration");const{name:t}=e.backend,n=new Zu,r=xr(t);if(r)return new sc(r,{backendName:t,authStore:n,config:e});throw new Error(`Backend not found: ${t}`)}const uc=function(){let e;return t=>e||(e=lc(t))}(),cc="AUTH_REQUEST",fc="AUTH_SUCCESS",dc="AUTH_FAILURE",pc="AUTH_REQUEST_DONE",hc="USE_OPEN_AUTHORING",gc="LOGOUT";function mc(){return{type:cc}}function yc(e){return{type:fc,payload:e}}function vc(e){return{type:dc,error:"Failed to authenticate",payload:e}}function bc(){return{type:hc}}function wc(){return(e,t)=>{const n=t(),r=uc(n.config);Promise.resolve(r.logout()).then(()=>{e({type:gc}),e({type:Ai})})}}const xc=Wt((e,t)=>{switch(t.type){case cc:e.isFetching=!0;break;case fc:e.user=t.payload;break;case dc:e.error=t.payload&&t.payload.toString();break;case pc:e.isFetching=!1;break;case gc:e.user=void 0,e.isFetching=!1}},{isFetching:!1,user:void 0,error:void 0});var Sc=__webpack_require__(62162),kc=__webpack_require__.n(Sc);const _c={isFetching:!1,term:"",collections:[],page:0,entryIds:[],queryHits:{},error:void 0,requests:[]},Ec=Wt((e,t)=>{switch(t.type){case vi:return _c;case di:{const{page:n,searchTerm:r,searchCollections:o}=t.payload;e.isFetching=!0,e.term=r,e.collections=o,e.page=n;break}case pi:{const{entries:n,page:r}=t.payload,o=n.map(e=>({collection:e.collection,slug:e.slug}));e.isFetching=!1,e.page=r,e.entryIds=!r||isNaN(r)||0===r?o:e.entryIds.concat(o);break}case hi:{const{error:n}=t.payload;e.isFetching=!1,e.error=n;break}case gi:{const{searchTerm:n,request:r}=t.payload;e.isFetching=!0,e.term=n,r&&e.requests.push(r);break}case bi:e.requests=e.requests.filter(e=>e.expires>=new Date);break;case mi:{const{namespace:n,hits:r}=t.payload;e.isFetching=!1,e.queryHits[n]=r;break}case yi:{const{error:n}=t.payload;e.isFetching=!1,e.error=n}}},_c),Cc=Ec;function Oc(e){return Object.values(e).some(e=>e.isLoading)}const Tc=Wt((e,t)=>{switch(t.type){case wa:t.payload.forEach(t=>{e[t.path]={asset:t,isLoading:!1,error:null}});break;case xa:{const n=t.payload;e[n.path]={asset:n,isLoading:!1,error:null};break}case Sa:{const n=t.payload;delete e[n];break}case ka:{const{path:n}=t.payload;e[n]=e[n]||{},e[n].isLoading=!0;break}case _a:{const{path:n}=t.payload;e[n]=e[n]||{},e[n].isLoading=!1,e[n].error=null;break}case Ea:{const{path:n,error:r}=t.payload;e[n]=e[n]||{},e[n].isLoading=!1,e[n].error=r}}},{}),Pc="DEPLOY_PREVIEW_REQUEST",Mc="DEPLOY_PREVIEW_SUCCESS",Rc="DEPLOY_PREVIEW_FAILURE";function Ac(e,t){return{type:Rc,payload:{collection:e,slug:t}}}const Ic=Wt((e,t)=>{switch(t.type){case Pc:{const{collection:n,slug:r}=t.payload;e[`${n}.${r}`]={isFetching:!0,status:"PENDING"};break}case Mc:{const{collection:n,slug:r,url:o,status:i}=t.payload,a=`${n}.${r}`;e[a].isFetching=!1,e[a].url=o,e[a].status=i;break}case Rc:{const{collection:n,slug:r}=t.payload,o=`${n}.${r}`;e[o].isFetching=!1,e[o].url=void 0,e[o].status="PENDING";break}}},{}),Dc=Ic,jc=["DEPLOY_PREVIEW","STATUS_REQUEST","STATUS_SUCCESS","STATUS_FAILURE"];function Lc(e){return jc.some(t=>e.type.includes(t))}const Nc=Wt((e,t)=>{!Lc(t)&&t.type.includes("REQUEST")?e.isFetching=!0:Lc(t)||!t.type.includes("SUCCESS")&&!t.type.includes("FAILURE")?t.type===hc&&(e.useOpenAuthoring=!0):e.isFetching=!1},{isFetching:!1,useOpenAuthoring:!1}),$c="STATUS_REQUEST",Fc="STATUS_SUCCESS",Bc="STATUS_FAILURE";function zc(e){return{type:Fc,payload:{status:e}}}const Uc=Wt((e,t)=>{switch(t.type){case $c:e.isFetching=!0;break;case Fc:e.isFetching=!1,e.status=t.payload.status;break;case Bc:e.isFetching=!1,e.error=t.payload.error}},{isFetching:!1,status:{auth:{status:!0},api:{status:!0,statusPage:""}},error:void 0}),qc=Wt((e,t)=>{switch(t.type){case Ai:e.notifications=[];break;case Ri:e.notifications=e.notifications.filter(e=>e.id!==t.id);break;case Mi:e.notifications=[...e.notifications,{id:Xr(),...t.payload}]}},{notifications:[]}),Wc={auth:xc,config:Yu,collections:function(e=jl,t){if(t.type===Ru){const e=t.payload.collections;let n=(0,Ge.OrderedMap)({});return e.forEach(e=>{n=n.set(e.name,(0,Ge.fromJS)(e))}),n}return e},search:Cc,integrations:function(e=Tu,t){return t.type===Ru?Ou(t.payload):e},entries:function(e=(0,Ge.Map)({entities:(0,Ge.Map)(),pages:(0,Ge.Map)(),sort:hl(),viewStyle:ml()}),t){switch(t.type){case ls:{const n=t.payload;return e.setIn(["entities",`${n.collection}.${n.slug}`,"isFetching"],!0)}case us:{const n=t.payload;return al=n.collection,cl=n.entry.slug,e.withMutations(e=>{e.setIn(["entities",`${al}.${cl}`],(0,Ge.fromJS)(n.entry));const t=e.getIn(["pages",al,"ids"],(0,Ge.List)());t.includes(cl)||e.setIn(["pages",al,"ids"],t.unshift(cl))})}case fs:{const n=t.payload,r=e.withMutations(e=>{e.setIn(["pages",n.collection,"isFetching"],!0)});return r}case ds:{const n=t.payload;return al=n.collection,sl=n.entries,ll=n.append,ul=n.page,e.withMutations(e=>{sl.forEach(t=>e.setIn(["entities",`${al}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1)));const t=(0,Ge.List)(sl.map(e=>e.slug));e.setIn(["pages",al],(0,Ge.Map)({page:ul,ids:ll?e.getIn(["pages",al,"ids"],(0,Ge.List)()).concat(t):t}))})}case ps:return e.setIn(["pages",t.meta.collection,"isFetching"],!1);case cs:{const n=t.payload;return e.withMutations(e=>{e.setIn(["entities",`${n.collection}.${n.slug}`,"isFetching"],!1),e.setIn(["entities",`${n.collection}.${n.slug}`,"error"],n.error.message)})}case pi:{const n=t.payload;return sl=n.entries,e.withMutations(e=>{sl.forEach(t=>e.setIn(["entities",`${t.collection}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1)))})}case js:{const n=t.payload;return e.withMutations(e=>{e.deleteIn(["entities",`${n.collectionName}.${n.entrySlug}`]),e.updateIn(["pages",n.collectionName,"ids"],e=>e.filter(e=>e!==n.entrySlug))})}case hs:{const n=t.payload,{collection:r,key:o,direction:i}=n,a=e.withMutations(e=>{const t=(0,Ge.OrderedMap)({[o]:(0,Ge.Map)({key:o,direction:i})});e.setIn(["sort",r],t),e.setIn(["pages",r,"isFetching"],!0),e.deleteIn(["pages",r,"page"])});return gl(a.get("sort")),a}case xs:case vs:case gs:{const n=t.payload,{collection:r,entries:o}=n;sl=o;const i=e.withMutations(e=>{sl.forEach(t=>e.setIn(["entities",`${t.collection}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1))),e.setIn(["pages",r,"isFetching"],!1);const t=(0,Ge.List)(sl.map(e=>e.slug));e.setIn(["pages",r],(0,Ge.Map)({page:1,ids:t}))});return i}case ms:{const n=t.payload,{collection:r,key:o}=n,i=e.withMutations(e=>{e.deleteIn(["sort",r,o]),e.setIn(["pages",r,"isFetching"],!1)});return gl(i.get("sort")),i}case ys:{const n=t.payload,{collection:r,filter:o}=n,i=e.withMutations(e=>{const t=e.getIn(["filter",r,o.id],(0,Ge.fromJS)(o));e.setIn(["filter",r,t.get("id")],t.set("active",!t.get("active")))});return i}case bs:{const n=t.payload,{collection:r,filter:o}=n,i=e.withMutations(e=>{e.deleteIn(["filter",r,o.id]),e.setIn(["pages",r,"isFetching"],!1)});return i}case ws:{const n=t.payload,{collection:r,group:o}=n,i=e.withMutations(e=>{const t=e.getIn(["group",r,o.id],(0,Ge.fromJS)(o));e.deleteIn(["group",r]),e.setIn(["group",r,t.get("id")],t.set("active",!t.get("active")))});return i}case Ss:{const n=t.payload,{collection:r,group:o}=n,i=e.withMutations(e=>{e.deleteIn(["group",r,o.id]),e.setIn(["pages",r,"isFetching"],!1)});return i}case $s:{const r=t.payload,{style:o}=r,i=e.withMutations(e=>{e.setIn(["viewStyle"],o)});return(n=i.get("viewStyle"))?localStorage.setItem(dl,n):localStorage.removeItem(dl),i}default:return e}var n},cursors:function(e=(0,Ge.fromJS)({cursorsByType:{collectionEntries:{}}}),t){switch(t.type){case ds:return e.setIn(["cursorsByType","collectionEntries",t.payload.collection],cn.Cursor.create(t.payload.cursor).store);case vs:case xs:case gs:return e.deleteIn(["cursorsByType","collectionEntries",t.payload.collection]);default:return e}},editorialWorkflow:function(e=(0,Ge.Map)(),t){switch(t.type){case Ru:return(t.payload&&t.payload.publish_mode)===Br?(0,Ge.Map)({entities:(0,Ge.Map)(),pages:(0,Ge.Map)()}):e;case La:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isFetching"],!0);case $a:return e.deleteIn(["entities",`${t.payload.collection}.${t.payload.slug}`]);case Na:return e.setIn(["entities",`${t.payload.collection}.${t.payload.entry.slug}`],(0,Ge.fromJS)(t.payload.entry));case Fa:return e.setIn(["pages","isFetching"],!0);case Ba:return e.withMutations(e=>{t.payload.entries.forEach(t=>e.setIn(["entities",`${t.collection}.${t.slug}`],(0,Ge.fromJS)(t).set("isFetching",!1))),e.set("pages",(0,Ge.Map)({...t.payload.pages,ids:(0,Ge.List)(t.payload.entries.map(e=>e.slug))}))});case za:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isPersisting"],!0);case Ua:return e.withMutations(e=>{e.setIn(["entities",`${t.payload.collection}.${t.payload.entry.get("slug")}`],(0,Ge.fromJS)(t.payload.entry)),e.deleteIn(["entities",`${t.payload.collection}.${t.payload.entry.get("slug")}`,"isPersisting"]),e.updateIn(["pages","ids"],(0,Ge.List)(),e=>e.push(t.payload.entry.get("slug")))});case qa:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isPersisting"],!1);case Wa:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isUpdatingStatus"],!0);case Ha:return e.withMutations(e=>{e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"status"],t.payload.newStatus),e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isUpdatingStatus"],!1)});case Va:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isUpdatingStatus"],!1);case Ka:return e.setIn(["entities",`${t.payload.collection}.${t.payload.slug}`,"isPublishing"],!0);case Ga:case Qa:return e.deleteIn(["entities",`${t.payload.collection}.${t.payload.slug}`]);default:return e}},entryDraft:function(e=(0,Ge.Map)(),t){switch(t.type){case ks:return e.withMutations(e=>{e.set("entry",(0,Ge.fromJS)(t.payload.entry)),e.setIn(["entry","newRecord"],!1),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!1),e.set("key",Xr())});case _s:return e.withMutations(e=>{e.set("entry",(0,Ge.fromJS)(t.payload)),e.setIn(["entry","newRecord"],!0),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!1),e.set("key",Xr())});case Ms:return e.withMutations(e=>{const t=e.get("localBackup").get("entry");e.delete("localBackup"),e.set("entry",t),e.setIn(["entry","newRecord"],!t.get("path")),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!0),e.set("key",Xr())});case Rs:return e.withMutations(e=>{e.set("entry",(0,Ge.fromJS)(t.payload)),e.setIn(["entry","newRecord"],!0),e.set("mediaFiles",(0,Ge.List)()),e.set("fieldsMetaData",(0,Ge.Map)()),e.set("fieldsErrors",(0,Ge.Map)()),e.set("hasChanged",!0)});case Es:return as;case Ps:{const{entry:n}=t.payload,r=new Ge.Map({entry:(0,Ge.fromJS)(n)});return e.set("localBackup",r)}case Cs:return e.withMutations(e=>{const{field:n,value:r,metadata:o,entries:i,i18n:a}=t.payload,s=n.get("name"),l=n.get("meta"),u=a&&lu(a.currentLocale,a.defaultLocale)||["data"];l?e.setIn(["entry","meta",s],r):(e.setIn(["entry",...u,s],r),a&&(e=mu(e,n,a.locales,a.defaultLocale))),e.mergeDeepIn(["fieldsMetaData"],(0,Ge.fromJS)(o));const c=e.getIn(["entry",...u]),f=e.getIn(["entry","meta"]);e.set("hasChanged",!i.some(e=>c.equals(e.get(...u)))||!i.some(e=>f.equals(e.get("meta"))))});case Os:return 0===t.payload.errors.length?e.deleteIn(["fieldsErrors",t.payload.uniquefieldId]):e.setIn(["fieldsErrors",t.payload.uniquefieldId],t.payload.errors);case Ts:{const{uniqueFieldId:n}=t.payload;return e.deleteIn(["fieldsErrors",n])}case As:case za:return e.setIn(["entry","isPersisting"],!0);case Ds:case qa:return e.deleteIn(["entry","isPersisting"]);case Wa:return e.setIn(["entry","isUpdatingStatus"],!0);case Va:case Ha:return e.deleteIn(["entry","isUpdatingStatus"]);case Ka:return e.setIn(["entry","isPublishing"],!0);case Ga:case Ya:return e.deleteIn(["entry","isPublishing"]);case Is:case Ua:return e.withMutations(e=>{e.deleteIn(["entry","isPersisting"]),e.set("hasChanged",!1),e.getIn(["entry","slug"])||e.setIn(["entry","slug"],t.payload.slug)});case js:return e.withMutations(e=>{e.deleteIn(["entry","isPersisting"]),e.set("hasChanged",!1)});case Ls:return e.withMutations(e=>{const n=e.getIn(["entry","mediaFiles"]);e.setIn(["entry","mediaFiles"],n.filterNot(e=>e.get("id")===t.payload.id).insert(0,(0,Ge.fromJS)(t.payload))),e.set("hasChanged",!0)});case Ns:return e.withMutations(e=>{const n=e.getIn(["entry","mediaFiles"]);e.setIn(["entry","mediaFiles"],n.filterNot(e=>e.get("id")===t.payload.id)),e.set("hasChanged",!0)});default:return e}},medias:Tc,mediaLibrary:function(e=(0,Ge.Map)(ya),t){switch(t.type){case Ni:return e.withMutations(e=>{e.set("externalLibrary",t.payload),e.set("showMediaButton",t.payload.enableStandalone())});case ji:{const{controlID:n,forImage:r,privateUpload:o,config:i,field:a,value:s,replaceIndex:l}=t.payload,u=i||(0,Ge.Map)();return e.get("privateUpload")!==o?(0,Ge.Map)({isVisible:!0,forImage:r,controlID:n,canInsert:!!n,privateUpload:o,config:u,controlMedia:(0,Ge.Map)(),displayURLs:(0,Ge.Map)(),field:a,value:s,replaceIndex:l}):e.withMutations(e=>{e.set("isVisible",!0),e.set("forImage",r??!1),e.set("controlID",n??""),e.set("canInsert",!!n),e.set("privateUpload",o),e.set("config",u),e.set("field",a??""),e.set("value",""==s&&u.get("multiple")?[]:s??""),e.set("replaceIndex",l??!1)})}case Li:return e.set("isVisible",!1);case $i:{const{mediaPath:n}=t.payload,r=e.get("controlID"),o=e.get("value");if(!Array.isArray(o))return e.withMutations(e=>{e.setIn(["controlMedia",r],n)});const i=e.get("replaceIndex"),a=Array.isArray(n)?n:[n],s=o;return"number"==typeof i?s[i]=a[0]:s.push(...a),e.withMutations(e=>{e.setIn(["controlMedia",r],s)})}case Fi:{const n=t.payload.controlID;return e.setIn(["controlMedia",n],"")}case Bi:return e.withMutations(e=>{e.set("isLoading",!0),e.set("isPaginating",t.payload.page>1)});case zi:{const{files:n=[],page:r,canPaginate:o,dynamicSearch:i,dynamicSearchQuery:a,privateUpload:s}=t.payload;if(e.get("privateUpload")!==s)return e;const l=n.map(e=>({...e,key:Xr()}));return e.withMutations(e=>{if(e.set("isLoading",!1),e.set("isPaginating",!1),e.set("page",r??1),e.set("hasNextPage",!!(o&&n.length>0)),e.set("dynamicSearch",i??!1),e.set("dynamicSearchQuery",a??""),e.set("dynamicSearchActive",!!a),r&&r>1){const t=e.get("files").concat(l);e.set("files",t)}else e.set("files",l)})}case Ui:return e.get("privateUpload")!==t.payload.privateUpload?e:e.set("isLoading",!1);case qi:return e.set("isPersisting",!0);case Wi:{const{file:n,privateUpload:r}=t.payload;return e.get("privateUpload")!==r?e:e.withMutations(e=>{const t=[{...n,key:Xr()},...e.get("files")];e.set("files",t),e.set("isPersisting",!1)})}case Hi:return e.get("privateUpload")!==t.payload.privateUpload?e:e.set("isPersisting",!1);case Vi:return e.set("isDeleting",!0);case Ki:{const{file:n,privateUpload:r}=t.payload,{key:o,id:i}=n;return e.get("privateUpload")!==r?e:e.withMutations(e=>{const t=e.get("files").filter(e=>o?e.key!==o:e.id!==i);e.set("files",t),e.deleteIn(["displayURLs",i]),e.set("isDeleting",!1)})}case Gi:return e.get("privateUpload")!==t.payload.privateUpload?e:e.set("isDeleting",!1);case Yi:return e.setIn(["displayURLs",t.payload.key,"isFetching"],!0);case Qi:{const n=["displayURLs",t.payload.key];return e.setIn([...n,"isFetching"],!1).setIn([...n,"url"],t.payload.url)}case Ji:{const n=["displayURLs",t.payload.key];return e.setIn([...n,"isFetching"],!1).setIn([...n,"err"],t.payload.err||!0).deleteIn([...n,"url"])}default:return e}},deploys:Dc,globalUI:Nc,status:Uc,notifications:qc};function Hc(e,t,n){return xl(e.entries,t,n)}function Vc(e,t){return Sl(e.entries,t)}function Kc(e,t,n){return function(e,t,n){return e[`${t}.${n}`]}(e.deploys,t,n)}function Gc(e,t,n){return function(e,t,n){return e&&e.getIn(["entities",`${t}.${n}`])}(e.editorialWorkflow,t,n)}function Yc(e,t){return function(e,t){return e?e.get("entities").filter(e=>e.get("status")===t).valueSeq():null}(e.editorialWorkflow,t)}function Qc(e,t,n){return Pu(e.integrations,t,n)}const Jc=(0,Ue.y$)((0,Ue.HY)({...Wc}),(0,qe.tY)((0,Ue.Tw)(Ve,({dispatch:e,getState:t})=>{let n=[];return r=>o=>{if(o.type===Ke)return n.push(o),null;const i=r(o);return function(r){const o=[],i=[];for(const e of n)e.predicate(r)?o.push(e):i.push(e);n=i;for(const n of o)n.run(e,t,r)}(o),i}})));var Xc=__webpack_require__(82451),Zc=__webpack_require__.n(Xc);function ef(e){return Zc()({},Er("en"),Er(e))}function tf(e){var t=null;return function(){return null==t&&(t=e()),t}}function nf(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,r.key,r)}}function rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var of=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rf(this,"entered",[]),rf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}var t,n;return t=e,n=[{key:"enter",value:function(e){var t=this,n=this.entered.length;return this.entered=function(e,t){var n=new Set,r=function(e){return n.add(e)};e.forEach(r),t.forEach(r);var o=[];return n.forEach(function(e){return o.push(e)}),o}(this.entered.filter(function(n){return t.isNodeInDocument(n)&&(!n.contains||n.contains(e))}),[e]),0===n&&this.entered.length>0}},{key:"leave",value:function(e){var t,n,r=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),n=e,t.filter(function(e){return e!==n})),r>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}],n&&nf(t.prototype,n),e}(),af=tf(function(){return/firefox/i.test(navigator.userAgent)}),sf=tf(function(){return Boolean(window.safari)});function lf(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,r.key,r)}}function uf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cf=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),uf(this,"xs",void 0),uf(this,"ys",void 0),uf(this,"c1s",void 0),uf(this,"c2s",void 0),uf(this,"c3s",void 0);for(var r=t.length,o=[],i=0;i<r;i++)o.push(i);o.sort(function(e,n){return t[e]<t[n]?-1:1});for(var a,s,l=[],u=[],c=[],f=0;f<r-1;f++)a=t[f+1]-t[f],s=n[f+1]-n[f],u.push(a),l.push(s),c.push(s/a);for(var d=[c[0]],p=0;p<u.length-1;p++){var h=c[p],g=c[p+1];if(h*g<=0)d.push(0);else{a=u[p];var m=u[p+1],y=a+m;d.push(3*y/((y+m)/h+(y+a)/g))}}d.push(c[c.length-1]);for(var v,b=[],w=[],x=0;x<d.length-1;x++){v=c[x];var S=d[x],k=1/u[x],_=S+d[x+1]-v-v;b.push((v-S-_)*k),w.push(_*k*k)}this.xs=t,this.ys=n,this.c1s=d,this.c2s=b,this.c3s=w}var t,n;return t=e,n=[{key:"interpolate",value:function(e){var t=this.xs,n=this.ys,r=this.c1s,o=this.c2s,i=this.c3s,a=t.length-1;if(e===t[a])return n[a];for(var s,l=0,u=i.length-1;l<=u;){var c=t[s=Math.floor(.5*(l+u))];if(c<e)l=s+1;else{if(!(c>e))return n[s];u=s-1}}var f=e-t[a=Math.max(0,u)],d=f*f;return n[a]+r[a]*f+o[a]*d+i[a]*f*d}}],n&&lf(t.prototype,n),e}();function ff(e){var t=1===e.nodeType?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function df(e){return{x:e.clientX,y:e.clientY}}var pf,hf="__NATIVE_FILE__",gf="__NATIVE_URL__",mf="__NATIVE_TEXT__",yf="__NATIVE_HTML__";function vf(e,t,n){var r=t.reduce(function(t,n){return t||e.getData(n)},"");return null!=r?r:n}function bf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wf=(bf(pf={},hf,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),bf(pf,yf,{exposeProperties:{html:function(e,t){return vf(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),bf(pf,gf,{exposeProperties:{urls:function(e,t){return vf(e,t,"").split("\n")},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),bf(pf,mf,{exposeProperties:{text:function(e,t){return vf(e,t,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),pf);function xf(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,r.key,r)}}function Sf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kf=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Sf(this,"item",void 0),Sf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}var t,n;return t=e,(n=[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(t,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var t=this;if(e){var n={};Object.keys(this.config.exposeProperties).forEach(function(r){n[r]={value:t.config.exposeProperties[r](e,t.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,n)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,t){return t===e.getSourceId()}},{key:"endDrag",value:function(){}}])&&xf(t.prototype,n),e}();function _f(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(wf).filter(function(e){return wf[e].matchesTypes.some(function(e){return t.indexOf(e)>-1})})[0]||null}function Ef(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,r.key,r)}}function Cf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Of=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Cf(this,"ownerDocument",null),Cf(this,"globalContext",void 0),Cf(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=n}var t,n;return t=e,(n=[{key:"window",get:function(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}},{key:"document",get:function(){var e;return null!==(e=this.globalContext)&&void 0!==e&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}}])&&Ef(t.prototype,n),e}();function Tf(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 Pf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tf(Object(n),!0).forEach(function(t){Rf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mf(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,r.key,r)}}function Rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Af=function(){function t(e,n,r){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Rf(this,"options",void 0),Rf(this,"actions",void 0),Rf(this,"monitor",void 0),Rf(this,"registry",void 0),Rf(this,"enterLeaveCounter",void 0),Rf(this,"sourcePreviewNodes",new Map),Rf(this,"sourcePreviewNodeOptions",new Map),Rf(this,"sourceNodes",new Map),Rf(this,"sourceNodeOptions",new Map),Rf(this,"dragStartSourceIds",null),Rf(this,"dropTargetIds",[]),Rf(this,"dragEnterTargetIds",[]),Rf(this,"currentNativeSource",null),Rf(this,"currentNativeHandle",null),Rf(this,"currentDragSourceNode",null),Rf(this,"altKeyPressed",!1),Rf(this,"mouseMoveTimeoutTimer",null),Rf(this,"asyncEndDragFrameId",null),Rf(this,"dragOverTargetIds",null),Rf(this,"lastClientOffset",null),Rf(this,"hoverRafId",null),Rf(this,"getSourceClientOffset",function(e){var t=o.sourceNodes.get(e);return t&&ff(t)||null}),Rf(this,"endDragNativeItem",function(){o.isDraggingNativeItem()&&(o.actions.endDrag(),o.currentNativeHandle&&o.registry.removeSource(o.currentNativeHandle),o.currentNativeHandle=null,o.currentNativeSource=null)}),Rf(this,"isNodeInDocument",function(e){return Boolean(e&&o.document&&o.document.body&&o.document.body.contains(e))}),Rf(this,"endDragIfSourceWasRemovedFromDOM",function(){var e=o.currentDragSourceNode;null==e||o.isNodeInDocument(e)||o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()}),Rf(this,"handleTopDragStartCapture",function(){o.clearCurrentDragSourceNode(),o.dragStartSourceIds=[]}),Rf(this,"handleTopDragStart",function(e){if(!e.defaultPrevented){var t=o.dragStartSourceIds;o.dragStartSourceIds=null;var n=df(e);o.monitor.isDragging()&&o.actions.endDrag(),o.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:o.getSourceClientOffset,clientOffset:n});var r=e.dataTransfer,i=_f(r);if(o.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){var a=o.monitor.getSourceId(),s=o.sourceNodes.get(a),l=o.sourcePreviewNodes.get(a)||s;if(l){var u=o.getCurrentSourcePreviewNodeOptions(),c=function(e,t,n,r,o){var i,a,s="IMG"===(i=t).nodeName&&(af()||!(null!==(a=document.documentElement)&&void 0!==a&&a.contains(i))),l=ff(s?e:t),u={x:n.x-l.x,y:n.y-l.y},c=e.offsetWidth,f=e.offsetHeight,d=r.anchorX,p=r.anchorY,h=function(e,t,n,r){var o=e?t.width:n,i=e?t.height:r;return sf()&&e&&(i/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:i}}(s,t,c,f),g=h.dragPreviewWidth,m=h.dragPreviewHeight,y=o.offsetX,v=o.offsetY,b=0===v||v;return{x:0===y||y?y:new cf([0,.5,1],[u.x,u.x/c*g,u.x+g-c]).interpolate(d),y:b?v:function(){var e=new cf([0,.5,1],[u.y,u.y/f*m,u.y+m-f]).interpolate(p);return sf()&&s&&(e+=(window.devicePixelRatio-1)*m),e}()}}(s,l,n,{anchorX:u.anchorX,anchorY:u.anchorY},{offsetX:u.offsetX,offsetY:u.offsetY});r.setDragImage(l,c.x,c.y)}}try{null==r||r.setData("application/json",{})}catch(e){}o.setCurrentDragSourceNode(e.target),o.getCurrentSourcePreviewNodeOptions().captureDraggingState?o.actions.publishDragSource():setTimeout(function(){return o.actions.publishDragSource()},0)}else if(i)o.beginDragNativeItem(i);else{if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}}),Rf(this,"handleTopDragEndCapture",function(){o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()}),Rf(this,"handleTopDragEnterCapture",function(e){if(o.dragEnterTargetIds=[],o.enterLeaveCounter.enter(e.target)&&!o.monitor.isDragging()){var t=e.dataTransfer,n=_f(t);n&&o.beginDragNativeItem(n,t)}}),Rf(this,"handleTopDragEnter",function(e){var t=o.dragEnterTargetIds;o.dragEnterTargetIds=[],o.monitor.isDragging()&&(o.altKeyPressed=e.altKey,t.length>0&&o.actions.hover(t,{clientOffset:df(e)}),t.some(function(e){return o.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())))}),Rf(this,"handleTopDragOverCapture",function(){o.dragOverTargetIds=[]}),Rf(this,"handleTopDragOver",function(e){var t=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));o.altKeyPressed=e.altKey,o.lastClientOffset=df(e),null===o.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(o.hoverRafId=requestAnimationFrame(function(){o.monitor.isDragging()&&o.actions.hover(t||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null})),(t||[]).some(function(e){return o.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))}),Rf(this,"handleTopDragLeaveCapture",function(e){o.isDraggingNativeItem()&&e.preventDefault(),o.enterLeaveCounter.leave(e.target)&&o.isDraggingNativeItem()&&setTimeout(function(){return o.endDragNativeItem()},0)}),Rf(this,"handleTopDropCapture",function(e){var t;o.dropTargetIds=[],o.isDraggingNativeItem()?(e.preventDefault(),null===(t=o.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):_f(e.dataTransfer)&&e.preventDefault(),o.enterLeaveCounter.reset()}),Rf(this,"handleTopDrop",function(e){var t=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(t,{clientOffset:df(e)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()}),Rf(this,"handleSelectStart",function(e){var t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))}),this.options=new Of(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new of(this.isNodeInDocument)}var n,r;return n=t,(r=[{key:"profile",value:function(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,t=this.rootElement;void 0!==t&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(e=this.window)||void 0===e||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,t,n){var r=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){r.sourcePreviewNodes.delete(e),r.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,t,n){var r=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);var o=function(t){return r.handleDragStart(t,e)},i=function(e){return r.handleSelectStart(e)};return t.setAttribute("draggable","true"),t.addEventListener("dragstart",o),t.addEventListener("selectstart",i),function(){r.sourceNodes.delete(e),r.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",o),t.removeEventListener("selectstart",i),t.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,t){var n=this,r=function(t){return n.handleDragEnter(t,e)},o=function(t){return n.handleDragOver(t,e)},i=function(t){return n.handleDrop(t,e)};return t.addEventListener("dragenter",r),t.addEventListener("dragover",o),t.addEventListener("drop",i),function(){t.removeEventListener("dragenter",r),t.removeEventListener("dragover",o),t.removeEventListener("drop",i)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return Pf({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return Pf({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var t=this.monitor.getItemType();return Object.keys(e).some(function(n){return e[n]===t})}},{key:"beginDragNativeItem",value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){var n=new kf(wf[e]);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var e;return null===(e=t.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",t.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}},{key:"handleDragStart",value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}},{key:"handleDragEnter",value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:"handleDragOver",value:function(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:"handleDrop",value:function(e,t){this.dropTargetIds.unshift(t)}}])&&Mf(n.prototype,r),t}(),If=function(e,t,n){return new Af(e,t,n)};function Df(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(i=new Error(t.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw i.framesToPop=1,i}}function jf(e,t,n){var r=n.getRegistry(),o=r.addTarget(e,t);return[o,function(){return r.removeTarget(o)}]}function Lf(e,t,n){var r=n.getRegistry(),o=r.addSource(e,t);return[o,function(){return r.removeSource(o)}]}function Nf(e){var t={};return Object.keys(e).forEach(function(r){var o=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var i=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(0,n.isValidElement)(t)){var o=t;return e(o,r),o}var i=t;!function(e){if("string"!=typeof e.type){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}(i);var a=r?function(t){return e(t,r)}:e;return function(e,t){var r=e.ref;return Df("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,n.cloneElement)(e,{ref:function(e){$f(r,e),$f(t,e)}}):(0,n.cloneElement)(e,{ref:t})}(i,a)}}(o);t[r]=function(){return i}}}),t}function $f(e,t){"function"==typeof e?e(t):e.current=t}function Ff(e){return Ff="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},Ff(e)}function Bf(e){return null!==e&&"object"===Ff(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function zf(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!s(u))return!1;var c=e[u],f=t[u];if(!1===(o=n?n.call(r,c,f,u):void 0)||void 0===o&&c!==f)return!1}return!0}function Uf(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,r.key,r)}}function qf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wf=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qf(this,"hooks",Nf({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,Bf(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,Bf(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),qf(this,"handlerId",null),qf(this,"dragSourceRef",null),qf(this,"dragSourceNode",void 0),qf(this,"dragSourceOptionsInternal",null),qf(this,"dragSourceUnsubscribe",void 0),qf(this,"dragPreviewRef",null),qf(this,"dragPreviewNode",void 0),qf(this,"dragPreviewOptionsInternal",null),qf(this,"dragPreviewUnsubscribe",void 0),qf(this,"lastConnectedHandlerId",null),qf(this,"lastConnectedDragSource",null),qf(this,"lastConnectedDragSourceOptions",null),qf(this,"lastConnectedDragPreview",null),qf(this,"lastConnectedDragPreviewOptions",null),qf(this,"backend",void 0),this.backend=t}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();t&&this.disconnectDragPreview(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!zf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!zf(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}])&&Uf(t.prototype,n),e}();function Hf(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,r.key,r)}}function Vf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Kf=!1,Gf=!1,Yf=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Vf(this,"internalMonitor",void 0),Vf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){Df(!Kf,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Kf=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Kf=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;Df(!Gf,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Gf=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Gf=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&Hf(t.prototype,n),e}();function Qf(e){return Qf="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},Qf(e)}function Jf(e){var t=e.current;return null==t?null:t.decoratedRef?t.decoratedRef.current:t}function Xf(e){return"function"==typeof e}function Zf(){}function ed(e){if(!function(e){return"object"===Qf(e)&&null!==e}(e))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function td(e,t){return"string"==typeof e||"symbol"===Qf(e)||!!t&&Array.isArray(e)&&e.every(function(e){return td(e,!1)})}var nd=__webpack_require__(31085),rd=(0,n.createContext)({dragDropManager:void 0});function od(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function id(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,r.key,r)}}function ad(e,t,n){return t&&id(e.prototype,t),n&&id(e,n),e}function sd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ld=function(){function e(t){od(this,e),sd(this,"isDisposed",!1),sd(this,"action",void 0),this.action=Xf(t)?t:Zf}return ad(e,[{key:"dispose",value:function(){this.isDisposed||(this.action(),this.isDisposed=!0)}}],[{key:"isDisposable",value:function(e){return Boolean(e&&Xf(e.dispose))}},{key:"_fixup",value:function(t){return e.isDisposable(t)?t:e.empty}},{key:"create",value:function(t){return new e(t)}}]),e}();sd(ld,"empty",{dispose:Zf});var ud=function(){function e(){od(this,e),sd(this,"isDisposed",!1),sd(this,"disposables",void 0);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.disposables=n}return ad(e,[{key:"add",value:function(e){this.isDisposed?e.dispose():this.disposables.push(e)}},{key:"remove",value:function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),e.dispose())}return t}},{key:"clear",value:function(){if(!this.isDisposed){for(var e=this.disposables.length,t=new Array(e),n=0;n<e;n++)t[n]=this.disposables[n];this.disposables=[];for(var r=0;r<e;r++)t[r].dispose()}}},{key:"dispose",value:function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;n<e;n++)t[n]=this.disposables[n];this.disposables=[];for(var r=0;r<e;r++)t[r].dispose()}}}]),e}(),cd=function(){function e(){od(this,e),sd(this,"isDisposed",!1),sd(this,"current",void 0)}return ad(e,[{key:"getDisposable",value:function(){return this.current}},{key:"setDisposable",value:function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e,n&&n.dispose()}t&&e&&e.dispose()}},{key:"dispose",value:function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=void 0,e&&e.dispose()}}}]),e}();function fd(e){return fd="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},fd(e)}function dd(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 pd(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,r.key,r)}}function hd(e,t){return hd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},hd(e,t)}function gd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function md(e){return md=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},md(e)}function yd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vd(e){var t=e.DecoratedComponent,r=e.createHandler,o=e.createMonitor,i=e.createConnector,a=e.registerHandler,s=e.containerDisplayName,l=e.getType,u=e.collect,c=e.options.arePropsEqual,f=void 0===c?zf:c,d=t,p=t.displayName||t.name||"Component",h=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}}),t&&hd(e,t)}(m,e);var t,s,c,h,g=(c=m,h=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=md(c);if(h){var n=md(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===fd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return gd(e)}(this,e)});function m(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,m),yd(gd(t=g.call(this,e)),"decoratedRef",(0,n.createRef)()),yd(gd(t),"handlerId",void 0),yd(gd(t),"manager",void 0),yd(gd(t),"handlerMonitor",void 0),yd(gd(t),"handlerConnector",void 0),yd(gd(t),"handler",void 0),yd(gd(t),"disposable",void 0),yd(gd(t),"currentType",void 0),yd(gd(t),"handleChange",function(){var e=t.getCurrentState();zf(e,t.state)||t.setState(e)}),t.disposable=new cd,t.receiveProps(e),t.dispose(),t}return t=m,s=[{key:"getHandlerId",value:function(){return this.handlerId}},{key:"getDecoratedComponentInstance",value:function(){return Df(this.decoratedRef.current,"In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()"),this.decoratedRef.current}},{key:"shouldComponentUpdate",value:function(e,t){return!f(e,this.props)||!zf(t,this.state)}},{key:"componentDidMount",value:function(){this.disposable=new cd,this.currentType=void 0,this.receiveProps(this.props),this.handleChange()}},{key:"componentDidUpdate",value:function(e){f(this.props,e)||(this.receiveProps(this.props),this.handleChange())}},{key:"componentWillUnmount",value:function(){this.dispose()}},{key:"receiveProps",value:function(e){this.handler&&(this.handler.receiveProps(e),this.receiveType(l(e)))}},{key:"receiveType",value:function(e){if(this.handlerMonitor&&this.manager&&this.handlerConnector&&e!==this.currentType){this.currentType=e;var t=function(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dd(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)?dd(e,t):void 0}}(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.")}()}(a(e,this.handler,this.manager),2),n=t[0],r=t[1];this.handlerId=n,this.handlerMonitor.receiveHandlerId(n),this.handlerConnector.receiveHandlerId(n);var o=this.manager.getMonitor().subscribeToStateChange(this.handleChange,{handlerIds:[n]});this.disposable.setDisposable(new ud(new ld(o),new ld(r)))}}},{key:"dispose",value:function(){this.disposable.dispose(),this.handlerConnector&&this.handlerConnector.receiveHandlerId(null)}},{key:"getCurrentState",value:function(){return this.handlerConnector?u(this.handlerConnector.hooks,this.handlerMonitor,this.props):{}}},{key:"render",value:function(){var e=this;return(0,nd.jsx)(rd.Consumer,{children:function(t){var n,r,o=t.dragDropManager;return e.receiveDragDropManager(o),"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(function(){var t;return null===(t=e.handlerConnector)||void 0===t?void 0:t.reconnect()}),(0,nd.jsx)(d,Object.assign({},e.props,e.getCurrentState(),{ref:(n=d,(r=n)&&r.prototype&&"function"==typeof r.prototype.render||function(e){var t;return"Symbol(react.forward_ref)"===(null==e||null===(t=e.$$typeof)||void 0===t?void 0:t.toString())}(n)?e.decoratedRef:null)}),void 0)}},void 0)}},{key:"receiveDragDropManager",value:function(e){void 0===this.manager&&(Df(void 0!==e,"Could not find the drag and drop manager in the context of %s. Make sure to render a DndProvider component in your top-level component. Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context",p,p),void 0!==e&&(this.manager=e,this.handlerMonitor=o(e),this.handlerConnector=i(e.getBackend()),this.handler=r(this.handlerMonitor,this.decoratedRef)))}}],s&&pd(t.prototype,s),m}(n.Component);return yd(h,"DecoratedComponent",t),yd(h,"displayName","".concat(s,"(").concat(p,")")),y()(h,t)}function bd(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,r.key,r)}}function wd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xd=["canDrag","beginDrag","isDragging","endDrag"],Sd=["beginDrag"],kd=function(){function e(t,n,r){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),wd(this,"props",null),wd(this,"spec",void 0),wd(this,"monitor",void 0),wd(this,"ref",void 0),wd(this,"beginDrag",function(){if(o.props)return o.spec.beginDrag(o.props,o.monitor,o.ref.current)}),this.spec=t,this.monitor=n,this.ref=r}var t,n;return t=e,(n=[{key:"receiveProps",value:function(e){this.props=e}},{key:"canDrag",value:function(){return!!this.props&&(!this.spec.canDrag||this.spec.canDrag(this.props,this.monitor))}},{key:"isDragging",value:function(e,t){return!!this.props&&(this.spec.isDragging?this.spec.isDragging(this.props,this.monitor):t===e.getSourceId())}},{key:"endDrag",value:function(){this.props&&this.spec.endDrag&&this.spec.endDrag(this.props,this.monitor,Jf(this.ref))}}])&&bd(t.prototype,n),e}();function _d(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,r.key,r)}}function Ed(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Cd=!1,Od=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ed(this,"internalMonitor",void 0),Ed(this,"targetId",null),this.internalMonitor=t.getMonitor()}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;Df(!Cd,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Cd=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Cd=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&_d(t.prototype,n),e}();function Td(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,r.key,r)}}function Pd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Md=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pd(this,"hooks",Nf({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,Bf(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),Pd(this,"handlerId",null),Pd(this,"dropTargetRef",null),Pd(this,"dropTargetNode",void 0),Pd(this,"dropTargetOptionsInternal",null),Pd(this,"unsubscribeDropTarget",void 0),Pd(this,"lastConnectedHandlerId",null),Pd(this,"lastConnectedDropTarget",null),Pd(this,"lastConnectedDropTargetOptions",null),Pd(this,"backend",void 0),this.backend=t}var t,n;return t=e,(n=[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!zf(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}])&&Td(t.prototype,n),e}();function Rd(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,r.key,r)}}function Ad(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Id=["canDrop","hover","drop"],Dd=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ad(this,"props",null),Ad(this,"spec",void 0),Ad(this,"monitor",void 0),Ad(this,"ref",void 0),this.spec=t,this.monitor=n,this.ref=r}var t,n;return t=e,(n=[{key:"receiveProps",value:function(e){this.props=e}},{key:"receiveMonitor",value:function(e){this.monitor=e}},{key:"canDrop",value:function(){return!this.spec.canDrop||this.spec.canDrop(this.props,this.monitor)}},{key:"hover",value:function(){this.spec.hover&&this.props&&this.spec.hover(this.props,this.monitor,Jf(this.ref))}},{key:"drop",value:function(){if(this.spec.drop)return this.spec.drop(this.props,this.monitor,this.ref.current)}}])&&Rd(t.prototype,n),e}();var jd="dnd-core/INIT_COORDS",Ld="dnd-core/BEGIN_DRAG",Nd="dnd-core/PUBLISH_DRAG_SOURCE",$d="dnd-core/HOVER",Fd="dnd-core/DROP",Bd="dnd-core/END_DRAG";function zd(e,t){return{type:jd,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Ud(e){return Ud="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},Ud(e)}function qd(e){return"object"===Ud(e)}var Wd={type:jd,payload:{clientOffset:null,sourceClientOffset:null}};function Hd(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},r=n.publishSource,o=void 0===r||r,i=n.clientOffset,a=n.getSourceClientOffset,s=e.getMonitor(),l=e.getRegistry();e.dispatch(zd(i)),function(e,t,n){Df(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){Df(n.getSource(e),"Expected sourceIds to be registered.")})}(t,s,l);var u=function(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}(t,s);if(null!==u){var c=null;if(i){if(!a)throw new Error("getSourceClientOffset must be defined");!function(e){Df("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(a),c=a(u)}e.dispatch(zd(i,c));var f=l.getSource(u).beginDrag(s,u);if(null!=f){!function(e){Df(qd(e),"Item must be an object.")}(f),l.pinSource(u);var d=l.getSourceType(u);return{type:Ld,payload:{itemType:d,item:f,sourceId:u,clientOffset:i||null,sourceClientOffset:c||null,isSourcePublic:!!o}}}}else e.dispatch(Wd)}}function Vd(e){return function(){if(e.getMonitor().isDragging())return{type:Nd}}}function Kd(e,t){return null===t?null===e:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Gd(e){return function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).clientOffset;!function(e){Df(Array.isArray(e),"Expected targetIds to be an array.")}(t);var r=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(e,t,n){Df(t.isDragging(),"Cannot call hover while not dragging."),Df(!t.didDrop(),"Cannot call hover after drop.");for(var r=0;r<e.length;r++){var o=e[r];Df(e.lastIndexOf(o)===r,"Expected targetIds to be unique in the passed array."),Df(n.getTarget(o),"Expected targetIds to be registered.")}}(r,o,i),function(e,t,n){for(var r=e.length-1;r>=0;r--){var o=e[r];Kd(t.getTargetType(o),n)||e.splice(r,1)}}(r,i,o.getItemType()),function(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}(r,o,i),{type:$d,payload:{targetIds:r,clientOffset:n||null}}}}function Yd(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 Qd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yd(Object(n),!0).forEach(function(t){Jd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xd(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();!function(e){Df(e.isDragging(),"Cannot call drop while not dragging."),Df(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(n);var o=function(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(n);o.forEach(function(o,i){var a=function(e,t,n,r){var o=n.getTarget(e),i=o?o.drop(r,e):void 0;return function(e){Df(void 0===e||qd(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:r.getDropResult()),i}(o,i,r,n),s={type:Fd,payload:{dropResult:Qd(Qd({},t),a)}};e.dispatch(s)})}}function Zd(e){return function(){var t=e.getMonitor(),n=e.getRegistry();!function(e){Df(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var r=t.getSourceId();return null!=r&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:Bd}}}function ep(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,r.key,r)}}function tp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var np=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),tp(this,"store",void 0),tp(this,"monitor",void 0),tp(this,"backend",void 0),tp(this,"isSetUp",!1),tp(this,"handleRefCountChange",function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}var t,n;return t=e,n=[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,t=this.store.dispatch,n=function(e){return{beginDrag:Hd(e),publishDragSource:Vd(e),hover:Gd(e),drop:Xd(e),endDrag:Zd(e)}}(this);return Object.keys(n).reduce(function(r,o){var i,a=n[o];return r[o]=(i=a,function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var a=i.apply(e,r);void 0!==a&&t(a)}),r},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}],n&&ep(t.prototype,n),e}(),rp=function(e,t){return e===t};function op(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 ip(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?op(Object(n),!0).forEach(function(t){ap(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):op(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ap(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sp={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function lp(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sp,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case jd:case Ld:return{initialSourceClientOffset:o.sourceClientOffset,initialClientOffset:o.clientOffset,clientOffset:o.clientOffset};case $d:return e=n.clientOffset,t=o.clientOffset,!e&&!t||e&&t&&e.x===t.x&&e.y===t.y?n:ip(ip({},n),{},{clientOffset:o.clientOffset});case Bd:case Fd:return sp;default:return n}}var up="dnd-core/ADD_SOURCE",cp="dnd-core/ADD_TARGET",fp="dnd-core/REMOVE_SOURCE",dp="dnd-core/REMOVE_TARGET";function pp(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 hp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pp(Object(n),!0).forEach(function(t){gp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mp={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function yp(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mp,r=arguments.length>1?arguments[1]:void 0,o=r.payload;switch(r.type){case Ld:return hp(hp({},n),{},{itemType:o.itemType,item:o.item,sourceId:o.sourceId,isSourcePublic:o.isSourcePublic,dropResult:null,didDrop:!1});case Nd:return hp(hp({},n),{},{isSourcePublic:!0});case $d:return hp(hp({},n),{},{targetIds:o.targetIds});case dp:return-1===n.targetIds.indexOf(o.targetId)?n:hp(hp({},n),{},{targetIds:(e=n.targetIds,t=o.targetId,e.filter(function(e){return e!==t}))});case Fd:return hp(hp({},n),{},{dropResult:o.dropResult,didDrop:!0,targetIds:[]});case Bd:return hp(hp({},n),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return n}}function vp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case up:case cp:return e+1;case fp:case dp:return e-1;default:return e}}var bp=[],wp=[];function xp(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case $d:break;case up:case cp:case dp:case fp:return bp;default:return wp}var t=e.payload,n=t.targetIds,r=void 0===n?[]:n,o=t.prevTargetIds,i=void 0===o?[]:o,a=function(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var o=[];return n.forEach(function(e,t){1===e&&o.push(t)}),o}(r,i),s=a.length>0||!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rp;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}(r,i);if(!s)return bp;var l=i[i.length-1],u=r[r.length-1];return l!==u&&(l&&a.push(l),u&&a.push(u)),a}function Sp(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)+1}function kp(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 _p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kp(Object(n),!0).forEach(function(t){Ep(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ep(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cp(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:xp(n.dirtyHandlerIds,{type:r.type,payload:_p(_p({},r.payload),{},{prevTargetIds:(e=n,t=[],"dragOperation.targetIds".split(".").reduce(function(e,n){return e&&e[n]?e[n]:t||null},e))})}),dragOffset:lp(n.dragOffset,r),refCount:vp(n.refCount,r),dragOperation:yp(n.dragOperation,r),stateId:Sp(n.stateId)}}function Op(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Tp(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,r.key,r)}}function Pp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}bp.__IS_NONE__=!0,wp.__IS_ALL__=!0;var Mp,Rp=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pp(this,"store",void 0),Pp(this,"registry",void 0),this.store=t,this.registry=n}var t,n;return t=e,n=[{key:"subscribeToStateChange",value:function(e){var t=this,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0}).handlerIds;Df("function"==typeof e,"listener must be a function."),Df(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");var r=this.store.getState().stateId;return this.store.subscribe(function(){var o=t.store.getState(),i=o.stateId;try{var a=i===r||i===r+1&&!function(e,t){if(e===bp)return!1;if(e===wp||void 0===t)return!0;var n,r=(n=e,t.filter(function(e){return n.indexOf(e)>-1}));return r.length>0}(o.dirtyHandlerIds,n);a||e()}finally{r=i}})}},{key:"subscribeToOffsetChange",value:function(e){var t=this;Df("function"==typeof e,"listener must be a function.");var n=this.store.getState().dragOffset;return this.store.subscribe(function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return Df(t,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&t.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return Df(t,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&Kd(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}},{key:"isDragging",value:function(){return Boolean(this.getItemType())}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return Df(t,"Expected to find a valid source. sourceId=".concat(e)),!(!this.isDragging()||!this.isSourcePublic())&&this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}},{key:"isOverTarget",value:function(e){if(!e)return!1;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1}).shallow;if(!this.isDragging())return!1;var n=this.registry.getTargetType(e),r=this.getItemType();if(r&&!Kd(n,r))return!1;var o=this.getTargetIds();if(!o.length)return!1;var i=o.indexOf(e);return t?i===o.length-1:i>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return t=(e=this.store.getState().dragOffset).clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset,t&&n&&r?Op(function(e,t){return{x:e.x+t.x,y:e.y+t.y}}(t,r),n):null;var e,t,n,r}},{key:"getDifferenceFromInitialOffset",value:function(){return t=(e=this.store.getState().dragOffset).clientOffset,n=e.initialClientOffset,t&&n?Op(t,n):null;var e,t,n}}],n&&Tp(t.prototype,n),e}(),Ap=0;function Ip(e){return Ip="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},Ip(e)}function Dp(e,t){t&&Array.isArray(e)?e.forEach(function(e){return Dp(e,!1)}):Df("string"==typeof e||"symbol"===Ip(e),t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(Mp||(Mp={}));const jp=void 0!==__webpack_require__.g?__webpack_require__.g:self,Lp=jp.MutationObserver||jp.WebKitMutationObserver;function Np(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const $p="function"==typeof Lp?function(e){let t=1;const n=new Lp(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:Np;class Fp{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Bp=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=$p(this.flush),this.requestErrorThrow=Np(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},zp=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new Fp(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(Bp.registerPendingError);function Up(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,r.key,r)}}function qp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wp(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hp(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)?Hp(e,t):void 0}}(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 Hp(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 Vp(e){switch(e[0]){case"S":return Mp.SOURCE;case"T":return Mp.TARGET;default:Df(!1,"Cannot parse handler ID: ".concat(e))}}function Kp(e,t){var n=e.entries(),r=!1;do{var o=n.next(),i=o.done;if(Wp(o.value,2)[1]===t)return!0;r=!!i}while(!r);return!1}var Gp=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qp(this,"types",new Map),qp(this,"dragSources",new Map),qp(this,"dropTargets",new Map),qp(this,"pinnedSourceId",null),qp(this,"pinnedSource",null),qp(this,"store",void 0),this.store=t}var t,n;return t=e,n=[{key:"addSource",value:function(e,t){Dp(e),function(e){Df("function"==typeof e.canDrag,"Expected canDrag to be a function."),Df("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),Df("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);var n=this.addHandler(Mp.SOURCE,e,t);return this.store.dispatch(function(e){return{type:up,payload:{sourceId:e}}}(n)),n}},{key:"addTarget",value:function(e,t){Dp(e,!0),function(e){Df("function"==typeof e.canDrop,"Expected canDrop to be a function."),Df("function"==typeof e.hover,"Expected hover to be a function."),Df("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);var n=this.addHandler(Mp.TARGET,e,t);return this.store.dispatch(function(e){return{type:cp,payload:{targetId:e}}}(n)),n}},{key:"containsHandler",value:function(e){return Kp(this.dragSources,e)||Kp(this.dropTargets,e)}},{key:"getSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Df(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return Df(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return Df(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return Df(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return Vp(e)===Mp.SOURCE}},{key:"isTargetId",value:function(e){return Vp(e)===Mp.TARGET}},{key:"removeSource",value:function(e){var t,n=this;Df(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:fp,payload:{sourceId:e}}}(e)),t=function(){n.dragSources.delete(e),n.types.delete(e)},Bp.enqueueTask(zp.create(t))}},{key:"removeTarget",value:function(e){Df(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:dp,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);Df(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){Df(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,n){var r=function(e){var t=(Ap++).toString();switch(e){case Mp.SOURCE:return"S".concat(t);case Mp.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}(e);return this.types.set(r,t),e===Mp.SOURCE?this.dragSources.set(r,n):e===Mp.TARGET&&this.dropTargets.set(r,n),r}}],n&&Up(t.prototype,n),e}();function Yp(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(t=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,(0,Ue.y$)(Cp,t&&n&&n({name:"dnd-core",instanceId:"dnd-core"}))),a=new Rp(i,new Gp(i)),s=new np(i,a),l=e(s,r,o);return s.receiveBackend(l),s}var Qp=["children"];function Jp(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}var Xp=0,Zp=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),eh=(0,n.memo)(function(e){var t=e.children,r=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t;return o[Zp]||(o[Zp]={dragDropManager:Yp(e,t,n,r)}),o[Zp]}(e.backend,e.context,e.options,e.debugMode);return[t,!e.context]}(function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Qp)),o=function(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jp(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)?Jp(e,t):void 0}}(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.")}()}(r,2),i=o[0],a=o[1];return(0,n.useEffect)(function(){if(a){var e=th();return++Xp,function(){0===--Xp&&(e[Zp]=null)}}},[]),(0,nd.jsx)(rd.Provider,Object.assign({value:i},{children:t}),void 0)});function th(){return void 0!==__webpack_require__.g?__webpack_require__.g:window}function nh({namespace:e,...t}){const n=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e;"function"!=typeof e&&(Df(td(e),'Expected "type" provided as the first argument to DragSource to be a string, or a function that returns a string given the current props. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',e),o=function(){return e}),Df(ed(t),'Expected "spec" provided as the second argument to DragSource to be a plain object. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',t);var i=function(e){return Object.keys(e).forEach(function(t){Df(xd.indexOf(t)>-1,'Expected the drag source specification to only have some of the following keys: %s. Instead received a specification with an unexpected "%s" key. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',xd.join(", "),t),Df("function"==typeof e[t],"Expected %s in the drag source specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source",t,t,e[t])}),Sd.forEach(function(t){Df("function"==typeof e[t],"Expected %s in the drag source specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source",t,t,e[t])}),function(t,n){return new kd(e,t,n)}}(t);return Df("function"==typeof n,'Expected "collect" provided as the third argument to DragSource to be a function that returns a plain object of props to inject. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',n),Df(ed(r),'Expected "options" provided as the fourth argument to DragSource to be a plain object when specified. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',n),function(e){return vd({containerDisplayName:"DragSource",createHandler:i,registerHandler:Lf,createConnector:function(e){return new Wf(e)},createMonitor:function(e){return new Yf(e)},DecoratedComponent:e,getType:o,collect:n,options:r})}}(e,{beginDrag:({children:e,isDragging:t,connectDragComponent:n,...r})=>r},e=>({connectDragComponent:e.dragSource()}))(({children:e,connectDragComponent:t})=>e(t));return r().createElement(n,t,t.children)}function rh({onDrop:e,namespace:t,...n}){const o=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e;"function"!=typeof e&&(Df(td(e,!0),'Expected "type" provided as the first argument to DropTarget to be a string, an array of strings, or a function that returns either given the current props. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',e),o=function(){return e}),Df(ed(t),'Expected "spec" provided as the second argument to DropTarget to be a plain object. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',t);var i=function(e){return Object.keys(e).forEach(function(t){Df(Id.indexOf(t)>-1,'Expected the drop target specification to only have some of the following keys: %s. Instead received a specification with an unexpected "%s" key. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',Id.join(", "),t),Df("function"==typeof e[t],"Expected %s in the drop target specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target",t,t,e[t])}),function(t,n){return new Dd(e,t,n)}}(t);return Df("function"==typeof n,'Expected "collect" provided as the third argument to DropTarget to be a function that returns a plain object of props to inject. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',n),Df(ed(r),'Expected "options" provided as the fourth argument to DropTarget to be a plain object when specified. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',n),function(e){return vd({containerDisplayName:"DropTarget",createHandler:i,registerHandler:jf,createMonitor:function(e){return new Od(e)},createConnector:function(e){return new Md(e)},DecoratedComponent:e,getType:o,collect:n,options:r})}}(t,{drop(t,n){e(n.getItem())}},(e,t)=>({connectDropTarget:e.dropTarget(),isHovered:t.isOver()}))(({children:e,connectDropTarget:t,isHovered:n})=>e(t,{isHovered:n}));return r().createElement(o,n,n.children)}nh.propTypes={namespace:a().any.isRequired,children:a().func.isRequired},rh.propTypes={onDrop:a().func.isRequired,namespace:a().any.isRequired,children:a().func.isRequired};var oh={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function ih(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var ah=/[A-Z]|^ms/g,sh=/_EMO_([^_]+?)_([^]*?)_EMO_/g,lh=function(e){return 45===e.charCodeAt(1)},uh=function(e){return null!=e&&"boolean"!=typeof e},ch=ih(function(e){return lh(e)?e:e.replace(ah,"-$&").toLowerCase()}),fh=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(sh,function(e,t,n){return ph={name:t,styles:n,next:ph},t})}return 1===oh[e]||lh(e)||"number"!=typeof t||0===t?t:t+"px"};function dh(e,t,n){if(null==n)return"";var r=n;if(void 0!==r.__emotion_styles)return r;switch(typeof n){case"boolean":return"";case"object":var o=n;if(1===o.anim)return ph={name:o.name,styles:o.styles,next:ph},o.name;var i=n;if(void 0!==i.styles){var a=i.next;if(void 0!==a)for(;void 0!==a;)ph={name:a.name,styles:a.styles,next:ph},a=a.next;return i.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=dh(e,t,n[o])+";";else for(var i in n){var a=n[i];if("object"!=typeof a){var s=a;null!=t&&void 0!==t[s]?r+=i+"{"+t[s]+"}":uh(s)&&(r+=ch(i)+":"+fh(i,s)+";")}else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var l=dh(e,t,a);switch(i){case"animation":case"animationName":r+=ch(i)+":"+l+";";break;default:r+=i+"{"+l+"}"}}else for(var u=0;u<a.length;u++)uh(a[u])&&(r+=ch(i)+":"+fh(i,a[u])+";")}return r}(e,t,n);case"function":if(void 0!==e){var s=ph,l=n(e);return ph=s,dh(e,t,l)}}var u=n;if(null==t)return u;var c=t[u];return void 0!==c?c:u}var ph,hh=/label:\s*([^\s;{]+)\s*(;|$)/g,gh=!!n.useInsertionEffect&&n.useInsertionEffect,mh=gh||function(e){return e()};gh||n.useLayoutEffect;var yh=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},vh=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,bh=ih(function(e){return vh.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),wh=function(e){return"theme"!==e},xh=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?bh:wh},Sh=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},kh=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return yh(t,n,r),mh(function(){return function(e,t,n){yh(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)}),null},_h=function e(t,r){var o,i,a=t.__emotion_real===t,s=a&&t.__emotion_base||t;void 0!==r&&(o=r.label,i=r.target);var l=Sh(t,r,a),u=l||xh(s),c=!u("as");return function(){var f=arguments,d=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&d.push("label:"+o+";"),null==f[0]||void 0===f[0].raw)d.push.apply(d,f);else{var p=f[0];d.push(p[0]);for(var g=f.length,m=1;m<g;m++)d.push(f[m],p[m])}var y=(0,so.withEmotionCache)(function(e,t,r){var o,a,f,p,h=c&&e.as||s,g="",m=[],y=e;if(null==e.theme){for(var v in y={},e)y[v]=e[v];y.theme=n.useContext(so.ThemeContext)}"string"==typeof e.className?(o=t.registered,a=m,f=e.className,p="",f.split(" ").forEach(function(e){void 0!==o[e]?a.push(o[e]+";"):e&&(p+=e+" ")}),g=p):null!=e.className&&(g=e.className+" ");var b=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,o="";ph=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,o+=dh(n,t,i)):o+=i[0];for(var a=1;a<e.length;a++)o+=dh(n,t,e[a]),r&&(o+=i[a]);hh.lastIndex=0;for(var s,l="";null!==(s=hh.exec(o));)l+="-"+s[1];var u=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+l;return{name:u,styles:o,next:ph}}(d.concat(m),t.registered,y);g+=t.key+"-"+b.name,void 0!==i&&(g+=" "+i);var w=c&&void 0===l?xh(h):u,x={};for(var S in e)c&&"as"===S||w(S)&&(x[S]=e[S]);return x.className=g,r&&(x.ref=r),n.createElement(n.Fragment,null,n.createElement(kh,{cache:t,serialized:b,isStringTag:"string"==typeof h}),n.createElement(h,x))});return y.displayName=void 0!==o?o:"Styled("+("string"==typeof s?s:s.displayName||s.name||"Component")+")",y.defaultProps=t.defaultProps,y.__emotion_real=y,y.__emotion_base=s,y.__emotion_styles=d,y.__emotion_forwardProp=l,Object.defineProperty(y,"toString",{value:function(){return"."+i}}),y.withComponent=function(t,n){return e(t,h({},r,n,{shouldForwardProp:Sh(y,n,!0)})).apply(void 0,d)},y}},Eh=__webpack_require__(20685),Ch=__webpack_require__.n(Eh);function Oh({title:e,config:t}){const n=t?.issue_reports?.url??"https://github.com/decaporg/decap-cms/issues/new";try{const r=function({config:e}){let t="";"string"==typeof DECAP_CMS_VERSION?t=`decap-cms@${DECAP_CMS_VERSION}`:"string"==typeof DECAP_CMS_APP_VERSION&&(t=`decap-cms-app@${DECAP_CMS_APP_VERSION}`);const n=function({version:e,provider:t,browser:n,config:r}){return`\n**Describe the bug**\n\n**To Reproduce**\n\n**Expected behavior**\n\n**Screenshots**\n\n**Applicable Versions:**\n - Decap CMS version: \`${e}\`\n - Git provider: \`${t}\`\n - Browser version: \`${n}\`\n\n**CMS configuration**\n\`\`\`\n${r}\n\`\`\`\n\n**Additional context**\n`}({version:t,provider:e.backend.name,browser:navigator.userAgent,config:hn().stringify(e)});return n}({config:t}),o=new URLSearchParams;return o.append("title",Ch()(e,{length:100})),o.append("body",Ch()(r,{length:4e3,omission:"\n..."})),o.append("labels","type: bug"),`${n}?${o.toString()}`}catch(e){return console.log(e),`${n}?template=bug_report.md`}}const Th=_h("div",{target:"emw4gx72",label:"ErrorBoundaryContainer"})("padding:40px;h1{font-size:28px;color:",Be.colors.text,";}h2{font-size:20px;}strong{color:",Be.colors.textLead,";font-weight:500;}hr{width:200px;margin:30px 0;border:0;height:1px;background-color:",Be.colors.text,";}a{color:",Be.colors.active,";}"),Ph=_h("span",{target:"emw4gx71",label:"PrivacyWarning"})("color:",Be.colors.text,";"),Mh=_h("button",{target:"emw4gx70",label:"CopyButton"})(Be.buttons.button,";",Be.buttons.default,";",Be.buttons.gray,";display:block;margin:12px 0;");function Rh({entry:e,t}){return console.log(e),(0,so.jsx)(r().Fragment,null,(0,so.jsx)("hr",null),(0,so.jsx)("h2",null,t("ui.errorBoundary.recoveredEntry.heading")),(0,so.jsx)("strong",null,t("ui.errorBoundary.recoveredEntry.warning")),(0,so.jsx)(Mh,{onClick:()=>navigator.clipboard.writeText(e)},t("ui.errorBoundary.recoveredEntry.copyButtonLabel")),(0,so.jsx)("pre",null,(0,so.jsx)("code",null,e)))}class Ah extends r().Component{static propTypes={children:a().node,t:a().func.isRequired,config:a().object.isRequired};state={hasError:!1,errorMessage:"",errorTitle:"",backup:""};static getDerivedStateFromError(e){return console.error(e),{hasError:!0,errorMessage:e.stack||e.toString(),errorTitle:e.toString()}}componentDidMount(){a().checkPropTypes(Ah.propTypes,this.props,"prop","ErrorBoundary")}shouldComponentUpdate(e,t){return!this.props.showBackup||this.state.errorMessage!==t.errorMessage||this.state.backup!==t.backup}async componentDidUpdate(){if(this.props.showBackup){const e=await cn.localForage.getItem("backup");e&&console.log(e),this.setState({backup:e})}}render(){const{hasError:e,errorMessage:t,backup:n,errorTitle:o}=this.state,{showBackup:i,t:a}=this.props;return e?(0,so.jsx)(Th,null,(0,so.jsx)("h1",null,a("ui.errorBoundary.title")),(0,so.jsx)("p",null,(0,so.jsx)("span",null,a("ui.errorBoundary.details")),(0,so.jsx)("a",{href:Oh({title:o,config:this.props.config}),target:"_blank",rel:"noopener noreferrer","data-testid":"issue-url"},a("ui.errorBoundary.reportIt"))),(0,so.jsx)("p",null,a("ui.errorBoundary.privacyWarning").split("\n").map((e,t)=>(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Ph,{key:t},e),(0,so.jsx)("br",null)))),(0,so.jsx)("hr",null),(0,so.jsx)("h2",null,a("ui.errorBoundary.detailsHeading")),(0,so.jsx)("p",null,t),n&&i&&(0,so.jsx)(Rh,{entry:n,t:a})):this.props.children}}const Ih=(0,ze.Tl)()(Ah);function Dh({label:e,imagesOnly:t,onChange:n,disabled:r,className:o}){return(0,so.jsx)("label",{tabIndex:"0",className:`nc-fileUploadButton ${o||""}`},(0,so.jsx)("span",null,e),(0,so.jsx)("input",{type:"file",accept:t?"image/*":"*/*",onChange:n,disabled:r}))}Dh.propTypes={className:a().string,label:a().string.isRequired,imagesOnly:a().bool,onChange:a().func.isRequired,disabled:a().bool};var jh=__webpack_require__(70373),Lh=__webpack_require__.n(jh),Nh={name:"1o9c9d2-ReactModalGlobalStyles",styles:".ReactModal__Body--open{overflow:hidden;};label:ReactModalGlobalStyles;"};function $h(){return(0,so.jsx)(so.Global,{styles:Nh})}const Fh=`\n ${Be.shadows.dropDeep};\n background-color: #fff;\n border-radius: ${Be.lengths.borderRadius};\n height: 80%;\n text-align: center;\n max-width: 2200px;\n padding: 20px;\n\n &:focus {\n outline: none;\n }\n `,Bh=`\n z-index: ${Be.zIndex.zIndex99999};\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n background-color: rgba(0, 0, 0, 0);\n transition: background-color ${Be.transitions.main}, opacity ${Be.transitions.main};\n `;class zh extends r().Component{static propTypes={children:a().node.isRequired,isOpen:a().bool.isRequired,className:a().string,onClose:a().func.isRequired};componentDidMount(){a().checkPropTypes(zh.propTypes,this.props,"prop","Modal"),Lh().setAppElement("#nc-root")}render(){const{isOpen:e,children:t,className:n,onClose:o}=this.props;return(0,so.jsx)(r().Fragment,null,(0,so.jsx)($h,null),(0,so.jsx)(so.ClassNames,null,({css:r,cx:i})=>(0,so.jsx)(Lh(),{isOpen:e,onRequestClose:o,closeTimeoutMS:300,className:{base:i(r`
|
|
18
18
|
${Fh};
|
|
19
19
|
`,n),afterOpen:"",beforeClose:""},overlayClassName:{base:r`
|
|
20
20
|
${Bh};
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
${ww.label};
|
|
44
44
|
`,classNameLabelActive:i`
|
|
45
45
|
${ww.labelActive};
|
|
46
|
-
`,controlComponent:F.control,entry:t,collection:n,config:r,field:o,uniqueFieldId:this.uniqueFieldId,value:e,mediaPaths:s,metadata:W,onChange:(e,t)=>{u(o,e,t),S(this.uniqueFieldId)},onValidate:m&&cv()(m,this.uniqueFieldId),onOpenMediaLibrary:c,onClearMediaControl:f,onRemoveMediaControl:d,onRemoveInsertedMedia:h,onPersistMedia:g,onAddAsset:p,getAsset:l,hasActiveStyle:E||this.state.styleActive,setActiveStyle:()=>this.setState({styleActive:!0}),setInactiveStyle:()=>this.setState({styleActive:!1}),resolveWidget:yr,widget:F,getEditorComponents:vr,controlRef:y,editorControl:Ow,query:v,loadEntry:k,queryHits:b[this.uniqueFieldId]||[],clearSearch:x,clearFieldErrors:S,isFetching:w,fieldsErrors:a,onValidateObject:q,isEditorComponent:C,isNewEditorComponent:O,parentIds:T,t:P,validateMetaField:M,isDisabled:A,isFieldDuplicate:D,isFieldHidden:j,isLoadingAsset:R,locale:L,isParentListCollapsed:N}),z&&(0,so.jsx)(_w,{active:E||this.state.styleActive,error:K},(0,so.jsx)(pw(),{remarkPlugins:[gw()],allowedElements:["a","strong","em","del"],unwrapDisallowed:!0,components:{a:({node:e,...t})=>(0,so.jsx)("a",bw({},t,{target:"_blank",rel:"noopener noreferrer",style:{color:"inherit"}}))}},z))))}}const Ow=V(function(e){const{collections:t,entryDraft:n}=e,r=n.get("entry"),o=t.get(n.getIn(["entry","collection"])),i=Oc(e.medias);return{mediaPaths:e.mediaLibrary.get("controlMedia"),isFetching:e.search.isFetching,queryHits:e.search.queryHits,config:e.config,entry:r,collection:o,isLoadingAsset:i,loadEntry:async function(n,r){const o=t.get(n);if(o)return await Ys(e,o,r);throw new Error(`Can't find collection '${n}'`)},validateMetaField:(t,n,r)=>function(e,t,n,r,o){if(n.get("meta")&&"path"===n.get("name")){if(!r)return nl(r,"invalidPath",o);const n=r.split("/").map(Jo(e.config.slug)).join("/");if(r!==n)return nl(r,"invalidPath",o);const i=ss(t,(0,Ge.fromJS)({entry:{meta:{path:r}}})),a=i?function(e,t,n){const r=Sl(e,t),o=r&&r.map(n=>xl(e,t,n));return o&&o.find(e=>e?.get("path")===n)}(e.entries,t.get("name"),i):void 0,s=a?.get("path"),l=e.entryDraft?.getIn(["entry","path"]);if(s&&s!==l)return nl(r,"pathExists",o)}return{error:!1}}(e,o,t,n,r)}},function(e){return{...(0,Ue.zH)({openMediaLibrary:ea,clearMediaControl:Xi,removeMediaControl:Zi,removeInsertedMedia:na,persistMedia:ia,addAsset:Oa,query:xi,clearSearch:wi,clearFieldErrors:Vs},e),boundGetAsset:(t,n)=>Ma(e,t,n)}},function(e,t,n){return{...e,...t,...n,boundGetAsset:t.boundGetAsset(e.collection,e.entry)}})((0,ze.Tl)()(Cw)),Tw=Ow,Pw=_h("div",{target:"e11hw0lx4",label:"ControlPaneContainer"})({name:"1n0x6o4",styles:"max-width:800px;margin:0 auto;padding-bottom:16px;font-size:16px"}),Mw=_h(Be.StyledDropdownButton,{target:"e11hw0lx3",label:"LocaleButton"})(Be.buttons.button,";",Be.buttons.medium,";color:",Be.colors.controlLabel,";background:",Be.colors.textFieldBorder,";height:100%;&:after{top:11px;}"),Rw=_h("div",{target:"e11hw0lx2",label:"LocaleButtonWrapper"})({name:"zjik7",styles:"display:flex"}),Aw=_h("div",{target:"e11hw0lx1",label:"LocaleRowWrapper"})({name:"zjik7",styles:"display:flex"}),Iw=_h(Be.Dropdown,{target:"e11hw0lx0",label:"StyledDropdown"})({name:"1hfmrg2",styles:"width:max-content;margin-top:20px;margin-bottom:20px;margin-right:20px"});function Dw({locales:e,dropdownText:t,onLocaleChange:n}){return(0,so.jsx)(Iw,{renderButton:()=>(0,so.jsx)(Rw,null,(0,so.jsx)(Mw,null,t))},e.map(e=>(0,so.jsx)(Be.DropdownItem,{css:(0,so.css)(Be.text.fieldLabel,";;label:LocaleDropdown;"),key:e,label:e,onClick:()=>n(e)})))}function jw({field:e,entry:t,isTranslatable:n,locale:r}){if(e.get("meta"))return t.getIn(["meta",e.get("name")]);if(n){const n=su(r);return t.getIn([...n,e.get("name")])}return t.getIn(["data",e.get("name")])}class Lw extends r().Component{state={selectedLocale:this.props.locale};childRefs={};controlRef=(e,t)=>{if(!t)return;const n=e.get("name");this.childRefs[n]=t};getControlRef=e=>t=>{this.controlRef(e,t)};handleLocaleChange=e=>{this.setState({selectedLocale:e}),this.props.onLocaleChange(e)};copyFromOtherLocale=({targetLocale:e,t})=>n=>{if(!window.confirm(t("editor.editorControlPane.i18n.copyFromLocaleConfirm",{locale:n.toUpperCase()})))return;const{entry:r,collection:o}=this.props,{locales:i,defaultLocale:a}=ru(o),s=this.state.selectedLocale,l=i&&{currentLocale:s,locales:i,defaultLocale:a};this.props.fields.forEach(t=>{if(ou(t,e,n)){const e=jw({field:t,entry:r,locale:n,isTranslatable:n!==a});e&&this.props.onChange(t,e,void 0,l)}})};validate=async()=>{this.props.fields.forEach(e=>{if("hidden"===e.get("widget"))return;const t=this.childRefs[e.get("name")],n=t?.innerWrappedControl?.validate??t?.validate;n&&n()})};switchToDefaultLocale=()=>{if(nu(this.props.collection)){const{defaultLocale:e}=ru(this.props.collection);return new Promise(t=>this.setState({selectedLocale:e},t))}return Promise.resolve()};focus(e){const[t,...n]=e.split("."),r=this.childRefs[t];r?.focus&&r.focus(n.join("."))}render(){const{collection:e,entry:t,fields:n,fieldsMetaData:r,fieldsErrors:o,onChange:i,onValidate:a,t:s}=this.props;if(!e||!n)return null;if(0===t.size||!0===t.get("partial"))return null;const{locales:l,defaultLocale:u}=ru(e),c=this.state.selectedLocale,f=l&&{currentLocale:c,locales:l,defaultLocale:u};return(0,so.jsx)(Pw,null,l&&(0,so.jsx)(Aw,null,(0,so.jsx)(Dw,{locales:l,dropdownText:s("editor.editorControlPane.i18n.writingInLocale",{locale:c.toUpperCase()}),onLocaleChange:this.handleLocaleChange}),(0,so.jsx)(Dw,{locales:l.filter(e=>e!==c),dropdownText:s("editor.editorControlPane.i18n.copyFromLocale"),onLocaleChange:this.copyFromOtherLocale({targetLocale:c,t:s})})),n.filter(e=>"hidden"!==e.get("widget")).map((n,s)=>{const l=ou(n,c,u),d=iu(n,c,u),p=au(n,c,u),h=f?`${c}_${s}`:s;return(0,so.jsx)(Tw,{key:h,field:n,value:jw({field:n,entry:t,locale:c,isTranslatable:l}),fieldsMetaData:r,fieldsErrors:o,onChange:(e,t,n)=>{i(e,t,n,f)},onValidate:a,controlRef:this.getControlRef(n),entry:t,collection:e,isDisabled:d,isHidden:p,isFieldDuplicate:e=>iu(e,c,u),isFieldHidden:e=>au(e,c,u),locale:c})}))}}Lw.propTypes={collection:Mg().map.isRequired,entry:Mg().map.isRequired,fields:Mg().list.isRequired,fieldsMetaData:Mg().map.isRequired,fieldsErrors:Mg().map.isRequired,onChange:a().func.isRequired,onValidate:a().func.isRequired,locale:a().string};var Nw=__webpack_require__(45231),$w={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Fw={0:8203,1:8204,2:8205,3:65279},Bw=new Array(4).fill(String.fromCodePoint(Fw[0])).join(""),zw=String.fromCharCode(0);function Uw(e){let t=JSON.stringify(e);return`${Bw}${Array.from(t).map(e=>{let n=e.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map(e=>String.fromCodePoint(Fw[e])).join("")}).join("")}`}var qw=Object.fromEntries(Object.entries(Fw).map(e=>e.reverse())),Ww=Object.fromEntries(Object.entries($w).map(e=>e.reverse())),Hw=`${Object.values($w).map(e=>`\\u{${e.toString(16)}}`).join("")}`,Vw=new RegExp(`[${Hw}]{4,}`,"gu");function Kw(e){return Ge.Map.isMap(e)}function Gw(e){return e?"types"in e?e.types??[]:"fields"in e?e.fields??[]:"field"in e?e.field?[e.field]:[]:[e]:[]}const Yw=new Map;class Qw extends r().Component{handleClick=e=>{const{previewProps:t,onFieldClick:n}=this.props,r=t?.collection?.getIn(["editor","visualEditing"],!1);if(r)try{const t=function(e){let t=e.match(Vw);if(t)return function(e,t=!1){let n=Array.from(e);if(n.length%2!=0)throw new Error("Encoded data has invalid length");if(n.length%4||!e.startsWith(Bw))return function(e,t){var n;let r=[];for(let t=.5*e.length;t--;){let n=`${Ww[e[2*t].codePointAt(0)]}${Ww[e[2*t+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(n,16)))}let o=[],i=[r.join("")],a=10;for(;i.length;){let e=i.shift();try{if(o.push(JSON.parse(e)),t)return o}catch(t){if(!a--)throw t;let r=+(null==(n=t.message.match(/\sposition\s(\d+)$/))?void 0:n[1]);if(!r)throw t;i.unshift(e.substring(0,r),e.substring(r))}}return o}(n,t);let r=[];for(let e=.25*n.length;e--;){let t=n.slice(4*e,4*e+4).map(e=>qw[e.codePointAt(0)]).join("");r.unshift(String.fromCharCode(parseInt(t,4)))}if(t){r.shift();let e=r.indexOf(zw);return-1===e&&(e=r.length),[JSON.parse(r.slice(0,e).join(""))]}return r.join("").split(zw).filter(Boolean).map(e=>JSON.parse(e))}(t[0],!0)[0]}(e.target.textContent);t?.decap&&n&&n(t.decap)}catch(e){console.log("Visual editing error:",e)}};renderPreview(){const{previewComponent:e,previewProps:t}=this.props;return(0,so.jsx)("div",{onClick:this.handleClick},(0,Se.isElement)(e)?r().cloneElement(e,t):r().createElement(e,t))}render(){const{previewProps:e}=this.props,t=e?.collection?.getIn(["editor","visualEditing"],!1),n=!t;return(0,so.jsx)(Nw.rH,null,e=>{const t=this.renderPreview();return n?(0,so.jsx)(uw.ScrollSyncPane,{attachTo:e.document.scrollingElement},t):t})}}Qw.propTypes={previewComponent:a().func.isRequired,getEditorComponents:a().func,previewProps:a().object,onFieldClick:a().func};const Jw=Qw;class Xw extends r().Component{shouldComponentUpdate(e){return["object","list"].includes(e.field.get("widget"))||this.props.value!==e.value||this.props.fieldsMetaData!==e.fieldsMetaData||this.props.getAsset!==e.getAsset}render(){const{previewComponent:e,...t}=this.props;return r().createElement(e,t)}}Xw.propTypes={previewComponent:a().func.isRequired,field:Mg().map.isRequired,value:a().oneOfType([a().node,a().object,a().string,a().bool])};const Zw=Xw;function ex(e){return"hidden"!==e.get("widget")}const tx=_h("div",{target:"e1iji6y40",label:"PreviewContainer"})({name:"9bq7s9",styles:"font-family:Roboto,'Helvetica Neue',HelveticaNeue,Helvetica,Arial,sans-serif"});class nx extends r().Component{render(){const{collection:e,fields:t,widgetFor:n}=this.props;return e&&t?(0,so.jsx)(tx,null,t.filter(ex).map(e=>(0,so.jsx)("div",{key:e.get("name")},n(e.get("name"))))):null}}nx.propTypes={collection:Mg().map.isRequired,entry:Mg().map.isRequired,fields:Mg().list.isRequired,getAsset:a().func.isRequired,widgetFor:a().func.isRequired};const rx=_h(Nw.Ay,{target:"enus48h0",label:"PreviewPaneFrame"})("width:100%;height:100%;border:none;background:#fff;border-radius:",Be.lengths.borderRadius,";");class ox extends r().Component{getWidget=(e,t,n,r,o=null)=>{const{getAsset:i,entry:a}=r,s=yr(e.get("widget")),l=o?e.get("name")+"_"+o:e.get("name"),u=t&&!s.allowMapValue&&Ge.Map.isMap(t);return s.preview?(0,so.jsx)(Zw,{previewComponent:s.preview,key:l,field:e,getAsset:i,value:u?t.get(e.get("name")):t,entry:a,fieldsMetaData:n,resolveWidget:yr,getRemarkPlugins:br,getEditorComponents:vr}):null};inferredFields={};inferFields(){const e=Yl(this.props.collection,"title"),t=Yl(this.props.collection,"shortTitle"),n=Yl(this.props.collection,"author");this.inferredFields={},e&&(this.inferredFields[e]=co.title),t&&(this.inferredFields[t]=co.shortTitle),n&&(this.inferredFields[n]=co.author)}widgetFor=(e,t=this.props.fields,n=this.props.entry.get("data"),r=this.props.fieldsMetaData)=>{let o=t&&t.find(t=>t.get("name")===e),i=Ge.Map.isMap(n)&&n.get(o.get("name"));o.get("meta")&&(i=this.props.entry.getIn(["meta",o.get("name")]));const a=o.get("fields"),s=o.get("field"),l=r&&r.get(o.get("name"),(0,Ge.Map)());a&&(o=o.set("fields",this.getNestedWidgets(a,i,l))),s&&(o=o.set("field",this.getSingleNested(s,i,l)));const u=Object.entries(this.inferredFields).filter(([e])=>Vl(this.props.collection,e)===o).map(([,e])=>e)[0];return u?i=u.defaultPreview(i):i&&-1!==["string","text","number"].indexOf(o.get("widget"))&&i.toString().length<50&&(i=(0,so.jsx)("div",null,(0,so.jsx)("strong",null,o.get("label",o.get("name")),":")," ",i)),i?this.getWidget(o,i,l,this.props):null};getNestedWidgets=(e,t,n)=>Ge.List.isList(t)?t.map(t=>this.widgetsForNestedFields(e,t,n)):this.widgetsForNestedFields(e,t,n);getSingleNested=(e,t,n)=>Ge.List.isList(t)?t.map((t,r)=>this.getWidget(e,t,n.get(e.get("name")),this.props,r)):this.getWidget(e,t,n.get(e.get("name")),this.props);widgetsForNestedFields=(e,t,n)=>e.map(r=>this.widgetFor(r.get("name"),e,t,n));widgetsFor=e=>{const{fields:t,entry:n,fieldsMetaData:r}=this.props,o=t.find(t=>t.get("name")===e),i=o&&o.get("fields"),a=o&&o.get("types"),s=n.getIn(["data",o.get("name")]),l=r.get(o.get("name"),(0,Ge.Map)());return Ge.List.isList(s)&&a?s.map(e=>{const t=a.find(t=>t.get("name")===e.get("type")),n=t&&t.get("fields"),r=n&&(0,Ge.Map)(n.map((t,n)=>[t.get("name"),(0,so.jsx)("div",{key:n},this.getWidget(t,e,l.get(t.get("name")),this.props))]));return(0,Ge.Map)({data:e,widgets:r})}):Ge.List.isList(s)?s.map(e=>{const t=i&&(0,Ge.Map)(i.map((t,n)=>[t.get("name"),(0,so.jsx)("div",{key:n},this.getWidget(t,e,l.get(t.get("name")),this.props))]));return(0,Ge.Map)({data:e,widgets:t})}):(0,Ge.Map)({data:s,widgets:i&&(0,Ge.Map)(i.map(e=>[e.get("name"),this.getWidget(e,s,l.get(e.get("name")),this.props)]))})};getCollection=async(e,t)=>{const{state:n}=this.props,r=n.collections.get(e);if(void 0===t)return(await Us(n,r)).map(e=>(0,Ge.Map)().set("data",e.data));const o=await Ys(n,r,t);return(0,Ge.Map)().set("data",o.data)};render(){const{entry:e,collection:t,config:n}=this.props;if(!e||!e.get("data"))return null;const r=pr(function(e,t){return Ll[e.get("type")].templateName(e,t)}(t,e.get("slug")))||nx;this.inferFields();const o=t.getIn(["editor","visualEditing"],!1)?e.set("data",(s=e.get("data"),l=this.props.fields,function e(t,n,r=""){if(Yw.get(r)===t)return t;const o={fields:n,path:r,visit:e};let i;return i=function(e){return Ge.List.isList(e)}(t)?function(e,t){let n=e;for(let e=0;e<n.size;e++){const r=n.get(e);if(Kw(r)){const o=r.get("type");if("string"==typeof o){const i=t.fields.find(e=>e.name===o),a=t.visit(r,Gw(i),`${t.path}.${e}`);n=n.set(e,a)}else{const o=t.visit(r,t.fields,`${t.path}.${e}`);n=n.set(e,o)}}else{const o=t.fields[0],i=t.visit(r,o?[o]:[],`${t.path}.${e}`);i!==r&&(n=n.set(e,i))}}return n}(t,o):Kw(t)?function(e,t){let n=e;for(const[e,r]of n.entrySeq().toArray()){const o=t.fields.find(t=>t.name===e);if(o){const i=Gw(o),a=t.visit(r,i,t.path?`${t.path}.${e}`:e);a!==r&&(n=n.set(e,a))}}return n}(t,o):"string"==typeof t?function(e,{fields:t,path:n}){const[r]=t;if(!r)return e;const{widget:o}=r;if("string"===o||"text"===o)return"visualEditing"in r&&!1===r.visualEditing?e:e+Uw({decap:n});if("markdown"===o){const t=Uw({decap:n});return e.split(/(\n\n+)/).map(e=>e.trim()?e+t:e).join("")}return e}(t,o):t,Yw.set(r,i),i}(s,l.toJS()))):e,i={...this.props,entry:o,widgetFor:(e,t,n=o.get("data"),r)=>this.widgetFor(e,t,n,r),widgetsFor:this.widgetsFor,getCollection:this.getCollection,getEditorComponents:vr},a=dr().map((e,t)=>e.raw?(0,so.jsx)("style",{key:t},e.value):(0,so.jsx)("link",{key:t,href:e.value,type:"text/css",rel:"stylesheet"}));var s,l;return t||(0,so.jsx)(rx,{id:"preview-pane",head:a}),(0,so.jsx)(Ih,{config:n},(0,so.jsx)(rx,{id:"preview-pane",head:a,initialContent:'\n<!DOCTYPE html>\n<html>\n <head><base target="_blank"/></head>\n <body><div></div></body>\n</html>\n'},(0,so.jsx)(Nw.rH,null,({document:e,window:t})=>(0,so.jsx)(Jw,{previewComponent:r,previewProps:{...i,document:e,window:t},onFieldClick:this.props.onFieldClick}))))}}ox.propTypes={collection:Mg().map.isRequired,fields:Mg().list.isRequired,entry:Mg().map.isRequired,fieldsMetaData:Mg().map.isRequired,getAsset:a().func.isRequired,onFieldClick:a().func};const ix=V(function(e){return{isLoadingAsset:Oc(e.medias),config:e.config,state:e}},function(e){return{boundGetAsset:(t,n)=>Ma(e,t,n)}},function(e,t,n){return{...e,...t,...n,getAsset:t.boundGetAsset(n.collection,n.entry)}})(ox),ax={noOverflow:{name:"1ctb18k-noOverflow",styles:"overflow:hidden;white-space:nowrap;text-overflow:ellipsis;label:noOverflow;"},buttonMargin:{name:"bx8mhy-buttonMargin",styles:"margin:0 10px;label:buttonMargin;"},toolbarSection:(0,so.css)("height:100%;display:flex;align-items:center;border:0 solid ",Be.colors.textFieldBorder,";;label:toolbarSection;"),publishedButton:(0,so.css)("background-color:",Be.colorsRaw.tealLight,";color:",Be.colorsRaw.tealDark,";;label:publishedButton;")},sx=_h("div",{target:"e1d2l9mo26",label:"TooltipText"})({name:"1ykbu60",styles:"visibility:hidden;width:321px;background-color:#555;color:#fff;text-align:unset;border-radius:6px;padding:5px;position:absolute;z-index:1;top:145%;left:50%;margin-left:-320px;opacity:0;transition:opacity 0.3s"}),lx=_h("div",{target:"e1d2l9mo25",label:"Tooltip"})("position:relative;display:inline-block;&:hover+",sx,"{visibility:visible;opacity:0.9;}"),ux=_h("div",{target:"e1d2l9mo24",label:"TooltipContainer"})({name:"bjn8wh",styles:"position:relative"}),cx=_h(Be.StyledDropdownButton,{target:"e1d2l9mo23",label:"DropdownButton"})(ax.noOverflow,"@media (max-width: 1200px){padding-left:10px;}"),fx=_h("div",{target:"e1d2l9mo22",label:"ToolbarContainer"})("box-shadow:0 2px 6px 0 rgba(68, 74, 87, 0.05),0 1px 3px 0 rgba(68, 74, 87, 0.1),0 2px 54px rgba(0, 0, 0, 0.1);position:absolute;top:0;left:0;width:100%;min-width:800px;z-index:",Be.zIndex.zIndex300,";background-color:#fff;height:66px;display:flex;justify-content:space-between;"),dx=_h("div",{target:"e1d2l9mo21",label:"ToolbarSectionMain"})(ax.toolbarSection,";flex:10;display:flex;justify-content:space-between;padding:0 10px;"),px=_h("div",{target:"e1d2l9mo20",label:"ToolbarSubSectionFirst"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),hx=_h(px,{target:"e1d2l9mo19",label:"ToolbarSubSectionLast"})({name:"1f60if8",styles:"justify-content:flex-end"}),gx=_h(Sy,{target:"e1d2l9mo18",label:"ToolbarSectionBackLink"})(ax.toolbarSection,";border-right-width:1px;font-weight:normal;padding:0 20px;&:hover,&:focus{background-color:#f1f2f4;}"),mx=_h("div",{target:"e1d2l9mo17",label:"ToolbarSectionMeta"})(ax.toolbarSection,";border-left-width:1px;padding:0 7px;"),yx=_h(Be.Dropdown,{target:"e1d2l9mo16",label:"ToolbarDropdown"})(ax.buttonMargin,";",Be.Icon,"{color:",Be.colorsRaw.teal,";}"),vx=_h("div",{target:"e1d2l9mo15",label:"BackArrow"})("color:",Be.colors.textLead,";font-size:21px;font-weight:600;margin-right:16px;"),bx=_h("div",{target:"e1d2l9mo14",label:"BackCollection"})("color:",Be.colors.textLead,";font-size:14px;"),wx=_h("div",{target:"e1d2l9mo13",label:"BackStatus"})({name:"j9a02z",styles:"margin-top:6px"}),xx=_h(wx,{target:"e1d2l9mo12",label:"BackStatusUnchanged"})(Be.components.textBadgeSuccess,";"),Sx=_h(wx,{target:"e1d2l9mo11",label:"BackStatusChanged"})(Be.components.textBadgeDanger,";"),kx=_h("button",{target:"e1d2l9mo10",label:"ToolbarButton"})(Be.buttons.button,";",Be.buttons.default,";",ax.buttonMargin,";",ax.noOverflow,";display:block;@media (max-width: 1200px){padding:0 10px;}"),_x=_h(kx,{target:"e1d2l9mo9",label:"DeleteButton"})(Be.buttons.lightRed,";"),Ex=_h(kx,{target:"e1d2l9mo8",label:"SaveButton"})(Be.buttons.lightBlue,";&[disabled]{",Be.buttons.disabled,";}"),Cx=_h(cx,{target:"e1d2l9mo7",label:"PublishedToolbarButton"})(ax.publishedButton,";"),Ox=_h(kx,{target:"e1d2l9mo6",label:"PublishedButton"})(ax.publishedButton,";"),Tx=_h(cx,{target:"e1d2l9mo5",label:"PublishButton"})("background-color:",Be.colorsRaw.teal,";"),Px=_h(cx,{target:"e1d2l9mo4",label:"StatusButton"})("background-color:",Be.colorsRaw.tealLight,";color:",Be.colorsRaw.teal,";"),Mx=_h("div",{target:"e1d2l9mo3",label:"PreviewButtonContainer"})("margin-right:12px;color:",Be.colorsRaw.blue,";display:flex;align-items:center;a,",Be.Icon,"{color:",Be.colorsRaw.blue,";}",Be.Icon,"{position:relative;top:1px;}"),Rx=_h("button",{target:"e1d2l9mo2",label:"RefreshPreviewButton"})("background:none;border:0;cursor:pointer;color:",Be.colorsRaw.blue,";span{margin-right:6px;}&:disabled{cursor:default;opacity:0.6;}",Be.Icon,"{",e=>e.$spinning&&"animation: spin 1s linear infinite;",";}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"),Ax=Rx.withComponent("a",{target:"e1d2l9mo27",label:"PreviewLink"}),Ix=_h(Be.DropdownItem,{target:"e1d2l9mo1",label:"PublishDropDownItem"})({name:"svxjwj",styles:"min-width:initial"}),Dx=_h(Be.DropdownItem,{target:"e1d2l9mo0",label:"StatusDropdownItem"})(Be.Icon,"{color:",Be.colors.infoText,";}");class jx extends r().Component{static propTypes={isPersisting:a().bool,isPublishing:a().bool,isUpdatingStatus:a().bool,isDeleting:a().bool,onPersist:a().func.isRequired,onPersistAndNew:a().func.isRequired,onPersistAndDuplicate:a().func.isRequired,showDelete:a().bool.isRequired,onDelete:a().func.isRequired,onDeleteUnpublishedChanges:a().func.isRequired,onChangeStatus:a().func.isRequired,onPublish:a().func.isRequired,unPublish:a().func.isRequired,onDuplicate:a().func.isRequired,onPublishAndNew:a().func.isRequired,onPublishAndDuplicate:a().func.isRequired,user:a().object,hasChanged:a().bool,displayUrl:a().string,collection:Mg().map.isRequired,hasWorkflow:a().bool,useOpenAuthoring:a().bool,hasUnpublishedChanges:a().bool,isNewEntry:a().bool,isModification:a().bool,currentStatus:a().string,onLogoutClick:a().func.isRequired,deployPreview:a().object,loadDeployPreview:a().func.isRequired,t:a().func.isRequired,editorBackLink:a().string.isRequired};componentDidMount(){a().checkPropTypes(jx.propTypes,this.props,"prop","EditorToolbar");const{isNewEntry:e,loadDeployPreview:t}=this.props;e||(this._pollController=new AbortController,t({maxAttempts:24,signal:this._pollController.signal}))}componentDidUpdate(e){const{isNewEntry:t,isPersisting:n,loadDeployPreview:r}=this.props;t||!e.isPersisting||n||(this._pollController?.abort(),this._pollController=new AbortController,r({maxAttempts:3,signal:this._pollController.signal}))}componentWillUnmount(){this._pollController?.abort()}renderSimpleControls=()=>{const{collection:e,hasChanged:t,isNewEntry:n,showDelete:o,onDelete:i,t:a}=this.props,s=e.get("create");return(0,so.jsx)(r().Fragment,null,n||t?this.renderNewEntrySimplePublishControls({canCreate:s}):this.renderExistingEntrySimplePublishControls({canCreate:s}),(0,so.jsx)("div",null,o?(0,so.jsx)(_x,{onClick:i},a("editor.editorToolbar.deleteEntry")):null))};renderDeployPreviewControls=e=>{const{deployPreview:t={},loadDeployPreview:n,t:r}=this.props,{url:o,status:i,isFetching:a}=t;if(!i)return;const s="SUCCESS"===i&&!a;return(0,so.jsx)(Mx,null,s?(0,so.jsx)(Ax,{rel:"noopener noreferrer",target:"_blank",href:o},(0,so.jsx)("span",null,e),(0,so.jsx)(Be.Icon,{type:"new-tab",size:"xsmall"})):(0,so.jsx)(Rx,{onClick:n,disabled:a,$spinning:a},(0,so.jsx)("span",null,r("editor.editorToolbar.deployPreviewPendingButtonLabel")),(0,so.jsx)(Be.Icon,{type:"refresh",size:"xsmall"})))};renderStatusInfoTooltip=()=>{const{t:e,currentStatus:t}=this.props,n={[zr.get("DRAFT")]:"statusInfoTooltipDraft",[zr.get("PENDING_REVIEW")]:"statusInfoTooltipInReview"},r=Object.keys(n).find(e=>e===t);return(0,so.jsx)(ux,null,(0,so.jsx)(lx,null,(0,so.jsx)(Be.Icon,{type:"info-circle",size:"small",className:"tooltip"})),r&&(0,so.jsx)(sx,null,e(`editor.editorToolbar.${n[r]}`)))};renderWorkflowStatusControls=()=>{const{isUpdatingStatus:e,onChangeStatus:t,currentStatus:n,t:o,useOpenAuthoring:i}=this.props,a={[zr.get("DRAFT")]:o("editor.editorToolbar.draft"),[zr.get("PENDING_REVIEW")]:o("editor.editorToolbar.inReview"),[zr.get("PENDING_PUBLISH")]:o("editor.editorToolbar.ready")},s=e?o("editor.editorToolbar.updating"):o("editor.editorToolbar.status",{status:a[n]});return(0,so.jsx)(r().Fragment,null,(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"120px",renderButton:()=>(0,so.jsx)(Px,null,s)},(0,so.jsx)(Dx,{label:o("editor.editorToolbar.draft"),onClick:()=>t("DRAFT"),icon:n===zr.get("DRAFT")?"check":null}),(0,so.jsx)(Dx,{label:o("editor.editorToolbar.inReview"),onClick:()=>t("PENDING_REVIEW"),icon:n===zr.get("PENDING_REVIEW")?"check":null}),i?"":(0,so.jsx)(Dx,{label:o("editor.editorToolbar.ready"),onClick:()=>t("PENDING_PUBLISH"),icon:n===zr.get("PENDING_PUBLISH")?"check":null})),i&&this.renderStatusInfoTooltip())};renderNewEntryWorkflowPublishControls=({canCreate:e,canPublish:t})=>{const{isPublishing:n,onPublish:o,onPublishAndNew:i,onPublishAndDuplicate:a,t:s}=this.props;return t?(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"200px",renderButton:()=>(0,so.jsx)(Tx,null,s(n?"editor.editorToolbar.publishing":"editor.editorToolbar.publish"))},(0,so.jsx)(Ix,{label:s("editor.editorToolbar.publishNow"),icon:"arrow",iconDirection:"right",onClick:o}),e?(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Ix,{label:s("editor.editorToolbar.publishAndCreateNew"),icon:"add",onClick:i}),(0,so.jsx)(Ix,{label:s("editor.editorToolbar.publishAndDuplicate"),icon:"add",onClick:a})):null):""};renderExistingEntryWorkflowPublishControls=({canCreate:e,canPublish:t,canDelete:n})=>{const{unPublish:r,onDuplicate:o,isPersisting:i,t:a}=this.props;return t||e?(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"max-content",key:"td-publish-create",renderButton:()=>(0,so.jsx)(Cx,null,a(i?"editor.editorToolbar.unpublishing":"editor.editorToolbar.published"))},n&&t&&(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.unpublish"),icon:"arrow",iconDirection:"right",onClick:r}),e&&(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.duplicate"),icon:"add",onClick:o})):""};renderExistingEntrySimplePublishControls=({canCreate:e})=>{const{onDuplicate:t,t:n}=this.props;return e?(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"max-content",renderButton:()=>(0,so.jsx)(Cx,null,n("editor.editorToolbar.published"))},(0,so.jsx)(Be.DropdownItem,{label:n("editor.editorToolbar.duplicate"),icon:"add",onClick:t})):(0,so.jsx)(Ox,null,n("editor.editorToolbar.published"))};renderNewEntrySimplePublishControls=({canCreate:e})=>{const{onPersist:t,onPersistAndNew:n,onPersistAndDuplicate:o,isPersisting:i,t:a}=this.props;return(0,so.jsx)("div",null,(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"max-content",renderButton:()=>(0,so.jsx)(Tx,null,a(i?"editor.editorToolbar.publishing":"editor.editorToolbar.publish"))},(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.publishNow"),icon:"arrow",iconDirection:"right",onClick:t}),e?(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.publishAndCreateNew"),icon:"add",onClick:n}),(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.publishAndDuplicate"),icon:"add",onClick:o})):null))};renderSimpleDeployPreviewControls=()=>{const{hasChanged:e,isNewEntry:t,t:n}=this.props;if(!t&&!e)return this.renderDeployPreviewControls(n("editor.editorToolbar.deployButtonLabel"))};renderWorkflowControls=()=>{const{onPersist:e,onDelete:t,onDeleteUnpublishedChanges:n,showDelete:o,hasChanged:i,hasUnpublishedChanges:a,useOpenAuthoring:s,isPersisting:l,isDeleting:u,isNewEntry:c,isModification:f,currentStatus:d,collection:p,t:h}=this.props,g=p.get("create"),m=p.get("publish")&&!s,y=p.get("delete",!0),v=a&&f&&h("editor.editorToolbar.deleteUnpublishedChanges")||a&&(c||!f)&&h("editor.editorToolbar.deleteUnpublishedEntry")||!a&&!f&&h("editor.editorToolbar.deletePublishedEntry");return[(0,so.jsx)(Ex,{disabled:!i,key:"save-button",onClick:()=>i&&e()},h(l?"editor.editorToolbar.saving":"editor.editorToolbar.save")),d?[(0,so.jsx)(r().Fragment,{key:"workflow-status-controls"},this.renderWorkflowStatusControls(),!i&&this.renderNewEntryWorkflowPublishControls({canCreate:g,canPublish:m}))]:!c&&(0,so.jsx)(r().Fragment,{key:"existing-entry-workflow-publish-controls"},this.renderExistingEntryWorkflowPublishControls({canCreate:g,canPublish:m,canDelete:y})),o&&!s||a||f?(0,so.jsx)(_x,{key:"delete-button",onClick:a?n:t},u?h("editor.editorToolbar.deleting"):v):null]};renderWorkflowDeployPreviewControls=()=>{const{currentStatus:e,isNewEntry:t,t:n}=this.props;return e?this.renderDeployPreviewControls(n("editor.editorToolbar.deployPreviewButtonLabel")):t?void 0:this.renderDeployPreviewControls(n("editor.editorToolbar.deployButtonLabel"))};render(){const{user:e,hasChanged:t,displayUrl:n,collection:r,hasWorkflow:o,onLogoutClick:i,t:a,editorBackLink:s}=this.props;return(0,so.jsx)(fx,null,(0,so.jsx)(gx,{to:s},(0,so.jsx)(vx,null,"←"),(0,so.jsx)("div",null,(0,so.jsx)(bx,null,a("editor.editorToolbar.backCollection",{collectionLabel:r.get("label")})),t?(0,so.jsx)(Sx,null,a("editor.editorToolbar.unsavedChanges")):(0,so.jsx)(xx,null,a("editor.editorToolbar.changesSaved")))),(0,so.jsx)(dx,null,(0,so.jsx)(px,null,o?this.renderWorkflowControls():this.renderSimpleControls()),(0,so.jsx)(hx,null,o?this.renderWorkflowDeployPreviewControls():this.renderSimpleDeployPreviewControls())),(0,so.jsx)(mx,null,(0,so.jsx)(Tg,{displayUrl:n,imageUrl:e?.avatar_url,onLogoutClick:i})))}}const Lx=(0,ze.Tl)()(jx);function Nx(){return Nx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nx.apply(null,arguments)}const $x="cms.preview-visible",Fx="cms.scroll-sync-enabled",Bx="cms.split-pane-position",zx="cms.i18n-visible",Ux={splitPane:(0,so.css)(Be.components.card,";border-radius:0;height:100%;;label:splitPane;"),pane:{name:"1yvxf4n-pane",styles:"height:100%;overflow-y:auto;label:pane;"}},qx=_h(Be.IconButton,{target:"e1nx103k7",label:"EditorToggle"})({name:"cn3xcj",styles:"margin-bottom:12px"});function Wx(){return(0,so.jsx)(so.Global,{styles:(0,so.css)(".Resizer.vertical{width:2px;cursor:col-resize;position:relative;background:none;&:before{content:'';width:2px;height:100%;position:relative;background-color:",Be.colors.textFieldBorder,";display:block;z-index:10;transition:background-color ",Be.transitions.main,";}&:hover,&:active{&:before{width:4px;left:-1px;background-color:",Be.colorsRaw.blue,";}}};label:ReactSplitPaneGlobalStyles;")})}const Hx=_h(lw,{target:"e1nx103k6",label:"StyledSplitPane"})(Ux.splitPane,";.Pane{height:100%;}"),Vx=_h("div",{target:"e1nx103k5",label:"NoPreviewContainer"})(Ux.splitPane,";"),Kx=_h("div",{target:"e1nx103k4",label:"EditorContainer"})("width:100%;min-width:800px;height:100%;position:absolute;top:0;left:0;overflow:hidden;padding-top:66px;background-color:",Be.colors.background,";"),Gx=_h("div",{target:"e1nx103k3",label:"Editor"})({name:"yd3x82",styles:"height:100%;margin:0 auto;position:relative"}),Yx=_h("div",{target:"e1nx103k2",label:"PreviewPaneContainer"})("height:100%;pointer-events:",e=>e.blockEntry?"none":"auto",";overflow-y:",e=>e.overFlow?"auto":"hidden",";"),Qx=_h(Yx,{target:"e1nx103k1",label:"ControlPaneContainer"})({name:"b2tic3",styles:"padding:0 16px;position:relative;overflow-x:hidden"}),Jx=_h("div",{target:"e1nx103k0",label:"ViewControls"})("position:absolute;top:10px;right:10px;z-index:",Be.zIndex.zIndex299,";");function Xx({i18nVisible:e,previewVisible:t,editor:n,editorWithEditor:r,editorWithPreview:o}){return e?r:t?o:(0,so.jsx)(Vx,null,n)}class Zx extends n.Component{state={showEventBlocker:!1,previewVisible:"false"!==localStorage.getItem($x),scrollSyncEnabled:"false"!==localStorage.getItem(Fx),i18nVisible:"false"!==localStorage.getItem(zx)};handleFieldClick=e=>{this.controlPaneRef?.focus(e)};handleSplitPaneDragStart=()=>{this.setState({showEventBlocker:!0})};handleSplitPaneDragFinished=()=>{this.setState({showEventBlocker:!1})};handleOnPersist=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e;await this.controlPaneRef.switchToDefaultLocale(),this.controlPaneRef.validate(),this.props.onPersist({createNew:t,duplicate:n})};handleOnPublish=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e;await this.controlPaneRef.switchToDefaultLocale(),this.controlPaneRef.validate(),this.props.onPublish({createNew:t,duplicate:n})};handleTogglePreview=()=>{const e=!this.state.previewVisible;this.setState({previewVisible:e}),localStorage.setItem($x,e)};handleToggleScrollSync=()=>{const e=!this.state.scrollSyncEnabled;this.setState({scrollSyncEnabled:e}),localStorage.setItem(Fx,e)};handleToggleI18n=()=>{const e=!this.state.i18nVisible;this.setState({i18nVisible:e}),localStorage.setItem(zx,e)};handleLeftPanelLocaleChange=e=>{this.setState({leftPanelLocale:e})};render(){const{collection:e,entry:t,fields:n,fieldsMetaData:r,fieldsErrors:o,onChange:i,showDelete:a,onDelete:s,onDeleteUnpublishedChanges:l,onChangeStatus:u,onPublish:c,unPublish:f,onDuplicate:d,onValidate:p,user:h,hasChanged:g,displayUrl:m,hasWorkflow:y,useOpenAuthoring:v,hasUnpublishedChanges:b,isNewEntry:w,isModification:x,currentStatus:S,onLogoutClick:k,loadDeployPreview:_,deployPreview:E,draftKey:C,editorBackLink:O,t:T}=this.props,{scrollSyncEnabled:P,showEventBlocker:M}=this.state,R=function(e,t){if(e.get("type")===ro){const n=$l(e,t.get("slug")),r=n?.getIn(["editor","preview"]);if(null!=r)return r}return e.getIn(["editor","preview"],!0)}(e,t),{locales:A,defaultLocale:I}=ru(this.props.collection),D=nu(e)&&A.length>1,j={collection:e,entry:t,fields:n,fieldsMetaData:r,fieldsErrors:o,onChange:i,onValidate:p},L=this.state.leftPanelLocale||A?.[0],N=(0,so.jsx)(Qx,{overFlow:!0,blockEntry:M},(0,so.jsx)(Lw,Nx({},j,{ref:e=>this.controlPaneRef=e,locale:L,t:T,onLocaleChange:this.handleLeftPanelLocaleChange}))),$=(0,so.jsx)(Qx,{overFlow:!this.state.scrollSyncEnabled,blockEntry:M},(0,so.jsx)(Lw,Nx({},j,{locale:A?.[1],t:T}))),F=D?function(e,t,n){return t===n?e:e.set("data",e.getIn([Zl,t,"data"]))}(t,L,I):t,B=(0,so.jsx)(uw.ScrollSync,{enabled:this.state.scrollSyncEnabled},(0,so.jsx)("div",null,(0,so.jsx)(Wx,null),(0,so.jsx)(Hx,{maxSize:-100,minSize:400,defaultSize:parseInt(localStorage.getItem(Bx),10)||"50%",onChange:e=>localStorage.setItem(Bx,e),onDragStarted:this.handleSplitPaneDragStart,onDragFinished:this.handleSplitPaneDragFinished},(0,so.jsx)(uw.ScrollSyncPane,null,N),(0,so.jsx)(Yx,{blockEntry:M},(0,so.jsx)(ix,{collection:e,entry:F,fields:n,fieldsMetaData:r,locale:L,onFieldClick:this.handleFieldClick}))))),z=(0,so.jsx)(uw.ScrollSync,{enabled:this.state.scrollSyncEnabled},(0,so.jsx)("div",null,(0,so.jsx)(Hx,{maxSize:-100,defaultSize:parseInt(localStorage.getItem(Bx),10)||"50%",onChange:e=>localStorage.setItem(Bx,e),onDragStarted:this.handleSplitPaneDragStart,onDragFinished:this.handleSplitPaneDragFinished},(0,so.jsx)(uw.ScrollSyncPane,null,N),(0,so.jsx)(uw.ScrollSyncPane,null,$)))),U=D&&this.state.i18nVisible,q=R&&this.state.previewVisible,W=U||q;return(0,so.jsx)(Kx,null,(0,so.jsx)(Lx,{isPersisting:t.get("isPersisting"),isPublishing:t.get("isPublishing"),isUpdatingStatus:t.get("isUpdatingStatus"),isDeleting:t.get("isDeleting"),onPersist:this.handleOnPersist,onPersistAndNew:()=>this.handleOnPersist({createNew:!0}),onPersistAndDuplicate:()=>this.handleOnPersist({createNew:!0,duplicate:!0}),onDelete:s,onDeleteUnpublishedChanges:l,onChangeStatus:u,showDelete:a,onPublish:c,unPublish:f,onDuplicate:d,onPublishAndNew:()=>this.handleOnPublish({createNew:!0}),onPublishAndDuplicate:()=>this.handleOnPublish({createNew:!0,duplicate:!0}),user:h,hasChanged:g,displayUrl:m,collection:e,hasWorkflow:y,useOpenAuthoring:v,hasUnpublishedChanges:b,isNewEntry:w,isModification:x,currentStatus:S,onLogoutClick:k,loadDeployPreview:_,deployPreview:E,editorBackLink:O}),(0,so.jsx)(Gx,{key:C},(0,so.jsx)(Jx,null,D&&(0,so.jsx)(qx,{isActive:U,onClick:this.handleToggleI18n,size:"large",type:"page",title:T("editor.editorInterface.toggleI18n"),marginTop:"70px"}),R&&(0,so.jsx)(qx,{isActive:q,onClick:this.handleTogglePreview,size:"large",type:"eye",title:T("editor.editorInterface.togglePreview")}),W&&!e.getIn(["editor","visualEditing"])&&(0,so.jsx)(qx,{isActive:P,onClick:this.handleToggleScrollSync,size:"large",type:"scroll",title:T("editor.editorInterface.toggleScrollSync")})),(0,so.jsx)(Xx,{i18nVisible:U,previewVisible:q,editor:N,editorWithEditor:z,editorWithPreview:B})))}}Zx.propTypes={collection:Mg().map.isRequired,entry:Mg().map.isRequired,fields:Mg().list.isRequired,fieldsMetaData:Mg().map.isRequired,fieldsErrors:Mg().map.isRequired,onChange:a().func.isRequired,onValidate:a().func.isRequired,onPersist:a().func.isRequired,showDelete:a().bool.isRequired,onDelete:a().func.isRequired,onDeleteUnpublishedChanges:a().func.isRequired,onPublish:a().func.isRequired,unPublish:a().func.isRequired,onDuplicate:a().func.isRequired,onChangeStatus:a().func.isRequired,user:a().object,hasChanged:a().bool,displayUrl:a().string,hasWorkflow:a().bool,useOpenAuthoring:a().bool,hasUnpublishedChanges:a().bool,isNewEntry:a().bool,isModification:a().bool,currentStatus:a().string,onLogoutClick:a().func.isRequired,deployPreview:a().object,loadDeployPreview:a().func.isRequired,draftKey:a().string.isRequired,t:a().func.isRequired};const eS=Zx;function tS(e,t){const{collections:n}=e,r=e.config.publish_mode===Br,o=n.get(t.match.params.name),i={isEditorialWorkflow:r,showDelete:!t.newEntry&&Wl(o)};if(r){const n=t.match.params[0],r=Gc(e,o.get("name"),n);r&&(i.unpublishedEntry=!0,i.entry=r)}return i}function nS(e,t,n){const{isEditorialWorkflow:r,unpublishedEntry:o}=e,{dispatch:i}=t,a={};return r&&(a.loadEntry=(e,t)=>i(ts(e,t)),a.persistEntry=e=>i(function(e,t){return async(n,r)=>{const o=r(),i=o.entryDraft,a=i.get("fieldsErrors"),s=function(e,t){return function(e,t){return e.get("entities")?e.get("entities").filter((e,n)=>kc()(n,`${t}.`)).map(e=>e.get("slug")).valueSeq():null}(e.editorialWorkflow,t)}(o,e.get("name")),l=Vc(o,e.get("name")).concat(s);if(!on()(o.editorialWorkflow.toJS(),"pages.ids",!1)&&n(ns(o.collections)),!a.isEmpty())return a.some(e=>e.some(e=>e.type&&e.type===Ci))&&n(Ii({message:{key:"ui.toast.missingRequiredField"},type:"error",dismissAfter:8e3})),Promise.reject();const u=uc(o.config),c=i.get("entry"),f=el({entry:c}),d=tl(e,c),p=i.set("entry",d);n(Xa(e,c.get("slug")));const h=t?u.persistUnpublishedEntry:u.persistEntry;try{const t=await h.call(u,{config:o.config,collection:e,entryDraft:p,assetProxies:f,usedSlugs:l});n(Ii({message:{key:"ui.toast.entrySaved"},type:"success",dismissAfter:4e3})),n(Za(e,d)),c.get("slug")!==t&&(await n(ts(e,t)),ja(e.get("name"),t))}catch(t){return n(Ii({message:{key:"ui.toast.onFailToPersist",details:t},type:"error",dismissAfter:8e3})),Promise.reject(n(es(t,e,c.get("slug"))))}}}(e,o))),{...n,...e,...a}}class rS extends r().Component{static propTypes={changeDraftField:a().func.isRequired,changeDraftFieldValidation:a().func.isRequired,collection:Mg().map.isRequired,createDraftDuplicateFromEntry:a().func.isRequired,createEmptyDraft:a().func.isRequired,discardDraft:a().func.isRequired,entry:Mg().map,entryDraft:Mg().map.isRequired,loadEntry:a().func.isRequired,persistEntry:a().func.isRequired,deleteEntry:a().func.isRequired,showDelete:a().bool.isRequired,fields:Mg().list.isRequired,slug:a().string,newEntry:a().bool.isRequired,displayUrl:a().string,hasWorkflow:a().bool,useOpenAuthoring:a().bool,unpublishedEntry:a().bool,isModification:a().bool,collectionEntriesLoaded:a().bool,updateUnpublishedEntryStatus:a().func.isRequired,publishUnpublishedEntry:a().func.isRequired,deleteUnpublishedEntry:a().func.isRequired,logoutUser:a().func.isRequired,loadEntries:a().func.isRequired,deployPreview:a().object,loadDeployPreview:a().func.isRequired,currentStatus:a().string,user:a().object,location:a().shape({pathname:a().string,search:a().string}),hasChanged:a().bool,t:a().func.isRequired,retrieveLocalBackup:a().func.isRequired,localBackup:Mg().map,loadLocalBackup:a().func,persistLocalBackup:a().func.isRequired,deleteLocalBackup:a().func};componentDidMount(){a().checkPropTypes(rS.propTypes,this.props,"prop","Editor");const{newEntry:e,collection:t,slug:n,loadEntry:r,createEmptyDraft:o,loadEntries:i,retrieveLocalBackup:s,collectionEntriesLoaded:l,t:u}=this.props;s(t,n),e?o(t,this.props.location.search):r(t,n);const c=u("editor.editor.onLeavePage");this.exitBlocker=e=>{if(this.props.entryDraft.get("hasChanged"))return e.returnValue=c,c},window.addEventListener("beforeunload",this.exitBlocker);const f=Aa.block((e,n)=>{const r=this.props.entryDraft.getIn(["entry","isPersisting"]),o=this.props.entryDraft.getIn(["entry","newRecord"]),i=`/collections/${t.get("name")}/new`;if(!r||!o||this.props.location.pathname!==i||"PUSH"!==n)return this.props.hasChanged?c:void 0});this.unlisten=Aa.listen((e,n)=>{const r=`/collections/${t.get("name")}/new`,o=`/collections/${t.get("name")}/entries/`,{pathname:i}=e;i.startsWith(r)||i.startsWith(o)&&"PUSH"===n||(this.deleteBackup(),f(),this.unlisten())}),l||i(t)}componentDidUpdate(e){if(!e.localBackup&&this.props.localBackup&&(window.confirm(this.props.t("editor.editor.confirmLoadBackup"))?this.props.loadLocalBackup():this.deleteBackup()),this.props.hasChanged&&this.createBackup(this.props.entryDraft.get("entry"),this.props.collection),e.entry===this.props.entry)return;const{newEntry:t,collection:n}=this.props;t&&e.createEmptyDraft(n,this.props.location.search)}componentWillUnmount(){this.createBackup.flush(),this.props.discardDraft(),window.removeEventListener("beforeunload",this.exitBlocker)}createBackup=zb()(function(e,t){this.props.persistLocalBackup(e,t)},2e3);handleChangeDraftField=(e,t,n,r)=>{const o=[this.props.unPublishedEntry,this.props.publishedEntry].filter(Boolean);this.props.changeDraftField({field:e,value:t,metadata:n,entries:o,i18n:r})};handleChangeStatus=e=>{const{entryDraft:t,updateUnpublishedEntryStatus:n,collection:r,slug:o,currentStatus:i,t:a}=this.props;if(t.get("hasChanged"))return void window.alert(a("editor.editor.onUpdatingWithUnsavedChanges"));const s=zr.get(e);n(r.get("name"),o,i,s)};deleteBackup(){const{deleteLocalBackup:e,collection:t,slug:n,newEntry:r}=this.props;this.createBackup.cancel(),e(t,!r&&n)}handlePersistEntry=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e,{persistEntry:r,collection:o,currentStatus:i,hasWorkflow:a,loadEntry:s,slug:l,createDraftDuplicateFromEntry:u,entryDraft:c}=this.props;await r(o),this.deleteBackup(),t?(Da(o.get("name")),n&&u(c.get("entry"))):l&&a&&!i&&s(o,l)};handlePublishEntry=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e,{publishUnpublishedEntry:r,createDraftDuplicateFromEntry:o,entryDraft:i,collection:a,slug:s,currentStatus:l,t:u}=this.props;l===zr.last()?i.get("hasChanged")?window.alert(u("editor.editor.onPublishingWithUnsavedChanges")):window.confirm(u("editor.editor.onPublishing"))&&(await r(a.get("name"),s),this.deleteBackup(),t&&Da(a.get("name")),n&&o(i.get("entry"))):window.alert(u("editor.editor.onPublishingNotReady"))};handleUnpublishEntry=async()=>{const{unpublishPublishedEntry:e,collection:t,slug:n,t:r}=this.props;if(window.confirm(r("editor.editor.onUnpublishing")))return await e(t,n),Ia(t.get("name"))};handleDuplicateEntry=()=>{const{createDraftDuplicateFromEntry:e,collection:t,entryDraft:n}=this.props;Da(t.get("name")),e(n.get("entry"))};handleDeleteEntry=()=>{const{entryDraft:e,newEntry:t,collection:n,deleteEntry:r,slug:o,t:i}=this.props;if(e.get("hasChanged")){if(!window.confirm(i("editor.editor.onDeleteWithUnsavedChanges")))return}else if(!window.confirm(i("editor.editor.onDeletePublishedEntry")))return;if(t)return Ia(n.get("name"));setTimeout(async()=>(await r(n,o),this.deleteBackup(),Ia(n.get("name"))),0)};handleDeleteUnpublishedChanges=async()=>{const{entryDraft:e,collection:t,slug:n,deleteUnpublishedEntry:r,loadEntry:o,isModification:i,t:a}=this.props;e.get("hasChanged")&&!window.confirm(a("editor.editor.onDeleteUnpublishedChangesWithUnsavedChanges"))||window.confirm(a("editor.editor.onDeleteUnpublishedChanges"))&&(await r(t.get("name"),n),this.deleteBackup(),i?o(t,n):Ia(t.get("name")))};render(){const{entry:e,entryDraft:t,fields:n,collection:r,changeDraftFieldValidation:o,user:i,hasChanged:a,displayUrl:s,hasWorkflow:l,useOpenAuthoring:u,unpublishedEntry:c,newEntry:f,isModification:d,currentStatus:p,logoutUser:h,deployPreview:g,loadDeployPreview:m,draftKey:y,slug:v,t:b,editorBackLink:w}=this.props,x=!f&&!c;return e&&e.get("error")?(0,so.jsx)("div",null,(0,so.jsx)("h3",null,e.get("error"))):null==t||void 0===t.get("entry")||e&&e.get("isFetching")?(0,so.jsx)(Be.Loader,{active:!0},b("editor.editor.loadingEntry")):(0,so.jsx)(eS,{draftKey:y,entry:t.get("entry"),collection:r,fields:n,fieldsMetaData:t.get("fieldsMetaData"),fieldsErrors:t.get("fieldsErrors"),onChange:this.handleChangeDraftField,onValidate:o,onPersist:this.handlePersistEntry,onDelete:this.handleDeleteEntry,onDeleteUnpublishedChanges:this.handleDeleteUnpublishedChanges,onChangeStatus:this.handleChangeStatus,onPublish:this.handlePublishEntry,unPublish:this.handleUnpublishEntry,onDuplicate:this.handleDuplicateEntry,showDelete:this.props.showDelete,user:i,hasChanged:a,displayUrl:s,hasWorkflow:l,useOpenAuthoring:u,hasUnpublishedChanges:c,isNewEntry:f,isModification:d,currentStatus:p,onLogoutClick:h,deployPreview:g,loadDeployPreview:t=>m(r,v,e,x,t),editorBackLink:w,t:b})}}const oS={changeDraftField:function({field:e,value:t,metadata:n,entries:r,i18n:o}){return{type:Cs,payload:{field:e,value:t,metadata:n,entries:r,i18n:o}}},changeDraftFieldValidation:function(e,t){return{type:Os,payload:{uniquefieldId:e,errors:t}}},loadEntry:Gs,loadEntries:Xs,loadDeployPreview:function(e,t,n,r,o){return async(i,a)=>{const s=a(),l=uc(s.config),u=e.get("name"),c=Kc(s,u,t);if(!c||!c.isFetching||o?.signal){i(function(e,t){return{type:Pc,payload:{collection:e,slug:t}}}(u,t));try{const a=r?l.getDeploy(e,t,n):await l.getDeployPreview(e,t,n,o);return i(a?function(e,t,n){const{url:r,status:o}=n;return{type:Mc,payload:{collection:e,slug:t,url:r,status:o}}}(u,t,a):Ac(u,t))}catch(e){console.error(e),i(Ii({message:{details:e.message,key:"ui.toast.onFailToLoadDeployPreview"},type:"error",dismissAfter:8e3})),i(Ac(u,t))}}}},loadLocalBackup:function(){return{type:Ms}},retrieveLocalBackup:function(e,t){return async(n,r)=>{const o=r(),i=uc(o.config),{entry:a}=await i.getLocalDraftBackup(e,t);if(a){const t=a.mediaFiles||[],o=await Promise.all(t.map(t=>t.file||t.url?Cn({path:t.path,file:t.file,url:t.url,field:t.field}):Ra({collection:e,entry:(0,Ge.fromJS)(a),path:t.path,field:t.field})(n,r)));return n(Ca(o)),n(function(e){return{type:Ps,payload:{entry:e}}}(a))}}},persistLocalBackup:function(e,t){return(n,r)=>{const o=r();return uc(o.config).persistLocalDraftBackup(e,t)}},deleteLocalBackup:function(e,t){return(n,r)=>{const o=r();return uc(o.config).deleteLocalDraftBackup(e,t)}},createDraftDuplicateFromEntry:function(e){return t=>{t(Ti({predicate:({type:e})=>e===_s,run:()=>t(function(e){return{type:Rs,payload:oi(e.get("collection"),"","",{data:e.get("data"),i18n:e.get("i18n"),mediaFiles:e.get("mediaFiles").toJS()})}}(e))}))}},createEmptyDraft:function(e,t){return async(n,r)=>{new URLSearchParams(t).forEach((t,n)=>{e=function(e,n){const r=Vl(e,n);if(!r)return e;let o=!1;return e=e.set("fields",Kl(e.get("fields",(0,Ge.List)()),function(e){const n=e;return n===r?(o=!0,(e=>{return e.set("default",!!["true","True","TRUE"].includes(n=t)||!["false","False","FALSE"].includes(n)&&function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}(n));var n})(n)):n},()=>o)),e}(e,n)});const o=e.get("fields",(0,Ge.List)()),i=function(e){return e.filter(e=>!e.get("meta")).toList()}(o),a=Zs(i),s=function(e){return e.filter(e=>!0===e.get("meta")).toList()}(o),l=Zs(s),u=r(),c=uc(u.config);e.has("media_folder")||await ma(n,r());const f=function(e,t){if(!nu(e))return{};return function(e,t){const{locales:n,defaultLocale:r}=ru(e);return Object.fromEntries(n.filter(e=>e!==r).map(e=>[e,{data:t}]))}(e,Zs(t,function(e){return e.get(Zl)!==tu.DUPLICATE&&e.get(Zl)!==tu.TRANSLATE}))}(e,i);let d=oi(e.get("name"),"","",{data:a,i18n:f,mediaFiles:[],meta:l});d=await c.processEntry(u,e,d),n({type:_s,payload:d})}},discardDraft:function(){return{type:Es}},persistEntry:function(e){return async(t,n)=>{const r=n(),o=r.entryDraft,i=o.get("fieldsErrors"),a=Vc(r,e.get("name"));if(!i.isEmpty())return i.some(e=>e.some(e=>e.type&&e.type===Ci))&&t(Ii({message:{key:"ui.toast.missingRequiredField"},type:"error",dismissAfter:8e3})),Promise.reject();const s=uc(r.config),l=o.get("entry"),u=el({entry:l}),c=tl(e,l),f=o.set("entry",c);return t(function(e,t){return{type:As,payload:{collectionName:e.get("name"),entrySlug:t.get("slug")}}}(e,c)),s.persistEntry({config:r.config,collection:e,entryDraft:f,assetProxies:u,usedSlugs:a}).then(async n=>{t(Ii({message:{key:"ui.toast.entrySaved"},type:"success",dismissAfter:4e3})),u.length>0&&await t(ra()),t(function(e,t,n){return{type:Is,payload:{collectionName:e.get("name"),entrySlug:t.get("slug"),slug:n}}}(e,c,n)),e.has("nested")&&await t(Xs(e)),l.get("slug")!==n&&(await t(Gs(e,n)),ja(e.get("name"),n))}).catch(n=>(console.error(n),t(Ii({message:{details:n,key:"ui.toast.onFailToPersist"},type:"error",dismissAfter:8e3})),Promise.reject(t(function(e,t,n){return{type:Ds,error:"Failed to persist entry",payload:{collectionName:e.get("name"),entrySlug:t.get("slug"),error:n.toString()}}}(e,c,n)))))}},deleteEntry:function(e,t){return(n,r)=>{const o=r(),i=uc(o.config);return n(function(e,t){return{type:"ENTRY_DELETE_REQUEST",payload:{collectionName:e.get("name"),entrySlug:t}}}(e,t)),i.deleteEntry(o,e,t).then(()=>n(Ws(e,t))).catch(r=>(n(Ii({message:{details:r,key:"ui.toast.onFailToDelete"},type:"error",dismissAfter:8e3})),console.error(r),Promise.reject(n(function(e,t,n){return{type:"ENTRY_DELETE_FAILURE",payload:{collectionName:e.get("name"),entrySlug:t,error:n.toString()}}}(e,t,r)))))}},updateUnpublishedEntryStatus:rs,publishUnpublishedEntry:is,unpublishPublishedEntry:function(e,t){return(n,r)=>{const o=r(),i=uc(o.config),a=Hc(o,e.get("name"),t),s=(0,Ge.Map)().set("entry",a);return n(Xa(e,t)),i.deleteEntry(o,e,t).then(()=>i.persistEntry({config:o.config,collection:e,entryDraft:s,assetProxies:[],usedSlugs:(0,Ge.List)(),status:zr.get("PENDING_PUBLISH")})).then(()=>{n(Za(e,a)),n(Ws(e,t)),n(ts(e,t)),n(Ii({message:{key:"ui.toast.entryUnpublished"},type:"success",dismissAfter:4e3}))}).catch(t=>{n(Ii({message:{key:"ui.toast.onFailToUnpublishEntry",details:t},type:"error",dismissAfter:8e3})),n(es(t,e,a.get("slug")))})}},deleteUnpublishedEntry:os,logoutUser:wc},iS=V(function(e,t){const{collections:n,entryDraft:r,auth:o,config:i,entries:a,globalUI:s}=e,l=t.match.params[0],u=n.get(t.match.params.name),c=u.get("name"),f=!0===t.newRecord,d=Fl(u,l),p=f?null:Hc(e,c,l),h=o.user,g=r.get("hasChanged"),m=i.display_url,y=i.publish_mode===Br,v=s.useOpenAuthoring,b=r.getIn(["entry","isModification"]),w=!!a.getIn(["pages",c]),x=Gc(e,c,l),S=Hc(e,c,l),k=x&&x.get("status"),_=Kc(e,c,l),E=r.get("localBackup"),C=r.get("key");let O=`/collections/${c}`;if("workflow"===new URLSearchParams(t.location.search).get("ref")&&(O="/workflow"),u.has("nested")&&l){const e=l.split("/");e.length>2&&(O=`${O}/filter/${e.slice(0,-2).join("/")}`)}return{collection:u,collections:n,newEntry:f,entryDraft:r,fields:d,slug:l,entry:p,user:h,hasChanged:g,displayUrl:m,hasWorkflow:y,useOpenAuthoring:v,isModification:b,collectionEntriesLoaded:w,currentStatus:k,deployPreview:_,localBackup:E,draftKey:C,publishedEntry:S,unPublishedEntry:x,editorBackLink:O}},oS)(function(e){return V(tS,null,nS)(class extends r().Component{render(){return(0,so.jsx)(e,this.props)}})}((0,ze.Tl)()(rS))),aS=_h("div",{target:"ew40z3q0",label:"NotFoundContainer"})("margin:",Be.lengths.pageMargin,";");function sS({t:e}){return(0,so.jsx)(aS,null,(0,so.jsx)("h2",null,e("app.notFoundPage.header")))}sS.propTypes={t:a().func.isRequired};const lS=(0,ze.Tl)()(sS);function uS(){return uS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uS.apply(null,arguments)}const cS={buttonActive:(0,so.css)("color:",Be.colors.active,";;label:buttonActive;")};function fS(e){return(0,so.jsx)("header",uS({css:(0,so.css)(Be.shadows.dropMain,";position:sticky;width:100%;top:0;background-color:",Be.colors.foreground,";z-index:",Be.zIndex.zIndex300,";height:",Be.lengths.topBarHeight,";;label:AppHeader;")},e))}const dS=_h("div",{target:"e1rbzf6g5",label:"AppHeaderContent"})({name:"jxf21e",styles:"display:flex;justify-content:space-between;min-width:800px;max-width:1440px;padding:0 12px;margin:0 auto"}),pS=_h("button",{target:"e1rbzf6g4",label:"AppHeaderButton"})(Be.buttons.button,";background:none;color:#7b8290;font-family:inherit;font-size:16px;font-weight:500;display:inline-flex;padding:16px 20px;align-items:center;",Be.Icon,"{margin-right:4px;color:#b3b9c4;}&:hover,&:active,&:focus-visible{",cS.buttonActive,";",Be.Icon,"{",cS.buttonActive,";}}",e=>(0,so.css)("&.",e.activeClassName,"{",cS.buttonActive,";",Be.Icon,"{",cS.buttonActive,";}};label:AppHeaderButton;"),";"),hS=pS.withComponent(Ey,{target:"e1rbzf6g6",label:"AppHeaderNavLink"}),gS=_h("div",{target:"e1rbzf6g3",label:"AppHeaderActions"})({name:"8irbms",styles:"display:inline-flex;align-items:center"}),mS=_h(Be.StyledDropdownButton,{target:"e1rbzf6g2",label:"AppHeaderQuickNewButton"})(Be.buttons.button,";",Be.buttons.medium,";",Be.buttons.gray,";margin-right:8px;&:after{top:11px;}"),yS=_h("ul",{target:"e1rbzf6g1",label:"AppHeaderNavList"})({name:"1vufzxm",styles:"display:flex;margin:0;list-style:none"}),vS=_h("li",{target:"e1rbzf6g0",label:"AppHeaderLogo"})({name:"d1300z",styles:"display:flex;align-items:center;img{padding:12px 20px;max-height:56px;max-width:300px;object-fit:contain;object-position:center;}"});class bS extends r().Component{static propTypes={user:a().object.isRequired,collections:Mg().map.isRequired,onCreateEntryClick:a().func.isRequired,onLogoutClick:a().func.isRequired,openMediaLibrary:a().func.isRequired,hasWorkflow:a().bool.isRequired,displayUrl:a().string,logoUrl:a().string,logo:a().shape({src:a().string.isRequired,show_in_header:a().bool}),isTestRepo:a().bool,t:a().func.isRequired,checkBackendStatus:a().func.isRequired};intervalId;componentDidMount(){a().checkPropTypes(bS.propTypes,this.props,"prop","Header"),this.intervalId=setInterval(()=>{this.props.checkBackendStatus()},3e5)}componentWillUnmount(){clearInterval(this.intervalId)}handleCreatePostClick=e=>{const{onCreateEntryClick:t}=this.props;t&&t(e)};render(){const{user:e,collections:t,onLogoutClick:n,openMediaLibrary:r,hasWorkflow:o,displayUrl:i,logoUrl:a,logo:s,isTestRepo:l,t:u,showMediaButton:c}=this.props,f=t.filter(e=>e.get("create")).toList(),d=s?.show_in_header&&s?.src;return(0,so.jsx)(fS,null,(0,so.jsx)(dS,null,(0,so.jsx)("nav",null,(0,so.jsx)(yS,null,d&&(0,so.jsx)(vS,null,(0,so.jsx)("img",{src:s?.src||a,alt:"Logo"})),(0,so.jsx)("li",null,(0,so.jsx)(hS,{to:"/",activeClassName:"header-link-active",isActive:(e,t)=>t.pathname.startsWith("/collections/")},(0,so.jsx)(Be.Icon,{type:"page"}),u("app.header.content"))),o&&(0,so.jsx)("li",null,(0,so.jsx)(hS,{to:"/workflow",activeClassName:"header-link-active"},(0,so.jsx)(Be.Icon,{type:"workflow"}),u("app.header.workflow"))),c&&(0,so.jsx)("li",null,(0,so.jsx)(pS,{onClick:r},(0,so.jsx)(Be.Icon,{type:"media-alt"}),u("app.header.media"))))),(0,so.jsx)(gS,null,f.size>0&&(0,so.jsx)(Be.Dropdown,{renderButton:()=>(0,so.jsx)(mS,null," ",u("app.header.quickAdd")),dropdownTopOverlap:"30px",dropdownWidth:"160px",dropdownPosition:"left"},f.map(e=>(0,so.jsx)(Be.DropdownItem,{key:e.get("name"),label:e.get("label_singular")||e.get("label"),onClick:()=>this.handleCreatePostClick(e.get("name"))}))),(0,so.jsx)(Tg,{displayUrl:i,isTestRepo:l,imageUrl:e?.avatar_url,onLogoutClick:n}))))}}const wS={checkBackendStatus:function(){return async(e,t)=>{try{const n=t();if(n.status.isFetching)return;e({type:$c});const r=uc(n.config),o=await r.status(),i="ui.toast.onBackendDown",a=n.notifications.notifications.filter(e=>"string"!=typeof e.message&&e.message?.key===i);if(!1===o.api.status)return 0===a.length&&e(Ii({message:{details:o.api.statusPage,key:"ui.toast.onBackendDown"},type:"error"})),e(zc(o));if(!0===o.api.status&&a.length>0&&a.forEach(t=>{e(Di(t.id))}),!1===o.auth.status){const t="ui.toast.onLoggedOut",r=n.notifications.notifications.find(e=>"string"!=typeof e.message&&e.message?.key===t);r||e(Ii({message:{key:"ui.toast.onLoggedOut"},type:"error"}))}e(zc(o))}catch(t){e(function(e){return{type:Bc,payload:{error:e}}}(t))}}}},xS=V(null,wS)((0,ze.Tl)()(bS));function SS(){return SS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SS.apply(null,arguments)}Ag().config({barColors:{0:Be.colors.active,"1.0":Be.colors.active},shadowBlur:0,barThickness:2});const kS=_h("div",{target:"eh2m33j2",label:"AppMainContainer"})({name:"y0stlg",styles:"min-width:800px;max-width:1440px;margin:0 auto"}),_S=_h("div",{target:"eh2m33j1",label:"ErrorContainer"})({name:"3zy121",styles:"margin:20px"}),ES=_h("pre",{target:"eh2m33j0",label:"ErrorCodeBlock"})({name:"1dps4tx",styles:"margin-left:20px;font-size:15px;line-height:1.5"});function CS(e){const t=e.filter(e=>!0!==e.get("hide")).first();if(t)return`/collections/${t.get("name")}`;throw new Error("Could not find a non hidden collection")}function OS({collections:e,render:t,...n}){const r=CS(e);return(0,so.jsx)($e,SS({},n,{render:n=>e.get(n.match.params.name)?t(n):(0,so.jsx)(De,{to:r})}))}class TS extends r().Component{static propTypes={auth:a().object.isRequired,config:a().object.isRequired,collections:Mg().map.isRequired,loginUser:a().func.isRequired,logoutUser:a().func.isRequired,user:a().object,isFetching:a().bool.isRequired,publishMode:a().oneOf([Fr,Br]),siteId:a().string,useMediaLibrary:a().bool,openMediaLibrary:a().func.isRequired,showMediaButton:a().bool,t:a().func.isRequired};componentDidMount(){a().checkPropTypes(TS.propTypes,this.props,"prop","App")}configError(e){const t=this.props.t;return(0,so.jsx)(_S,null,(0,so.jsx)("h1",null,t("app.app.errorHeader")),(0,so.jsx)("div",null,(0,so.jsx)("strong",null,t("app.app.configErrors"),":"),(0,so.jsx)(ES,null,e.error),(0,so.jsx)("span",null,t("app.app.checkConfigYml"))))}handleLogin(e){this.props.loginUser(e)}authenticating(){const{auth:e,t}=this.props,n=uc(this.props.config);return null==n?(0,so.jsx)("div",null,(0,so.jsx)("h1",null,t("app.app.waitingBackend"))):(0,so.jsx)("div",null,(0,so.jsx)(bg,null),r().createElement(n.authComponent(),{onLogin:this.handleLogin.bind(this),error:e.error,inProgress:e.isFetching,siteId:this.props.config.backend.site_domain,base_url:this.props.config.backend.base_url,authEndpoint:this.props.config.backend.auth_endpoint,config:this.props.config,clearHash:()=>Aa.replace("/"),t}))}handleLinkClick(e,t,...n){e.preventDefault(),t(...n)}render(){const{user:e,config:t,collections:n,logoutUser:o,isFetching:i,publishMode:a,useMediaLibrary:s,openMediaLibrary:l,t:u,showMediaButton:c}=this.props;if(null===t)return null;if(t.error)return this.configError(t);if(t.isFetching)return(0,so.jsx)(Be.Loader,{active:!0},u("app.app.loadingConfig"));if(null==e)return this.authenticating(u);const f=CS(n),d=a===Br;return(0,so.jsx)(r().Fragment,null,(0,so.jsx)(bg,null),(0,so.jsx)(xS,{user:e,collections:n,onCreateEntryClick:Ig,onLogoutClick:o,openMediaLibrary:l,hasWorkflow:d,displayUrl:t.display_url,logoUrl:t.logo_url,logo:t.logo,isTestRepo:"test-repo"===t.backend.name,showMediaButton:c}),(0,so.jsx)(kS,null,i&&(0,so.jsx)(Ag(),null),(0,so.jsx)(Fe,null,(0,so.jsx)(De,{exact:!0,from:"/",to:f}),(0,so.jsx)(De,{exact:!0,from:"/search/",to:f}),(0,so.jsx)(OS,{exact:!0,collections:n,path:"/collections/:name/search/",render:({match:e})=>(0,so.jsx)(De,{to:`/collections/${e.params.name}`})}),(0,so.jsx)(De,{from:"/error=access_denied&error_description=Signups+not+allowed+for+this+instance",to:f}),d?(0,so.jsx)($e,{path:"/workflow",component:Fb}):null,(0,so.jsx)(OS,{exact:!0,collections:n,path:"/collections/:name",render:e=>(0,so.jsx)(lb,e)}),(0,so.jsx)(OS,{path:"/collections/:name/new",collections:n,render:e=>(0,so.jsx)(iS,SS({},e,{newRecord:!0}))}),(0,so.jsx)(OS,{path:"/collections/:name/entries/*",collections:n,render:e=>(0,so.jsx)(iS,e)}),(0,so.jsx)(OS,{path:"/collections/:name/search/:searchTerm",collections:n,render:e=>(0,so.jsx)(lb,SS({},e,{isSearchResults:!0,isSingleSearchResult:!0}))}),(0,so.jsx)(OS,{collections:n,path:"/collections/:name/filter/:filterTerm*",render:e=>(0,so.jsx)(lb,e)}),(0,so.jsx)($e,{path:"/search/:searchTerm",render:e=>(0,so.jsx)(lb,SS({},e,{isSearchResults:!0}))}),(0,so.jsx)(OS,{path:"/edit/:name/:entryName",collections:n,render:({match:e})=>{const{name:t,entryName:n}=e.params;return(0,so.jsx)(De,{to:`/collections/${t}/entries/${n}`})}}),(0,so.jsx)($e,{component:lS})),s?(0,so.jsx)(my,null):null))}}const PS=V(function(e){const{auth:t,config:n,collections:r,globalUI:o,mediaLibrary:i}=e,a=t.user,s=o.isFetching,l=n.publish_mode,u=!i.get("externalLibrary");return{auth:t,config:n,collections:r,user:a,isFetching:s,publishMode:l,showMediaButton:i.get("showMediaButton"),useMediaLibrary:u}},{openMediaLibrary:ea,loginUser:function(e){return(t,n)=>{const r=n(),o=uc(r.config);return t(mc()),o.authenticate(e).then(e=>{e.useOpenAuthoring&&t(bc()),t(yc(e))}).catch(e=>{console.error(e),t(Ii({message:{details:e.message,key:"ui.toast.onFailToAuth"},type:"error",dismissAfter:8e3})),t(vc(e))})}},logoutUser:wc})((0,ze.Tl)()(TS));function MS({field:e,t}){return(0,so.jsx)("div",null,t("editor.editorWidgets.unknownControl.noControl",{widget:e.get("widget")}))}MS.propTypes={field:Mg().map,t:a().func.isRequired};const RS=(0,ze.Tl)()(MS);function AS({field:e,t}){return(0,so.jsx)("div",{className:"nc-widgetPreview"},t("editor.editorWidgets.unknownPreview.noPreview",{widget:e.get("widget")}))}function IS(e){return Jc.dispatch(ta(e,void 0))}AS.propTypes={field:Mg().map,t:a().func.isRequired},hr("unknown",RS,(0,ze.Tl)()(AS));const DS=po()(async function(e,t){const n=Sr(e);if(n){const e=await n.init({options:t,handleInsert:IS});Jc.dispatch(function(e){const t={show:e.show||(()=>{}),hide:e.hide||(()=>{}),onClearControl:e.onClearControl||(()=>{}),onRemoveControl:e.onRemoveControl||(()=>{}),enableStandalone:e.enableStandalone||(()=>{})};return{type:Ni,payload:t}}(e))}else{const t=new Error(`Missing external media library '${e}'. Please use 'registerMediaLibrary' to register it.`);Jc.dispatch(Hu(t))}});Jc.subscribe(()=>{const e=Jc.getState();if(e){const t=e.config.media_library?.name;if(t&&!e.mediaLibrary.get("externalLibrary")){const n=e.config.media_library;DS(t,n)}}}),__webpack_require__(22847);const jS="nc-root",LS=V(function(e){return{locale:Ku(e.config),config:e.config}})(function({locale:e,config:t}){return(0,so.jsx)(ze.F2,{locale:e,messages:ef(e)},(0,so.jsx)(Ih,{showBackup:!0,config:t},(0,so.jsx)(Pe,{history:Aa},(0,so.jsx)($e,{component:PS}))))}),NS={...fr,init:function(e={}){const{config:t}=e;console.log("decap-cms-core 3.12.0"),Jc.dispatch(Vu(t,function(){Jc.dispatch((e,t)=>{const n=t(),r=uc(n.config);return e(mc()),Promise.resolve(r.currentUser()).then(t=>{t?(t.useOpenAuthoring&&e(bc()),e(yc(t))):e({type:pc})}).catch(t=>{e(vc(t)),e(wc())})})})),(0,o.createRoot)(function(){const e=document.getElementById(jS);if(e)return e;const t=document.createElement("div");return t.id=jS,document.body.appendChild(t),t}()).render((0,so.jsx)(function(){return(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Be.GlobalStyles,null),(0,so.jsx)(p,{store:Jc},(0,so.jsx)(LS,null)))},null))}}})(),__webpack_exports__=__webpack_exports__.DecapCmsCore,__webpack_exports__})());
|
|
46
|
+
`,controlComponent:F.control,entry:t,collection:n,config:r,field:o,uniqueFieldId:this.uniqueFieldId,value:e,mediaPaths:s,metadata:W,onChange:(e,t)=>{u(o,e,t),S(this.uniqueFieldId)},onValidate:m&&cv()(m,this.uniqueFieldId),onOpenMediaLibrary:c,onClearMediaControl:f,onRemoveMediaControl:d,onRemoveInsertedMedia:h,onPersistMedia:g,onAddAsset:p,getAsset:l,hasActiveStyle:E||this.state.styleActive,setActiveStyle:()=>this.setState({styleActive:!0}),setInactiveStyle:()=>this.setState({styleActive:!1}),resolveWidget:yr,widget:F,getEditorComponents:vr,controlRef:y,editorControl:Ow,query:v,loadEntry:k,queryHits:b[this.uniqueFieldId]||[],clearSearch:x,clearFieldErrors:S,isFetching:w,fieldsErrors:a,onValidateObject:q,isEditorComponent:C,isNewEditorComponent:O,parentIds:T,t:P,validateMetaField:M,isDisabled:A,isFieldDuplicate:D,isFieldHidden:j,isLoadingAsset:R,locale:L,isParentListCollapsed:N}),z&&(0,so.jsx)(_w,{active:E||this.state.styleActive,error:K},(0,so.jsx)(pw(),{remarkPlugins:[gw()],allowedElements:["a","strong","em","del"],unwrapDisallowed:!0,components:{a:({node:e,...t})=>(0,so.jsx)("a",bw({},t,{target:"_blank",rel:"noopener noreferrer",style:{color:"inherit"}}))}},z))))}}const Ow=V(function(e){const{collections:t,entryDraft:n}=e,r=n.get("entry"),o=t.get(n.getIn(["entry","collection"])),i=Oc(e.medias);return{mediaPaths:e.mediaLibrary.get("controlMedia"),isFetching:e.search.isFetching,queryHits:e.search.queryHits,config:e.config,entry:r,collection:o,isLoadingAsset:i,loadEntry:async function(n,r){const o=t.get(n);if(o)return await Ys(e,o,r);throw new Error(`Can't find collection '${n}'`)},validateMetaField:(t,n,r)=>function(e,t,n,r,o){if(n.get("meta")&&"path"===n.get("name")){if(!r)return nl(r,"invalidPath",o);const n=r.split("/").map(Jo(e.config.slug)).join("/");if(r!==n)return nl(r,"invalidPath",o);const i=ss(t,(0,Ge.fromJS)({entry:{meta:{path:r}}})),a=i?function(e,t,n){const r=Sl(e,t),o=r&&r.map(n=>xl(e,t,n));return o&&o.find(e=>e?.get("path")===n)}(e.entries,t.get("name"),i):void 0,s=a?.get("path"),l=e.entryDraft?.getIn(["entry","path"]);if(s&&s!==l)return nl(r,"pathExists",o)}return{error:!1}}(e,o,t,n,r)}},function(e){return{...(0,Ue.zH)({openMediaLibrary:ea,clearMediaControl:Xi,removeMediaControl:Zi,removeInsertedMedia:na,persistMedia:ia,addAsset:Oa,query:xi,clearSearch:wi,clearFieldErrors:Vs},e),boundGetAsset:(t,n)=>Ma(e,t,n)}},function(e,t,n){return{...e,...t,...n,boundGetAsset:t.boundGetAsset(e.collection,e.entry)}})((0,ze.Tl)()(Cw)),Tw=Ow,Pw=_h("div",{target:"e11hw0lx4",label:"ControlPaneContainer"})({name:"1n0x6o4",styles:"max-width:800px;margin:0 auto;padding-bottom:16px;font-size:16px"}),Mw=_h(Be.StyledDropdownButton,{target:"e11hw0lx3",label:"LocaleButton"})(Be.buttons.button,";",Be.buttons.medium,";color:",Be.colors.controlLabel,";background:",Be.colors.textFieldBorder,";height:100%;&:after{top:11px;}"),Rw=_h("div",{target:"e11hw0lx2",label:"LocaleButtonWrapper"})({name:"zjik7",styles:"display:flex"}),Aw=_h("div",{target:"e11hw0lx1",label:"LocaleRowWrapper"})({name:"zjik7",styles:"display:flex"}),Iw=_h(Be.Dropdown,{target:"e11hw0lx0",label:"StyledDropdown"})({name:"1hfmrg2",styles:"width:max-content;margin-top:20px;margin-bottom:20px;margin-right:20px"});function Dw({locales:e,dropdownText:t,onLocaleChange:n}){return(0,so.jsx)(Iw,{renderButton:()=>(0,so.jsx)(Rw,null,(0,so.jsx)(Mw,null,t))},e.map(e=>(0,so.jsx)(Be.DropdownItem,{css:(0,so.css)(Be.text.fieldLabel,";;label:LocaleDropdown;"),key:e,label:e,onClick:()=>n(e)})))}function jw({field:e,entry:t,isTranslatable:n,locale:r}){if(e.get("meta"))return t.getIn(["meta",e.get("name")]);if(n){const n=su(r);return t.getIn([...n,e.get("name")])}return t.getIn(["data",e.get("name")])}class Lw extends r().Component{state={selectedLocale:this.props.locale};childRefs={};controlRef=(e,t)=>{if(!t)return;const n=e.get("name");this.childRefs[n]=t};getControlRef=e=>t=>{this.controlRef(e,t)};handleLocaleChange=e=>{this.setState({selectedLocale:e}),this.props.onLocaleChange(e)};copyFromOtherLocale=({targetLocale:e,t})=>n=>{if(!window.confirm(t("editor.editorControlPane.i18n.copyFromLocaleConfirm",{locale:n.toUpperCase()})))return;const{entry:r,collection:o}=this.props,{locales:i,defaultLocale:a}=ru(o),s=this.state.selectedLocale,l=i&&{currentLocale:s,locales:i,defaultLocale:a};this.props.fields.forEach(t=>{if(ou(t,e,n)){const e=jw({field:t,entry:r,locale:n,isTranslatable:n!==a});e&&this.props.onChange(t,e,void 0,l)}})};validate=async()=>{this.props.fields.forEach(e=>{if("hidden"===e.get("widget"))return;const t=this.childRefs[e.get("name")],n=t?.innerWrappedControl?.validate??t?.validate;n&&n()})};switchToDefaultLocale=()=>{if(nu(this.props.collection)){const{defaultLocale:e}=ru(this.props.collection);return new Promise(t=>this.setState({selectedLocale:e},t))}return Promise.resolve()};focus(e){const[t,...n]=e.split("."),r=this.childRefs[t];r?.focus&&r.focus(n.join("."))}render(){const{collection:e,entry:t,fields:n,fieldsMetaData:r,fieldsErrors:o,onChange:i,onValidate:a,t:s}=this.props;if(!e||!n)return null;if(0===t.size||!0===t.get("partial"))return null;const{locales:l,defaultLocale:u}=ru(e),c=this.state.selectedLocale,f=l&&{currentLocale:c,locales:l,defaultLocale:u};return(0,so.jsx)(Pw,null,l&&(0,so.jsx)(Aw,null,(0,so.jsx)(Dw,{locales:l,dropdownText:s("editor.editorControlPane.i18n.writingInLocale",{locale:c.toUpperCase()}),onLocaleChange:this.handleLocaleChange}),(0,so.jsx)(Dw,{locales:l.filter(e=>e!==c),dropdownText:s("editor.editorControlPane.i18n.copyFromLocale"),onLocaleChange:this.copyFromOtherLocale({targetLocale:c,t:s})})),n.filter(e=>"hidden"!==e.get("widget")).map((n,s)=>{const l=ou(n,c,u),d=iu(n,c,u),p=au(n,c,u),h=f?`${c}_${s}`:s;return(0,so.jsx)(Tw,{key:h,field:n,value:jw({field:n,entry:t,locale:c,isTranslatable:l}),fieldsMetaData:r,fieldsErrors:o,onChange:(e,t,n)=>{i(e,t,n,f)},onValidate:a,controlRef:this.getControlRef(n),entry:t,collection:e,isDisabled:d,isHidden:p,isFieldDuplicate:e=>iu(e,c,u),isFieldHidden:e=>au(e,c,u),locale:c})}))}}Lw.propTypes={collection:Mg().map.isRequired,entry:Mg().map.isRequired,fields:Mg().list.isRequired,fieldsMetaData:Mg().map.isRequired,fieldsErrors:Mg().map.isRequired,onChange:a().func.isRequired,onValidate:a().func.isRequired,locale:a().string};var Nw=__webpack_require__(45231),$w={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Fw={0:8203,1:8204,2:8205,3:65279},Bw=new Array(4).fill(String.fromCodePoint(Fw[0])).join(""),zw=String.fromCharCode(0);function Uw(e){let t=JSON.stringify(e);return`${Bw}${Array.from(t).map(e=>{let n=e.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map(e=>String.fromCodePoint(Fw[e])).join("")}).join("")}`}var qw=Object.fromEntries(Object.entries(Fw).map(e=>e.reverse())),Ww=Object.fromEntries(Object.entries($w).map(e=>e.reverse())),Hw=`${Object.values($w).map(e=>`\\u{${e.toString(16)}}`).join("")}`,Vw=new RegExp(`[${Hw}]{4,}`,"gu");function Kw(e){return Ge.Map.isMap(e)}function Gw(e){return e?"types"in e?e.types??[]:"fields"in e?e.fields??[]:"field"in e?e.field?[e.field]:[]:[e]:[]}const Yw=new Map;class Qw extends r().Component{handleClick=e=>{const{previewProps:t,onFieldClick:n}=this.props,r=t?.collection?.getIn(["editor","visualEditing"],!1);if(r)try{const t=function(e){let t=e.match(Vw);if(t)return function(e,t=!1){let n=Array.from(e);if(n.length%2!=0)throw new Error("Encoded data has invalid length");if(n.length%4||!e.startsWith(Bw))return function(e,t){var n;let r=[];for(let t=.5*e.length;t--;){let n=`${Ww[e[2*t].codePointAt(0)]}${Ww[e[2*t+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(n,16)))}let o=[],i=[r.join("")],a=10;for(;i.length;){let e=i.shift();try{if(o.push(JSON.parse(e)),t)return o}catch(t){if(!a--)throw t;let r=+(null==(n=t.message.match(/\sposition\s(\d+)$/))?void 0:n[1]);if(!r)throw t;i.unshift(e.substring(0,r),e.substring(r))}}return o}(n,t);let r=[];for(let e=.25*n.length;e--;){let t=n.slice(4*e,4*e+4).map(e=>qw[e.codePointAt(0)]).join("");r.unshift(String.fromCharCode(parseInt(t,4)))}if(t){r.shift();let e=r.indexOf(zw);return-1===e&&(e=r.length),[JSON.parse(r.slice(0,e).join(""))]}return r.join("").split(zw).filter(Boolean).map(e=>JSON.parse(e))}(t[0],!0)[0]}(e.target.textContent);t?.decap&&n&&n(t.decap)}catch(e){console.log("Visual editing error:",e)}};renderPreview(){const{previewComponent:e,previewProps:t}=this.props;return(0,so.jsx)("div",{onClick:this.handleClick},(0,Se.isElement)(e)?r().cloneElement(e,t):r().createElement(e,t))}render(){const{previewProps:e}=this.props,t=e?.collection?.getIn(["editor","visualEditing"],!1),n=!t;return(0,so.jsx)(Nw.rH,null,e=>{const t=this.renderPreview();return n?(0,so.jsx)(uw.ScrollSyncPane,{attachTo:e.document.scrollingElement},t):t})}}Qw.propTypes={previewComponent:a().func.isRequired,getEditorComponents:a().func,previewProps:a().object,onFieldClick:a().func};const Jw=Qw;class Xw extends r().Component{shouldComponentUpdate(e){return["object","list"].includes(e.field.get("widget"))||this.props.value!==e.value||this.props.fieldsMetaData!==e.fieldsMetaData||this.props.getAsset!==e.getAsset}render(){const{previewComponent:e,...t}=this.props;return r().createElement(e,t)}}Xw.propTypes={previewComponent:a().func.isRequired,field:Mg().map.isRequired,value:a().oneOfType([a().node,a().object,a().string,a().bool])};const Zw=Xw;function ex(e){return"hidden"!==e.get("widget")}const tx=_h("div",{target:"e1iji6y40",label:"PreviewContainer"})({name:"9bq7s9",styles:"font-family:Roboto,'Helvetica Neue',HelveticaNeue,Helvetica,Arial,sans-serif"});class nx extends r().Component{render(){const{collection:e,fields:t,widgetFor:n}=this.props;return e&&t?(0,so.jsx)(tx,null,t.filter(ex).map(e=>(0,so.jsx)("div",{key:e.get("name")},n(e.get("name"))))):null}}nx.propTypes={collection:Mg().map.isRequired,entry:Mg().map.isRequired,fields:Mg().list.isRequired,getAsset:a().func.isRequired,widgetFor:a().func.isRequired};const rx=_h(Nw.Ay,{target:"enus48h0",label:"PreviewPaneFrame"})("width:100%;height:100%;border:none;background:#fff;border-radius:",Be.lengths.borderRadius,";");class ox extends r().Component{getWidget=(e,t,n,r,o=null)=>{const{getAsset:i,entry:a}=r,s=yr(e.get("widget")),l=o?e.get("name")+"_"+o:e.get("name"),u=t&&!s.allowMapValue&&Ge.Map.isMap(t);return s.preview?(0,so.jsx)(Zw,{previewComponent:s.preview,key:l,field:e,getAsset:i,value:u?t.get(e.get("name")):t,entry:a,fieldsMetaData:n,resolveWidget:yr,getRemarkPlugins:br,getEditorComponents:vr}):null};inferredFields={};inferFields(){const e=Yl(this.props.collection,"title"),t=Yl(this.props.collection,"shortTitle"),n=Yl(this.props.collection,"author");this.inferredFields={},e&&(this.inferredFields[e]=co.title),t&&(this.inferredFields[t]=co.shortTitle),n&&(this.inferredFields[n]=co.author)}widgetFor=(e,t=this.props.fields,n=this.props.entry.get("data"),r=this.props.fieldsMetaData)=>{let o=t&&t.find(t=>t.get("name")===e),i=Ge.Map.isMap(n)&&n.get(o.get("name"));o.get("meta")&&(i=this.props.entry.getIn(["meta",o.get("name")]));const a=o.get("fields"),s=o.get("field"),l=r&&r.get(o.get("name"),(0,Ge.Map)());a&&(o=o.set("fields",this.getNestedWidgets(a,i,l))),s&&(o=o.set("field",this.getSingleNested(s,i,l)));const u=Object.entries(this.inferredFields).filter(([e])=>Vl(this.props.collection,e)===o).map(([,e])=>e)[0];return u?i=u.defaultPreview(i):i&&-1!==["string","text","number"].indexOf(o.get("widget"))&&i.toString().length<50&&(i=(0,so.jsx)("div",null,(0,so.jsx)("strong",null,o.get("label",o.get("name")),":")," ",i)),i?this.getWidget(o,i,l,this.props):null};getNestedWidgets=(e,t,n)=>Ge.List.isList(t)?t.map(t=>this.widgetsForNestedFields(e,t,n)):this.widgetsForNestedFields(e,t,n);getSingleNested=(e,t,n)=>Ge.List.isList(t)?t.map((t,r)=>this.getWidget(e,t,n.get(e.get("name")),this.props,r)):this.getWidget(e,t,n.get(e.get("name")),this.props);widgetsForNestedFields=(e,t,n)=>e.map(r=>this.widgetFor(r.get("name"),e,t,n));widgetsFor=e=>{const{fields:t,entry:n,fieldsMetaData:r}=this.props,o=t.find(t=>t.get("name")===e),i=o&&o.get("fields"),a=o&&o.get("types"),s=n.getIn(["data",o.get("name")]),l=r.get(o.get("name"),(0,Ge.Map)());return Ge.List.isList(s)&&a?s.map(e=>{const t=a.find(t=>t.get("name")===e.get("type")),n=t&&t.get("fields"),r=n&&(0,Ge.Map)(n.map((t,n)=>[t.get("name"),(0,so.jsx)("div",{key:n},this.getWidget(t,e,l.get(t.get("name")),this.props))]));return(0,Ge.Map)({data:e,widgets:r})}):Ge.List.isList(s)?s.map(e=>{const t=i&&(0,Ge.Map)(i.map((t,n)=>[t.get("name"),(0,so.jsx)("div",{key:n},this.getWidget(t,e,l.get(t.get("name")),this.props))]));return(0,Ge.Map)({data:e,widgets:t})}):(0,Ge.Map)({data:s,widgets:i&&(0,Ge.Map)(i.map(e=>[e.get("name"),this.getWidget(e,s,l.get(e.get("name")),this.props)]))})};getCollection=async(e,t)=>{const{state:n}=this.props,r=n.collections.get(e);if(void 0===t)return(await Us(n,r)).map(e=>(0,Ge.Map)().set("data",e.data));const o=await Ys(n,r,t);return(0,Ge.Map)().set("data",o.data)};render(){const{entry:e,collection:t,config:n}=this.props;if(!e||!e.get("data"))return null;const r=pr(function(e,t){return Ll[e.get("type")].templateName(e,t)}(t,e.get("slug")))||nx;this.inferFields();const o=t.getIn(["editor","visualEditing"],!1)?e.set("data",(s=e.get("data"),l=this.props.fields,function e(t,n,r=""){if(Yw.get(r)===t)return t;const o={fields:n,path:r,visit:e};let i;return i=function(e){return Ge.List.isList(e)}(t)?function(e,t){let n=e;for(let e=0;e<n.size;e++){const r=n.get(e);if(Kw(r)){const o=r.get("type");if("string"==typeof o){const i=t.fields.find(e=>e.name===o),a=t.visit(r,Gw(i),`${t.path}.${e}`);n=n.set(e,a)}else{const o=t.visit(r,t.fields,`${t.path}.${e}`);n=n.set(e,o)}}else{const o=t.fields[0],i=t.visit(r,o?[o]:[],`${t.path}.${e}`);i!==r&&(n=n.set(e,i))}}return n}(t,o):Kw(t)?function(e,t){let n=e;for(const[e,r]of n.entrySeq().toArray()){const o=t.fields.find(t=>t.name===e);if(o){const i=Gw(o),a=t.visit(r,i,t.path?`${t.path}.${e}`:e);a!==r&&(n=n.set(e,a))}}return n}(t,o):"string"==typeof t?function(e,{fields:t,path:n}){const[r]=t;if(!r)return e;const{widget:o}=r;if("string"===o||"text"===o)return"visualEditing"in r&&!1===r.visualEditing?e:e+Uw({decap:n});if("markdown"===o){const t=Uw({decap:n});return e.split(/(\n\n+)/).map(e=>e.trim()?e+t:e).join("")}return e}(t,o):t,Yw.set(r,i),i}(s,l.toJS()))):e,i={...this.props,entry:o,widgetFor:(e,t,n=o.get("data"),r)=>this.widgetFor(e,t,n,r),widgetsFor:this.widgetsFor,getCollection:this.getCollection,getEditorComponents:vr},a=dr().map((e,t)=>e.raw?(0,so.jsx)("style",{key:t},e.value):(0,so.jsx)("link",{key:t,href:e.value,type:"text/css",rel:"stylesheet"}));var s,l;return t||(0,so.jsx)(rx,{id:"preview-pane",head:a}),(0,so.jsx)(Ih,{config:n},(0,so.jsx)(rx,{id:"preview-pane",head:a,initialContent:'\n<!DOCTYPE html>\n<html>\n <head><base target="_blank"/></head>\n <body><div></div></body>\n</html>\n'},(0,so.jsx)(Nw.rH,null,({document:e,window:t})=>(0,so.jsx)(Jw,{previewComponent:r,previewProps:{...i,document:e,window:t},onFieldClick:this.props.onFieldClick}))))}}ox.propTypes={collection:Mg().map.isRequired,fields:Mg().list.isRequired,entry:Mg().map.isRequired,fieldsMetaData:Mg().map.isRequired,getAsset:a().func.isRequired,onFieldClick:a().func};const ix=V(function(e){return{isLoadingAsset:Oc(e.medias),config:e.config,state:e}},function(e){return{boundGetAsset:(t,n)=>Ma(e,t,n)}},function(e,t,n){return{...e,...t,...n,getAsset:t.boundGetAsset(n.collection,n.entry)}})(ox),ax={noOverflow:{name:"1ctb18k-noOverflow",styles:"overflow:hidden;white-space:nowrap;text-overflow:ellipsis;label:noOverflow;"},buttonMargin:{name:"bx8mhy-buttonMargin",styles:"margin:0 10px;label:buttonMargin;"},toolbarSection:(0,so.css)("height:100%;display:flex;align-items:center;border:0 solid ",Be.colors.textFieldBorder,";;label:toolbarSection;"),publishedButton:(0,so.css)("background-color:",Be.colorsRaw.tealLight,";color:",Be.colorsRaw.tealDark,";;label:publishedButton;")},sx=_h("div",{target:"e1d2l9mo26",label:"TooltipText"})({name:"1ykbu60",styles:"visibility:hidden;width:321px;background-color:#555;color:#fff;text-align:unset;border-radius:6px;padding:5px;position:absolute;z-index:1;top:145%;left:50%;margin-left:-320px;opacity:0;transition:opacity 0.3s"}),lx=_h("div",{target:"e1d2l9mo25",label:"Tooltip"})("position:relative;display:inline-block;&:hover+",sx,"{visibility:visible;opacity:0.9;}"),ux=_h("div",{target:"e1d2l9mo24",label:"TooltipContainer"})({name:"bjn8wh",styles:"position:relative"}),cx=_h(Be.StyledDropdownButton,{target:"e1d2l9mo23",label:"DropdownButton"})(ax.noOverflow,"@media (max-width: 1200px){padding-left:10px;}"),fx=_h("div",{target:"e1d2l9mo22",label:"ToolbarContainer"})("box-shadow:0 2px 6px 0 rgba(68, 74, 87, 0.05),0 1px 3px 0 rgba(68, 74, 87, 0.1),0 2px 54px rgba(0, 0, 0, 0.1);position:absolute;top:0;left:0;width:100%;min-width:800px;z-index:",Be.zIndex.zIndex300,";background-color:#fff;height:66px;display:flex;justify-content:space-between;"),dx=_h("div",{target:"e1d2l9mo21",label:"ToolbarSectionMain"})(ax.toolbarSection,";flex:10;display:flex;justify-content:space-between;padding:0 10px;"),px=_h("div",{target:"e1d2l9mo20",label:"ToolbarSubSectionFirst"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),hx=_h(px,{target:"e1d2l9mo19",label:"ToolbarSubSectionLast"})({name:"1f60if8",styles:"justify-content:flex-end"}),gx=_h(Sy,{target:"e1d2l9mo18",label:"ToolbarSectionBackLink"})(ax.toolbarSection,";border-right-width:1px;font-weight:normal;padding:0 20px;&:hover,&:focus{background-color:#f1f2f4;}"),mx=_h("div",{target:"e1d2l9mo17",label:"ToolbarSectionMeta"})(ax.toolbarSection,";border-left-width:1px;padding:0 7px;"),yx=_h(Be.Dropdown,{target:"e1d2l9mo16",label:"ToolbarDropdown"})(ax.buttonMargin,";",Be.Icon,"{color:",Be.colorsRaw.teal,";}"),vx=_h("div",{target:"e1d2l9mo15",label:"BackArrow"})("color:",Be.colors.textLead,";font-size:21px;font-weight:600;margin-right:16px;"),bx=_h("div",{target:"e1d2l9mo14",label:"BackCollection"})("color:",Be.colors.textLead,";font-size:14px;"),wx=_h("div",{target:"e1d2l9mo13",label:"BackStatus"})({name:"j9a02z",styles:"margin-top:6px"}),xx=_h(wx,{target:"e1d2l9mo12",label:"BackStatusUnchanged"})(Be.components.textBadgeSuccess,";"),Sx=_h(wx,{target:"e1d2l9mo11",label:"BackStatusChanged"})(Be.components.textBadgeDanger,";"),kx=_h("button",{target:"e1d2l9mo10",label:"ToolbarButton"})(Be.buttons.button,";",Be.buttons.default,";",ax.buttonMargin,";",ax.noOverflow,";display:block;@media (max-width: 1200px){padding:0 10px;}"),_x=_h(kx,{target:"e1d2l9mo9",label:"DeleteButton"})(Be.buttons.lightRed,";"),Ex=_h(kx,{target:"e1d2l9mo8",label:"SaveButton"})(Be.buttons.lightBlue,";&[disabled]{",Be.buttons.disabled,";}"),Cx=_h(cx,{target:"e1d2l9mo7",label:"PublishedToolbarButton"})(ax.publishedButton,";"),Ox=_h(kx,{target:"e1d2l9mo6",label:"PublishedButton"})(ax.publishedButton,";"),Tx=_h(cx,{target:"e1d2l9mo5",label:"PublishButton"})("background-color:",Be.colorsRaw.teal,";"),Px=_h(cx,{target:"e1d2l9mo4",label:"StatusButton"})("background-color:",Be.colorsRaw.tealLight,";color:",Be.colorsRaw.teal,";"),Mx=_h("div",{target:"e1d2l9mo3",label:"PreviewButtonContainer"})("margin-right:12px;color:",Be.colorsRaw.blue,";display:flex;align-items:center;a,",Be.Icon,"{color:",Be.colorsRaw.blue,";}",Be.Icon,"{position:relative;top:1px;}"),Rx=_h("button",{target:"e1d2l9mo2",label:"RefreshPreviewButton"})("background:none;border:0;cursor:pointer;color:",Be.colorsRaw.blue,";span{margin-right:6px;}&:disabled{cursor:default;opacity:0.6;}",Be.Icon,"{",e=>e.$spinning&&"animation: spin 1s linear infinite;",";}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"),Ax=Rx.withComponent("a",{target:"e1d2l9mo27",label:"PreviewLink"}),Ix=_h(Be.DropdownItem,{target:"e1d2l9mo1",label:"PublishDropDownItem"})({name:"svxjwj",styles:"min-width:initial"}),Dx=_h(Be.DropdownItem,{target:"e1d2l9mo0",label:"StatusDropdownItem"})(Be.Icon,"{color:",Be.colors.infoText,";}");class jx extends r().Component{static propTypes={isPersisting:a().bool,isPublishing:a().bool,isUpdatingStatus:a().bool,isDeleting:a().bool,onPersist:a().func.isRequired,onPersistAndNew:a().func.isRequired,onPersistAndDuplicate:a().func.isRequired,showDelete:a().bool.isRequired,onDelete:a().func.isRequired,onDeleteUnpublishedChanges:a().func.isRequired,onChangeStatus:a().func.isRequired,onPublish:a().func.isRequired,unPublish:a().func.isRequired,onDuplicate:a().func.isRequired,onPublishAndNew:a().func.isRequired,onPublishAndDuplicate:a().func.isRequired,user:a().object,hasChanged:a().bool,displayUrl:a().string,collection:Mg().map.isRequired,hasWorkflow:a().bool,useOpenAuthoring:a().bool,hasUnpublishedChanges:a().bool,isNewEntry:a().bool,isModification:a().bool,currentStatus:a().string,onLogoutClick:a().func.isRequired,deployPreview:a().object,loadDeployPreview:a().func.isRequired,t:a().func.isRequired,editorBackLink:a().string.isRequired};componentDidMount(){a().checkPropTypes(jx.propTypes,this.props,"prop","EditorToolbar");const{isNewEntry:e,loadDeployPreview:t}=this.props;e||(this._pollController=new AbortController,t({maxAttempts:24,signal:this._pollController.signal}))}componentDidUpdate(e){const{isNewEntry:t,isPersisting:n,loadDeployPreview:r}=this.props;t||!e.isPersisting||n||(this._pollController?.abort(),this._pollController=new AbortController,r({maxAttempts:3,signal:this._pollController.signal}))}componentWillUnmount(){this._pollController?.abort()}renderSimpleControls=()=>{const{collection:e,hasChanged:t,isNewEntry:n,showDelete:o,onDelete:i,t:a}=this.props,s=e.get("create");return(0,so.jsx)(r().Fragment,null,n||t?this.renderNewEntrySimplePublishControls({canCreate:s}):this.renderExistingEntrySimplePublishControls({canCreate:s}),(0,so.jsx)("div",null,o?(0,so.jsx)(_x,{onClick:i},a("editor.editorToolbar.deleteEntry")):null))};renderDeployPreviewControls=e=>{const{deployPreview:t={},loadDeployPreview:n,t:r}=this.props,{url:o,status:i,isFetching:a}=t;if(!i)return;const s="SUCCESS"===i&&!a;return(0,so.jsx)(Mx,null,s?(0,so.jsx)(Ax,{rel:"noopener noreferrer",target:"_blank",href:o},(0,so.jsx)("span",null,e),(0,so.jsx)(Be.Icon,{type:"new-tab",size:"xsmall"})):(0,so.jsx)(Rx,{onClick:n,disabled:a,$spinning:a},(0,so.jsx)("span",null,r("editor.editorToolbar.deployPreviewPendingButtonLabel")),(0,so.jsx)(Be.Icon,{type:"refresh",size:"xsmall"})))};renderStatusInfoTooltip=()=>{const{t:e,currentStatus:t}=this.props,n={[zr.get("DRAFT")]:"statusInfoTooltipDraft",[zr.get("PENDING_REVIEW")]:"statusInfoTooltipInReview"},r=Object.keys(n).find(e=>e===t);return(0,so.jsx)(ux,null,(0,so.jsx)(lx,null,(0,so.jsx)(Be.Icon,{type:"info-circle",size:"small",className:"tooltip"})),r&&(0,so.jsx)(sx,null,e(`editor.editorToolbar.${n[r]}`)))};renderWorkflowStatusControls=()=>{const{isUpdatingStatus:e,onChangeStatus:t,currentStatus:n,t:o,useOpenAuthoring:i}=this.props,a={[zr.get("DRAFT")]:o("editor.editorToolbar.draft"),[zr.get("PENDING_REVIEW")]:o("editor.editorToolbar.inReview"),[zr.get("PENDING_PUBLISH")]:o("editor.editorToolbar.ready")},s=e?o("editor.editorToolbar.updating"):o("editor.editorToolbar.status",{status:a[n]});return(0,so.jsx)(r().Fragment,null,(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"120px",renderButton:()=>(0,so.jsx)(Px,null,s)},(0,so.jsx)(Dx,{label:o("editor.editorToolbar.draft"),onClick:()=>t("DRAFT"),icon:n===zr.get("DRAFT")?"check":null}),(0,so.jsx)(Dx,{label:o("editor.editorToolbar.inReview"),onClick:()=>t("PENDING_REVIEW"),icon:n===zr.get("PENDING_REVIEW")?"check":null}),i?"":(0,so.jsx)(Dx,{label:o("editor.editorToolbar.ready"),onClick:()=>t("PENDING_PUBLISH"),icon:n===zr.get("PENDING_PUBLISH")?"check":null})),i&&this.renderStatusInfoTooltip())};renderNewEntryWorkflowPublishControls=({canCreate:e,canPublish:t})=>{const{isPublishing:n,onPublish:o,onPublishAndNew:i,onPublishAndDuplicate:a,t:s}=this.props;return t?(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"200px",renderButton:()=>(0,so.jsx)(Tx,null,s(n?"editor.editorToolbar.publishing":"editor.editorToolbar.publish"))},(0,so.jsx)(Ix,{label:s("editor.editorToolbar.publishNow"),icon:"arrow",iconDirection:"right",onClick:o}),e?(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Ix,{label:s("editor.editorToolbar.publishAndCreateNew"),icon:"add",onClick:i}),(0,so.jsx)(Ix,{label:s("editor.editorToolbar.publishAndDuplicate"),icon:"add",onClick:a})):null):""};renderExistingEntryWorkflowPublishControls=({canCreate:e,canPublish:t,canDelete:n})=>{const{unPublish:r,onDuplicate:o,isPersisting:i,t:a}=this.props;return t||e?(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"max-content",key:"td-publish-create",renderButton:()=>(0,so.jsx)(Cx,null,a(i?"editor.editorToolbar.unpublishing":"editor.editorToolbar.published"))},n&&t&&(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.unpublish"),icon:"arrow",iconDirection:"right",onClick:r}),e&&(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.duplicate"),icon:"add",onClick:o})):""};renderExistingEntrySimplePublishControls=({canCreate:e})=>{const{onDuplicate:t,t:n}=this.props;return e?(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"max-content",renderButton:()=>(0,so.jsx)(Cx,null,n("editor.editorToolbar.published"))},(0,so.jsx)(Be.DropdownItem,{label:n("editor.editorToolbar.duplicate"),icon:"add",onClick:t})):(0,so.jsx)(Ox,null,n("editor.editorToolbar.published"))};renderNewEntrySimplePublishControls=({canCreate:e})=>{const{onPersist:t,onPersistAndNew:n,onPersistAndDuplicate:o,isPersisting:i,t:a}=this.props;return(0,so.jsx)("div",null,(0,so.jsx)(yx,{dropdownTopOverlap:"40px",dropdownWidth:"max-content",renderButton:()=>(0,so.jsx)(Tx,null,a(i?"editor.editorToolbar.publishing":"editor.editorToolbar.publish"))},(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.publishNow"),icon:"arrow",iconDirection:"right",onClick:t}),e?(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.publishAndCreateNew"),icon:"add",onClick:n}),(0,so.jsx)(Be.DropdownItem,{label:a("editor.editorToolbar.publishAndDuplicate"),icon:"add",onClick:o})):null))};renderSimpleDeployPreviewControls=()=>{const{hasChanged:e,isNewEntry:t,t:n}=this.props;if(!t&&!e)return this.renderDeployPreviewControls(n("editor.editorToolbar.deployButtonLabel"))};renderWorkflowControls=()=>{const{onPersist:e,onDelete:t,onDeleteUnpublishedChanges:n,showDelete:o,hasChanged:i,hasUnpublishedChanges:a,useOpenAuthoring:s,isPersisting:l,isDeleting:u,isNewEntry:c,isModification:f,currentStatus:d,collection:p,t:h}=this.props,g=p.get("create"),m=p.get("publish")&&!s,y=p.get("delete",!0),v=a&&f&&h("editor.editorToolbar.deleteUnpublishedChanges")||a&&(c||!f)&&h("editor.editorToolbar.deleteUnpublishedEntry")||!a&&!f&&h("editor.editorToolbar.deletePublishedEntry");return[(0,so.jsx)(Ex,{disabled:!i,key:"save-button",onClick:()=>i&&e()},h(l?"editor.editorToolbar.saving":"editor.editorToolbar.save")),d?[(0,so.jsx)(r().Fragment,{key:"workflow-status-controls"},this.renderWorkflowStatusControls(),!i&&this.renderNewEntryWorkflowPublishControls({canCreate:g,canPublish:m}))]:!c&&(0,so.jsx)(r().Fragment,{key:"existing-entry-workflow-publish-controls"},this.renderExistingEntryWorkflowPublishControls({canCreate:g,canPublish:m,canDelete:y})),o&&!s||a||f?(0,so.jsx)(_x,{key:"delete-button",onClick:a?n:t},u?h("editor.editorToolbar.deleting"):v):null]};renderWorkflowDeployPreviewControls=()=>{const{currentStatus:e,isNewEntry:t,t:n}=this.props;return e?this.renderDeployPreviewControls(n("editor.editorToolbar.deployPreviewButtonLabel")):t?void 0:this.renderDeployPreviewControls(n("editor.editorToolbar.deployButtonLabel"))};render(){const{user:e,hasChanged:t,displayUrl:n,collection:r,hasWorkflow:o,onLogoutClick:i,t:a,editorBackLink:s}=this.props;return(0,so.jsx)(fx,null,(0,so.jsx)(gx,{to:s},(0,so.jsx)(vx,null,"←"),(0,so.jsx)("div",null,(0,so.jsx)(bx,null,a("editor.editorToolbar.backCollection",{collectionLabel:r.get("label")})),t?(0,so.jsx)(Sx,null,a("editor.editorToolbar.unsavedChanges")):(0,so.jsx)(xx,null,a("editor.editorToolbar.changesSaved")))),(0,so.jsx)(dx,null,(0,so.jsx)(px,null,o?this.renderWorkflowControls():this.renderSimpleControls()),(0,so.jsx)(hx,null,o?this.renderWorkflowDeployPreviewControls():this.renderSimpleDeployPreviewControls())),(0,so.jsx)(mx,null,(0,so.jsx)(Tg,{displayUrl:n,imageUrl:e?.avatar_url,onLogoutClick:i})))}}const Lx=(0,ze.Tl)()(jx);function Nx(){return Nx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nx.apply(null,arguments)}const $x="cms.preview-visible",Fx="cms.scroll-sync-enabled",Bx="cms.split-pane-position",zx="cms.i18n-visible",Ux={splitPane:(0,so.css)(Be.components.card,";border-radius:0;height:100%;;label:splitPane;"),pane:{name:"1yvxf4n-pane",styles:"height:100%;overflow-y:auto;label:pane;"}},qx=_h(Be.IconButton,{target:"e1nx103k7",label:"EditorToggle"})({name:"cn3xcj",styles:"margin-bottom:12px"});function Wx(){return(0,so.jsx)(so.Global,{styles:(0,so.css)(".Resizer.vertical{width:2px;cursor:col-resize;position:relative;background:none;&:before{content:'';width:2px;height:100%;position:relative;background-color:",Be.colors.textFieldBorder,";display:block;z-index:10;transition:background-color ",Be.transitions.main,";}&:hover,&:active{&:before{width:4px;left:-1px;background-color:",Be.colorsRaw.blue,";}}};label:ReactSplitPaneGlobalStyles;")})}const Hx=_h(lw,{target:"e1nx103k6",label:"StyledSplitPane"})(Ux.splitPane,";.Pane{height:100%;}"),Vx=_h("div",{target:"e1nx103k5",label:"NoPreviewContainer"})(Ux.splitPane,";"),Kx=_h("div",{target:"e1nx103k4",label:"EditorContainer"})("width:100%;min-width:800px;height:100%;position:absolute;top:0;left:0;overflow:hidden;padding-top:66px;background-color:",Be.colors.background,";"),Gx=_h("div",{target:"e1nx103k3",label:"Editor"})({name:"yd3x82",styles:"height:100%;margin:0 auto;position:relative"}),Yx=_h("div",{target:"e1nx103k2",label:"PreviewPaneContainer"})("height:100%;pointer-events:",e=>e.blockEntry?"none":"auto",";overflow-y:",e=>e.overFlow?"auto":"hidden",";"),Qx=_h(Yx,{target:"e1nx103k1",label:"ControlPaneContainer"})({name:"b2tic3",styles:"padding:0 16px;position:relative;overflow-x:hidden"}),Jx=_h("div",{target:"e1nx103k0",label:"ViewControls"})("position:absolute;top:10px;right:10px;z-index:",Be.zIndex.zIndex299,";");function Xx({i18nVisible:e,previewVisible:t,editor:n,editorWithEditor:r,editorWithPreview:o}){return e?r:t?o:(0,so.jsx)(Vx,null,n)}class Zx extends n.Component{state={showEventBlocker:!1,previewVisible:"false"!==localStorage.getItem($x),scrollSyncEnabled:"false"!==localStorage.getItem(Fx),i18nVisible:"false"!==localStorage.getItem(zx)};handleFieldClick=e=>{this.controlPaneRef?.focus(e)};handleSplitPaneDragStart=()=>{this.setState({showEventBlocker:!0})};handleSplitPaneDragFinished=()=>{this.setState({showEventBlocker:!1})};handleOnPersist=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e;await this.controlPaneRef.switchToDefaultLocale(),this.controlPaneRef.validate(),this.props.onPersist({createNew:t,duplicate:n})};handleOnPublish=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e;await this.controlPaneRef.switchToDefaultLocale(),this.controlPaneRef.validate(),this.props.onPublish({createNew:t,duplicate:n})};handleTogglePreview=()=>{const e=!this.state.previewVisible;this.setState({previewVisible:e}),localStorage.setItem($x,e)};handleToggleScrollSync=()=>{const e=!this.state.scrollSyncEnabled;this.setState({scrollSyncEnabled:e}),localStorage.setItem(Fx,e)};handleToggleI18n=()=>{const e=!this.state.i18nVisible;this.setState({i18nVisible:e}),localStorage.setItem(zx,e)};handleLeftPanelLocaleChange=e=>{this.setState({leftPanelLocale:e})};render(){const{collection:e,entry:t,fields:n,fieldsMetaData:r,fieldsErrors:o,onChange:i,showDelete:a,onDelete:s,onDeleteUnpublishedChanges:l,onChangeStatus:u,onPublish:c,unPublish:f,onDuplicate:d,onValidate:p,user:h,hasChanged:g,displayUrl:m,hasWorkflow:y,useOpenAuthoring:v,hasUnpublishedChanges:b,isNewEntry:w,isModification:x,currentStatus:S,onLogoutClick:k,loadDeployPreview:_,deployPreview:E,draftKey:C,editorBackLink:O,t:T}=this.props,{scrollSyncEnabled:P,showEventBlocker:M}=this.state,R=function(e,t){if(e.get("type")===ro){const n=$l(e,t.get("slug")),r=n?.getIn(["editor","preview"]);if(null!=r)return r}return e.getIn(["editor","preview"],!0)}(e,t),{locales:A,defaultLocale:I}=ru(this.props.collection),D=nu(e)&&A.length>1,j={collection:e,entry:t,fields:n,fieldsMetaData:r,fieldsErrors:o,onChange:i,onValidate:p},L=this.state.leftPanelLocale||A?.[0],N=(0,so.jsx)(Qx,{overFlow:!0,blockEntry:M},(0,so.jsx)(Lw,Nx({},j,{ref:e=>this.controlPaneRef=e,locale:L,t:T,onLocaleChange:this.handleLeftPanelLocaleChange}))),$=(0,so.jsx)(Qx,{overFlow:!this.state.scrollSyncEnabled,blockEntry:M},(0,so.jsx)(Lw,Nx({},j,{locale:A?.[1],t:T}))),F=D?function(e,t,n){return t===n?e:e.set("data",e.getIn([Zl,t,"data"]))}(t,L,I):t,B=(0,so.jsx)(uw.ScrollSync,{enabled:this.state.scrollSyncEnabled},(0,so.jsx)("div",null,(0,so.jsx)(Wx,null),(0,so.jsx)(Hx,{maxSize:-100,minSize:400,defaultSize:parseInt(localStorage.getItem(Bx),10)||"50%",onChange:e=>localStorage.setItem(Bx,e),onDragStarted:this.handleSplitPaneDragStart,onDragFinished:this.handleSplitPaneDragFinished},(0,so.jsx)(uw.ScrollSyncPane,null,N),(0,so.jsx)(Yx,{blockEntry:M},(0,so.jsx)(ix,{collection:e,entry:F,fields:n,fieldsMetaData:r,locale:L,onFieldClick:this.handleFieldClick}))))),z=(0,so.jsx)(uw.ScrollSync,{enabled:this.state.scrollSyncEnabled},(0,so.jsx)("div",null,(0,so.jsx)(Hx,{maxSize:-100,defaultSize:parseInt(localStorage.getItem(Bx),10)||"50%",onChange:e=>localStorage.setItem(Bx,e),onDragStarted:this.handleSplitPaneDragStart,onDragFinished:this.handleSplitPaneDragFinished},(0,so.jsx)(uw.ScrollSyncPane,null,N),(0,so.jsx)(uw.ScrollSyncPane,null,$)))),U=D&&this.state.i18nVisible,q=R&&this.state.previewVisible,W=U||q;return(0,so.jsx)(Kx,null,(0,so.jsx)(Lx,{isPersisting:t.get("isPersisting"),isPublishing:t.get("isPublishing"),isUpdatingStatus:t.get("isUpdatingStatus"),isDeleting:t.get("isDeleting"),onPersist:this.handleOnPersist,onPersistAndNew:()=>this.handleOnPersist({createNew:!0}),onPersistAndDuplicate:()=>this.handleOnPersist({createNew:!0,duplicate:!0}),onDelete:s,onDeleteUnpublishedChanges:l,onChangeStatus:u,showDelete:a,onPublish:c,unPublish:f,onDuplicate:d,onPublishAndNew:()=>this.handleOnPublish({createNew:!0}),onPublishAndDuplicate:()=>this.handleOnPublish({createNew:!0,duplicate:!0}),user:h,hasChanged:g,displayUrl:m,collection:e,hasWorkflow:y,useOpenAuthoring:v,hasUnpublishedChanges:b,isNewEntry:w,isModification:x,currentStatus:S,onLogoutClick:k,loadDeployPreview:_,deployPreview:E,editorBackLink:O}),(0,so.jsx)(Gx,{key:C},(0,so.jsx)(Jx,null,D&&(0,so.jsx)(qx,{isActive:U,onClick:this.handleToggleI18n,size:"large",type:"page",title:T("editor.editorInterface.toggleI18n"),marginTop:"70px"}),R&&(0,so.jsx)(qx,{isActive:q,onClick:this.handleTogglePreview,size:"large",type:"eye",title:T("editor.editorInterface.togglePreview")}),W&&!e.getIn(["editor","visualEditing"])&&(0,so.jsx)(qx,{isActive:P,onClick:this.handleToggleScrollSync,size:"large",type:"scroll",title:T("editor.editorInterface.toggleScrollSync")})),(0,so.jsx)(Xx,{i18nVisible:U,previewVisible:q,editor:N,editorWithEditor:z,editorWithPreview:B})))}}Zx.propTypes={collection:Mg().map.isRequired,entry:Mg().map.isRequired,fields:Mg().list.isRequired,fieldsMetaData:Mg().map.isRequired,fieldsErrors:Mg().map.isRequired,onChange:a().func.isRequired,onValidate:a().func.isRequired,onPersist:a().func.isRequired,showDelete:a().bool.isRequired,onDelete:a().func.isRequired,onDeleteUnpublishedChanges:a().func.isRequired,onPublish:a().func.isRequired,unPublish:a().func.isRequired,onDuplicate:a().func.isRequired,onChangeStatus:a().func.isRequired,user:a().object,hasChanged:a().bool,displayUrl:a().string,hasWorkflow:a().bool,useOpenAuthoring:a().bool,hasUnpublishedChanges:a().bool,isNewEntry:a().bool,isModification:a().bool,currentStatus:a().string,onLogoutClick:a().func.isRequired,deployPreview:a().object,loadDeployPreview:a().func.isRequired,draftKey:a().string.isRequired,t:a().func.isRequired};const eS=Zx;function tS(e,t){const{collections:n}=e,r=e.config.publish_mode===Br,o=n.get(t.match.params.name),i={isEditorialWorkflow:r,showDelete:!t.newEntry&&Wl(o)};if(r){const n=t.match.params[0],r=Gc(e,o.get("name"),n);r&&(i.unpublishedEntry=!0,i.entry=r)}return i}function nS(e,t,n){const{isEditorialWorkflow:r,unpublishedEntry:o}=e,{dispatch:i}=t,a={};return r&&(a.loadEntry=(e,t)=>i(ts(e,t)),a.persistEntry=e=>i(function(e,t){return async(n,r)=>{const o=r(),i=o.entryDraft,a=i.get("fieldsErrors"),s=function(e,t){return function(e,t){return e.get("entities")?e.get("entities").filter((e,n)=>kc()(n,`${t}.`)).map(e=>e.get("slug")).valueSeq():null}(e.editorialWorkflow,t)}(o,e.get("name")),l=Vc(o,e.get("name")).concat(s);if(!on()(o.editorialWorkflow.toJS(),"pages.ids",!1)&&n(ns(o.collections)),!a.isEmpty())return a.some(e=>e.some(e=>e.type&&e.type===Ci))&&n(Ii({message:{key:"ui.toast.missingRequiredField"},type:"error",dismissAfter:8e3})),Promise.reject();const u=uc(o.config),c=i.get("entry"),f=el({entry:c}),d=tl(e,c),p=i.set("entry",d);n(Xa(e,c.get("slug")));const h=t?u.persistUnpublishedEntry:u.persistEntry;try{const t=await h.call(u,{config:o.config,collection:e,entryDraft:p,assetProxies:f,usedSlugs:l});n(Ii({message:{key:"ui.toast.entrySaved"},type:"success",dismissAfter:4e3})),n(Za(e,d)),c.get("slug")!==t&&(await n(ts(e,t)),ja(e.get("name"),t))}catch(t){return n(Ii({message:{key:"ui.toast.onFailToPersist",details:t},type:"error",dismissAfter:8e3})),Promise.reject(n(es(t,e,c.get("slug"))))}}}(e,o))),{...n,...e,...a}}class rS extends r().Component{static propTypes={changeDraftField:a().func.isRequired,changeDraftFieldValidation:a().func.isRequired,collection:Mg().map.isRequired,createDraftDuplicateFromEntry:a().func.isRequired,createEmptyDraft:a().func.isRequired,discardDraft:a().func.isRequired,entry:Mg().map,entryDraft:Mg().map.isRequired,loadEntry:a().func.isRequired,persistEntry:a().func.isRequired,deleteEntry:a().func.isRequired,showDelete:a().bool.isRequired,fields:Mg().list.isRequired,slug:a().string,newEntry:a().bool.isRequired,displayUrl:a().string,hasWorkflow:a().bool,useOpenAuthoring:a().bool,unpublishedEntry:a().bool,isModification:a().bool,collectionEntriesLoaded:a().bool,updateUnpublishedEntryStatus:a().func.isRequired,publishUnpublishedEntry:a().func.isRequired,deleteUnpublishedEntry:a().func.isRequired,logoutUser:a().func.isRequired,loadEntries:a().func.isRequired,deployPreview:a().object,loadDeployPreview:a().func.isRequired,currentStatus:a().string,user:a().object,location:a().shape({pathname:a().string,search:a().string}),hasChanged:a().bool,t:a().func.isRequired,retrieveLocalBackup:a().func.isRequired,localBackup:Mg().map,loadLocalBackup:a().func,persistLocalBackup:a().func.isRequired,deleteLocalBackup:a().func};componentDidMount(){a().checkPropTypes(rS.propTypes,this.props,"prop","Editor");const{newEntry:e,collection:t,slug:n,loadEntry:r,createEmptyDraft:o,loadEntries:i,retrieveLocalBackup:s,collectionEntriesLoaded:l,t:u}=this.props;s(t,n),e?o(t,this.props.location.search):r(t,n);const c=u("editor.editor.onLeavePage");this.exitBlocker=e=>{if(this.props.entryDraft.get("hasChanged"))return e.returnValue=c,c},window.addEventListener("beforeunload",this.exitBlocker);const f=Aa.block((e,n)=>{const r=this.props.entryDraft.getIn(["entry","isPersisting"]),o=this.props.entryDraft.getIn(["entry","newRecord"]),i=`/collections/${t.get("name")}/new`;if(!r||!o||this.props.location.pathname!==i||"PUSH"!==n)return this.props.hasChanged?c:void 0});this.unlisten=Aa.listen((e,n)=>{const r=`/collections/${t.get("name")}/new`,o=`/collections/${t.get("name")}/entries/`,{pathname:i}=e;i.startsWith(r)||i.startsWith(o)&&"PUSH"===n||(this.deleteBackup(),f(),this.unlisten())}),l||i(t)}componentDidUpdate(e){if(!e.localBackup&&this.props.localBackup&&(window.confirm(this.props.t("editor.editor.confirmLoadBackup"))?this.props.loadLocalBackup():this.deleteBackup()),this.props.hasChanged&&this.createBackup(this.props.entryDraft.get("entry"),this.props.collection),e.entry===this.props.entry)return;const{newEntry:t,collection:n}=this.props;t&&e.createEmptyDraft(n,this.props.location.search)}componentWillUnmount(){this.createBackup.flush(),this.props.discardDraft(),window.removeEventListener("beforeunload",this.exitBlocker)}createBackup=zb()(function(e,t){this.props.persistLocalBackup(e,t)},2e3);handleChangeDraftField=(e,t,n,r)=>{const o=[this.props.unPublishedEntry,this.props.publishedEntry].filter(Boolean);this.props.changeDraftField({field:e,value:t,metadata:n,entries:o,i18n:r})};handleChangeStatus=e=>{const{entryDraft:t,updateUnpublishedEntryStatus:n,collection:r,slug:o,currentStatus:i,t:a}=this.props;if(t.get("hasChanged"))return void window.alert(a("editor.editor.onUpdatingWithUnsavedChanges"));const s=zr.get(e);n(r.get("name"),o,i,s)};deleteBackup(){const{deleteLocalBackup:e,collection:t,slug:n,newEntry:r}=this.props;this.createBackup.cancel(),e(t,!r&&n)}handlePersistEntry=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e,{persistEntry:r,collection:o,currentStatus:i,hasWorkflow:a,loadEntry:s,slug:l,createDraftDuplicateFromEntry:u,entryDraft:c}=this.props;await r(o),this.deleteBackup(),t?(Da(o.get("name")),n&&u(c.get("entry"))):l&&a&&!i&&s(o,l)};handlePublishEntry=async(e={})=>{const{createNew:t=!1,duplicate:n=!1}=e,{publishUnpublishedEntry:r,createDraftDuplicateFromEntry:o,entryDraft:i,collection:a,slug:s,currentStatus:l,t:u}=this.props;l===zr.last()?i.get("hasChanged")?window.alert(u("editor.editor.onPublishingWithUnsavedChanges")):window.confirm(u("editor.editor.onPublishing"))&&(await r(a.get("name"),s),this.deleteBackup(),t&&Da(a.get("name")),n&&o(i.get("entry"))):window.alert(u("editor.editor.onPublishingNotReady"))};handleUnpublishEntry=async()=>{const{unpublishPublishedEntry:e,collection:t,slug:n,t:r}=this.props;if(window.confirm(r("editor.editor.onUnpublishing")))return await e(t,n),Ia(t.get("name"))};handleDuplicateEntry=()=>{const{createDraftDuplicateFromEntry:e,collection:t,entryDraft:n}=this.props;Da(t.get("name")),e(n.get("entry"))};handleDeleteEntry=()=>{const{entryDraft:e,newEntry:t,collection:n,deleteEntry:r,slug:o,t:i}=this.props;if(e.get("hasChanged")){if(!window.confirm(i("editor.editor.onDeleteWithUnsavedChanges")))return}else if(!window.confirm(i("editor.editor.onDeletePublishedEntry")))return;if(t)return Ia(n.get("name"));setTimeout(async()=>(await r(n,o),this.deleteBackup(),Ia(n.get("name"))),0)};handleDeleteUnpublishedChanges=async()=>{const{entryDraft:e,collection:t,slug:n,deleteUnpublishedEntry:r,loadEntry:o,isModification:i,t:a}=this.props;e.get("hasChanged")&&!window.confirm(a("editor.editor.onDeleteUnpublishedChangesWithUnsavedChanges"))||window.confirm(a("editor.editor.onDeleteUnpublishedChanges"))&&(await r(t.get("name"),n),this.deleteBackup(),i?o(t,n):Ia(t.get("name")))};render(){const{entry:e,entryDraft:t,fields:n,collection:r,changeDraftFieldValidation:o,user:i,hasChanged:a,displayUrl:s,hasWorkflow:l,useOpenAuthoring:u,unpublishedEntry:c,newEntry:f,isModification:d,currentStatus:p,logoutUser:h,deployPreview:g,loadDeployPreview:m,draftKey:y,slug:v,t:b,editorBackLink:w}=this.props,x=!f&&!c;return e&&e.get("error")?(0,so.jsx)("div",null,(0,so.jsx)("h3",null,e.get("error"))):null==t||void 0===t.get("entry")||e&&e.get("isFetching")?(0,so.jsx)(Be.Loader,{active:!0},b("editor.editor.loadingEntry")):(0,so.jsx)(eS,{draftKey:y,entry:t.get("entry"),collection:r,fields:n,fieldsMetaData:t.get("fieldsMetaData"),fieldsErrors:t.get("fieldsErrors"),onChange:this.handleChangeDraftField,onValidate:o,onPersist:this.handlePersistEntry,onDelete:this.handleDeleteEntry,onDeleteUnpublishedChanges:this.handleDeleteUnpublishedChanges,onChangeStatus:this.handleChangeStatus,onPublish:this.handlePublishEntry,unPublish:this.handleUnpublishEntry,onDuplicate:this.handleDuplicateEntry,showDelete:this.props.showDelete,user:i,hasChanged:a,displayUrl:s,hasWorkflow:l,useOpenAuthoring:u,hasUnpublishedChanges:c,isNewEntry:f,isModification:d,currentStatus:p,onLogoutClick:h,deployPreview:g,loadDeployPreview:t=>m(r,v,e,x,t),editorBackLink:w,t:b})}}const oS={changeDraftField:function({field:e,value:t,metadata:n,entries:r,i18n:o}){return{type:Cs,payload:{field:e,value:t,metadata:n,entries:r,i18n:o}}},changeDraftFieldValidation:function(e,t){return{type:Os,payload:{uniquefieldId:e,errors:t}}},loadEntry:Gs,loadEntries:Xs,loadDeployPreview:function(e,t,n,r,o){return async(i,a)=>{const s=a(),l=uc(s.config),u=e.get("name"),c=Kc(s,u,t);if(!c||!c.isFetching||o?.signal){i(function(e,t){return{type:Pc,payload:{collection:e,slug:t}}}(u,t));try{const a=r?l.getDeploy(e,t,n):await l.getDeployPreview(e,t,n,o);return i(a?function(e,t,n){const{url:r,status:o}=n;return{type:Mc,payload:{collection:e,slug:t,url:r,status:o}}}(u,t,a):Ac(u,t))}catch(e){console.error(e),i(Ii({message:{details:e.message,key:"ui.toast.onFailToLoadDeployPreview"},type:"error",dismissAfter:8e3})),i(Ac(u,t))}}}},loadLocalBackup:function(){return{type:Ms}},retrieveLocalBackup:function(e,t){return async(n,r)=>{const o=r(),i=uc(o.config),{entry:a}=await i.getLocalDraftBackup(e,t);if(a){const t=a.mediaFiles||[],o=await Promise.all(t.map(t=>t.file||t.url?Cn({path:t.path,file:t.file,url:t.url,field:t.field}):Ra({collection:e,entry:(0,Ge.fromJS)(a),path:t.path,field:t.field})(n,r)));return n(Ca(o)),n(function(e){return{type:Ps,payload:{entry:e}}}(a))}}},persistLocalBackup:function(e,t){return(n,r)=>{const o=r();return uc(o.config).persistLocalDraftBackup(e,t)}},deleteLocalBackup:function(e,t){return(n,r)=>{const o=r();return uc(o.config).deleteLocalDraftBackup(e,t)}},createDraftDuplicateFromEntry:function(e){return t=>{t(Ti({predicate:({type:e})=>e===_s,run:()=>t(function(e){return{type:Rs,payload:oi(e.get("collection"),"","",{data:e.get("data"),i18n:e.get("i18n"),mediaFiles:e.get("mediaFiles").toJS()})}}(e))}))}},createEmptyDraft:function(e,t){return async(n,r)=>{new URLSearchParams(t).forEach((t,n)=>{e=function(e,n){const r=Vl(e,n);if(!r)return e;let o=!1;return e=e.set("fields",Kl(e.get("fields",(0,Ge.List)()),function(e){const n=e;return n===r?(o=!0,(e=>{return e.set("default",!!["true","True","TRUE"].includes(n=t)||!["false","False","FALSE"].includes(n)&&function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}(n));var n})(n)):n},()=>o)),e}(e,n)});const o=e.get("fields",(0,Ge.List)()),i=function(e){return e.filter(e=>!e.get("meta")).toList()}(o),a=Zs(i),s=function(e){return e.filter(e=>!0===e.get("meta")).toList()}(o),l=Zs(s),u=r(),c=uc(u.config);e.has("media_folder")||await ma(n,r());const f=function(e,t){if(!nu(e))return{};return function(e,t){const{locales:n,defaultLocale:r}=ru(e);return Object.fromEntries(n.filter(e=>e!==r).map(e=>[e,{data:t}]))}(e,Zs(t,function(e){return e.get(Zl)!==tu.DUPLICATE&&e.get(Zl)!==tu.TRANSLATE}))}(e,i);let d=oi(e.get("name"),"","",{data:a,i18n:f,mediaFiles:[],meta:l});d=await c.processEntry(u,e,d),n({type:_s,payload:d})}},discardDraft:function(){return{type:Es}},persistEntry:function(e){return async(t,n)=>{const r=n(),o=r.entryDraft,i=o.get("fieldsErrors"),a=Vc(r,e.get("name"));if(!i.isEmpty())return i.some(e=>e.some(e=>e.type&&e.type===Ci))&&t(Ii({message:{key:"ui.toast.missingRequiredField"},type:"error",dismissAfter:8e3})),Promise.reject();const s=uc(r.config),l=o.get("entry"),u=el({entry:l}),c=tl(e,l),f=o.set("entry",c);return t(function(e,t){return{type:As,payload:{collectionName:e.get("name"),entrySlug:t.get("slug")}}}(e,c)),s.persistEntry({config:r.config,collection:e,entryDraft:f,assetProxies:u,usedSlugs:a}).then(async n=>{t(Ii({message:{key:"ui.toast.entrySaved"},type:"success",dismissAfter:4e3})),u.length>0&&await t(ra()),t(function(e,t,n){return{type:Is,payload:{collectionName:e.get("name"),entrySlug:t.get("slug"),slug:n}}}(e,c,n)),e.has("nested")&&await t(Xs(e)),l.get("slug")!==n&&(await t(Gs(e,n)),ja(e.get("name"),n))}).catch(n=>(console.error(n),t(Ii({message:{details:n,key:"ui.toast.onFailToPersist"},type:"error",dismissAfter:8e3})),Promise.reject(t(function(e,t,n){return{type:Ds,error:"Failed to persist entry",payload:{collectionName:e.get("name"),entrySlug:t.get("slug"),error:n.toString()}}}(e,c,n)))))}},deleteEntry:function(e,t){return(n,r)=>{const o=r(),i=uc(o.config);return n(function(e,t){return{type:"ENTRY_DELETE_REQUEST",payload:{collectionName:e.get("name"),entrySlug:t}}}(e,t)),i.deleteEntry(o,e,t).then(()=>n(Ws(e,t))).catch(r=>(n(Ii({message:{details:r,key:"ui.toast.onFailToDelete"},type:"error",dismissAfter:8e3})),console.error(r),Promise.reject(n(function(e,t,n){return{type:"ENTRY_DELETE_FAILURE",payload:{collectionName:e.get("name"),entrySlug:t,error:n.toString()}}}(e,t,r)))))}},updateUnpublishedEntryStatus:rs,publishUnpublishedEntry:is,unpublishPublishedEntry:function(e,t){return(n,r)=>{const o=r(),i=uc(o.config),a=Hc(o,e.get("name"),t),s=(0,Ge.Map)().set("entry",a);return n(Xa(e,t)),i.deleteEntry(o,e,t).then(()=>i.persistEntry({config:o.config,collection:e,entryDraft:s,assetProxies:[],usedSlugs:(0,Ge.List)(),status:zr.get("PENDING_PUBLISH")})).then(()=>{n(Za(e,a)),n(Ws(e,t)),n(ts(e,t)),n(Ii({message:{key:"ui.toast.entryUnpublished"},type:"success",dismissAfter:4e3}))}).catch(t=>{n(Ii({message:{key:"ui.toast.onFailToUnpublishEntry",details:t},type:"error",dismissAfter:8e3})),n(es(t,e,a.get("slug")))})}},deleteUnpublishedEntry:os,logoutUser:wc},iS=V(function(e,t){const{collections:n,entryDraft:r,auth:o,config:i,entries:a,globalUI:s}=e,l=t.match.params[0],u=n.get(t.match.params.name),c=u.get("name"),f=!0===t.newRecord,d=Fl(u,l),p=f?null:Hc(e,c,l),h=o.user,g=r.get("hasChanged"),m=i.display_url,y=i.publish_mode===Br,v=s.useOpenAuthoring,b=r.getIn(["entry","isModification"]),w=!!a.getIn(["pages",c]),x=Gc(e,c,l),S=Hc(e,c,l),k=x&&x.get("status"),_=Kc(e,c,l),E=r.get("localBackup"),C=r.get("key");let O=`/collections/${c}`;if("workflow"===new URLSearchParams(t.location.search).get("ref")&&(O="/workflow"),u.has("nested")&&l){const e=l.split("/");e.length>2&&(O=`${O}/filter/${e.slice(0,-2).join("/")}`)}return{collection:u,collections:n,newEntry:f,entryDraft:r,fields:d,slug:l,entry:p,user:h,hasChanged:g,displayUrl:m,hasWorkflow:y,useOpenAuthoring:v,isModification:b,collectionEntriesLoaded:w,currentStatus:k,deployPreview:_,localBackup:E,draftKey:C,publishedEntry:S,unPublishedEntry:x,editorBackLink:O}},oS)(function(e){return V(tS,null,nS)(class extends r().Component{render(){return(0,so.jsx)(e,this.props)}})}((0,ze.Tl)()(rS))),aS=_h("div",{target:"ew40z3q0",label:"NotFoundContainer"})("margin:",Be.lengths.pageMargin,";");function sS({t:e}){return(0,so.jsx)(aS,null,(0,so.jsx)("h2",null,e("app.notFoundPage.header")))}sS.propTypes={t:a().func.isRequired};const lS=(0,ze.Tl)()(sS);function uS(){return uS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uS.apply(null,arguments)}const cS={buttonActive:(0,so.css)("color:",Be.colors.active,";;label:buttonActive;")};function fS(e){return(0,so.jsx)("header",uS({css:(0,so.css)(Be.shadows.dropMain,";position:sticky;width:100%;top:0;background-color:",Be.colors.foreground,";z-index:",Be.zIndex.zIndex300,";height:",Be.lengths.topBarHeight,";;label:AppHeader;")},e))}const dS=_h("div",{target:"e1rbzf6g5",label:"AppHeaderContent"})({name:"jxf21e",styles:"display:flex;justify-content:space-between;min-width:800px;max-width:1440px;padding:0 12px;margin:0 auto"}),pS=_h("button",{target:"e1rbzf6g4",label:"AppHeaderButton"})(Be.buttons.button,";background:none;color:#7b8290;font-family:inherit;font-size:16px;font-weight:500;display:inline-flex;padding:16px 20px;align-items:center;",Be.Icon,"{margin-right:4px;color:#b3b9c4;}&:hover,&:active,&:focus-visible{",cS.buttonActive,";",Be.Icon,"{",cS.buttonActive,";}}",e=>(0,so.css)("&.",e.activeClassName,"{",cS.buttonActive,";",Be.Icon,"{",cS.buttonActive,";}};label:AppHeaderButton;"),";"),hS=pS.withComponent(Ey,{target:"e1rbzf6g6",label:"AppHeaderNavLink"}),gS=_h("div",{target:"e1rbzf6g3",label:"AppHeaderActions"})({name:"8irbms",styles:"display:inline-flex;align-items:center"}),mS=_h(Be.StyledDropdownButton,{target:"e1rbzf6g2",label:"AppHeaderQuickNewButton"})(Be.buttons.button,";",Be.buttons.medium,";",Be.buttons.gray,";margin-right:8px;&:after{top:11px;}"),yS=_h("ul",{target:"e1rbzf6g1",label:"AppHeaderNavList"})({name:"1vufzxm",styles:"display:flex;margin:0;list-style:none"}),vS=_h("li",{target:"e1rbzf6g0",label:"AppHeaderLogo"})({name:"d1300z",styles:"display:flex;align-items:center;img{padding:12px 20px;max-height:56px;max-width:300px;object-fit:contain;object-position:center;}"});class bS extends r().Component{static propTypes={user:a().object.isRequired,collections:Mg().map.isRequired,onCreateEntryClick:a().func.isRequired,onLogoutClick:a().func.isRequired,openMediaLibrary:a().func.isRequired,hasWorkflow:a().bool.isRequired,displayUrl:a().string,logoUrl:a().string,logo:a().shape({src:a().string.isRequired,show_in_header:a().bool}),isTestRepo:a().bool,t:a().func.isRequired,checkBackendStatus:a().func.isRequired};intervalId;componentDidMount(){a().checkPropTypes(bS.propTypes,this.props,"prop","Header"),this.intervalId=setInterval(()=>{this.props.checkBackendStatus()},3e5)}componentWillUnmount(){clearInterval(this.intervalId)}handleCreatePostClick=e=>{const{onCreateEntryClick:t}=this.props;t&&t(e)};render(){const{user:e,collections:t,onLogoutClick:n,openMediaLibrary:r,hasWorkflow:o,displayUrl:i,logoUrl:a,logo:s,isTestRepo:l,t:u,showMediaButton:c}=this.props,f=t.filter(e=>e.get("create")).toList(),d=s?.show_in_header&&s?.src;return(0,so.jsx)(fS,null,(0,so.jsx)(dS,null,(0,so.jsx)("nav",null,(0,so.jsx)(yS,null,d&&(0,so.jsx)(vS,null,(0,so.jsx)("img",{src:s?.src||a,alt:"Logo"})),(0,so.jsx)("li",null,(0,so.jsx)(hS,{to:"/",activeClassName:"header-link-active",isActive:(e,t)=>t.pathname.startsWith("/collections/")},(0,so.jsx)(Be.Icon,{type:"page"}),u("app.header.content"))),o&&(0,so.jsx)("li",null,(0,so.jsx)(hS,{to:"/workflow",activeClassName:"header-link-active"},(0,so.jsx)(Be.Icon,{type:"workflow"}),u("app.header.workflow"))),c&&(0,so.jsx)("li",null,(0,so.jsx)(pS,{onClick:r},(0,so.jsx)(Be.Icon,{type:"media-alt"}),u("app.header.media"))))),(0,so.jsx)(gS,null,f.size>0&&(0,so.jsx)(Be.Dropdown,{renderButton:()=>(0,so.jsx)(mS,null," ",u("app.header.quickAdd")),dropdownTopOverlap:"30px",dropdownWidth:"160px",dropdownPosition:"left"},f.map(e=>(0,so.jsx)(Be.DropdownItem,{key:e.get("name"),label:e.get("label_singular")||e.get("label"),onClick:()=>this.handleCreatePostClick(e.get("name"))}))),(0,so.jsx)(Tg,{displayUrl:i,isTestRepo:l,imageUrl:e?.avatar_url,onLogoutClick:n}))))}}const wS={checkBackendStatus:function(){return async(e,t)=>{try{const n=t();if(n.status.isFetching)return;e({type:$c});const r=uc(n.config),o=await r.status(),i="ui.toast.onBackendDown",a=n.notifications.notifications.filter(e=>"string"!=typeof e.message&&e.message?.key===i);if(!1===o.api.status)return 0===a.length&&e(Ii({message:{details:o.api.statusPage,key:"ui.toast.onBackendDown"},type:"error"})),e(zc(o));if(!0===o.api.status&&a.length>0&&a.forEach(t=>{e(Di(t.id))}),!1===o.auth.status){const t="ui.toast.onLoggedOut",r=n.notifications.notifications.find(e=>"string"!=typeof e.message&&e.message?.key===t);r||e(Ii({message:{key:"ui.toast.onLoggedOut"},type:"error"}))}e(zc(o))}catch(t){e(function(e){return{type:Bc,payload:{error:e}}}(t))}}}},xS=V(null,wS)((0,ze.Tl)()(bS));function SS(){return SS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SS.apply(null,arguments)}Ag().config({barColors:{0:Be.colors.active,"1.0":Be.colors.active},shadowBlur:0,barThickness:2});const kS=_h("div",{target:"eh2m33j2",label:"AppMainContainer"})({name:"y0stlg",styles:"min-width:800px;max-width:1440px;margin:0 auto"}),_S=_h("div",{target:"eh2m33j1",label:"ErrorContainer"})({name:"3zy121",styles:"margin:20px"}),ES=_h("pre",{target:"eh2m33j0",label:"ErrorCodeBlock"})({name:"1dps4tx",styles:"margin-left:20px;font-size:15px;line-height:1.5"});function CS(e){const t=e.filter(e=>!0!==e.get("hide")).first();if(t)return`/collections/${t.get("name")}`;throw new Error("Could not find a non hidden collection")}function OS({collections:e,render:t,...n}){const r=CS(e);return(0,so.jsx)($e,SS({},n,{render:n=>e.get(n.match.params.name)?t(n):(0,so.jsx)(De,{to:r})}))}class TS extends r().Component{static propTypes={auth:a().object.isRequired,config:a().object.isRequired,collections:Mg().map.isRequired,loginUser:a().func.isRequired,logoutUser:a().func.isRequired,user:a().object,isFetching:a().bool.isRequired,publishMode:a().oneOf([Fr,Br]),siteId:a().string,useMediaLibrary:a().bool,openMediaLibrary:a().func.isRequired,showMediaButton:a().bool,t:a().func.isRequired};componentDidMount(){a().checkPropTypes(TS.propTypes,this.props,"prop","App")}configError(e){const t=this.props.t;return(0,so.jsx)(_S,null,(0,so.jsx)("h1",null,t("app.app.errorHeader")),(0,so.jsx)("div",null,(0,so.jsx)("strong",null,t("app.app.configErrors"),":"),(0,so.jsx)(ES,null,e.error),(0,so.jsx)("span",null,t("app.app.checkConfigYml"))))}handleLogin(e){this.props.loginUser(e)}authenticating(){const{auth:e,t}=this.props,n=uc(this.props.config);return null==n?(0,so.jsx)("div",null,(0,so.jsx)("h1",null,t("app.app.waitingBackend"))):(0,so.jsx)("div",null,(0,so.jsx)(bg,null),r().createElement(n.authComponent(),{onLogin:this.handleLogin.bind(this),error:e.error,inProgress:e.isFetching,siteId:this.props.config.backend.site_domain,base_url:this.props.config.backend.base_url,authEndpoint:this.props.config.backend.auth_endpoint,config:this.props.config,clearHash:()=>Aa.replace("/"),t}))}handleLinkClick(e,t,...n){e.preventDefault(),t(...n)}render(){const{user:e,config:t,collections:n,logoutUser:o,isFetching:i,publishMode:a,useMediaLibrary:s,openMediaLibrary:l,t:u,showMediaButton:c}=this.props;if(null===t)return null;if(t.error)return this.configError(t);if(t.isFetching)return(0,so.jsx)(Be.Loader,{active:!0},u("app.app.loadingConfig"));if(null==e)return this.authenticating(u);const f=CS(n),d=a===Br;return(0,so.jsx)(r().Fragment,null,(0,so.jsx)(bg,null),(0,so.jsx)(xS,{user:e,collections:n,onCreateEntryClick:Ig,onLogoutClick:o,openMediaLibrary:l,hasWorkflow:d,displayUrl:t.display_url,logoUrl:t.logo_url,logo:t.logo,isTestRepo:"test-repo"===t.backend.name,showMediaButton:c}),(0,so.jsx)(kS,null,i&&(0,so.jsx)(Ag(),null),(0,so.jsx)(Fe,null,(0,so.jsx)(De,{exact:!0,from:"/",to:f}),(0,so.jsx)(De,{exact:!0,from:"/search/",to:f}),(0,so.jsx)(OS,{exact:!0,collections:n,path:"/collections/:name/search/",render:({match:e})=>(0,so.jsx)(De,{to:`/collections/${e.params.name}`})}),(0,so.jsx)(De,{from:"/error=access_denied&error_description=Signups+not+allowed+for+this+instance",to:f}),d?(0,so.jsx)($e,{path:"/workflow",component:Fb}):null,(0,so.jsx)(OS,{exact:!0,collections:n,path:"/collections/:name",render:e=>(0,so.jsx)(lb,e)}),(0,so.jsx)(OS,{path:"/collections/:name/new",collections:n,render:e=>(0,so.jsx)(iS,SS({},e,{newRecord:!0}))}),(0,so.jsx)(OS,{path:"/collections/:name/entries/*",collections:n,render:e=>(0,so.jsx)(iS,e)}),(0,so.jsx)(OS,{path:"/collections/:name/search/:searchTerm",collections:n,render:e=>(0,so.jsx)(lb,SS({},e,{isSearchResults:!0,isSingleSearchResult:!0}))}),(0,so.jsx)(OS,{collections:n,path:"/collections/:name/filter/:filterTerm*",render:e=>(0,so.jsx)(lb,e)}),(0,so.jsx)($e,{path:"/search/:searchTerm",render:e=>(0,so.jsx)(lb,SS({},e,{isSearchResults:!0}))}),(0,so.jsx)(OS,{path:"/edit/:name/:entryName",collections:n,render:({match:e})=>{const{name:t,entryName:n}=e.params;return(0,so.jsx)(De,{to:`/collections/${t}/entries/${n}`})}}),(0,so.jsx)($e,{component:lS})),s?(0,so.jsx)(my,null):null))}}const PS=V(function(e){const{auth:t,config:n,collections:r,globalUI:o,mediaLibrary:i}=e,a=t.user,s=o.isFetching,l=n.publish_mode,u=!i.get("externalLibrary");return{auth:t,config:n,collections:r,user:a,isFetching:s,publishMode:l,showMediaButton:i.get("showMediaButton"),useMediaLibrary:u}},{openMediaLibrary:ea,loginUser:function(e){return(t,n)=>{const r=n(),o=uc(r.config);return t(mc()),o.authenticate(e).then(e=>{e.useOpenAuthoring&&t(bc()),t(yc(e))}).catch(e=>{console.error(e),t(Ii({message:{details:e.message,key:"ui.toast.onFailToAuth"},type:"error",dismissAfter:8e3})),t(vc(e))})}},logoutUser:wc})((0,ze.Tl)()(TS));function MS({field:e,t}){return(0,so.jsx)("div",null,t("editor.editorWidgets.unknownControl.noControl",{widget:e.get("widget")}))}MS.propTypes={field:Mg().map,t:a().func.isRequired};const RS=(0,ze.Tl)()(MS);function AS({field:e,t}){return(0,so.jsx)("div",{className:"nc-widgetPreview"},t("editor.editorWidgets.unknownPreview.noPreview",{widget:e.get("widget")}))}function IS(e){return Jc.dispatch(ta(e,void 0))}AS.propTypes={field:Mg().map,t:a().func.isRequired},hr("unknown",RS,(0,ze.Tl)()(AS));const DS=po()(async function(e,t){const n=Sr(e);if(n){const e=await n.init({options:t,handleInsert:IS});Jc.dispatch(function(e){const t={show:e.show||(()=>{}),hide:e.hide||(()=>{}),onClearControl:e.onClearControl||(()=>{}),onRemoveControl:e.onRemoveControl||(()=>{}),enableStandalone:e.enableStandalone||(()=>{})};return{type:Ni,payload:t}}(e))}else{const t=new Error(`Missing external media library '${e}'. Please use 'registerMediaLibrary' to register it.`);Jc.dispatch(Hu(t))}});Jc.subscribe(()=>{const e=Jc.getState();if(e){const t=e.config.media_library?.name;if(t&&!e.mediaLibrary.get("externalLibrary")){const n=e.config.media_library;DS(t,n)}}}),__webpack_require__(22847);const jS="nc-root",LS=V(function(e){return{locale:Ku(e.config),config:e.config}})(function({locale:e,config:t}){return(0,so.jsx)(ze.F2,{locale:e,messages:ef(e)},(0,so.jsx)(Ih,{showBackup:!0,config:t},(0,so.jsx)(Pe,{history:Aa},(0,so.jsx)($e,{component:PS}))))}),NS={...fr,init:function(e={}){const{config:t}=e;console.log("decap-cms-core 3.13.0"),Jc.dispatch(Vu(t,function(){Jc.dispatch((e,t)=>{const n=t(),r=uc(n.config);return e(mc()),Promise.resolve(r.currentUser()).then(t=>{t?(t.useOpenAuthoring&&e(bc()),e(yc(t))):e({type:pc})}).catch(t=>{e(vc(t)),e(wc())})})})),(0,o.createRoot)(function(){const e=document.getElementById(jS);if(e)return e;const t=document.createElement("div");return t.id=jS,document.body.appendChild(t),t}()).render((0,so.jsx)(function(){return(0,so.jsx)(r().Fragment,null,(0,so.jsx)(Be.GlobalStyles,null),(0,so.jsx)(p,{store:Jc},(0,so.jsx)(LS,null)))},null))}}})(),__webpack_exports__=__webpack_exports__.DecapCmsCore,__webpack_exports__})());
|
|
47
47
|
//# sourceMappingURL=decap-cms-core.js.map
|