@strapi/admin 4.5.2 → 4.5.4

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.
Files changed (119) hide show
  1. package/admin/src/components/AuthenticatedApp/index.js +13 -2
  2. package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +1 -1
  3. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +39 -3
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +5 -1
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/recursivelyFindPathsBasedOnCondition.js +8 -1
  6. package/admin/src/content-manager/components/Inputs/index.js +5 -19
  7. package/admin/src/content-manager/components/NonRepeatableComponent/index.js +4 -0
  8. package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -9
  9. package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +1 -1
  10. package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js +4 -0
  11. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +1 -1
  12. package/admin/src/content-manager/components/Wysiwyg/Editor.js +1 -1
  13. package/admin/src/content-manager/hooks/useLazyComponents/index.js +69 -0
  14. package/admin/src/content-manager/pages/CollectionTypeRecursivePath/components/ErrorFallback.js +13 -0
  15. package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +2 -1
  16. package/admin/src/content-manager/pages/EditView/GridRow/index.js +62 -0
  17. package/admin/src/content-manager/pages/EditView/index.js +74 -154
  18. package/admin/src/content-manager/pages/EditView/selectors.js +14 -0
  19. package/admin/src/content-manager/pages/EditView/utils/createAttributesLayout.js +11 -6
  20. package/admin/src/content-manager/pages/EditView/utils/getCustomFieldUidsFromLayout.js +18 -0
  21. package/admin/src/content-manager/pages/EditView/utils/index.js +1 -0
  22. package/admin/src/content-manager/pages/EditViewLayoutManager/index.js +1 -1
  23. package/admin/src/content-manager/sharedReducers/crudReducer/actions.js +5 -0
  24. package/admin/src/content-manager/sharedReducers/crudReducer/constants.js +2 -0
  25. package/admin/src/content-manager/sharedReducers/crudReducer/reducer.js +7 -0
  26. package/admin/src/core/apis/CustomFields.js +46 -1
  27. package/admin/src/core/utils/axiosInstance.js +4 -2
  28. package/admin/src/hooks/index.js +1 -0
  29. package/admin/src/hooks/useFetchClient/index.js +23 -0
  30. package/admin/src/pages/App/index.js +20 -13
  31. package/admin/src/pages/HomePage/SocialLinks.js +4 -4
  32. package/admin/src/pages/MarketplacePage/components/SortSelect/index.js +20 -0
  33. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +2 -3
  34. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +23 -18
  35. package/admin/src/translations/en.json +4 -0
  36. package/admin/src/translations/ru.json +789 -489
  37. package/admin/src/translations/tr.json +485 -5
  38. package/admin/src/utils/fetchClient.js +45 -0
  39. package/admin/src/utils/getFetchClient.js +10 -0
  40. package/admin/src/utils/index.js +1 -0
  41. package/admin/src/utils/uniqueAdminHash.js +22 -0
  42. package/build/{1233.bddaaa76.chunk.js → 1233.802422fa.chunk.js} +63 -63
  43. package/build/4306.df40a798.chunk.js +98 -0
  44. package/build/4318.9283c350.chunk.js +30 -0
  45. package/build/5057.195a59ff.chunk.js +65 -0
  46. package/build/{805.a1894307.chunk.js → 805.e991a370.chunk.js} +6 -6
  47. package/build/{4986.3820d11d.chunk.js → 8176.e929d326.chunk.js} +3 -3
  48. package/build/{8633.8da5488a.chunk.js → 8633.43ec9042.chunk.js} +1 -1
  49. package/build/8881.c693411a.chunk.js +245 -0
  50. package/build/9161.4a0ab137.chunk.js +2119 -0
  51. package/build/9279.6290c87a.chunk.js +117 -0
  52. package/build/9707.a0cc4ad8.chunk.js +70 -0
  53. package/build/Admin-authenticatedApp.0da578b8.chunk.js +80 -0
  54. package/build/{Admin_homePage.54e33c2d.chunk.js → Admin_homePage.8945f71a.chunk.js} +5 -5
  55. package/build/{Admin_marketplace.ff012eb2.chunk.js → Admin_marketplace.ed754a4a.chunk.js} +5 -5
  56. package/build/{Admin_profilePage.e9fcce92.chunk.js → Admin_profilePage.60ab80bb.chunk.js} +1 -1
  57. package/build/{Admin_settingsPage.a1a5218b.chunk.js → Admin_settingsPage.6ef8acc9.chunk.js} +6 -6
  58. package/build/admin-app.a3277e72.chunk.js +112 -0
  59. package/build/admin-edit-roles-page.f407538c.chunk.js +1 -0
  60. package/build/admin-edit-users.5547b126.chunk.js +10 -0
  61. package/build/{admin-users.a0748674.chunk.js → admin-users.e64fb0f1.chunk.js} +1 -1
  62. package/build/content-manager.f9630c3b.chunk.js +1197 -0
  63. package/build/content-type-builder-list-view.4412efc3.chunk.js +201 -0
  64. package/build/content-type-builder-translation-tr-json.949e22eb.chunk.js +1 -0
  65. package/build/content-type-builder.b132b5f4.chunk.js +145 -0
  66. package/build/email-settings-page.c6e62f6b.chunk.js +15 -0
  67. package/build/email-translation-tr-json.8aa034bb.chunk.js +1 -0
  68. package/build/en-json.7dd57947.chunk.js +1 -0
  69. package/build/i18n-translation-tr-json.34ca9d61.chunk.js +1 -0
  70. package/build/index.html +1 -1
  71. package/build/main.71f24343.js +2034 -0
  72. package/build/ru-json.8830286f.chunk.js +1 -0
  73. package/build/runtime~main.1115f82b.js +2 -0
  74. package/build/sso-settings-page.feed2f45.chunk.js +1 -0
  75. package/build/tr-json.eac8bd79.chunk.js +1 -0
  76. package/build/upload-settings.450cab1a.chunk.js +18 -0
  77. package/build/upload-translation-tr-json.b173223a.chunk.js +1 -0
  78. package/build/upload.74540aab.chunk.js +64 -0
  79. package/build/users-advanced-settings-page.0c0b8230.chunk.js +13 -0
  80. package/build/users-email-settings-page.3126ff8c.chunk.js +28 -0
  81. package/build/users-permissions-translation-tr-json.9bebc250.chunk.js +1 -0
  82. package/build/users-providers-settings-page.b7b602e2.chunk.js +33 -0
  83. package/build/users-roles-settings-page.ce5b582d.chunk.js +30 -0
  84. package/build/webhook-edit-page.1215a6b7.chunk.js +75 -0
  85. package/package.json +13 -13
  86. package/server/controllers/admin.js +2 -0
  87. package/server/routes/admin.js +1 -1
  88. package/server/services/metrics.js +5 -2
  89. package/utils/get-plugins-path.js +17 -3
  90. package/build/1920.208c77f8.chunk.js +0 -245
  91. package/build/2438.afe24949.chunk.js +0 -2525
  92. package/build/2517.5cc235ba.chunk.js +0 -117
  93. package/build/4306.e62b841c.chunk.js +0 -98
  94. package/build/4318.7931eee7.chunk.js +0 -30
  95. package/build/9707.932a3c12.chunk.js +0 -70
  96. package/build/Admin-authenticatedApp.7484bdf1.chunk.js +0 -80
  97. package/build/admin-app.9cb0abc7.chunk.js +0 -112
  98. package/build/admin-edit-roles-page.23f15909.chunk.js +0 -1
  99. package/build/admin-edit-users.283b49ed.chunk.js +0 -10
  100. package/build/content-manager.577fddcb.chunk.js +0 -1200
  101. package/build/content-type-builder-list-view.95012cf0.chunk.js +0 -201
  102. package/build/content-type-builder-translation-tr-json.2e52bc60.chunk.js +0 -1
  103. package/build/content-type-builder.95b9d6a2.chunk.js +0 -145
  104. package/build/email-settings-page.4bb3606f.chunk.js +0 -15
  105. package/build/email-translation-tr-json.87f2feb3.chunk.js +0 -1
  106. package/build/en-json.4a269f6b.chunk.js +0 -1
  107. package/build/main.23670c4c.js +0 -2026
  108. package/build/ru-json.d7cfc2ff.chunk.js +0 -1
  109. package/build/runtime~main.4dc8c7c6.js +0 -2
  110. package/build/sso-settings-page.9f091262.chunk.js +0 -1
  111. package/build/tr-json.9c44ea0c.chunk.js +0 -1
  112. package/build/upload-settings.3010911f.chunk.js +0 -18
  113. package/build/upload.9f19f2e8.chunk.js +0 -64
  114. package/build/users-advanced-settings-page.9df41d67.chunk.js +0 -13
  115. package/build/users-email-settings-page.56d82eaf.chunk.js +0 -28
  116. package/build/users-permissions-translation-tr-json.cdc49a3c.chunk.js +0 -1
  117. package/build/users-providers-settings-page.96bb7da0.chunk.js +0 -33
  118. package/build/users-roles-settings-page.445e5e16.chunk.js +0 -30
  119. package/build/webhook-edit-page.3285abc4.chunk.js +0 -75
@@ -0,0 +1,1197 @@
1
+ (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{37475:(_c,ct)=>{var p=function(){var r={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(y,oe,le,be,q,ae,ke){var ce=ae.length-1;switch(q){case 1:this.$=y.replace(/\\(\\|")/g,"$1").replace(/\\n/g,`
2
+ `).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(y);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=ae[ce-1];case 13:this.$={};break;case 14:this.$=ae[ce-1];break;case 15:this.$=[ae[ce-2],ae[ce]];break;case 16:this.$={},this.$[ae[ce][0]]=ae[ce][1];break;case 17:this.$=ae[ce-2],ae[ce-2][ae[ce][0]]=ae[ce][1];break;case 18:this.$=[];break;case 19:this.$=ae[ce-1];break;case 20:this.$=[ae[ce]];break;case 21:this.$=ae[ce-2],ae[ce-2].push(ae[ce]);break}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(y,oe){throw new Error(y)},parse:function(y){var oe=this,le=[0],be=[null],q=[],ae=this.table,ke="",ce=0,Bt=0,E=0,Fe=2,Se=1;this.lexer.setInput(y),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var s=this.lexer.yylloc;q.push(s),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function Ro(B){le.length=le.length-2*B,be.length=be.length-B,q.length=q.length-B}function Ot(){var B;return B=oe.lexer.lex()||1,typeof B!="number"&&(B=oe.symbols_[B]||B),B}for(var Oe,Ue,we,Me,In,Rt,rt={},Qe,Ne,De,j;;){we=le[le.length-1],this.defaultActions[we]?Me=this.defaultActions[we]:(Oe==null&&(Oe=Ot()),Me=ae[we]&&ae[we][Oe]);e:if(typeof Me=="undefined"||!Me.length||!Me[0]){if(!E){j=[];for(Qe in ae[we])this.terminals_[Qe]&&Qe>2&&j.push("'"+this.terminals_[Qe]+"'");var T="";this.lexer.showPosition?T="Parse error on line "+(ce+1)+`:
3
+ `+this.lexer.showPosition()+`
4
+ Expecting `+j.join(", ")+", got '"+this.terminals_[Oe]+"'":T="Parse error on line "+(ce+1)+": Unexpected "+(Oe==1?"end of input":"'"+(this.terminals_[Oe]||Oe)+"'"),this.parseError(T,{text:this.lexer.match,token:this.terminals_[Oe]||Oe,line:this.lexer.yylineno,loc:s,expected:j})}if(E==3){if(Oe==Se)throw new Error(T||"Parsing halted.");Bt=this.lexer.yyleng,ke=this.lexer.yytext,ce=this.lexer.yylineno,s=this.lexer.yylloc,Oe=Ot()}for(;!(Fe.toString()in ae[we]);){if(we==0)throw new Error(T||"Parsing halted.");Ro(1),we=le[le.length-1]}Ue=Oe,Oe=Fe,we=le[le.length-1],Me=ae[we]&&ae[we][Fe],E=3}if(Me[0]instanceof Array&&Me.length>1)throw new Error("Parse Error: multiple actions possible at state: "+we+", token: "+Oe);switch(Me[0]){case 1:le.push(Oe),be.push(this.lexer.yytext),q.push(this.lexer.yylloc),le.push(Me[1]),Oe=null,Ue?(Oe=Ue,Ue=null):(Bt=this.lexer.yyleng,ke=this.lexer.yytext,ce=this.lexer.yylineno,s=this.lexer.yylloc,E>0&&E--);break;case 2:if(Ne=this.productions_[Me[1]][1],rt.$=be[be.length-Ne],rt._$={first_line:q[q.length-(Ne||1)].first_line,last_line:q[q.length-1].last_line,first_column:q[q.length-(Ne||1)].first_column,last_column:q[q.length-1].last_column},Rt=this.performAction.call(rt,ke,Bt,ce,this.yy,Me[1],be,q),typeof Rt!="undefined")return Rt;Ne&&(le=le.slice(0,-1*Ne*2),be=be.slice(0,-1*Ne),q=q.slice(0,-1*Ne)),le.push(this.productions_[Me[1]][0]),be.push(rt.$),q.push(rt._$),De=ae[le[le.length-2]][le[le.length-1]],le.push(De);break;case 3:return!0}}return!0}},ut=function(){var J={EOF:1,parseError:function(oe,le){if(this.yy.parseError)this.yy.parseError(oe,le);else throw new Error(oe)},setInput:function(y){return this._input=y,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.match+=y,this.matched+=y;var oe=y.match(/\n/);return oe&&this.yylineno++,this._input=this._input.slice(1),y},unput:function(y){return this._input=y+this._input,this},more:function(){return this._more=!0,this},less:function(y){this._input=this.match.slice(y)+this._input},pastInput:function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var y=this.pastInput(),oe=new Array(y.length+1).join("-");return y+this.upcomingInput()+`
5
+ `+oe+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,oe,le,be,q,ae;this._more||(this.yytext="",this.match="");for(var ke=this._currentRules(),ce=0;ce<ke.length&&(le=this._input.match(this.rules[ke[ce]]),!(le&&(!oe||le[0].length>oe[0].length)&&(oe=le,be=ce,!this.options.flex)));ce++);if(oe)return ae=oe[0].match(/\n.*/g),ae&&(this.yylineno+=ae.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ae?ae[ae.length-1].length-1:this.yylloc.last_column+oe[0].length},this.yytext+=oe[0],this.match+=oe[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(oe[0].length),this.matched+=oe[0],y=this.performAction.call(this,this.yy,this,ke[be],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y||void 0;if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var oe=this.next();return typeof oe!="undefined"?oe:this.lex()},begin:function(oe){this.conditionStack.push(oe)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(oe){this.begin(oe)}};return J.options={},J.performAction=function(oe,le,be,q){var ae=q;switch(be){case 0:break;case 1:return 6;case 2:return le.yytext=le.yytext.substr(1,le.yyleng-2),4;break;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},J.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],J.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},J}();return r.lexer=ut,r}();ct.parser=p,ct.parse=function(){return p.parse.apply(p,arguments)},ct.main=function(ut){if(!ut[1])throw new Error("Usage: "+ut[0]+" FILE")}},38257:(_c,ct,p)=>{"use strict";p.r(ct),p.d(ct,{App:()=>zc,default:()=>QC});var r=p(32735),ut=p(99357),J=p(5141),y=p(88425),oe=p(28356),le=p(96709),be=p(27649),q=p(5636),ae=p(98978),ke=p.n(ae),ce=p(83983);const E=e=>`content-manager.${e}`;var Fe=p(74506),Se=p(60216),s=p.n(Se);const Ot=(0,r.createContext)();var Oe=Object.defineProperty,Ue=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,In=(e,t,n)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t)=>{for(var n in t||(t={}))we.call(t,n)&&In(e,n,t[n]);if(Ue)for(var n of Ue(t))Me.call(t,n)&&In(e,n,t[n]);return e},rt=(e,t)=>{var n={};for(var o in e)we.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Ue)for(var o of Ue(e))t.indexOf(o)<0&&Me.call(e,o)&&(n[o]=e[o]);return n};function Qe(e){var t=e,{attributes:n,buttonData:o,children:a,goTo:l,layout:i,metadatas:c,moveItem:u,moveRow:d,onAddData:m,relationsLayout:g,removeField:f,selectedItemName:h,setEditFieldToSelect:b}=t,C=rt(t,["attributes","buttonData","children","goTo","layout","metadatas","moveItem","moveRow","onAddData","relationsLayout","removeField","selectedItemName","setEditFieldToSelect"]);return r.createElement(Ot.Provider,{value:Rt({attributes:n,buttonData:o,goTo:l,layout:i,metadatas:c,moveItem:u,moveRow:d,onAddData:m,relationsLayout:g,removeField:f,selectedItemName:h,setEditFieldToSelect:b},C)},a)}Qe.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},Qe.propTypes={attributes:s().object,buttonData:s().array,children:s().node.isRequired,goTo:s().func,layout:s().array,metadatas:s().object,moveItem:s().func,moveRow:s().func,onAddData:s().func,relationsLayout:s().array,removeField:s().func,selectedItemName:s().string,setEditFieldToSelect:s().func};const Ne=Qe,De={COMPONENT:"component",EDIT_FIELD:"editField",EDIT_RELATION:"editRelation",FIELD:"field",RELATION:"relation"};var j=p(83292),T=p(62345),B=p(36320),z=p(88860),Re=p(50563),ze=p(4038),dt=p(47081),wo=p(16899);const Uc=(0,j.default)(T.x)`
7
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
8
+ `,Hc=(0,j.default)(T.x)`
9
+ height: ${32/16}rem;
10
+ width: ${32/16}rem;
11
+ border-radius: 50%;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+
16
+ svg {
17
+ height: ${6/16}rem;
18
+ width: ${11/16}rem;
19
+ > path {
20
+ fill: ${({theme:e})=>e.colors.neutral600};
21
+ }
22
+ }
23
+ `,Gc=j.default.button`
24
+ border: none;
25
+ background: transparent;
26
+ display: block;
27
+ width: 100%;
28
+ text-align: unset;
29
+ padding: 0;
30
+ `,Mo=({displayedValue:e})=>r.createElement(Uc,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,y.pxToRem)(300)},r.createElement(B.k,{justifyContent:"space-between"},r.createElement(Gc,{type:"button"},r.createElement(B.k,null,r.createElement(Hc,{background:"neutral200"},r.createElement(wo.default,null)),r.createElement(T.x,{paddingLeft:6,maxWidth:(0,y.pxToRem)(150)},r.createElement(z.Z,{textColor:"neutral700",ellipsis:!0},e)))),r.createElement(T.x,{paddingLeft:3},r.createElement(B.k,null,r.createElement(Re.h,{icon:r.createElement(ze.default,null)}),r.createElement(T.x,{paddingLeft:2},r.createElement(Re.h,{icon:r.createElement(dt.Z,null)}))))));Mo.propTypes={displayedValue:s().string.isRequired};const Kc=Mo;var ie=p(27677),pt=p(68625),Dn=p(35331);const To=e=>e.length>20?`${e.substring(0,20)}...`:e,Ln=(0,j.default)(B.k)`
31
+ height: ${({theme:e})=>e.spaces[7]};
32
+
33
+ &:last-child {
34
+ padding: 0 ${({theme:e})=>e.spaces[3]};
35
+ }
36
+ `,Io=(0,j.default)(Ln)`
37
+ padding: 0 ${({theme:e})=>e.spaces[3]};
38
+ border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
39
+ cursor: all-scroll;
40
+
41
+ svg {
42
+ width: ${12/16}rem;
43
+ height: ${12/16}rem;
44
+ }
45
+ `,Qc=(0,j.default)(B.k)`
46
+ display: inline-flex;
47
+ max-height: ${32/16}rem;
48
+ opacity: ${({transparent:e})=>e?0:1};
49
+ background-color: ${({theme:e,isSibling:t})=>t?e.colors.neutral100:e.colors.primary100};
50
+ border: 1px solid
51
+ ${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
52
+
53
+ svg {
54
+ width: ${10/16}rem;
55
+ height: ${10/16}rem;
56
+
57
+ path {
58
+ fill: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
59
+ }
60
+ }
61
+
62
+ ${z.Z} {
63
+ color: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
64
+ }
65
+
66
+ ${Io} {
67
+ border-right: 1px solid
68
+ ${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
69
+ }
70
+ `,Sn=({labelField:e,transparent:t,isSibling:n})=>{const o=To(e);return r.createElement(Qc,{hasRadius:!0,justifyContent:"space-between",transparent:t,isSibling:n},r.createElement(ie.K,{horizontal:!0,spacing:3},r.createElement(Io,{alignItems:"center"},r.createElement(dt.Z,null)),r.createElement(z.Z,{fontWeight:"bold"},o)),r.createElement(B.k,{paddingLeft:3},r.createElement(Ln,{alignItems:"center"},r.createElement(pt.Z,null)),r.createElement(Ln,{alignItems:"center"},r.createElement(Dn.default,null))))};Sn.defaultProps={isSibling:!1,transparent:!1},Sn.propTypes={isSibling:s().bool,labelField:s().string.isRequired,transparent:s().bool};const xn=Sn,Yc={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function Jc(e,t,n){if(!e||!t)return{display:"none"};const{x:o,y:a}=n,l=`translate(${o}px, ${a}px)`;return{transform:l,WebkitTransform:l}}const Xc=()=>{const{itemType:e,isDragging:t,item:n,initialOffset:o,currentOffset:a,mouseOffset:l}=(0,Fe.useDragLayer)(i=>({item:i.getItem(),itemType:i.getItemType(),initialOffset:i.getInitialSourceClientOffset(),currentOffset:i.getSourceClientOffset(),isDragging:i.isDragging(),mouseOffset:i.getClientOffset()}));return t?r.createElement(Ne,null,r.createElement("div",{style:Yc},r.createElement("div",{style:Jc(o,a,l),className:"col-md-2"},[De.EDIT_RELATION,De.EDIT_FIELD,De.FIELD].includes(e)&&r.createElement(xn,{labelField:n.labelField}),e===De.COMPONENT&&r.createElement(Kc,{displayedValue:n.displayedValue})))):null},Do=(0,r.createContext)();var eu=p(47533),Y=p(92891);const Lo=(0,r.createContext)(),pP=(0,r.createContext)(),mP=null;var pe=p(4409);const So=e=>e["content-manager_editViewLayoutManager"].currentLayout;var tu=Object.defineProperty,nu=Object.defineProperties,ru=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,ou=Object.prototype.hasOwnProperty,su=Object.prototype.propertyIsEnumerable,ko=(e,t,n)=>t in e?tu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,au=(e,t)=>{for(var n in t||(t={}))ou.call(t,n)&&ko(e,n,t[n]);if(xo)for(var n of xo(t))su.call(t,n)&&ko(e,n,t[n]);return e},iu=(e,t)=>nu(e,ru(t));const Ye=()=>{const e=(0,pe.useSelector)(So),t=(0,r.useCallback)(n=>(0,Y.get)(e,["components",n],{}),[e]);return iu(au({},e),{getComponentLayout:t})};var lu=p(43653),Ae=p.n(lu),me=p(17247),cu=p(99381),Ve=p.n(cu);const zt=(e,t,n)=>{if(Array.isArray(e)&&t>=0&&n>=0&&t<=e.length-1&&n<=e.length-1){const o=Ve()(e),a=o.splice(t,1);return o.splice(n,0,a[0]),o}return e},Fo=e=>{const t=e.type;return t==="relation"?!(0,Y.toLower)(e.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(t)&&!!t},Ao=(e,t)=>Object.keys(e).reduce((n,o)=>{const a=(0,Y.get)(e,[o],{}),{default:l,component:i,type:c,required:u,min:d,repeatable:m}=a;if(c==="json"&&(n[o]=null),c==="json"&&u===!0&&(n[o]={}),l!==void 0&&(n[o]=l),c==="component"){const g=(0,Y.get)(t,[i,"attributes"],{}),f=Ao(g,t);if(u===!0&&(n[o]=m===!0?[]:f),d&&m===!0&&u){n[o]=[];for(let h=0;h<d;h+=1)n[o].push(f)}}return c==="dynamiczone"&&u===!0&&(n[o]=[]),n},{}),Zt=Ao;var uu=Object.defineProperty,du=Object.defineProperties,pu=Object.getOwnPropertyDescriptors,Wt=Object.getOwnPropertySymbols,jo=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable,No=(e,t,n)=>t in e?uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kn=(e,t)=>{for(var n in t||(t={}))jo.call(t,n)&&No(e,n,t[n]);if(Wt)for(var n of Wt(t))$o.call(t,n)&&No(e,n,t[n]);return e},Fn=(e,t)=>du(e,pu(t)),mu=(e,t)=>{var n={};for(var o in e)jo.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Wt)for(var o of Wt(e))t.indexOf(o)<0&&$o.call(e,o)&&(n[o]=e[o]);return n};const _t=e=>{var t=e,{layouts:n,metadatas:o}=t,a=mu(t,["layouts","metadatas"]);const l=n.list.map(u=>u.name?u.name:u),i=Object.keys(o).reduce((u,d)=>{const m=(0,Y.get)(o,[d],{});let g=m.edit;return g.mainField&&(g=Fn(kn({},g),{mainField:m.edit.mainField.name})),Fn(kn({},u),{[d]:{edit:g,list:(0,Y.omit)(m.list,["mainField"])}})},{}),c=n.edit.map(u=>u.map(({name:d,size:m})=>({name:d,size:m})));return Fn(kn({},a),{layouts:{edit:c,list:l},metadatas:i})};var fu=Object.defineProperty,gu=Object.defineProperties,yu=Object.getOwnPropertyDescriptors,Vo=Object.getOwnPropertySymbols,hu=Object.prototype.hasOwnProperty,bu=Object.prototype.propertyIsEnumerable,qo=(e,t,n)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vu=(e,t)=>{for(var n in t||(t={}))hu.call(t,n)&&qo(e,n,t[n]);if(Vo)for(var n of Vo(t))bu.call(t,n)&&qo(e,n,t[n]);return e},Eu=(e,t)=>gu(e,yu(t));const Cu=(e,t)=>e.map(n=>Eu(vu({},n),{subject:t})),Bo=e=>{const t={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(t).reduce((n,o)=>(n[o]=Cu(t[o],e),n),{})},zo=e=>e.split(".").filter(t=>(0,Y.isNaN)(parseInt(t,10))),Zo=e=>e.length===0?-1:Math.max.apply(Math,e.map(t=>t.__temp_key__)),ge=e=>`/content-manager/${e}`;var Pu=Object.defineProperty,Wo=Object.getOwnPropertySymbols,Ou=Object.prototype.hasOwnProperty,Ru=Object.prototype.propertyIsEnumerable,_o=(e,t,n)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ut=(e,t)=>{for(var n in t||(t={}))Ou.call(t,n)&&_o(e,n,t[n]);if(Wo)for(var n of Wo(t))Ru.call(t,n)&&_o(e,n,t[n]);return e};const Uo=(e,t,n)=>{const o=c=>t.find(u=>u.uid===c),a=Object.assign({},e),l=e[n].uid,i=o(l);return(0,Y.set)(a,[n],Ut(Ut({},e[n]),i)),Object.keys(e.components).forEach(c=>{const u=o(c);(0,Y.set)(a,["components",c],Ut(Ut({},e.components[c]),u))}),a};var wu=Object.defineProperty,Mu=Object.defineProperties,Tu=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertySymbols,Iu=Object.prototype.hasOwnProperty,Du=Object.prototype.propertyIsEnumerable,Go=(e,t,n)=>t in e?wu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ko=(e,t)=>{for(var n in t||(t={}))Iu.call(t,n)&&Go(e,n,t[n]);if(Ho)for(var n of Ho(t))Du.call(t,n)&&Go(e,n,t[n]);return e},Qo=(e,t)=>Mu(e,Tu(t));const wt=(e,t)=>e&&Object.keys(e).reduce((n,o)=>{const a=n[o];return a===null?n:Array.isArray(a)?Array.isArray(n)?(n[o]=wt(a,t),n):Qo(Ko({},n),{[o]:a.map(l=>wt(l,t))}):typeof a=="object"?Array.isArray(n)?(n[o]=wt(a,t),n):Qo(Ko({},n),{[o]:wt(a,t)}):(o===t&&delete n[o],n)},e),Lu=wt,Yo=(e,t,n)=>{const o=(a,l)=>Object.keys(a).reduce((i,c)=>{const u=(0,y.getType)(l,c),d=(0,Y.get)(a,c),m=(0,y.getOtherInfos)(l,[c,"component"]),g=(0,y.getOtherInfos)(l,[c,"repeatable"]);return u==="dynamiczone"?(i[c]=d.map(f=>o(f,n[f.__component])),i):u==="component"?(g?i[c]=d&&d.map(f=>o(f,n[m])):i[c]=d&&o(d,n[m]),i):(u!=="password"&&(i[c]=d),i)},{});return o(e,t)};var Su=Object.defineProperty,xu=Object.defineProperties,ku=Object.getOwnPropertyDescriptors,Jo=Object.getOwnPropertySymbols,Fu=Object.prototype.hasOwnProperty,Au=Object.prototype.propertyIsEnumerable,Xo=(e,t,n)=>t in e?Su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mt=(e,t)=>{for(var n in t||(t={}))Fu.call(t,n)&&Xo(e,n,t[n]);if(Jo)for(var n of Jo(t))Au.call(t,n)&&Xo(e,n,t[n]);return e},Tt=(e,t)=>xu(e,ku(t));const es=(e,t)=>t.find(n=>n.uid===e),ju=(e,t)=>{const n=$u(e,t),o=ts(n.contentType,t),a=Nu(n.contentType,n.components);return(0,Y.set)(n,["contentType","layouts","edit"],o),(0,Y.set)(n,["contentType","layouts","list"],a),Object.keys(n.components).forEach(l=>{const i=ts(n.components[l],t);(0,Y.set)(n,["components",l,"layouts","edit"],i)}),n},$u=(e,t)=>{const n=Uo((0,Y.cloneDeep)(e),t,"contentType"),{components:o,contentType:a}=n,l=i=>Object.keys(i.metadatas).reduce((c,u)=>{const d=(0,Y.get)(i,["attributes",u],{});let m=i.metadatas[u];if(d.type==="relation"){const g=es(d.targetModel,t),f=m.edit.mainField,h={name:f,schema:(0,Y.get)(g,["attributes",f])};m={list:Tt(Mt({},m.list),{mainField:h}),edit:Tt(Mt({},m.edit),{mainField:h})}}return c[u]=m,c},{});return(0,Y.set)(n,["contentType","metadatas"],l(a)),Object.keys(o).forEach(i=>{const c=o[i],u=l(c);(0,Y.set)(n,["components",i,"metadatas"],u)}),n},ts=(e,t)=>e.layouts.edit.reduce((n,o)=>{const a=o.map(l=>{const i=(0,Y.get)(e,["attributes",l.name],{}),c=Tt(Mt({},l),{fieldSchema:i,metadatas:(0,Y.get)(e,["metadatas",l.name,"edit"],{})});if(i.type==="relation"){const d=es(i.targetModel,t).pluginOptions||{};(0,Y.set)(c,"targetModelPluginOptions",d),(0,Y.set)(c,"queryInfos",{shouldDisplayRelationLink:Vu(e,l.name,t)})}return c});return n.push(a),n},[]),Nu=(e,t)=>e.layouts.list.reduce((o,a)=>{const l=(0,Y.get)(e,["attributes",a],{}),i=(0,Y.get)(e,["metadatas",a,"list"],{}),c=l.type;if(c==="relation")return o.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i}),o;if(c==="component"){const u=t[l.component],d=u.settings.mainField,m=u.attributes[d];return o.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:Tt(Mt({},i),{mainField:Tt(Mt({},m),{name:d})})}),o}return o.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i}),o},[]),Vu=(e,t,n)=>{const o=(0,Y.get)(e,["attributes",t,"targetModel"],"");return qu(n).includes(o)},qu=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t),ns=ju;var Ht=p(97889),Bu=Object.defineProperty,zu=Object.defineProperties,Zu=Object.getOwnPropertyDescriptors,rs=Object.getOwnPropertySymbols,Wu=Object.prototype.hasOwnProperty,_u=Object.prototype.propertyIsEnumerable,os=(e,t,n)=>t in e?Bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gt=(e,t)=>{for(var n in t||(t={}))Wu.call(t,n)&&os(e,n,t[n]);if(rs)for(var n of rs(t))_u.call(t,n)&&os(e,n,t[n]);return e},ss=(e,t)=>zu(e,Zu(t));const Uu={error:null,isLoading:!0,layout:{},layouts:{}},Hu=(e,t)=>(0,Ht.default)(e,n=>{switch(t.type){case"GET_DATA":{n.isLoading=!0,n.error=null,n.layout={};break}case"GET_DATA_SUCCEEDED":{const o=t.data.contentType.uid;n.layout=t.data,n.layouts[o]=t.data,n.isLoading=!1;break}case"GET_DATA_ERROR":{n.isLoading=!1,n.error=t.error;break}case"SET_LAYOUT_FROM_STATE":{n.error=null,n.layout=e.layouts[t.uid];break}case"UPDATE_LAYOUT":{const o=e.layout;n.layout=ss(Gt({},o),{contentType:Gt({uid:o.contentType.uid},t.newLayout.contentType)}),n.layouts[o.contentType.uid]=ss(Gt({},o),{contentType:Gt({uid:o.contentType.uid},t.newLayout.contentType)});break}default:return n}});var It=p(98178),Gu=p(34947);const Dt=()=>e=>e["content-manager_app"]||Gu.E,MP=()=>createSelector(Dt(),e=>e),TP=()=>createSelector(Dt(),e=>e.models),Ku=()=>(0,It.P1)(Dt(),e=>({collectionTypeLinks:e.collectionTypeLinks,singleTypeLinks:e.singleTypeLinks})),An=()=>(0,It.P1)(Dt(),({components:e,models:t})=>({schemas:[...e,...t]})),IP=null;var Qu=p(98399),Yu=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const as=e=>{const[{error:t,isLoading:n,layout:o,layouts:a},l]=(0,r.useReducer)(Hu,Uu),i=(0,r.useMemo)(An,[]),{schemas:c}=(0,pe.useSelector)(g=>i(g),pe.shallowEqual),u=(0,r.useRef)(!0),d=(0,r.useCallback)((g,f)=>Yu(void 0,null,function*(){if(a[g]){l({type:"SET_LAYOUT_FROM_STATE",uid:g});return}l({type:"GET_DATA"});try{const h=ge(`content-types/${g}/configuration`),{data:{data:b}}=yield me.be.get(h,{cancelToken:f.token});l({type:"GET_DATA_SUCCEEDED",data:ns(b,c)})}catch(h){if(Ae().isCancel(h))return;u.current&&Qu.error(h),u.current&&l({type:"GET_DATA_ERROR",error:h})}}),[a,c]);(0,r.useEffect)(()=>()=>{u.current=!1},[]),(0,r.useEffect)(()=>{const f=Ae().CancelToken.source();return d(e,f),()=>{f.cancel("Operation canceled by the user.")}},[e,d]);const m=(0,r.useCallback)(g=>{l({type:"UPDATE_LAYOUT",newLayout:ns(g,c)})},[c]);return{error:t,isLoading:n,layout:o,updateLayout:m}},Ju=e=>e["content-manager_app"].collectionTypeLinks;var He=p(77997),Xu=p(33795),M=p.n(Xu),ed=p(85973),is=p.n(ed),td=Object.defineProperty,nd=Object.defineProperties,rd=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertySymbols,od=Object.prototype.hasOwnProperty,sd=Object.prototype.propertyIsEnumerable,cs=(e,t,n)=>t in e?td(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ad=(e,t)=>{for(var n in t||(t={}))od.call(t,n)&&cs(e,n,t[n]);if(ls)for(var n of ls(t))sd.call(t,n)&&cs(e,n,t[n]);return e},id=(e,t)=>nd(e,rd(t));const us=(e,t)=>Object.keys(e).reduce((n,o)=>{const a=e[o],l=M()(t,[o],a);return is()(a)?id(ad({},n),{[o]:us(a,l)}):(n[o]=l,n)},{}),ld=(e,t,n)=>{const o=e.find(({to:m})=>m.includes(t));if(!o)return"/";const{to:a,search:l}=o,i=(0,He.parse)(l),c=(0,He.parse)(n.substring(1)),u=us(i,c);return`${a}?${(0,He.stringify)(u,{encode:!1})}`},ds=e=>{const[{rawQuery:t}]=(0,y.useQueryParams)(),n=(0,pe.useSelector)(Ju);return ld(n,e,t)},ot=()=>(0,r.useContext)(Ot),ps=()=>{const{search:e}=(0,J.useLocation)(),t=e?(0,He.parse)(e.substring(1)):{};return t.plugins?(0,He.stringify)({plugins:t.plugins},{encode:!1}):""};var ms=p(89334);const cd=(e,t,n)=>({type:ms.m,permissions:e,__meta__:{plugins:t,containerName:n}}),ud=()=>({type:ms.Q}),dd=e=>e["content-manager_rbacManager"].permissions,pd=e=>e.rbacProvider.collectionTypesRelatedPermissions,fs=(e,t,n="listView")=>{const o=(0,pe.useSelector)(pd),a=(0,pe.useSelector)(dd),l=(0,pe.useDispatch)(),i=o[t];return(0,r.useEffect)(()=>i?(l(cd(i,e?e.plugins:null,n)),()=>{l(ud())}):()=>{},[i,l,e,n]),a},jP=()=>useContext(WysiwygContext),$P=null,gs=e=>{const t=(0,r.useRef)();return(0,r.useEffect)(()=>{t.current=e},[e]),t.current};var Kt=p(70836),ys=p(4460);const md=()=>({type:ys.c}),fd=(e,t)=>({type:ys.O,layout:e,query:t});var gd=p(8266),Je=p.n(gd),mt=p(17e3),qe=p(15335),Ce=p(5803),yd=p(2669),hd=p(66694);const bd=()=>(0,r.useContext)(hd.ux),hs=e=>{const{getAdminInjectedComponents:t}=bd(),[n,o,a]=e.split(".");return t(n,o,a)};var vd=Object.defineProperty,Qt=Object.getOwnPropertySymbols,bs=Object.prototype.hasOwnProperty,vs=Object.prototype.propertyIsEnumerable,Es=(e,t,n)=>t in e?vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ed=(e,t)=>{for(var n in t||(t={}))bs.call(t,n)&&Es(e,n,t[n]);if(Qt)for(var n of Qt(t))vs.call(t,n)&&Es(e,n,t[n]);return e},Cd=(e,t)=>{var n={};for(var o in e)bs.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Qt)for(var o of Qt(e))t.indexOf(o)<0&&vs.call(e,o)&&(n[o]=e[o]);return n};const Cs=e=>{var t=e,{area:n}=t,o=Cd(t,["area"]);return hs(n).map(l=>r.createElement(l.Component,Ed({key:l.name},o)))};Cs.propTypes={area:s().string.isRequired};const Yt=Cs;var Pd=Object.defineProperty,Ps=Object.getOwnPropertySymbols,Od=Object.prototype.hasOwnProperty,Rd=Object.prototype.propertyIsEnumerable,Os=(e,t,n)=>t in e?Pd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rs=(e,t)=>{for(var n in t||(t={}))Od.call(t,n)&&Os(e,n,t[n]);if(Ps)for(var n of Ps(t))Rd.call(t,n)&&Os(e,n,t[n]);return e};function wd(e,t){return n=>{const o=t(n.name);return r.createElement(e,Rs(Rs({},n),o))}}const Md=wd;function Td(e){const{addComponentToDynamicZone:t,createActionAllowedFields:n,isCreatingEntry:o,formErrors:a,modifiedData:l,moveComponentUp:i,moveComponentDown:c,removeComponentFromDynamicZone:u,readActionAllowedFields:d,updateActionAllowedFields:m}=(0,y.useCMEditViewDataManager)(),g=(0,r.useMemo)(()=>(0,Y.get)(l,[e],[]).map(b=>b.__component),[l,e]),f=(0,r.useMemo)(()=>(o?n:m).includes(e),[e,o,n,m]),h=(0,r.useMemo)(()=>(o?[]:d).includes(e),[e,o,d]);return{addComponentToDynamicZone:t,formErrors:a,isCreatingEntry:o,isFieldAllowed:f,isFieldReadable:h,moveComponentUp:i,moveComponentDown:c,removeComponentFromDynamicZone:u,dynamicDisplayedComponents:g}}const Id=Td;var jn=p(10504),$n=p(83828),Nn=p(61762),Vn=p(89966),Dd=p(14949),Ld=p(65261),Sd=p(61868),xd=p.n(Sd),ws=p(86308),kd=Object.defineProperty,Ms=Object.getOwnPropertySymbols,Fd=Object.prototype.hasOwnProperty,Ad=Object.prototype.propertyIsEnumerable,Ts=(e,t,n)=>t in e?kd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jd=(e,t)=>{for(var n in t||(t={}))Fd.call(t,n)&&Ts(e,n,t[n]);if(Ms)for(var n of Ms(t))Ad.call(t,n)&&Ts(e,n,t[n]);return e};const $d=j.default.span`
71
+ > svg {
72
+ width: ${(0,y.pxToRem)(24)};
73
+ height: ${(0,y.pxToRem)(24)};
74
+ > circle {
75
+ fill: ${({theme:e})=>e.colors.primary200};
76
+ }
77
+ > path {
78
+ fill: ${({theme:e})=>e.colors.primary600};
79
+ }
80
+ }
81
+ `,qn=({error:e,isReadOnly:t,onClick:n})=>{const{formatMessage:o}=(0,q.useIntl)();return r.createElement(r.Fragment,null,r.createElement(T.x,{as:"button",background:"neutral100",borderColor:e?"danger600":"neutral200",disabled:t,hasRadius:!0,onClick:n,paddingTop:9,paddingBottom:9,type:"button"},r.createElement(ie.K,{spacing:2},r.createElement(B.k,{justifyContent:"center",style:{cursor:t?"not-allowed":"inherit"}},r.createElement($d,null,r.createElement(ws.Z,null))),r.createElement(B.k,{justifyContent:"center"},r.createElement(z.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},o({id:E("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),(e==null?void 0:e.id)&&r.createElement(z.Z,{textColor:"danger600",variant:"pi"},o({id:e.id,defaultMessage:e.id},jd({},e.values))))};qn.defaultProps={error:void 0,isReadOnly:!1},qn.propTypes={error:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),isReadOnly:s().bool,onClick:s().func.isRequired};const Is=qn;var Nd=p(9086),Vd=p.n(Nd),qd=p(88708),Bn=p.n(qd),Bd=p(27509),Jt=p.n(Bd),qP=p(40795),zd=p(88591),Zd=p.n(zd),zn=p(59845),Wd=p(20871),_d=p.n(Wd),Ud=p(48375),Ds=p.n(Ud),Hd=p(31089),Gd=p.n(Hd),Kd=p(16043),Qd=p.n(Kd),Yd=p(5109),Jd=p.n(Yd),Xd=p(47955),ep=p.n(Xd),tp=p(95706),np=p.n(tp),rp=p(6658),op=p.n(rp),sp=p(36407),ap=p.n(sp),ip=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});(()=>ip(void 0,null,function*(){yield p.e(7347).then(p.bind(p,98362))}))();const ft=new(Zd())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(e,t){if(t&&t!=="auto"&&(0,zn.getLanguage)(t))return'<pre class="hljs language-'+ft.utils.escapeHtml(t.toLowerCase())+'"><code>'+(0,zn.highlight)(t,e,!0).value+"</code></pre>";if(t==="auto"){const n=(0,zn.highlightAuto)(e);return'<pre class="hljs language-'+ft.utils.escapeHtml(n.language)+'"><code>'+n.value+"</code></pre>"}return'<pre class="hljs"><code>'+ft.utils.escapeHtml(e)+"</code></pre>"}}).use(_d()).use(Ds(),"warning").use(Ds(),"tip").use(Gd()).use(Qd()).use(Jd()).use(ep()).use(np()).use(op()).use(ap());ft.renderer.rules.footnote_ref=(e,t,n,o,a)=>'<sup class="footnote-ref"><span>'+a.rules.footnote_caption(e,t,n,o,a)+"</span></sup>",ft.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';const lp=ft;var cp=p(13993),Ls=p.n(cp),up=Object.defineProperty,dp=Object.defineProperties,pp=Object.getOwnPropertyDescriptors,Ss=Object.getOwnPropertySymbols,mp=Object.prototype.hasOwnProperty,fp=Object.prototype.propertyIsEnumerable,xs=(e,t,n)=>t in e?up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gp=(e,t)=>{for(var n in t||(t={}))mp.call(t,n)&&xs(e,n,t[n]);if(Ss)for(var n of Ss(t))fp.call(t,n)&&xs(e,n,t[n]);return e},yp=(e,t)=>dp(e,pp(t));const hp=yp(gp({},Ls().defaults),{allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}}),bp=e=>Ls()(e,hp),vp=j.default.div`
82
+ position: absolute;
83
+ top: 0;
84
+ width: 100%;
85
+ height: 100%;
86
+ overflow: auto;
87
+ padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
88
+ font-size: ${14/16}rem;
89
+ background-color: ${({theme:e})=>e.colors.neutral0};
90
+ z-index: 2;
91
+ cursor: not-allowed;
92
+ color: ${({theme:e})=>e.colors.neutral800};
93
+
94
+ h1,
95
+ h2,
96
+ h3,
97
+ h4,
98
+ h5,
99
+ h6 {
100
+ margin-block-start: 10px;
101
+ margin-block-end: 10px;
102
+ }
103
+
104
+ p {
105
+ margin-bottom: 10px;
106
+ }
107
+
108
+ h1 {
109
+ font-size: ${36/16}rem;
110
+ font-weight: 600;
111
+ }
112
+
113
+ h2 {
114
+ font-size: ${30/16}rem;
115
+ font-weight: 500;
116
+ }
117
+
118
+ h3 {
119
+ font-size: ${24/16}rem;
120
+ font-weight: 500;
121
+ }
122
+
123
+ h4 {
124
+ font-size: ${20/16}rem;
125
+ font-weight: 500;
126
+ }
127
+
128
+ strong {
129
+ font-weight: 800;
130
+ }
131
+
132
+ em {
133
+ font-style: italic;
134
+ }
135
+
136
+ blockquote {
137
+ margin-top: 41px;
138
+ margin-bottom: 34px;
139
+ font-size: ${14/16}rem;
140
+ font-weight: 400;
141
+ border-left: 5px solid #eee;
142
+ font-style: italic;
143
+ padding: 10px 20px;
144
+ }
145
+
146
+ img {
147
+ max-width: 100%;
148
+ }
149
+
150
+ table {
151
+ thead {
152
+ background: ${({theme:e})=>e.colors.neutral150};
153
+
154
+ th {
155
+ padding: ${({theme:e})=>e.spaces[4]};
156
+ }
157
+ }
158
+ tr {
159
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
160
+ }
161
+ th,
162
+ td {
163
+ padding: ${({theme:e})=>e.spaces[4]};
164
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
165
+ border-bottom: 0;
166
+ border-top: 0;
167
+ }
168
+ }
169
+
170
+ pre,
171
+ code {
172
+ font-size: 13px;
173
+ border-radius: 3px;
174
+ background-color: #002b36;
175
+ }
176
+
177
+ /* Inline code */
178
+ p,
179
+ pre,
180
+ td {
181
+ > code {
182
+ color: #839496;
183
+ }
184
+ }
185
+
186
+ .warning {
187
+ background-color: #faa684;
188
+ padding: 30px;
189
+ border-radius: 3px;
190
+ }
191
+ .tip {
192
+ padding: 30px;
193
+ border-radius: 3px;
194
+ }
195
+
196
+ .footnote-ref,
197
+ .footnote-backref {
198
+ color: #007bff;
199
+ }
200
+
201
+ ol {
202
+ list-style-type: decimal;
203
+ margin-block-start: ${({theme:e})=>e.spaces[4]};
204
+ margin-block-end: ${({theme:e})=>e.spaces[4]};
205
+ margin-inline-start: 0px;
206
+ margin-inline-end: 0px;
207
+ padding-inline-start: ${({theme:e})=>e.spaces[4]};
208
+ ol,
209
+ ul {
210
+ margin-block-start: 0px;
211
+ margin-block-end: 0px;
212
+ }
213
+ }
214
+
215
+ ul {
216
+ list-style-type: disc;
217
+ margin-block-start: ${({theme:e})=>e.spaces[4]};
218
+ margin-block-end: ${({theme:e})=>e.spaces[4]};
219
+ margin-inline-start: 0px;
220
+ margin-inline-end: 0px;
221
+ padding-inline-start: ${({theme:e})=>e.spaces[4]};
222
+ ul,
223
+ ol {
224
+ margin-block-start: 0px;
225
+ margin-block-end: 0px;
226
+ }
227
+ }
228
+ `,Zn=({data:e})=>{const t=(0,r.useMemo)(()=>bp(lp.render(e.replaceAll("\\n",`
229
+ `)||"")),[e]);return r.createElement(vp,null,r.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))};Zn.defaultProps={data:""},Zn.propTypes={data:s().string};const ks=(0,r.memo)(Zn),Ep=j.default.div`
230
+ cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
231
+ height: 100%;
232
+ /* BASICS */
233
+ .CodeMirror-placeholder {
234
+ color: ${({theme:e})=>e.colors.neutral600} !important;
235
+ }
236
+
237
+ .CodeMirror {
238
+ /* Set height, width, borders, and global font properties here */
239
+ font-size: ${14/16}rem;
240
+ height: ${({isExpandMode:e})=>e?"100%":"290px"};
241
+ color: ${({theme:e})=>e.colors.neutral800};
242
+ direction: ltr;
243
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
244
+ 'Open Sans', 'Helvetica Neue', sans-serif;
245
+ }
246
+
247
+ /* PADDING */
248
+
249
+ .CodeMirror-lines {
250
+ padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
251
+ /* Vertical padding around content */
252
+ }
253
+
254
+ .CodeMirror-scrollbar-filler,
255
+ .CodeMirror-gutter-filler {
256
+ /* The little square between H and V scrollbars */
257
+ background-color: ${({theme:e})=>`${e.colors.neutral0}`};
258
+ }
259
+
260
+ /* GUTTER */
261
+
262
+ .CodeMirror-gutters {
263
+ border-right: 1px solid #ddd;
264
+ background-color: #f7f7f7;
265
+ white-space: nowrap;
266
+ }
267
+ .CodeMirror-linenumbers {
268
+ }
269
+ .CodeMirror-linenumber {
270
+ padding: 0 3px 0 5px;
271
+ min-width: 20px;
272
+ text-align: right;
273
+ color: #999;
274
+ white-space: nowrap;
275
+ }
276
+
277
+ .CodeMirror-guttermarker {
278
+ color: black;
279
+ }
280
+ .CodeMirror-guttermarker-subtle {
281
+ color: #999;
282
+ }
283
+
284
+ /* CURSOR */
285
+
286
+ .CodeMirror-cursor {
287
+ border-left: 1px solid black;
288
+ border-right: none;
289
+ width: 0;
290
+ }
291
+ /* Shown when moving in bi-directional text */
292
+ .CodeMirror div.CodeMirror-secondarycursor {
293
+ border-left: 1px solid silver;
294
+ }
295
+ .cm-fat-cursor .CodeMirror-cursor {
296
+ width: auto;
297
+ border: 0 !important;
298
+ background: #7e7;
299
+ }
300
+ .cm-fat-cursor div.CodeMirror-cursors {
301
+ /* z-index: 1; */
302
+ }
303
+
304
+ .cm-fat-cursor-mark {
305
+ background-color: rgba(20, 255, 20, 0.5);
306
+ -webkit-animation: blink 1.06s steps(1) infinite;
307
+ -moz-animation: blink 1.06s steps(1) infinite;
308
+ animation: blink 1.06s steps(1) infinite;
309
+ }
310
+ .cm-animate-fat-cursor {
311
+ width: auto;
312
+ border: 0;
313
+ -webkit-animation: blink 1.06s steps(1) infinite;
314
+ -moz-animation: blink 1.06s steps(1) infinite;
315
+ animation: blink 1.06s steps(1) infinite;
316
+ background-color: #7e7;
317
+ }
318
+
319
+ /* Can style cursor different in overwrite (non-insert) mode */
320
+ .CodeMirror-overwrite .CodeMirror-cursor {
321
+ }
322
+
323
+ .cm-tab {
324
+ display: inline-block;
325
+ text-decoration: inherit;
326
+ }
327
+
328
+ .CodeMirror-rulers {
329
+ position: absolute;
330
+ left: 0;
331
+ right: 0;
332
+ top: -50px;
333
+ bottom: 0;
334
+ overflow: hidden;
335
+ }
336
+ .CodeMirror-ruler {
337
+ border-left: 1px solid #ccc;
338
+ top: 0;
339
+ bottom: 0;
340
+ position: absolute;
341
+ }
342
+
343
+ /* DEFAULT THEME */
344
+
345
+ .cm-header,
346
+ .cm-strong {
347
+ font-weight: bold;
348
+ }
349
+ .cm-em {
350
+ font-style: italic;
351
+ }
352
+ .cm-link {
353
+ text-decoration: underline;
354
+ }
355
+ .cm-strikethrough {
356
+ text-decoration: line-through;
357
+ }
358
+
359
+ .CodeMirror-composing {
360
+ border-bottom: 2px solid;
361
+ }
362
+
363
+ /* Default styles for common addons */
364
+
365
+ div.CodeMirror span.CodeMirror-matchingbracket {
366
+ color: #0b0;
367
+ }
368
+ div.CodeMirror span.CodeMirror-nonmatchingbracket {
369
+ color: #a22;
370
+ }
371
+ .CodeMirror-matchingtag {
372
+ background: rgba(255, 150, 0, 0.3);
373
+ }
374
+ .CodeMirror-activeline-background {
375
+ background: #e8f2ff;
376
+ }
377
+
378
+ /* STOP */
379
+
380
+ /* The rest of this file contains styles related to the mechanics of
381
+ the editor. You probably shouldn't touch them. */
382
+
383
+ .CodeMirror {
384
+ position: relative;
385
+ overflow: hidden;
386
+ background: ${({theme:e})=>`${e.colors.neutral0}`};
387
+ }
388
+
389
+ .CodeMirror-scroll {
390
+ overflow: scroll !important; /* Things will break if this is overridden */
391
+ /* 50px is the magic margin used to hide the element's real scrollbars */
392
+ /* See overflow: hidden in .CodeMirror */
393
+ margin-bottom: -50px;
394
+ margin-right: -50px;
395
+ padding-bottom: 50px;
396
+ height: 100%;
397
+ outline: none; /* Prevent dragging from highlighting the element */
398
+ position: relative;
399
+ }
400
+ .CodeMirror-sizer {
401
+ position: relative;
402
+ border-right: 50px solid transparent;
403
+ }
404
+
405
+ /* The fake, visible scrollbars. Used to force redraw during scrolling
406
+ before actual scrolling happens, thus preventing shaking and
407
+ flickering artifacts. */
408
+ .CodeMirror-vscrollbar,
409
+ .CodeMirror-hscrollbar,
410
+ .CodeMirror-scrollbar-filler,
411
+ .CodeMirror-gutter-filler {
412
+ position: absolute;
413
+ z-index: 1;
414
+ display: none;
415
+ outline: none;
416
+ }
417
+
418
+ .CodeMirror-vscrollbar {
419
+ right: 0;
420
+ top: 0;
421
+ overflow-x: hidden;
422
+ overflow-y: scroll;
423
+ }
424
+ .CodeMirror-hscrollbar {
425
+ bottom: 0;
426
+ left: 0;
427
+ overflow-y: hidden;
428
+ overflow-x: scroll;
429
+ }
430
+ .CodeMirror-scrollbar-filler {
431
+ right: 0;
432
+ bottom: 0;
433
+ }
434
+
435
+ .CodeMirror-lines {
436
+ cursor: text;
437
+ min-height: 1px; /* prevents collapsing before first draw */
438
+ }
439
+ /* Reset some styles that the rest of the page might have set */
440
+ .CodeMirror pre.CodeMirror-line,
441
+ .CodeMirror pre.CodeMirror-line-like {
442
+ -moz-border-radius: 0;
443
+ -webkit-border-radius: 0;
444
+ border-radius: 0;
445
+ border-width: 0;
446
+ background: transparent;
447
+ font-family: inherit;
448
+ font-size: inherit;
449
+ margin: 0;
450
+ white-space: pre;
451
+ word-wrap: normal;
452
+ line-height: 1.5;
453
+ color: inherit;
454
+ /* z-index: 2; */
455
+ position: relative;
456
+ overflow: visible;
457
+ -webkit-tap-highlight-color: transparent;
458
+ -webkit-font-variant-ligatures: contextual;
459
+ font-variant-ligatures: contextual;
460
+ }
461
+
462
+ .CodeMirror pre.CodeMirror-line-like {
463
+ z-index: 2;
464
+ }
465
+
466
+ .CodeMirror-wrap pre.CodeMirror-line,
467
+ .CodeMirror-wrap pre.CodeMirror-line-like {
468
+ word-wrap: break-word;
469
+ white-space: pre-wrap;
470
+ word-break: normal;
471
+ }
472
+
473
+ .CodeMirror-linebackground {
474
+ position: absolute;
475
+ left: 0;
476
+ right: 0;
477
+ top: 0;
478
+ bottom: 0;
479
+ z-index: 0;
480
+ }
481
+
482
+ .CodeMirror-linewidget {
483
+ position: relative;
484
+ /* z-index: 2; */
485
+ padding: 0.1px; /* Force widget margins to stay inside of the container */
486
+ }
487
+
488
+ .CodeMirror-widget {
489
+ }
490
+
491
+ .CodeMirror-rtl pre {
492
+ direction: rtl;
493
+ }
494
+
495
+ .CodeMirror-code {
496
+ outline: none;
497
+ }
498
+
499
+ /* Force content-box sizing for the elements where we expect it */
500
+ .CodeMirror-scroll,
501
+ .CodeMirror-sizer,
502
+ .CodeMirror-gutter,
503
+ .CodeMirror-gutters,
504
+ .CodeMirror-linenumber {
505
+ -moz-box-sizing: content-box;
506
+ box-sizing: content-box;
507
+ }
508
+
509
+ .CodeMirror-measure {
510
+ position: absolute;
511
+ width: 100%;
512
+ height: 0;
513
+ overflow: hidden;
514
+ visibility: hidden;
515
+ }
516
+
517
+ .CodeMirror-cursor {
518
+ position: absolute;
519
+ pointer-events: none;
520
+ border-color: ${({theme:e})=>`${e.colors.neutral800}`};
521
+ }
522
+ .CodeMirror-measure pre {
523
+ position: static;
524
+ }
525
+
526
+ div.CodeMirror-cursors {
527
+ visibility: hidden;
528
+ position: relative;
529
+ + div {
530
+ z-index: 0 !important;
531
+ }
532
+ }
533
+
534
+ div.CodeMirror-dragcursors {
535
+ visibility: visible;
536
+ }
537
+
538
+ .CodeMirror-focused div.CodeMirror-cursors {
539
+ visibility: visible;
540
+ }
541
+
542
+ .CodeMirror-selected {
543
+ background: ${({theme:e})=>e.colors.neutral200};
544
+ /* z-index: -10; */
545
+ }
546
+ .CodeMirror-crosshair {
547
+ cursor: crosshair;
548
+ }
549
+
550
+ /* Used to force a border model for a node */
551
+ .cm-force-border {
552
+ padding-right: 0.1px;
553
+ }
554
+
555
+ /* See issue #2901 */
556
+ .cm-tab-wrap-hack:after {
557
+ content: '';
558
+ }
559
+
560
+ /* Help users use markselection to safely style text background */
561
+ span.CodeMirror-selectedtext {
562
+ background: none;
563
+ }
564
+
565
+ span {
566
+ color: ${({theme:e})=>e.colors.neutral800} !important;
567
+ }
568
+ `;var Wn=p(69783);const xe=(0,j.default)(Re.h)`
569
+ padding: ${({theme:e})=>e.spaces[2]};
570
+ /* Trick to prevent the outline from overflowing because of the general outline-offset */
571
+ outline-offset: -2px !important;
572
+
573
+ svg {
574
+ width: ${18/16}rem;
575
+ height: ${18/16}rem;
576
+ }
577
+ `,Cp=(0,j.default)(xe)`
578
+ svg {
579
+ width: ${8/16}rem;
580
+ height: ${8/16}rem;
581
+ }
582
+ `,Fs=(0,j.default)(Re.o)`
583
+ margin-left: ${({theme:e})=>e.spaces[4]};
584
+ `,As=(0,j.default)(Re.h)`
585
+ margin: ${({theme:e})=>`0 ${e.spaces[2]}`};
586
+ padding: ${({theme:e})=>e.spaces[2]};
587
+
588
+ svg {
589
+ width: ${18/16}rem;
590
+ height: ${18/16}rem;
591
+ }
592
+ `,Pp=(0,j.default)(Re.o)`
593
+ margin-right: ${({theme:e})=>`${e.spaces[2]}`};
594
+ `,Op=j.default.div`
595
+ position: relative;
596
+ height: calc(100% - 48px);
597
+ `,Rp=(0,j.default)(Wn.Y)`
598
+ background-color: transparent;
599
+ border: none;
600
+ align-items: center;
601
+
602
+ svg {
603
+ margin-left: ${({theme:e})=>`${e.spaces[2]}`};
604
+ path {
605
+ fill: ${({theme:e})=>e.colors.neutral700};
606
+ width: ${12/16}rem;
607
+ height: ${12/16}rem;
608
+ }
609
+ }
610
+ `;var Xt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,wp=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Mp=/[*+-]\s/;function Tp(e){if(e.getOption("disableInput"))return Jt().Pass;for(var t=e.listSelections(),n=[],o=0;o<t.length;o++){var a=t[o].head,l=e.getStateAfter(a.line),i=l.list!==!1,c=l.quote!==0,u=e.getLine(a.line),d=Xt.exec(u),m=/^\s*$/.test(u.slice(0,a.ch));if(!t[o].empty()||!i&&!c||!d||m){e.execCommand("newlineAndIndent");return}if(wp.test(u)){var g=c&&/>\s*$/.test(u),f=!/>\s*$/.test(u);(g||f)&&e.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),n[o]=`
611
+ `}else{var h=d[1],b=d[5],C=!(Mp.test(d[2])||d[2].indexOf(">")>=0),k=C?parseInt(d[3],10)+1+d[4]:d[2].replace("x"," ");n[o]=`
612
+ `+h+k+b,C&&Ip(e,a)}}e.replaceSelections(n)}function Ip(e,t){var n=t.line,o=0,a=0,l=Xt.exec(e.getLine(n)),i=l[1];do{o+=1;var c=n+o,u=e.getLine(c),d=Xt.exec(u);if(d){var m=d[1],g=parseInt(l[3],10)+o-a,f=parseInt(d[3],10),h=f;if(i===m&&!isNaN(f))g===f&&(h=f+1),g>f&&(h=g+1),e.replaceRange(u.replace(Xt,m+h+d[4]+d[5]),{line:c,ch:0},{line:c,ch:u.length});else{if(i.length>m.length||i.length<m.length&&o===1)return;a+=1}}}while(d)}const Dp=Tp,_n=({disabled:e,editorRef:t,error:n,isPreviewMode:o,isExpandMode:a,name:l,onChange:i,placeholder:c,textareaRef:u,value:d})=>{const m=(0,r.useRef)(i);return(0,r.useEffect)(()=>{t.current=Jt().fromTextArea(u.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),Jt().commands.newlineAndIndentContinueMarkdownList=Dp,t.current.on("change",g=>{m.current({target:{name:l,value:g.getValue(),type:"wysiwyg"}})})},[t,u,l,c]),(0,r.useEffect)(()=>{d&&!t.current.hasFocus()&&t.current.setValue(d)},[t,d]),(0,r.useEffect)(()=>{o||e?t.current.setOption("readOnly","nocursor"):t.current.setOption("readOnly",!1)},[e,o,t]),(0,r.useEffect)(()=>{n?t.current.setOption("screenReaderLabel",n):t.current.setOption("screenReaderLabel","Editor")},[t,n]),r.createElement(Op,null,r.createElement(Ep,{isExpandMode:a,disabled:e||o},r.createElement("textarea",{ref:u})),o&&r.createElement(ks,{data:d}))};_n.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},_n.propTypes={disabled:s().bool,editorRef:s().shape({current:s().any}).isRequired,error:s().string,isPreviewMode:s().bool,isExpandMode:s().bool,name:s().string.isRequired,onChange:s().func.isRequired,placeholder:s().string,textareaRef:s().shape({current:s().any}).isRequired,value:s().string};const Lp=_n;var js=p(67563),ye=p(41415),Ze=p(70218),Pe=p(84967),Sp=p(46406),$s=p(73906),Ns=p(49844),Vs=p(99283),xp=p(83139),kp=p(35635),Fp=p(20063),Ap=p(80601),jp=p(11417),$p=p(43231),Np=p(65663),qs=p(49825);const Un=({disabled:e,editorRef:t,isExpandMode:n,isPreviewMode:o,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[c,u]=(0,r.useState)(!1),{formatMessage:d}=(0,q.useIntl)(),m=d({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),g=(0,r.useRef)(),f=()=>{u(h=>!h)};return e||o?r.createElement(T.x,{padding:2,background:"neutral100"},r.createElement(B.k,{justifyContent:"space-between"},r.createElement(B.k,null,r.createElement(Ze.P,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},r.createElement(Pe.W,{value:"h1"},"h1"),r.createElement(Pe.W,{value:"h2"},"h2"),r.createElement(Pe.W,{value:"h3"},"h3"),r.createElement(Pe.W,{value:"h4"},"h4"),r.createElement(Pe.W,{value:"h5"},"h5"),r.createElement(Pe.W,{value:"h6"},"h6")),r.createElement(Fs,null,r.createElement(xe,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:r.createElement($s.Z,null)}),r.createElement(xe,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(Ns.Z,null)}),r.createElement(xe,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(Vs.Z,null)})),r.createElement(As,{disabled:!0,id:"more",label:"More",icon:r.createElement(qs.Z,null)})),!n&&r.createElement(ye.z,{onClick:i,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):r.createElement(T.x,{padding:2,background:"neutral100"},r.createElement(B.k,{justifyContent:"space-between"},r.createElement(B.k,null,r.createElement(Ze.P,{id:"selectTitle",placeholder:m,size:"S",onChange:h=>a(h,t)},r.createElement(Pe.W,{value:"h1"},"h1"),r.createElement(Pe.W,{value:"h2"},"h2"),r.createElement(Pe.W,{value:"h3"},"h3"),r.createElement(Pe.W,{value:"h4"},"h4"),r.createElement(Pe.W,{value:"h5"},"h5"),r.createElement(Pe.W,{value:"h6"},"h6")),r.createElement(Fs,null,r.createElement(xe,{onClick:()=>a("Bold",t),id:"Bold",label:"Bold",name:"Bold",icon:r.createElement($s.Z,null)}),r.createElement(xe,{onClick:()=>a("Italic",t),id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(Ns.Z,null)}),r.createElement(xe,{onClick:()=>a("Underline",t),id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(Vs.Z,null)})),r.createElement(As,{ref:g,onClick:f,id:"more",label:"More",icon:r.createElement(qs.Z,null)}),c&&r.createElement(Sp.J,{centered:!0,source:g,spacing:4,id:"popover"},r.createElement(js.i,{onEscape:f,restoreFocus:!1},r.createElement(B.k,null,r.createElement(Pp,null,r.createElement(xe,{onClick:()=>a("Strikethrough",t,f),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:r.createElement(xp.Z,null)}),r.createElement(xe,{onClick:()=>a("BulletList",t,f),id:"BulletList",label:"BulletList",name:"BulletList",icon:r.createElement(kp.Z,null)}),r.createElement(xe,{onClick:()=>a("NumberList",t,f),id:"NumberList",label:"NumberList",name:"NumberList",icon:r.createElement(Fp.Z,null)})),r.createElement(Re.o,null,r.createElement(xe,{onClick:()=>a("Code",t,f),id:"Code",label:"Code",name:"Code",icon:r.createElement(Ap.Z,null)}),r.createElement(xe,{onClick:()=>{f(),l()},id:"Image",label:"Image",name:"Image",icon:r.createElement(jp.Z,null)}),r.createElement(Cp,{onClick:()=>a("Link",t,f),id:"Link",label:"Link",name:"Link",icon:r.createElement($p.Z,null)}),r.createElement(xe,{onClick:()=>a("Quote",t,f),id:"Quote",label:"Quote",name:"Quote",icon:r.createElement(Np.Z,null)})))))),i&&r.createElement(ye.z,{onClick:i,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};Un.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},Un.propTypes={disabled:s().bool.isRequired,editorRef:s().shape({current:s().any}).isRequired,isExpandMode:s().bool.isRequired,isPreviewMode:s().bool,onActionClick:s().func,onToggleMediaLib:s().func,onTogglePreviewMode:s().func};const Vp=Un;var qp=p(18070);const Hn=({onToggleExpand:e})=>{const{formatMessage:t}=(0,q.useIntl)();return r.createElement(T.x,{padding:2,background:"neutral100",hasRadius:!0},r.createElement(B.k,{justifyContent:"flex-end",alignItems:"flex-end"},r.createElement(Rp,{id:"expand",onClick:e},r.createElement(z.Z,null,t({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),r.createElement(qp.Z,null))))};Hn.defaultProps={onToggleExpand(){}},Hn.propTypes={onToggleExpand:s().func};const Bp=Hn;var zp=Object.defineProperty,Bs=Object.getOwnPropertySymbols,Zp=Object.prototype.hasOwnProperty,Wp=Object.prototype.propertyIsEnumerable,zs=(e,t,n)=>t in e?zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_p=(e,t)=>{for(var n in t||(t={}))Zp.call(t,n)&&zs(e,n,t[n]);if(Bs)for(var n of Bs(t))Wp.call(t,n)&&zs(e,n,t[n]);return e};const Gn=({id:e,error:t,name:n,description:o})=>{const{formatMessage:a}=(0,q.useIntl)(),l=o?a({id:o.id,defaultMessage:o.defaultMessage},_p({},o.values)):"";return!l||t?null:r.createElement(z.Z,{as:"p",variant:"pi",id:`${e||n}-hint`,textColor:"neutral600"},l)};Gn.defaultProps={id:void 0,description:void 0,error:void 0},Gn.propTypes={description:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),error:s().string,id:s().string,name:s().string.isRequired};const Up=Gn,Zs=(e,t)=>{let n;switch(e){case"Strikethrough":n=`~~${t}~~`;break;case"Bold":n=`**${t}**`;break;case"Italic":n=`_${t}_`;break;case"Underline":n=`<u>${t}</u>`;break;case"Code":n=`\`\`\`
613
+ ${t}
614
+ \`\`\``;break;case"Link":n=`[${t}](link)`;break;case"Quote":n=`>${t}`;break;default:n=t}return n},Ws=e=>{let t,n={start:e.length,end:0};switch(e){case"Strikethrough":t=`~~${e}~~`,n.end=2;break;case"Bold":t=`**${e}**`,n.end=2;break;case"Italic":t=`_${e}_`,n.end=1;break;case"alt":t=`[${e}]()`,n.end=3;break;case"Underline":t=`<u>${e}</u>`,n.end=4;break;case"Code":t=`\`\`\`
615
+ ${e}
616
+ \`\`\``,n.end=3;break;case"Link":t=`[${e}](link)`,n.end=7;break;case"Quote":t=`>${e}`,n.end=0;break;default:t=""}return{editedText:t,selection:n}},_s=e=>{let t;switch(e){case"BulletList":t="- ";break;case"NumberList":t="1. ";break;case"h1":t="# ";break;case"h2":t="## ";break;case"h3":t="### ";break;case"h4":t="#### ";break;case"h5":t="##### ";break;case"h6":t="###### ";break;default:return""}return t},Us=(e,t)=>{const n=e.current.getSelection();let o;if(n){const a=Zs(t,n);e.current.replaceSelection(a),e.current.focus()}else{o=Ws(t),e.current.replaceSelection(o.editedText),e.current.focus();const{line:a,ch:l}=e.current.getCursor(),i=l-o.selection.end,c=l-o.selection.end-o.selection.start;e.current.setSelection({line:a,ch:c},{line:a,ch:i})}},Hp=(e,t)=>{const n=e.current.getDoc(),o=t==="BulletList"?"- ":"1. ";if(n.somethingSelected()){const a=n.listSelections();let l=null;e.current.operation(function(){a.forEach(function(i){const c=[i.head.line,i.anchor.line].sort();l==null&&(l=n.getLine(c[0]).startsWith(o));for(let u=c[0];u<=c[1];u++)if(l)n.getLine(u).startsWith(o)&&n.replaceRange("",{line:u,ch:0},{line:u,ch:o.length});else{const d=t==="BulletList"?"- ":`${u+1}. `;n.replaceRange(d,{line:u,ch:0})}})})}else{let{line:a}=n.getCursor();const l=_s(t),i=e.current.getLine(a),c=l+i;e.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),e.current.replaceSelection(c)}e.current.focus()},Gp=(e,t)=>{let{line:n}=e.current.getCursor();const o=_s(t),a=e.current.getLine(n),l=a.replace(/#{1,6}\s/g,"").trim(),i=o+l;e.current.setSelection({line:n,ch:0},{line:n,ch:a.length}),e.current.replaceSelection(i),setTimeout(()=>{const c=e.current.getLine(n).length;e.current.focus(),e.current.setCursor({line:n,ch:c})},0)},Kp=(e,t)=>{let{line:n,ch:o}=e.current.getCursor();t.forEach((a,l)=>{let i=e.current.getLine(n).length;e.current.setCursor({line:n,ch:i}),(l>0||l===0&&o!==0)&&(i=e.current.getLine(n).length,e.current.setCursor({line:n,ch:i}),n++,e.current.replaceSelection(`
617
+ `)),a.mime.includes("image")?e.current.replaceSelection(`![${a.alt}](${a.url})`):e.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>e.current.focus(),0)},Qp=(e,t,n,o,a)=>{const l=Zs(t,a),i=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.replaceSelection(""),e.current.setCursor({line:n,ch:o}),e.current.replaceSelection(`
618
+ `),e.current.replaceSelection(l),t==="Code"){let{line:c}=e.current.getCursor();e.current.setCursor({line:c-1,ch:a.length})}e.current.replaceRange(i,{line:n+4,ch:0},{line:1/0,ch:1/0}),e.current.focus()},Yp=(e,t,n,o)=>{const a=Ws(t),l=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.setCursor({line:n,ch:o}),e.current.replaceSelection(`
619
+ `),e.current.replaceSelection(a.editedText),t==="Code")n+=2,e.current.setSelection({line:n,ch:0},{line:n,ch:4});else{n+=1;let{ch:i}=e.current.getCursor(),c=i-a.selection.end,u=i-a.selection.end-a.selection.start;e.current.setSelection({line:n,ch:u},{line:n,ch:c})}e.current.replaceRange(l,{line:n+2,ch:0},{line:1/0,ch:1/0}),e.current.focus()},Jp=(e,t)=>{const n=e.current.getSelection();let{line:o}=e.current.getCursor(),a=e.current.getLine(o).length;n?Qp(e,t,o,a,n):Yp(e,t,o,a)};var Xp=p(71933),em=p(74464);const tm=(e,t)=>`${e}${Math.floor(t*255).toString(16).padStart(2,0)}`,nm=(0,j.default)(B.k)`
620
+ background: ${({theme:e})=>tm(e.colors.neutral800,.2)};
621
+ `,rm=(0,j.default)(T.x)`
622
+ border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
623
+ `,om=(0,j.default)(Wn.Y)`
624
+ background-color: transparent;
625
+ border: none;
626
+ align-items: center;
627
+
628
+ svg {
629
+ margin-left: ${({theme:e})=>`${e.spaces[2]}`};
630
+ path {
631
+ fill: ${({theme:e})=>e.colors.neutral700};
632
+ width: ${12/16}rem;
633
+ height: ${12/16}rem;
634
+ }
635
+ }
636
+ `,Kn=({children:e,isExpandMode:t,error:n,previewContent:o,onCollapse:a})=>{const{formatMessage:l}=(0,q.useIntl)();return(0,r.useEffect)(()=>{const i=document.body;return t&&i.classList.add("lock-body-scroll"),()=>{t&&i.classList.remove("lock-body-scroll")}},[t]),t?r.createElement(Xp.h,{role:"dialog","aria-modal":!1},r.createElement(js.i,{onEscape:a},r.createElement(nm,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},r.createElement(T.x,{id:"wysiwyg-expand",background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},r.createElement(B.k,{height:"100%",alignItems:"flex-start"},r.createElement(rm,{flex:"1",height:"100%"},e),r.createElement(T.x,{flex:"1",height:"100%"},r.createElement(B.k,{height:(0,y.pxToRem)(48),background:"neutral100",justifyContent:"flex-end"},r.createElement(om,{id:"collapse",onClick:a},r.createElement(z.Z,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),r.createElement(em.Z,null))),r.createElement(T.x,{position:"relative",height:"100%"},r.createElement(ks,{data:o})))))))):r.createElement(T.x,{borderColor:n?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},e)};Kn.defaultProps={error:void 0,previewContent:""},Kn.propTypes={children:s().node.isRequired,error:s().string,isExpandMode:s().bool.isRequired,previewContent:s().string,onCollapse:s().func.isRequired};var sm=Object.defineProperty,Hs=Object.getOwnPropertySymbols,am=Object.prototype.hasOwnProperty,im=Object.prototype.propertyIsEnumerable,Gs=(e,t,n)=>t in e?sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ks=(e,t)=>{for(var n in t||(t={}))am.call(t,n)&&Gs(e,n,t[n]);if(Hs)for(var n of Hs(t))im.call(t,n)&&Gs(e,n,t[n]);return e};const lm=(0,j.default)(T.x)`
637
+ svg path {
638
+ fill: ${({theme:e})=>e.colors.neutral500};
639
+ }
640
+ `,cm=(0,j.default)(z.Z)`
641
+ line-height: 0;
642
+ `,Qn=({description:e,disabled:t,error:n,intlLabel:o,labelAction:a,name:l,onChange:i,placeholder:c,value:u,required:d})=>{const{formatMessage:m}=(0,q.useIntl)(),g=(0,r.useRef)(null),f=(0,r.useRef)(null),[h,b]=(0,r.useState)(!1),[C,k]=(0,r.useState)(!1),[P,O]=(0,r.useState)(!1),{components:F}=(0,y.useLibrary)(),v=F["media-library"],R=()=>k(_=>!_),I=()=>b(_=>!_),w=()=>{b(!1),O(_=>!_)},U=(_,V,A)=>{switch(_){case"Link":case"Strikethrough":{Us(V,_),A();break}case"Code":case"Quote":{Jp(V,_),A();break}case"Bold":case"Italic":case"Underline":{Us(V,_);break}case"BulletList":case"NumberList":{Hp(V,_),A();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{Gp(V,_);break}default:}},Z=_=>{const V=_.map(A=>({alt:A.alternativeText||A.name,url:(0,y.prefixFileUrlWithBackendUrl)(A.url),mime:A.mime}));Kp(f,V),k(!1)},N=c?m({id:c.id,defaultMessage:c.defaultMessage},Ks({},c.values)):"",Q=o.id?m({id:o.id,defaultMessage:o.defaultMessage},Ks({},o.values)):l;return r.createElement(r.Fragment,null,r.createElement(ie.K,{spacing:1},r.createElement(ie.K,{horizontal:!0,spacing:1},r.createElement(z.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},Q,d&&r.createElement(cm,{textColor:"danger600"},"*")),a&&r.createElement(lm,{paddingLeft:1},a)),r.createElement(Kn,{isExpandMode:P,error:n,previewContent:u,onCollapse:w},r.createElement(Vp,{isExpandMode:P,editorRef:f,isPreviewMode:h,onActionClick:U,onToggleMediaLib:R,onTogglePreviewMode:P?void 0:I,disabled:t}),r.createElement(Lp,{disabled:t,isExpandMode:P,editorRef:f,error:n,isPreviewMode:h,name:l,onChange:i,placeholder:N,textareaRef:g,value:u}),!P&&r.createElement(Bp,{onToggleExpand:w})),r.createElement(Up,{description:e,name:l,error:n})),n&&r.createElement(T.x,{paddingTop:1},r.createElement(z.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},n)),C&&r.createElement(v,{onClose:R,onSelectAssets:Z}))};Qn.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:""},Qn.propTypes={description:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),disabled:s().bool,error:s().string,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}).isRequired,labelAction:s().element,name:s().string.isRequired,onChange:s().func.isRequired,placeholder:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),required:s().bool,value:s().string};const um=Qn;var dm=p(16285),pm=p.n(dm),Qs=p(67014),Ys=p(47851),mm=p(37475);const fm=j.default.div`
643
+ cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
644
+ /* BASICS */
645
+
646
+ .colored {
647
+ background-color: yellow;
648
+ color: black !important;
649
+ }
650
+
651
+ > div {
652
+ border-radius: 3px;
653
+ > div:last-of-type {
654
+ min-height: 253px;
655
+ max-height: 506px;
656
+ }
657
+ }
658
+
659
+ .CodeMirror {
660
+ /* Set height, width, borders, and global font properties here */
661
+ font-size: ${14/16}rem;
662
+ direction: ltr;
663
+ z-index: 0;
664
+ }
665
+ `,gm=(0,j.default)(T.x)`
666
+ border-radius: ${({theme:e})=>e.borderRadius};
667
+ border: 1px solid ${({theme:e,error:t})=>t?e.colors.danger600:"transparent"};
668
+ `;var Js=p(76437),ym=Object.defineProperty,Xs=Object.getOwnPropertySymbols,hm=Object.prototype.hasOwnProperty,bm=Object.prototype.propertyIsEnumerable,ea=(e,t,n)=>t in e?ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vm=(e,t)=>{for(var n in t||(t={}))hm.call(t,n)&&ea(e,n,t[n]);if(Xs)for(var n of Xs(t))bm.call(t,n)&&ea(e,n,t[n]);return e};const Em=(0,j.default)(T.x)`
669
+ svg path {
670
+ fill: ${({theme:e})=>e.colors.neutral500};
671
+ }
672
+ `,Yn=({intlLabel:e,labelAction:t,name:n,required:o})=>{const{formatMessage:a}=(0,q.useIntl)(),l=e!=null&&e.id?a({id:e.id,defaultMessage:e.defaultMessage},vm({},e.values)):n;return r.createElement(B.k,null,r.createElement(Js.Q,{required:o},l),t&&r.createElement(Em,{paddingLeft:1},t))};Yn.defaultProps={id:void 0,intlLabel:void 0,labelAction:void 0,required:!1},Yn.propTypes={id:s().string,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),labelAction:s().element,name:s().string.isRequired,required:s().bool};const Cm=Yn;var ta=p(87107);const Jn=({name:e,hint:t,error:n,children:o})=>{const{formatMessage:a}=(0,q.useIntl)(),l=n?a({id:n,defaultMessage:n}):"";return r.createElement(ta.g,{name:e,hint:t&&a(t),error:l,id:e},o)};Jn.defaultProps={hint:void 0,error:""},Jn.propTypes={name:s().string.isRequired,hint:s().shape({id:s().string,defaultMessage:s().string}),error:s().string,children:s().node.isRequired};const Pm=Jn;var Om=Object.defineProperty,Rm=(e,t,n)=>t in e?Om(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,st=(e,t,n)=>(Rm(e,typeof t!="symbol"?t+"":t,n),n),wm=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const Mm=600,Tm="blackboard";(()=>wm(void 0,null,function*(){yield p.e(3860).then(p.t.bind(p,87541,23)),yield p.e(2781).then(p.t.bind(p,80249,23)),yield p.e(953).then(p.t.bind(p,54745,23)),yield p.e(5178).then(p.t.bind(p,3903,23)),yield p.e(5509).then(p.t.bind(p,59577,23)),yield p.e(3973).then(p.bind(p,65701)),yield p.e(2218).then(p.bind(p,88333))}))();class Xn extends r.Component{constructor(t){super(t),st(this,"timer",null),st(this,"setInitValue",()=>{const{value:n}=this.props;try{return n===null?this.codeMirror.setValue(""):n===0?this.codeMirror.setValue("0"):this.codeMirror.setValue(n)}catch(o){return this.setState({error:!0})}}),st(this,"setSize",()=>this.codeMirror.setSize("100%","auto")),st(this,"getContentAtLine",n=>this.codeMirror.getLine(n)),st(this,"markSelection",({message:n})=>{let o=parseInt(n.split(":")[0].split("line ")[1],10)-1,a=this.getContentAtLine(o);a==="{"&&(o+=1,a=this.getContentAtLine(o));const l=a.length,i=l-pm()(a," ").length,c=this.codeMirror.markText({line:o,ch:i},{line:o,ch:l},{className:"colored"});this.setState({markedText:c})}),st(this,"handleChange",(n,o)=>{if(o.origin==="setValue")return;const{name:a,onChange:l}=this.props;let i=n.getValue();i===""&&(i=null),l({target:{name:a,value:i,type:"json"}}),this.state.markedText&&(this.state.markedText.clear(),this.setState({markedText:null,error:null})),clearTimeout(this.timer),this.timer=setTimeout(()=>this.testJSON(n.getValue()),Mm)}),st(this,"testJSON",n=>{try{mm.parse(n)}catch(o){this.markSelection(o)}}),this.editor=r.createRef(),this.state={error:!1,markedText:null}}componentDidMount(){this.codeMirror=Jt().fromTextArea(this.editor.current,{autoCloseBrackets:!0,lineNumbers:!0,matchBrackets:!0,mode:"application/json",readOnly:this.props.disabled,smartIndent:!0,styleSelectedText:!0,tabSize:2,theme:Tm,fontSize:"13px"}),this.codeMirror.on("change",this.handleChange),this.setSize(),this.setInitValue()}componentDidUpdate(t){t.value!==this.props.value&&!this.codeMirror.state.focused&&this.setInitValue()}render(){return this.state.error?r.createElement("div",null,"error json"):r.createElement(Pm,{name:this.props.name,hint:this.props.description,error:this.props.error},r.createElement(ie.K,{spacing:1},r.createElement(Cm,{intlLabel:this.props.intlLabel,labelAction:this.props.labelAction,name:this.props.name,required:this.props.required}),r.createElement(gm,{error:this.props.error},r.createElement(fm,{disabled:this.props.disabled},r.createElement("textarea",{ref:this.editor,autoComplete:"off",id:this.props.id||this.props.name,defaultValue:""}))),r.createElement(Qs.J,null),r.createElement(Ys.c,null)))}}Xn.defaultProps={description:null,disabled:!1,id:void 0,error:void 0,intlLabel:void 0,labelAction:void 0,onChange(){},value:null,required:!1},Xn.propTypes={description:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),disabled:s().bool,error:s().string,id:s().string,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),labelAction:s().element,name:s().string.isRequired,onChange:s().func,value:s().any,required:s().bool};const Im=Xn;var er=p(10369),na=p(44647),Dm=p(38705),Lt=p(69932),Lm=p(27169);const ra=(e,t)=>{const[n,o]=(0,r.useState)(e);return(0,r.useEffect)(()=>{const a=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(a)}},[e,t]),n},Sm=/^[A-Za-z0-9-_.~]*$/;var xm=p(63642);const km=(0,j.default)(T.x)`
673
+ position: relative;
674
+ `,Fm=(0,j.default)(xm.E)`
675
+ svg {
676
+ height: 1rem;
677
+ width: 1rem;
678
+ path {
679
+ fill: ${({theme:e})=>e.colors.neutral400};
680
+ }
681
+ }
682
+
683
+ svg:hover {
684
+ path {
685
+ fill: ${({theme:e})=>e.colors.primary600};
686
+ }
687
+ }
688
+ `,tr=(0,j.default)(B.k)`
689
+ position: absolute;
690
+ right: ${({theme:e})=>e.spaces[6]};
691
+ width: 100px;
692
+ pointer-events: none;
693
+
694
+ svg {
695
+ margin-right: ${({theme:e})=>e.spaces[1]};
696
+ height: ${12/16}rem;
697
+ width: ${12/16}rem;
698
+ path {
699
+ fill: ${({theme:e,notAvailable:t})=>t?e.colors.danger600:e.colors.success600};
700
+ }
701
+ }
702
+ `,Am=j.keyframes`
703
+ from {
704
+ transform: rotate(0deg);
705
+ }
706
+ to {
707
+ transform: rotate(359deg);
708
+ }
709
+ `,jm=(0,j.default)(B.k)`
710
+ animation: ${Am} 2s infinite linear;
711
+ `;var $m=Object.defineProperty,oa=Object.getOwnPropertySymbols,Nm=Object.prototype.hasOwnProperty,Vm=Object.prototype.propertyIsEnumerable,sa=(e,t,n)=>t in e?$m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nr=(e,t)=>{for(var n in t||(t={}))Nm.call(t,n)&&sa(e,n,t[n]);if(oa)for(var n of oa(t))Vm.call(t,n)&&sa(e,n,t[n]);return e},aa=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const rr=({attribute:e,contentTypeUID:t,description:n,disabled:o,error:a,intlLabel:l,labelAction:i,name:c,onChange:u,value:d,placeholder:m,required:g})=>{const{modifiedData:f,initialData:h,layout:b}=(0,y.useCMEditViewDataManager)(),[C,k]=(0,r.useState)(!1),[P,O]=(0,r.useState)(null),F=ra(d,300),v=(0,r.useRef)(),R=h[c],{formatMessage:I}=(0,q.useIntl)(),w=M()(b,["options","timestamps",0]),U=!h[w],Z=ra(f[e.targetField],300),[N,Q]=(0,r.useState)(!1),[_,V]=(0,r.useState)(null),A=l.id?I({id:l.id,defaultMessage:l.defaultMessage},nr({},l.values)):c,H=n?I({id:n.id,defaultMessage:n.defaultMessage},nr({},n.values)):"",S=m?I({id:m.id,defaultMessage:m.defaultMessage},nr({},m.values)):"";v.current=(L=!1)=>aa(void 0,null,function*(){k(!0);const G=ge("uid/generate");try{const{data:{data:ne}}=yield me.be.post(G,{contentTypeUID:t,field:c,data:f});u({target:{name:c,value:ne,type:"text"}},L),k(!1)}catch(ne){k(!1)}});const K=()=>aa(void 0,null,function*(){k(!0);const L=ge("uid/check-availability");if(!!d)try{const{data:G}=yield me.be.post(L,{contentTypeUID:t,field:c,value:d?d.trim():""});O(G),k(!1)}catch(G){k(!1)}});(0,r.useEffect)(()=>{!d&&e.required&&v.current(!0)},[]),(0,r.useEffect)(()=>{F&&F.trim().match(Sm)&&F!==R&&K(),F||O(null)},[F,R]),(0,r.useEffect)(()=>{let L;return P&&P.isAvailable&&(L=setTimeout(()=>{O(null)},4e3)),()=>{L&&clearTimeout(L)}},[P]),(0,r.useEffect)(()=>{!N&&U&&Z&&f[e.targetField]&&!d&&v.current(!0)},[Z,N,U]);const $=()=>{V(I({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},D=()=>{V(null)},x=L=>{L.target.value&&U&&Q(!0),u(L)};return r.createElement(er.o,{disabled:o,error:a,endAction:r.createElement(km,null,P&&P.isAvailable&&!_&&r.createElement(tr,{alignItems:"center",justifyContent:"flex-end"},r.createElement(Dm.default,null),r.createElement(z.Z,{textColor:"success600",variant:"pi"},I({id:"content-manager.components.uid.available",defaultMessage:"Available"}))),P&&!P.isAvailable&&!_&&r.createElement(tr,{notAvailable:!0,alignItems:"center",justifyContent:"flex-end"},r.createElement(Lt.default,null),r.createElement(z.Z,{textColor:"danger600",variant:"pi"},I({id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),_&&r.createElement(tr,{alignItems:"center",justifyContent:"flex-end"},r.createElement(z.Z,{textColor:"primary600",variant:"pi"},_)),r.createElement(Fm,{onClick:()=>v.current(),label:"regenerate",onMouseEnter:$,onMouseLeave:D},C?r.createElement(jm,null,r.createElement(Lm.default,null)):r.createElement(na.Z,null))),hint:H,label:A,labelAction:i,name:c,onChange:x,placeholder:S,value:d||"",required:g})};rr.propTypes={attribute:s().shape({targetField:s().string,required:s().bool}).isRequired,contentTypeUID:s().string.isRequired,description:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),disabled:s().bool,error:s().string,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}).isRequired,labelAction:s().element,name:s().string.isRequired,onChange:s().func.isRequired,value:s().string,placeholder:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),required:s().bool},rr.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1};const qm=rr;var Bm=p(88423),or=p.n(Bm),zm=p(54450),ia=p(41234),Zm=p(50428),la=p(99140),sr=p(7563),St=p(63919),Wm=Object.defineProperty,en=Object.getOwnPropertySymbols,ca=Object.prototype.hasOwnProperty,ua=Object.prototype.propertyIsEnumerable,da=(e,t,n)=>t in e?Wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_m=(e,t)=>{for(var n in t||(t={}))ca.call(t,n)&&da(e,n,t[n]);if(en)for(var n of en(t))ua.call(t,n)&&da(e,n,t[n]);return e},Um=(e,t)=>{var n={};for(var o in e)ca.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&en)for(var o of en(e))t.indexOf(o)<0&&ua.call(e,o)&&(n[o]=e[o]);return n};const ar=e=>{var t=e,{children:n,loadMore:o,search:a,totalNumberOfRelations:l,size:i}=t,c=Um(t,["children","loadMore","search","totalNumberOfRelations","size"]);return r.createElement(r.Fragment,null,r.createElement(B.k,{paddingBottom:l>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},r.createElement(ie.K,_m({basis:i<=6?"100%":"70%",spacing:1},c),a),o),n)};ar.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},ar.propTypes={children:s().node.isRequired,search:s().node,loadMore:s().node,size:s().number.isRequired,totalNumberOfRelations:s().number};var Hm=Object.defineProperty,tn=Object.getOwnPropertySymbols,pa=Object.prototype.hasOwnProperty,ma=Object.prototype.propertyIsEnumerable,fa=(e,t,n)=>t in e?Hm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gm=(e,t)=>{for(var n in t||(t={}))pa.call(t,n)&&fa(e,n,t[n]);if(tn)for(var n of tn(t))ma.call(t,n)&&fa(e,n,t[n]);return e},Km=(e,t)=>{var n={};for(var o in e)pa.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&tn)for(var o of tn(e))t.indexOf(o)<0&&ma.call(e,o)&&(n[o]=e[o]);return n};const Qm=(0,j.default)(B.k)`
712
+ width: 100%;
713
+ /* Used to prevent endAction to be pushed out of container */
714
+ min-width: 0;
715
+ `,ir=e=>{var t=e,{children:n,disabled:o,endAction:a,style:l}=t,i=Km(t,["children","disabled","endAction","style"]);return r.createElement(T.x,{style:l,as:"li"},r.createElement(B.k,Gm({paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderSize:1,background:o?"neutral150":"neutral0",borderColor:"neutral200",justifyContent:"space-between"},i),r.createElement(Qm,{justifyContent:"space-between"},n),a&&r.createElement(T.x,{paddingLeft:4},a)))};ir.defaultProps={disabled:!1,endAction:void 0,style:void 0},ir.propTypes={children:s().node.isRequired,disabled:s().bool,endAction:s().node,style:s().shape({height:s().number,left:s().number,position:s().string,right:s().number,width:s().string})};var Ym=Object.defineProperty,nn=Object.getOwnPropertySymbols,ga=Object.prototype.hasOwnProperty,ya=Object.prototype.propertyIsEnumerable,ha=(e,t,n)=>t in e?Ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jm=(e,t)=>{for(var n in t||(t={}))ga.call(t,n)&&ha(e,n,t[n]);if(nn)for(var n of nn(t))ya.call(t,n)&&ha(e,n,t[n]);return e},Xm=(e,t)=>{var n={};for(var o in e)ga.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&nn)for(var o of nn(e))t.indexOf(o)<0&&ya.call(e,o)&&(n[o]=e[o]);return n};const ef=(0,j.default)(T.x)`
716
+ position: relative;
717
+ overflow-x: hidden;
718
+ overflow-y: auto;
719
+
720
+ &:before,
721
+ &:after {
722
+ position: absolute;
723
+ width: 100%;
724
+ height: 4px;
725
+ z-index: 1;
726
+ }
727
+
728
+ &:before {
729
+ /* TODO: as for DS Table component we would need this to be handled by the DS theme */
730
+ content: ${({overflowDirection:e})=>e==="top-bottom"||e==="top"?"''":void 0};
731
+ background: linear-gradient(rgba(33, 33, 52, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
732
+ top: 0;
733
+ }
734
+
735
+ &:after {
736
+ /* TODO: as for DS Table component we would need this to be handled by the DS theme */
737
+ content: ${({overflowDirection:e})=>e==="top-bottom"||e==="bottom"?"''":void 0};
738
+ background: linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(33, 33, 52, 0.1) 100%);
739
+ bottom: 0;
740
+ }
741
+ `,lr=e=>{var t=e,{children:n,overflow:o}=t,a=Xm(t,["children","overflow"]);return r.createElement(ef,Jm({overflowDirection:o},a),r.createElement(ie.K,{spacing:1},n))};lr.defaultProps={overflow:""},lr.propTypes={children:s().node.isRequired,overflow:s().oneOf(["top-bottom","bottom","top",""])};var tf=p(65384),nf=Object.defineProperty,ba=Object.getOwnPropertySymbols,rf=Object.prototype.hasOwnProperty,of=Object.prototype.propertyIsEnumerable,va=(e,t,n)=>t in e?nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ea=(e,t)=>{for(var n in t||(t={}))rf.call(t,n)&&va(e,n,t[n]);if(ba)for(var n of ba(t))of.call(t,n)&&va(e,n,t[n]);return e};const sf=j.default.div`
742
+ flex-shrink: 0;
743
+ width: ${(0,y.pxToRem)(6)};
744
+ height: ${(0,y.pxToRem)(6)};
745
+ margin-right: ${({theme:e})=>e.spaces[2]};
746
+ background-color: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
747
+ border-radius: 50%;
748
+ `,Ca=e=>{const{formatMessage:t}=(0,q.useIntl)(),n=tf.components.Option,{publicationState:o,mainField:a,id:l}=e.data;if(o){const i=o==="draft",c={id:E("components.Select.draft-info-title"),defaultMessage:"State: Draft"},u={id:E("components.Select.publish-info-title"),defaultMessage:"State: Published"},d=t(i?c:u);return r.createElement(n,Ea({},e),r.createElement(B.k,null,r.createElement(sf,{title:d,isDraft:i}),r.createElement(z.Z,{ellipsis:!0},a!=null?a:l)))}return r.createElement(n,Ea({},e),a!=null?a:l)};Ca.propTypes={isFocused:s().bool.isRequired,data:s().shape({id:s().number.isRequired,isDraft:s().bool,mainField:s().string,publicationState:s().oneOfType([s().string,s().bool])}).isRequired};const rn=50;var af=Object.defineProperty,lf=Object.defineProperties,cf=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,uf=Object.prototype.hasOwnProperty,df=Object.prototype.propertyIsEnumerable,Oa=(e,t,n)=>t in e?af(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pf=(e,t)=>{for(var n in t||(t={}))uf.call(t,n)&&Oa(e,n,t[n]);if(Pa)for(var n of Pa(t))df.call(t,n)&&Oa(e,n,t[n]);return e},mf=(e,t)=>lf(e,cf(t));const ff=(0,j.default)(Zm.r)`
749
+ display: block;
750
+
751
+ > span {
752
+ white-space: nowrap;
753
+ overflow: hidden;
754
+ text-overflow: ellipsis;
755
+ display: block;
756
+ }
757
+ `,gf=j.default.button`
758
+ svg path {
759
+ fill: ${({theme:e})=>e.colors.neutral500};
760
+ }
761
+
762
+ &:hover svg path,
763
+ &:focus svg path {
764
+ fill: ${({theme:e})=>e.colors.neutral600};
765
+ }
766
+ `,cr=({description:e,disabled:t,error:n,id:o,name:a,numberOfRelationsToDisplay:l,label:i,labelAction:c,labelLoadMore:u,labelDisconnectRelation:d,loadingMessage:m,noRelationsMessage:g,onRelationConnect:f,onRelationLoadMore:h,onRelationDisconnect:b,onSearchNextPage:C,onSearch:k,placeholder:P,publicationStateTranslations:O,required:F,relations:v,searchResults:R,size:I})=>{var w;const[U,Z]=(0,r.useState)(null),N=(0,r.useRef)(),Q=(0,r.useRef)(),[_,V]=(0,r.useState)(""),{data:A}=R,H=v.data,S=(w=H.length)!=null?w:0,K=(0,r.useMemo)(()=>S>l?Math.min(S,l)*rn+rn/2:Math.min(S,l)*rn,[S,l]),$=!!u&&!t&&v.hasNextPage||v.isLoading,D=(0,r.useMemo)(()=>A.flat().filter(Boolean).map(ve=>mf(pf({},ve),{value:ve.id,label:ve.mainField})),[A]);(0,r.useEffect)(()=>{if(S<=l)return V("");const ve=Be=>{const Ge=Be.target.parentNode.scrollHeight,Ke=Be.target.scrollHeight-Be.target.scrollTop;return Be.target.scrollTop===0?V("bottom"):V(Ke===Ge?"top":"top-bottom")},je=Q==null?void 0:Q.current;return!v.isLoading&&H.length>0&&je&&Q.current.addEventListener("scroll",ve),()=>{je&&je.removeEventListener("scroll",ve)}},[v,H,l,S]);const[x,L]=(0,r.useState)(!1),G=(0,r.useRef)(),ne=(0,r.useRef)([]);(0,r.useEffect)(()=>(D.length>0&&ne.current.length===0&&L(ve=>(ve&&(G.current=setTimeout(()=>{L(!0)},10)),!1)),()=>{ne.current=D||[]}),[D]),(0,r.useEffect)(()=>()=>{G.current&&clearTimeout(G.current)},[]);const re=()=>{L(!1)},fe=()=>{L(!0),k()},W=gs(H.length),ue=(0,r.useRef)(),_e=()=>{ue.current="loadMore",h()};return(0,r.useEffect)(()=>{ue.current==="onChange"&&H.length!==W?N.current.scrollToItem(H.length,"end"):ue.current==="loadMore"&&H.length!==W&&N.current.scrollToItem(0,"start")},[W,H]),r.createElement(ta.g,{error:n,name:a,hint:e,id:o},r.createElement(ar,{totalNumberOfRelations:S,size:I,search:r.createElement(r.Fragment,null,r.createElement(Js.Q,{action:c,required:F},i),r.createElement(y.ReactSelect,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:Ca},options:D,isDisabled:t,isLoading:R.isLoading,error:n,inputId:o,isSearchable:!0,isClear:!0,loadingMessage:()=>m,onChange:ve=>{Z(null),f(ve),ue.current="onChange"},onInputChange:ve=>{Z(ve),k(ve)},onMenuClose:re,onMenuOpen:fe,menuIsOpen:x,noOptionsMessage:()=>g,onMenuScrollToBottom:()=>{R.hasNextPage&&C()},placeholder:P,name:a,value:U})),loadMore:$&&r.createElement(sr.A,{disabled:v.isLoading||v.isFetchingNextPage,onClick:_e,loading:v.isLoading||v.isFetchingNextPage,startIcon:r.createElement(na.Z,null)},u)},r.createElement(lr,{overflow:_},r.createElement(zm.t7,{height:K,ref:N,outerRef:Q,itemCount:S,itemSize:rn,itemData:H,innerElementType:"ol"},({data:ve,index:je,style:Be})=>{const{publicationState:Ge,href:Ke,mainField:Ee,id:$e}=ve[je],Ct=Ge==="draft"?"secondary":"success";return r.createElement(ir,{disabled:t,key:`relation-${a}-${$e}`,endAction:r.createElement(gf,{"data-testid":`remove-relation-${$e}`,disabled:t,type:"button",onClick:()=>b(ve[je]),"aria-label":d},r.createElement(la.J,{width:"12px",as:Dn.default})),style:Be},r.createElement(T.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},r.createElement(St.u,{description:Ee!=null?Ee:`${$e}`},Ke?r.createElement(ff,{to:Ke,disabled:t},Ee!=null?Ee:$e):r.createElement(z.Z,{textColor:t?"neutral600":"primary600",ellipsis:!0},Ee!=null?Ee:$e))),Ge&&r.createElement(ia.q,{variant:Ct,showBullet:!1,size:"S"},r.createElement(z.Z,{fontWeight:"bold",textColor:`${Ct}700`},O[Ge])))})),(e||n)&&r.createElement(T.x,{paddingTop:2},r.createElement(Qs.J,null),r.createElement(Ys.c,null))))},yf=s().shape({data:s().arrayOf(s().shape({href:s().string,id:s().number.isRequired,publicationState:s().oneOfType([s().string,s().bool]),mainField:s().oneOfType([s().string,s().number])})),hasNextPage:s().bool,isFetchingNextPage:s().bool.isRequired,isLoading:s().bool.isRequired,isSuccess:s().bool.isRequired}),hf=s().shape({data:s().arrayOf(s().shape({id:s().number.isRequired,href:s().string,mainField:s().oneOfType([s().string,s().number]),publicationState:s().oneOfType([s().string,s().bool])})),hasNextPage:s().bool,isLoading:s().bool.isRequired,isSuccess:s().bool.isRequired});cr.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,required:!1,relations:{data:[]},searchResults:{data:[]}},cr.propTypes={error:s().string,description:s().string,disabled:s().bool,id:s().string.isRequired,label:s().string.isRequired,labelAction:s().element,labelLoadMore:s().string,labelDisconnectRelation:s().string.isRequired,loadingMessage:s().string.isRequired,name:s().string.isRequired,noRelationsMessage:s().string.isRequired,numberOfRelationsToDisplay:s().number.isRequired,onRelationConnect:s().func.isRequired,onRelationDisconnect:s().func.isRequired,onRelationLoadMore:s().func.isRequired,onSearch:s().func.isRequired,onSearchNextPage:s().func.isRequired,placeholder:s().string.isRequired,publicationStateTranslations:s().shape({draft:s().string.isRequired,published:s().string.isRequired}).isRequired,required:s().bool,searchResults:hf,size:s().number.isRequired,relations:yf};const bf=cr;var at=p(84968),vf=Object.defineProperty,Ra=Object.getOwnPropertySymbols,Ef=Object.prototype.hasOwnProperty,Cf=Object.prototype.propertyIsEnumerable,wa=(e,t,n)=>t in e?vf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ma=(e,t)=>{for(var n in t||(t={}))Ef.call(t,n)&&wa(e,n,t[n]);if(Ra)for(var n of Ra(t))Cf.call(t,n)&&wa(e,n,t[n]);return e};function Pf(e,t){return n=>{const o=t(n);return r.createElement(e,Ma(Ma({},n),o))}}const Of=Pf;var Rf=Object.defineProperty,wf=Object.defineProperties,Mf=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,Tf=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Ia=(e,t,n)=>t in e?Rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Df=(e,t)=>{for(var n in t||(t={}))Tf.call(t,n)&&Ia(e,n,t[n]);if(Ta)for(var n of Ta(t))If.call(t,n)&&Ia(e,n,t[n]);return e},Lf=(e,t)=>wf(e,Mf(t));function Sf({componentUid:e,isUserAllowedToEditField:t,isUserAllowedToReadField:n,name:o,queryInfos:a}){var l;const{isCreatingEntry:i,createActionAllowedFields:c,readActionAllowedFields:u,updateActionAllowedFields:d,slug:m,initialData:g}=(0,y.useCMEditViewDataManager)(),f=(0,r.useMemo)(()=>t===!0?!0:(i?c:d).includes(o),[i,c,o,t,d]),h=(0,r.useMemo)(()=>n?!0:(i?[]:u).includes(o),[i,n,o,u]),b=o.split(".");let C;e&&(C=(l=M()(g,b.slice(0,-1)))==null?void 0:l.id);const k=(0,r.useMemo)(()=>i?null:e?C?ge(`relations/${e}/${C}/${b.at(-1)}`):null:ge(`relations/${m}/${g.id}/${o.split(".").at(-1)}`),[i,e,m,g.id,o,C,b]),P=(0,r.useMemo)(()=>ge(e?`relations/${e}/${o.split(".").at(-1)}`:`relations/${m}/${o.split(".").at(-1)}`),[e,m,o]);return{componentId:C,isComponentRelation:Boolean(e),queryInfos:Lf(Df({},a),{endpoints:{search:P,relation:k}}),isCreatingEntry:i,isFieldAllowed:f,isFieldReadable:h}}const xf=Sf;function kf(e,t){return`${ge(`collectionType/${e}/${t!=null?t:""}`)}`}const on={DRAFT:"draft",PUBLISHED:"published"},ur=5,Ff=10;var Af=Object.defineProperty,Da=Object.getOwnPropertySymbols,jf=Object.prototype.hasOwnProperty,$f=Object.prototype.propertyIsEnumerable,La=(e,t,n)=>t in e?Af(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nf=(e,t)=>{for(var n in t||(t={}))jf.call(t,n)&&La(e,n,t[n]);if(Da)for(var n of Da(t))$f.call(t,n)&&La(e,n,t[n]);return e};const dr=(e,{shouldAddLink:t,mainFieldName:n,targetModel:o})=>{const a=Nf({},e);return t&&(a.href=kf(o,a.id)),a.publicationState=!1,(a==null?void 0:a.publishedAt)!==void 0&&(a.publicationState=a.publishedAt?on.PUBLISHED:on.DRAFT),a.mainField=a[n],a},Vf=(e,{shouldAddLink:t=!1,mainFieldName:n,targetModel:o}={})=>[...e].map(a=>dr(a,{shouldAddLink:t,mainFieldName:n,targetModel:o}));var qf=Object.defineProperty,Bf=Object.defineProperties,zf=Object.getOwnPropertyDescriptors,Sa=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,Wf=Object.prototype.propertyIsEnumerable,xa=(e,t,n)=>t in e?qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_f=(e,t)=>{for(var n in t||(t={}))Zf.call(t,n)&&xa(e,n,t[n]);if(Sa)for(var n of Sa(t))Wf.call(t,n)&&xa(e,n,t[n]);return e},Uf=(e,t)=>Bf(e,zf(t));const Hf=(e,{mainFieldName:t})=>{const{data:n}=e,{pages:o=[]}=n!=null?n:{};return Uf(_f({},e),{data:o.map(a=>a==null?void 0:a.results.map(l=>dr(l,{mainFieldName:t}))).filter(Boolean).flat()})},Gf=(e=[],t=[])=>{const n=e.reduce((a,l)=>t.find(i=>i.id===l.id)?a:[...a,l.id],[]),o=t.reduce((a,l)=>e.find(i=>i.id===l.id)?a:[...a,l.id],[]);return[n,o]};var Kf=Object.defineProperty,Qf=Object.defineProperties,Yf=Object.getOwnPropertyDescriptors,ka=Object.getOwnPropertySymbols,Jf=Object.prototype.hasOwnProperty,Xf=Object.prototype.propertyIsEnumerable,Fa=(e,t,n)=>t in e?Kf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xt=(e,t)=>{for(var n in t||(t={}))Jf.call(t,n)&&Fa(e,n,t[n]);if(ka)for(var n of ka(t))Xf.call(t,n)&&Fa(e,n,t[n]);return e},sn=(e,t)=>Qf(e,Yf(t)),Aa=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const eg=(e,{name:t,relation:n,search:o})=>{const[a,l]=(0,r.useState)({}),[i,c]=(0,r.useState)(0),u=v=>Aa(void 0,[v],function*({pageParam:R=1}){var I;try{const{data:w}=yield me.be.get(n==null?void 0:n.endpoint,{params:sn(xt({},(I=n.pageParams)!=null?I:{}),{page:R})});return c(R),w}catch(w){return null}}),d=v=>Aa(void 0,[v],function*({pageParam:R=1}){var I;try{const{data:w}=yield me.be.get(o.endpoint,{params:sn(xt(xt({},(I=o.pageParams)!=null?I:{}),a),{page:R})});return w}catch(w){return null}}),{onLoad:m,normalizeArguments:g={}}=n,f=(0,at.useInfiniteQuery)(["relation",e],u,{cacheTime:0,enabled:n.enabled,getNextPageParam(v){const R=!(v!=null&&v.pagination);if(!(!v||R||(v==null?void 0:v.pagination.page)>=(v==null?void 0:v.pagination.pageCount)))return v.pagination.page+1},select:v=>sn(xt({},v),{pages:v.pages.map(R=>{if(!R)return R;const{data:I,results:w,pagination:U}=R,Z=!!I;let N=[];return Z?N=[I]:w&&(N=[...w].reverse()),{pagination:U,results:N}})})}),{pageGoal:h}=n,{status:b,data:C,fetchNextPage:k,hasNextPage:P}=f;(0,r.useEffect)(()=>{h>i&&P&&b==="success"&&k({pageParam:i+1})},[h,i,k,P,b]),(0,r.useEffect)(()=>{var v,R;if(b==="success"&&C&&((R=(v=C.pages)==null?void 0:v.at(-1))==null?void 0:R.results)&&m){const I=Vf(C.pages.at(-1).results,g);m({target:{name:t,value:I}})}},[b,m,t,C]);const O=(0,at.useInfiniteQuery)(["relation",e,"search",JSON.stringify(a)],d,{enabled:Object.keys(a).length>0,getNextPageParam(v){if(!(!(v!=null&&v.pagination)||v.pagination.page>=v.pagination.pageCount))return v.pagination.page+1}});return{relations:f,search:O,searchFor:(v,R={})=>{l(sn(xt({},R),{_q:v}))}}};var tg=Object.defineProperty,ng=Object.defineProperties,rg=Object.getOwnPropertyDescriptors,ja=Object.getOwnPropertySymbols,og=Object.prototype.hasOwnProperty,sg=Object.prototype.propertyIsEnumerable,$a=(e,t,n)=>t in e?tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pr=(e,t)=>{for(var n in t||(t={}))og.call(t,n)&&$a(e,n,t[n]);if(ja)for(var n of ja(t))sg.call(t,n)&&$a(e,n,t[n]);return e},mr=(e,t)=>ng(e,rg(t));const fr=({error:e,componentId:t,isComponentRelation:n,editable:o,description:a,intlLabel:l,isCreatingEntry:i,isFieldAllowed:c,isFieldReadable:u,labelAction:d,mainField:m,name:g,queryInfos:{endpoints:f,defaultParams:h,shouldDisplayRelationLink:b},placeholder:C,required:k,relationType:P,size:O,targetModel:F})=>{var v,R,I,w,U,Z;const{formatMessage:N}=(0,q.useIntl)(),{connectRelation:Q,disconnectRelation:_,loadRelation:V,modifiedData:A,slug:H,initialData:S}=(0,y.useCMEditViewDataManager)(),K=M()(A,g,[]),$=Math.ceil(M()(S,g,[]).length/ur),{relations:D,search:x,searchFor:L}=eg(`${H}-${g}-${(v=S==null?void 0:S.id)!=null?v:""}`,{name:g,relation:{enabled:!!f.relation,endpoint:f.relation,pageGoal:$,pageParams:mr(pr({},h),{pageSize:ur}),onLoad:V,normalizeArguments:{mainFieldName:m.name,shouldAddLink:b,targetModel:F}},search:{endpoint:f.search,pageParams:mr(pr({},h),{entityId:i?void 0:n?t:S.id,pageSize:Ff})}}),G=(0,r.useMemo)(()=>P.toLowerCase().includes("morph"),[P]),ne=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(P),re=(0,r.useMemo)(()=>G?!0:i?!o:!c&&u||!o,[G,i,o,c,u]),fe=Ee=>{const $e=dr(Ee,{mainFieldName:m.name,shouldAddLink:b,targetModel:F});Q({name:g,value:$e,toOneRelation:ne})},W=Ee=>{_({name:g,id:Ee.id})},ue=()=>{D.fetchNextPage()},_e=(Ee="")=>{const[$e,Ct]=Gf(K,M()(S,g));L(Ee,{idsToInclude:Ct,idsToOmit:$e})},ve=()=>{x.fetchNextPage()};if(!c&&i||!i&&!c&&!u)return r.createElement(y.NotAllowedInput,{name:g,intlLabel:l,labelAction:d});const je=K.length,Be=((R=M()(S,g))!=null?R:[]).length,Ge=(Z=(U=(w=(I=D.data)==null?void 0:I.pages[0])==null?void 0:w.pagination)==null?void 0:U.total)!=null?Z:0,Ke=!D.data&&je===Be?je:je-Be+Ge;return r.createElement(bf,{error:e,description:a,disabled:re,id:g,label:`${N({id:l.id,defaultMessage:l.defaultMessage})} ${Ke>0?`(${Ke})`:""}`,labelAction:d,labelLoadMore:i?null:N({id:E("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:N({id:E("relation.disconnect"),defaultMessage:"Remove"}),listHeight:320,loadingMessage:N({id:E("relation.isLoading"),defaultMessage:"Relations are loading"}),name:g,noRelationsMessage:N({id:E("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:ur,onRelationConnect:Ee=>fe(Ee),onRelationDisconnect:Ee=>W(Ee),onRelationLoadMore:()=>ue(),onSearch:Ee=>_e(Ee),onSearchNextPage:()=>ve(),placeholder:N(C||{id:E("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[on.DRAFT]:N({id:E("relation.publicationState.draft"),defaultMessage:"Draft"}),[on.PUBLISHED]:N({id:E("relation.publicationState.published"),defaultMessage:"Published"})},relations:or()(mr(pr({},D),{data:K}),"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:k,searchResults:Hf(x,{mainFieldName:m.name}),size:O})};fr.defaultProps={componentId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},fr.propTypes={componentId:s().number,editable:s().bool,error:s().string,description:s().string,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}).isRequired,labelAction:s().element,isCreatingEntry:s().bool.isRequired,isComponentRelation:s().bool,isFieldAllowed:s().bool,isFieldReadable:s().bool.isRequired,mainField:s().shape({name:s().string.isRequired,schema:s().shape({type:s().string.isRequired}).isRequired}).isRequired,name:s().string.isRequired,placeholder:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),required:s().bool,relationType:s().string.isRequired,size:s().number.isRequired,targetModel:s().string.isRequired,queryInfos:s().shape({defaultParams:s().shape({locale:s().string}),endpoints:s().shape({relation:s().string,search:s().string.isRequired}).isRequired,shouldDisplayRelationLink:s().bool.isRequired}).isRequired};const ag=(0,r.memo)(fr),ig=Of(ag,xf);var lg=Object.defineProperty,Na=Object.getOwnPropertySymbols,cg=Object.prototype.hasOwnProperty,ug=Object.prototype.propertyIsEnumerable,Va=(e,t,n)=>t in e?lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qa=(e,t)=>{for(var n in t||(t={}))cg.call(t,n)&&Va(e,n,t[n]);if(Na)for(var n of Na(t))ug.call(t,n)&&Va(e,n,t[n]);return e};function dg(e,t){return n=>{const o=t(n.keys);return r.createElement(e,qa(qa({},n),o))}}const pg=dg,mg=(e,t=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:t,hidden:t},key:"__enum_option_null",value:""},...e.map(n=>({metadatas:{intlLabel:{id:n,defaultMessage:n},hidden:!1,disabled:!1},key:n,value:n}))],fg=(e="")=>{switch((0,Y.toLower)(e)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return e;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return e||"text"}},gg=e=>{let t;return e==="float"||e==="decimal"?t=.01:t=1,t};function yg(e){const{createActionAllowedFields:t,formErrors:n,isCreatingEntry:o,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:c,updateActionAllowedFields:u}=(0,y.useCMEditViewDataManager)(),d=(0,r.useMemo)(()=>o?t:u,[o,t,u]),m=(0,r.useMemo)(()=>o?[]:i,[o,i]),g=(0,Y.get)(a,e,null);return{allowedFields:d,formErrors:n,isCreatingEntry:o,onChange:l,readableFields:m,shouldNotRunValidations:c,value:g}}const hg=yg,Ba=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];var bg=Object.defineProperty,vg=Object.defineProperties,Eg=Object.getOwnPropertyDescriptors,za=Object.getOwnPropertySymbols,Cg=Object.prototype.hasOwnProperty,Pg=Object.prototype.propertyIsEnumerable,Za=(e,t,n)=>t in e?bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,an=(e,t)=>{for(var n in t||(t={}))Cg.call(t,n)&&Za(e,n,t[n]);if(za)for(var n of za(t))Pg.call(t,n)&&Za(e,n,t[n]);return e},Og=(e,t)=>vg(e,Eg(t));function gr({allowedFields:e,componentUid:t,fieldSchema:n,formErrors:o,isCreatingEntry:a,keys:l,labelAction:i,metadatas:c,onChange:u,readableFields:d,shouldNotRunValidations:m,queryInfos:g,value:f,size:h,customFieldInputs:b}){const{fields:C}=(0,y.useLibrary)(),{formatMessage:k}=(0,q.useIntl)(),{contentType:P}=Ye(),O=(0,r.useMemo)(()=>!M()(c,"editable",!0),[c]),{type:F,customField:v}=n,R=M()(o,[l],null),I=(0,r.useMemo)(()=>zo(l),[l]),w=(0,r.useMemo)(()=>{const re=Vd()(n,m?[...Ba,"required","minLength"]:Ba),fe=n.regex||null;if(fe){const W=new RegExp(fe);W&&(re.regex=W)}return re},[n,m]),U=(0,r.useMemo)(()=>M()(w,["required"],!1),[w]),Z=(0,r.useMemo)(()=>{const re=M()(P,["attributes"],{});return M()(re,[I[0],"type"],null)==="dynamiczone"},[P,I]),N=(0,r.useMemo)(()=>fg(F),[F]),Q=(0,r.useMemo)(()=>F==="media"&&!f?[]:f,[F,f]),_=(0,r.useMemo)(()=>gg(F),[F]),V=(0,r.useMemo)(()=>{const re=I.join(".");if(e.includes(re))return!0;if(Z)return e.includes(I[0]);if(I.length>1){const W=Bn()(I,I.length-1).join(".");return e.includes(W)}return!1},[e,I,Z]),A=(0,r.useMemo)(()=>{const re=I.join(".");if(d.includes(re))return!0;if(Z)return d.includes(I[0]);if(I.length>1){const W=Bn()(I,I.length-1).join(".");return d.includes(W)}return!1},[d,I,Z]),H=(0,r.useMemo)(()=>A||V,[V,A]),S=(0,r.useMemo)(()=>a?O:A&&!V?!0:O,[O,a,V,A]),K=(0,r.useMemo)(()=>mg(n.enum||[],U),[n,U]),{label:$,description:D,placeholder:x,visible:L}=c,G=(0,r.useMemo)(()=>{if(!c.step||N!=="datetime"&&N!=="time")return _;if(!Q)return c.step;let re;return N==="datetime"?re=parseInt(Q.substr(14,2),10):N==="time"&&(re=parseInt(Q.slice(-2),10)),re%c.step===0?c.step:_},[N,Q,c.step,_]);if(L===!1)return null;if(!H)return r.createElement(y.NotAllowedInput,{description:D?{id:D,defaultMessage:D}:null,intlLabel:{id:$,defaultMessage:$},labelAction:i,error:R&&k(R),name:l,required:U});if(F==="relation")return r.createElement(ig,Og(an(an({},c),n),{componentUid:t,description:c.description?k({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:i,isUserAllowedToEditField:V,isUserAllowedToReadField:A,name:l,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:g,size:h,value:f,error:R&&k(R)}));const ne=an(an({json:Im,uid:qm,media:C.media,wysiwyg:um},C),b);return r.createElement(y.GenericInput,{attribute:n,autoComplete:"new-password",intlLabel:{id:$,defaultMessage:$},isNullable:N==="bool"&&[null,void 0].includes(n.default),description:D?{id:D,defaultMessage:D}:null,disabled:S,error:R,labelAction:i,contentTypeUID:P.uid,customInputs:ne,multiple:n.multiple||!1,name:l,onChange:u,options:K,placeholder:x?{id:x,defaultMessage:x}:null,required:n.required||!1,step:G,type:v||N,value:Q,withDefaultValue:!1})}gr.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},gr.propTypes={allowedFields:s().array.isRequired,componentUid:s().string,fieldSchema:s().object.isRequired,formErrors:s().object,keys:s().string.isRequired,isCreatingEntry:s().bool.isRequired,labelAction:s().element,metadatas:s().object.isRequired,onChange:s().func.isRequired,readableFields:s().array.isRequired,size:s().number,shouldNotRunValidations:s().bool.isRequired,value:s().any,queryInfos:s().shape({containsKey:s().string,defaultParams:s().object,endPoint:s().string}),customFieldInputs:s().object};const Rg=(0,r.memo)(gr,Je()),yr=pg(Rg,hg);var wg=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const gt=new Map,hr=(e=[])=>{const[t,n]=(0,r.useState)(Object.fromEntries(gt)),[o,a]=(0,r.useState)(()=>gt.size===0&&e.length>0),l=(0,y.useCustomFields)();(0,r.useEffect)(()=>{const c=d=>{n(d),a(!1)},u=(d,m)=>wg(void 0,null,function*(){const g=yield Promise.all(m);d.forEach((f,h)=>{gt.set(f,g[h].default)}),c(Object.fromEntries(gt))});if(e.length&&o){const d=e.filter(g=>!gt.get(g)),m=d.map(g=>l.get(g).components.Input());m.length>0&&u(d,m)}},[e,l,o]);const i=(0,r.useCallback)(()=>{gt.clear(),n({})},[]);return{isLazyLoading:o,lazyComponentStore:t,cleanup:i}},br=({componentUid:e,isFromDynamicZone:t,isNested:n,name:o})=>{const{getComponentLayout:a}=Ye(),i=(0,r.useMemo)(()=>a(e),[e,a]).layouts.edit,{lazyComponentStore:c}=hr();return r.createElement(T.x,{background:t?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:n,borderColor:n?"neutral200":""},r.createElement(ie.K,{spacing:6},i.map((u,d)=>r.createElement(qe.r,{gap:4,key:d},u.map(({name:m,size:g,metadatas:f,fieldSchema:h,queryInfos:b})=>{const C=h.type==="component",k=`${o}.${m}`;if(C){const P=h.component;return r.createElement(Ce.P,{col:g,s:12,xs:12,key:m},r.createElement(ln,{componentUid:P,intlLabel:{id:f.label,defaultMessage:f.label},isNested:!0,isRepeatable:h.repeatable,max:h.max,min:h.min,name:k,required:h.required||!1}))}return r.createElement(Ce.P,{col:g,key:m,s:12,xs:12},r.createElement(yr,{componentUid:e,keys:k,fieldSchema:h,metadatas:f,queryInfos:b,size:g,customFieldInputs:c}))})))))};br.defaultProps={isFromDynamicZone:!1,isNested:!1},br.propTypes={componentUid:s().string.isRequired,isFromDynamicZone:s().bool,isNested:s().bool,name:s().string.isRequired};const Mg=br;var kt=p(19406),Tg=Object.defineProperty,Wa=Object.getOwnPropertySymbols,Ig=Object.prototype.hasOwnProperty,Dg=Object.prototype.propertyIsEnumerable,_a=(e,t,n)=>t in e?Tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ua=(e,t)=>{for(var n in t||(t={}))Ig.call(t,n)&&_a(e,n,t[n]);if(Wa)for(var n of Wa(t))Dg.call(t,n)&&_a(e,n,t[n]);return e};function Lg(e,t){return n=>{const o=t(n);return r.createElement(e,Ua(Ua({},n),o))}}const Sg=Lg;function xg(){const{addRepeatableComponentToField:e,formErrors:t}=(0,y.useCMEditViewDataManager)();return{addRepeatableComponentToField:e,formErrors:t}}const kg=xg;function Fg(e,t){return Object.keys(t).filter(n=>n.startsWith(e)).map(n=>n.split(".").slice(0,e.split(".").length+1).join("."))}var vr=p(51968),Ag=p(41119),Ha=p.n(Ag);const jg=j.default.span`
767
+ display: block;
768
+ background-color: ${({theme:e})=>e.colors.primary100};
769
+ outline: 1px dashed ${({theme:e})=>e.colors.primary500};
770
+ outline-offset: -1px;
771
+ padding: ${({theme:e})=>e.spaces[6]};
772
+ `,$g=()=>r.createElement(jg,{padding:6,background:"primary100"}),Ng=(0,j.default)(Re.h)`
773
+ background-color: transparent;
774
+
775
+ svg {
776
+ path {
777
+ fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
778
+ }
779
+ }
780
+
781
+ &:hover {
782
+ svg {
783
+ path {
784
+ fill: ${({theme:e})=>e.colors.primary600};
785
+ }
786
+ }
787
+ }
788
+ `,Ga=(0,j.default)(Re.h)`
789
+ background-color: transparent;
790
+
791
+ svg {
792
+ path {
793
+ fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
794
+ }
795
+ }
796
+ `,Vg=j.default.span`
797
+ display: flex;
798
+ justify-content: space-between;
799
+ padding-left: ${({theme:e})=>e.spaces[4]};
800
+ padding-right: ${({theme:e})=>e.spaces[4]};
801
+ background-color: ${({theme:e})=>e.colors.neutral0};
802
+ height: ${50/16}rem;
803
+ `,qg=(0,j.default)(sr.A)`
804
+ text-align: left;
805
+
806
+ svg {
807
+ width: ${14/16}rem;
808
+ height: ${14/16}rem;
809
+
810
+ path {
811
+ fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral500};
812
+ }
813
+ }
814
+ `,Ka=({displayedValue:e})=>r.createElement(Vg,null,r.createElement(ie.K,{horizontal:!0,spacing:3,flex:1},r.createElement(B.k,{justifyContent:"center",borderRadius:"50%",height:`${24/16}rem}`,width:`${24/16}rem}`,"aria-hidden":!0,as:"span",background:"neutral200"},r.createElement(la.J,{as:wo.default,width:`${8/16}rem}`,color:"neutral600"})),r.createElement(qg,{onClick:()=>{},flex:1},r.createElement(z.Z,{fontWeight:"bold",textColor:"neutral700"},e))),r.createElement(ie.K,{horizontal:!0,spacing:0},r.createElement(Ga,{noBorder:!0,onClick:()=>{},icon:r.createElement(ze.default,null)}),r.createElement(Ga,{icon:r.createElement(dt.Z,null),noBorder:!0})));Ka.propTypes={displayedValue:s().string.isRequired};const Bg=Ka;var zg=Object.defineProperty,Qa=Object.getOwnPropertySymbols,Zg=Object.prototype.hasOwnProperty,Wg=Object.prototype.propertyIsEnumerable,Ya=(e,t,n)=>t in e?zg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ja=(e,t)=>{for(var n in t||(t={}))Zg.call(t,n)&&Ya(e,n,t[n]);if(Qa)for(var n of Qa(t))Wg.call(t,n)&&Ya(e,n,t[n]);return e};function _g(e,t){return n=>{const o=t(n);return r.createElement(e,Ja(Ja({},n),o))}}const Ug=_g;function Hg({schema:e,componentFieldName:t}){const{checkFormErrors:n,modifiedData:o,moveComponentField:a,removeRepeatableField:l,triggerFormValidation:i}=(0,y.useCMEditViewDataManager)(),c=(0,r.useMemo)(()=>(0,Y.get)(e,["settings","mainField"],"id"),[e]);return{displayedValue:(0,Y.toString)((0,Y.get)(o,[...t.split("."),c],"")),mainField:c,checkFormErrors:n,moveComponentField:a,removeRepeatableField:l,schema:e,triggerFormValidation:i}}const Gg=Hg,Kg=j.default.span`
815
+ display: flex;
816
+ align-items: center;
817
+ height: ${({theme:e})=>e.spaces[7]};
818
+
819
+ padding: 0 ${({theme:e})=>e.spaces[3]};
820
+ cursor: all-scroll;
821
+
822
+ svg {
823
+ width: ${12/16}rem;
824
+ height: ${12/16}rem;
825
+ }
826
+ `,Er=({componentFieldName:e,componentUid:t,hasErrorMessage:n,hasErrors:o,isDraggingSibling:a,isOpen:l,isReadOnly:i,onClickToggle:c,schema:u,toggleCollapses:d,moveComponentField:m,removeRepeatableField:g,setIsDraggingSibling:f,triggerFormValidation:h,displayedValue:b})=>{const C=(0,r.useRef)(null),k=(0,r.useRef)(null),[,P]=(0,r.useState)(!1),{formatMessage:O}=(0,q.useIntl)(),F=u.layouts.edit,[,v]=(0,Fe.useDrop)({accept:De.COMPONENT,canDrop(){return!1},hover(_,V){if(!k.current)return;const A=_.originalPath,H=e,S=A.split("."),K=S.slice().splice(-1).join(""),$=H.split(".").splice(-1).join(""),D=S.slice(0,S.length-1),x=parseInt(K,10),L=parseInt($,10);if(x===L)return;const G=k.current.getBoundingClientRect(),ne=(G.bottom-G.top)/2,fe=V.getClientOffset().y-G.top;x<L&&fe<ne||x>L&&fe>ne||A.split(".").length===H.split(".").length&&(m(D,x,L),_.originalPath=H)}}),[{isDragging:R},I,w]=(0,Fe.useDrag)({type:De.COMPONENT,item(){return d(-1),{displayedValue:b,originalPath:e}},end(){h(),f(!1)},collect:_=>({isDragging:_.isDragging()})});(0,r.useEffect)(()=>{w((0,vr.rX)(),{captureDraggingState:!1})},[w]),(0,r.useEffect)(()=>{R&&f(!0)},[R,f]),(0,r.useEffect)(()=>{a||P(_=>!_)},[a]);const U={dragRef:I(C),dropRef:v(k)},Z=Ha()(b),N=o?"error":void 0,{lazyComponentStore:Q}=hr();return r.createElement(T.x,{ref:U?U.dropRef:null},R&&r.createElement($g,null),!R&&a&&r.createElement(Bg,{displayedValue:Z,componentFieldName:e}),!R&&!a&&r.createElement($n.U,{error:N,hasErrorMessage:n,expanded:l,onToggle:c,id:e,size:"S"},r.createElement(Nn.B,{action:i?null:r.createElement(ie.K,{horizontal:!0,spacing:0},r.createElement(Ng,{expanded:l,noBorder:!0,onClick:()=>{g(e),d()},label:O({id:E("containers.Edit.delete"),defaultMessage:"Delete"}),icon:r.createElement(ze.default,null)}),r.createElement(St.u,{description:O({id:E("components.DragHandle-label"),defaultMessage:"Drag"})},r.createElement(Kg,{role:"button",tabIndex:-1,ref:U.dragRef,onClick:_=>_.stopPropagation()},r.createElement(dt.Z,null)))),title:Z,togglePosition:"left"}),r.createElement(Vn.v,null,r.createElement(ie.K,{background:"neutral100",padding:6,spacing:6},F.map((_,V)=>r.createElement(qe.r,{gap:4,key:V},_.map(({name:A,fieldSchema:H,metadatas:S,queryInfos:K,size:$})=>{const D=H.type==="component",x=`${e}.${A}`;if(D){const L=H.component;return r.createElement(Ce.P,{col:$,s:12,xs:12,key:A},r.createElement(ln,{componentUid:L,intlLabel:{id:S.label,defaultMessage:S.label},isRepeatable:H.repeatable,isNested:!0,name:x,max:H.max,min:H.min,required:H.required}))}return r.createElement(Ce.P,{key:x,col:$,s:12,xs:12},r.createElement(yr,{componentUid:t,fieldSchema:H,keys:x,metadatas:S,queryInfos:K,size:$,customFieldInputs:Q}))})))))))};Er.defaultProps={componentUid:void 0,isDraggingSibling:!1,isOpen:!1,setIsDraggingSibling(){},toggleCollapses(){}},Er.propTypes={componentFieldName:s().string.isRequired,componentUid:s().string,hasErrorMessage:s().bool.isRequired,hasErrors:s().bool.isRequired,isDraggingSibling:s().bool,isOpen:s().bool,isReadOnly:s().bool.isRequired,onClickToggle:s().func.isRequired,schema:s().object.isRequired,toggleCollapses:s().func,moveComponentField:s().func.isRequired,removeRepeatableField:s().func.isRequired,setIsDraggingSibling:s().func,triggerFormValidation:s().func.isRequired,displayedValue:s().string.isRequired};const Qg=(0,r.memo)(Er),Yg=Ug(Qg,Gg);var Xa=p(861),Jg=Object.defineProperty,ei=Object.getOwnPropertySymbols,Xg=Object.prototype.hasOwnProperty,ey=Object.prototype.propertyIsEnumerable,ti=(e,t,n)=>t in e?Jg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ty=(e,t)=>{for(var n in t||(t={}))Xg.call(t,n)&&ti(e,n,t[n]);if(ei)for(var n of ei(t))ey.call(t,n)&&ti(e,n,t[n]);return e};const ny=(0,j.default)(T.x)`
827
+ overflow: hidden;
828
+ border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
829
+ border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
830
+ border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
831
+ border-radius: 0 0 ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius};
832
+ `,ry=(0,j.default)(T.x)`
833
+ > div {
834
+ & > * {
835
+ border-radius: unset;
836
+ border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
837
+ border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
838
+ border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
839
+ }
840
+ > div {
841
+ > div:first-of-type {
842
+ border-radius: unset;
843
+ }
844
+ }
845
+ }
846
+
847
+ > div:first-of-type {
848
+ > div {
849
+ border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
850
+ > div:first-of-type {
851
+ border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
852
+ }
853
+ }
854
+
855
+ > div:not([data-strapi-expanded='true']) {
856
+ border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
857
+
858
+ &:hover {
859
+ border-top: 1px solid ${({theme:e})=>e.colors.primary600};
860
+ }
861
+ }
862
+
863
+ > span {
864
+ border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
865
+ border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
866
+ }
867
+ }
868
+
869
+ & [data-strapi-expanded='true'] {
870
+ border: 1px solid ${({theme:e})=>e.colors.primary600};
871
+ }
872
+
873
+ ${({theme:e,footer:t})=>`
874
+ &:not(${t}) {
875
+ & > *:last-of-type {
876
+ border-radius: 0 0 ${e.borderRadius} ${e.borderRadius};
877
+ }
878
+ }
879
+ `}
880
+ `,oy=(0,j.default)(T.x)`
881
+ svg path {
882
+ fill: ${({theme:e})=>e.colors.neutral500};
883
+ }
884
+ `,Cr=({children:e,footer:t,label:n,labelAction:o,error:a})=>{const{formatMessage:l}=(0,q.useIntl)(),i=r.Children.toArray(e).map(c=>(0,r.cloneElement)(c,{hasErrorMessage:!1}));return r.createElement(Xa.k,{attributeName:"data-strapi-accordion-toggle"},n&&r.createElement(B.k,{paddingBottom:1},r.createElement(z.Z,{as:"label",textColor:"neutral800",variant:"pi",fontWeight:"bold"},n),o&&r.createElement(oy,{paddingLeft:1},o)),r.createElement(ry,{footer:t},i),t&&r.createElement(ny,null,t),a&&r.createElement(T.x,{paddingTop:1},r.createElement(z.Z,{variant:"pi",textColor:"danger600"},l({id:a.id,defaultMessage:a.id},ty({},a.values)))))};Cr.defaultProps={error:void 0,footer:null,label:null,labelAction:void 0},Cr.propTypes={children:s().node.isRequired,error:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),footer:s().node,label:s().string,labelAction:s().node};const sy=Cr,ay=(0,j.default)(sr.A)`
885
+ height: 100%;
886
+ width: 100%;
887
+ border-radius: 0 0 4px 4px;
888
+ display: flex;
889
+ justify-content: center;
890
+ span {
891
+ font-weight: 600;
892
+ font-size: 14px;
893
+ }
894
+ `,Pr=({addRepeatableComponentToField:e,formErrors:t,componentUid:n,componentValue:o,componentValueLength:a,isReadOnly:l,max:i,min:c,name:u})=>{const d=(0,y.useNotification)(),{formatMessage:m}=(0,q.useIntl)(),[g,f]=(0,r.useState)(""),[h,b]=(0,r.useState)(!1),[,C]=(0,Fe.useDrop)({accept:De.COMPONENT}),{getComponentLayout:k,components:P}=Ye(),O=(0,r.useMemo)(()=>k(n),[n,k]),F=(0,r.useMemo)(()=>Zo(o||[])+1,[o]),v=Fg(u,t),R=()=>{f("")},I=c-a,w=M()(t,u,{id:""}).id.includes("min"),U=(0,r.useCallback)(()=>{l||(a<i?(e(u,O,P,w),f(F)):a>=i&&d({type:"info",message:{id:E("components.notification.info.maximum-requirement")}}))},[P,e,O,a,w,l,i,u,F,d]);let Z=t[u];return w&&(Z={id:E("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:I}}),a===0?r.createElement(Is,{error:Z,isReadOnly:l,onClick:U}):(v.some(Q=>Q.split(".").length>1)&&!w&&(Z={id:E("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r.createElement(T.x,{hasRadius:!0,ref:C},r.createElement(sy,{error:Z,footer:r.createElement(B.k,{justifyContent:"center",height:"48px",background:"neutral0"},r.createElement(ay,{disabled:l,onClick:U,startIcon:r.createElement(kt.default,null)},m({id:E("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"})))},o.map((Q,_)=>{const V=Q.__temp_key__,A=g===V,H=`${u}.${_}`,S=v.includes(H);return r.createElement(Yg,{componentFieldName:H,componentUid:n,hasErrors:S,hasMinError:w,isDraggingSibling:h,isOpen:A,isReadOnly:l,key:V,onClickToggle:()=>{f(A?"":V)},parentName:u,schema:O,setIsDraggingSibling:b,toggleCollapses:R})}))))};Pr.defaultProps={componentValue:null,componentValueLength:0,formErrors:{},max:1/0,min:0},Pr.propTypes={addRepeatableComponentToField:s().func.isRequired,componentUid:s().string.isRequired,componentValue:s().oneOfType([s().array,s().object]),componentValueLength:s().number,formErrors:s().object,isReadOnly:s().bool.isRequired,max:s().number,min:s().number,name:s().string.isRequired};const iy=(0,r.memo)(Pr),ly=Sg(iy,kg);var cy=Object.defineProperty,ni=Object.getOwnPropertySymbols,uy=Object.prototype.hasOwnProperty,dy=Object.prototype.propertyIsEnumerable,ri=(e,t,n)=>t in e?cy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oi=(e,t)=>{for(var n in t||(t={}))uy.call(t,n)&&ri(e,n,t[n]);if(ni)for(var n of ni(t))dy.call(t,n)&&ri(e,n,t[n]);return e};function py(e,t){return n=>{const o=t(n);return r.createElement(e,oi(oi({},n),o))}}const my=py;function fy({isFromDynamicZone:e,name:t}){const{addNonRepeatableComponentToField:n,createActionAllowedFields:o,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:c,updateActionAllowedFields:u,formErrors:d}=(0,y.useCMEditViewDataManager)(),{contentType:m}=Ye(),g=(0,r.useMemo)(()=>{const O=(0,Y.get)(m,["attributes"],{});return Object.keys(O).filter(v=>(0,Y.get)(O,[v,"type"],"")==="dynamiczone")},[m]),f=(0,r.useMemo)(()=>a?o:u,[a,o,u]),h=(0,Y.get)(l,t,null),b=(0,r.useMemo)(()=>zo(t),[t]),C=(0,r.useMemo)(()=>e&&a||f.filter(v=>v===b[0]).length>0?!0:f.map(v=>v.split(".")).filter(v=>v.length<b.length?!1:(0,Y.take)(v,b.length).join(".")===b.join(".")).length>0,[e,a,f,b]),k=(0,r.useMemo)(()=>e||g.includes(b[0])?!0:(a?[]:c).map(v=>v.split(".")).filter(v=>v.length<b.length?!1:(0,Y.take)(v,b.length).join(".")===b.join(".")).length>0,[e,g,b,a,c]),P=(0,r.useMemo)(()=>a||C?!1:k,[C,k,a]);return{addNonRepeatableComponentToField:n,formErrors:d,hasChildrenAllowedFields:C,hasChildrenReadableFields:k,isCreatingEntry:a,isReadOnly:P,removeComponentFromField:i,componentValue:h}}const gy=fy,yy=(0,j.default)(T.x)`
895
+ svg path {
896
+ fill: ${({theme:e})=>e.colors.neutral500};
897
+ }
898
+ `,Or=({intlLabel:e,id:t,labelAction:n,name:o,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:c}=(0,q.useIntl)(),u=e!=null&&e.id?c(e):o;return r.createElement(T.x,{paddingBottom:1},r.createElement(B.k,null,r.createElement(z.Z,{textColor:"neutral800",htmlFor:t||o,variant:"pi",fontWeight:"bold",as:"label"},u,l&&r.createElement(r.Fragment,null,"\xA0(",a,")"),i&&r.createElement(z.Z,{textColor:"danger600"},"*")),n&&r.createElement(yy,{paddingLeft:1},n)))};Or.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},Or.propTypes={id:s().string,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}).isRequired,labelAction:s().element,name:s().string.isRequired,numberOfEntries:s().number,required:s().bool,showNumberOfEntries:s().bool};const hy=Or,Rr=({addNonRepeatableComponentToField:e,componentUid:t,intlLabel:n,isCreatingEntry:o,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:c,max:u,min:d,name:m,hasChildrenAllowedFields:g,hasChildrenReadableFields:f,isReadOnly:h,componentValue:b,removeComponentFromField:C,required:k})=>{const{formatMessage:P}=(0,q.useIntl)(),O=xd()(b),F=b!==null||a,v=!l&&F&&!a&&g,{getComponentLayout:R,components:I}=Ye(),w=(0,r.useMemo)(()=>R(t),[t,R]);if(!g&&o)return r.createElement(y.NotAllowedInput,{labelAction:c,intlLabel:n,name:m});if(!g&&!o&&!f)return r.createElement(y.NotAllowedInput,{labelAction:c,intlLabel:n,name:m});const U=()=>{e(m,w,I)};return r.createElement(T.x,null,r.createElement(B.k,{justifyContent:"space-between"},n&&r.createElement(hy,{intlLabel:n,labelAction:c,name:m,numberOfEntries:O,showNumberOfEntries:l,required:k}),v&&r.createElement(Re.h,{label:P({id:E("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:r.createElement(ze.default,null),noBorder:!0,onClick:()=>{C(m,t)}})),r.createElement(ie.K,{spacing:1},!l&&!F&&r.createElement(Is,{isReadOnly:h,onClick:U}),!l&&F&&r.createElement(Mg,{componentUid:t,isFromDynamicZone:a,isNested:i,name:m}),l&&r.createElement(ly,{componentValue:b,componentValueLength:O,componentUid:t,isReadOnly:h,max:u,min:d,name:m})))};Rr.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},Rr.propTypes={addNonRepeatableComponentToField:s().func.isRequired,componentUid:s().string.isRequired,componentValue:s().oneOfType([s().object,s().array]),hasChildrenAllowedFields:s().bool,hasChildrenReadableFields:s().bool,isCreatingEntry:s().bool.isRequired,isFromDynamicZone:s().bool,isReadOnly:s().bool,isRepeatable:s().bool,isNested:s().bool,intlLabel:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired,values:s().object}),labelAction:s().element,max:s().number,min:s().number,name:s().string.isRequired,removeComponentFromField:s().func.isRequired,required:s().bool};const by=(0,r.memo)(Rr,Je()),ln=my(by,gy),wr=(0,j.default)(Re.h)`
899
+ background-color: transparent;
900
+
901
+ svg path {
902
+ fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
903
+ }
904
+ `,vy=(0,j.default)(T.x)`
905
+ > div:first-child {
906
+ box-shadow: ${({theme:e})=>e.shadows.tableShadow};
907
+ }
908
+ `,Ey=(0,j.default)(T.x)`
909
+ border-radius: 0 0 ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[1]};
910
+ `,Cy=(0,j.default)(T.x)`
911
+ width: ${({theme:e})=>e.spaces[2]};
912
+ height: ${({theme:e})=>e.spaces[4]};
913
+ `,Mr=({componentUid:e,formErrors:t,index:n,isFieldAllowed:o,onMoveComponentDownClick:a,onMoveComponentUpClick:l,name:i,onRemoveComponentClick:c,showDownIcon:u,showUpIcon:d})=>{const[m,g]=(0,r.useState)(!0),{formatMessage:f}=(0,q.useIntl)(),{getComponentLayout:h}=Ye(),{modifiedData:b}=(0,y.useCMEditViewDataManager)(),{icon:C,friendlyName:k,mainValue:P}=(0,r.useMemo)(()=>{var R;const I=h(e),{info:{icon:w,displayName:U}}=I,Z=M()(I,["settings","mainField"],"id"),N=(R=M()(b,[i,n,Z]))!=null?R:"",Q=Z==="id"?"":N.trim(),_=Q.length>0?` - ${Q}`:Q;return{friendlyName:U,icon:w,mainValue:_}},[e,h,b,i,n]),O=Object.keys(t).filter(R=>{const I=R.split(".");return`${I[0]}.${I[1]}`==`${i}.${n}`});let F;O.length>0&&(F=f({id:E("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const v=()=>{g(R=>!R)};return r.createElement(T.x,null,r.createElement(B.k,{justifyContent:"center"},r.createElement(Cy,{background:"neutral200"})),r.createElement(vy,{hasRadius:!0},r.createElement($n.U,{expanded:m,onToggle:v,size:"S",error:F},r.createElement(Nn.B,{startIcon:C&&r.createElement(jn.G,{icon:C}),action:r.createElement(ie.K,{horizontal:!0,spacing:0,expanded:m},u&&r.createElement(wr,{noBorder:!0,label:f({id:E("components.DynamicZone.move-down-label"),defaultMessage:"Move component down"}),onClick:a,icon:r.createElement(Dd.Z,null)}),d&&r.createElement(wr,{noBorder:!0,label:f({id:E("components.DynamicZone.move-up-label"),defaultMessage:"Move component up"}),onClick:l,icon:r.createElement(Ld.Z,null)}),o&&r.createElement(wr,{noBorder:!0,label:f({id:E("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:k}),onClick:c,icon:r.createElement(ze.default,null)})),title:`${k}${P}`,togglePosition:"left"}),r.createElement(Vn.v,null,r.createElement(Ey,{background:"neutral0"},r.createElement(ln,{componentUid:e,icon:C,name:`${i}.${n}`,isFromDynamicZone:!0}))))))};Mr.defaultProps={formErrors:{},index:0,isFieldAllowed:!0,showDownIcon:!0,showUpIcon:!0},Mr.propTypes={componentUid:s().string.isRequired,formErrors:s().object,index:s().number,isFieldAllowed:s().bool,name:s().string.isRequired,onMoveComponentDownClick:s().func.isRequired,onMoveComponentUpClick:s().func.isRequired,onRemoveComponentClick:s().func.isRequired,showDownIcon:s().bool,showUpIcon:s().bool};const Py=Mr,Tr=(0,j.default)(ws.Z)`
914
+ transform: ${({$isOpen:e})=>e?"rotate(45deg)":"rotate(0deg)"};
915
+ > circle {
916
+ fill: ${({theme:e,$hasError:t})=>t?e.colors.danger200:e.colors.neutral150};
917
+ }
918
+ > path {
919
+ fill: ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral600};
920
+ }
921
+ `,Oy=(0,j.default)(Wn.Y)`
922
+ border-radius: 26px;
923
+ border-color: ${({theme:e})=>e.colors.neutral150};
924
+ background: ${({theme:e})=>e.colors.neutral0};
925
+ padding-top: ${({theme:e})=>e.spaces[3]};
926
+ padding-right: ${({theme:e})=>e.spaces[4]};
927
+ padding-bottom: ${({theme:e})=>e.spaces[3]};
928
+ padding-left: ${({theme:e})=>e.spaces[4]};
929
+
930
+ box-shadow: ${({theme:e})=>e.shadows.filterShadow};
931
+
932
+ svg {
933
+ height: ${({theme:e})=>e.spaces[6]};
934
+ width: ${({theme:e})=>e.spaces[6]};
935
+ > path {
936
+ fill: ${({theme:e})=>e.colors.neutral600};
937
+ }
938
+ }
939
+ &:hover {
940
+ color: ${({theme:e})=>e.colors.primary600} !important;
941
+ ${z.Z} {
942
+ color: ${({theme:e})=>e.colors.primary600} !important;
943
+ }
944
+
945
+ ${Tr} {
946
+ > circle {
947
+ fill: ${({theme:e})=>e.colors.primary600};
948
+ }
949
+ > path {
950
+ fill: ${({theme:e})=>e.colors.neutral100};
951
+ }
952
+ }
953
+ }
954
+ &:active {
955
+ ${z.Z} {
956
+ color: ${({theme:e})=>e.colors.primary600};
957
+ }
958
+ ${Tr} {
959
+ > circle {
960
+ fill: ${({theme:e})=>e.colors.primary600};
961
+ }
962
+ > path {
963
+ fill: ${({theme:e})=>e.colors.neutral100};
964
+ }
965
+ }
966
+ }
967
+ `,Ry=(0,j.default)(T.x)`
968
+ height: 100%;
969
+ `,Ir=({hasError:e,hasMaxError:t,hasMinError:n,isDisabled:o,isOpen:a,label:l,missingComponentNumber:i,name:c,onClick:u})=>{const{formatMessage:d}=(0,q.useIntl)(),m=d({id:E("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||c}),g=d({id:"app.utils.close-label",defaultMessage:"Close"});let f=a?g:m;return t&&!a&&(f=d({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),n&&!a&&(f=d({id:E("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),r.createElement(B.k,{justifyContent:"center"},r.createElement(T.x,{style:{cursor:o?"not-allowed":"pointer"}},r.createElement(Oy,{type:"button",onClick:u,disabled:o,hasError:e},r.createElement(B.k,null,r.createElement(Ry,{"aria-hidden":!0,paddingRight:2},r.createElement(Tr,{$isOpen:a,$hasError:e&&!a})),r.createElement(z.Z,{variant:"pi",fontWeight:"bold",textColor:e&&!a?"danger600":"neutral500"},f)))))};Ir.defaultProps={hasError:!1,hasMaxError:!1,hasMinError:!1,isDisabled:!1,isOpen:!1,label:"",missingComponentNumber:0},Ir.propTypes={label:s().string,hasError:s().bool,hasMaxError:s().bool,hasMinError:s().bool,isDisabled:s().bool,isOpen:s().bool,missingComponentNumber:s().number,name:s().string.isRequired,onClick:s().func.isRequired};const wy=Ir,My=(0,j.default)(T.x)`
970
+ border-radius: ${(0,y.pxToRem)(26)};
971
+ `,Dr=({label:e,labelAction:t,name:n,numberOfComponents:o,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,q.useIntl)(),c=i({id:e||n,defaultMessage:e||n});return r.createElement(B.k,{justifyContent:"center"},r.createElement(T.x,null,r.createElement(My,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},r.createElement(B.k,{direction:"column",justifyContent:"center"},r.createElement(B.k,{maxWidth:(0,y.pxToRem)(356)},r.createElement(z.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),r.createElement(z.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",o,")"),a&&r.createElement(z.Z,{textColor:"danger600"},"*"),t&&r.createElement(T.x,{paddingLeft:1},t)),l&&r.createElement(T.x,{paddingTop:1,maxWidth:(0,y.pxToRem)(356)},r.createElement(z.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};Dr.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Dr.propTypes={intlDescription:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired}),label:s().string,labelAction:s().element,name:s().string.isRequired,numberOfComponents:s().number,required:s().bool};const Ty=Dr;var Iy=p(81346),Dy=p.n(Iy);const si=(0,j.default)(jn.G)`
972
+ width: ${(0,y.pxToRem)(32)} !important;
973
+ height: ${(0,y.pxToRem)(32)} !important;
974
+ padding: ${(0,y.pxToRem)(9)};
975
+ border-radius: ${(0,y.pxToRem)(64)};
976
+ background: ${({theme:e})=>e.colors.neutral150};
977
+ path {
978
+ fill: ${({theme:e})=>e.colors.neutral500};
979
+ }
980
+ `,Ly=(0,j.default)(T.x)`
981
+ flex-shrink: 0;
982
+ height: ${(0,y.pxToRem)(84)};
983
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
984
+ background: ${({theme:e})=>e.colors.neutral100};
985
+ border-radius: ${({theme:e})=>e.borderRadius};
986
+ display: flex;
987
+ justify-content: center;
988
+ align-items: center;
989
+
990
+ &.active,
991
+ &:hover {
992
+ border: 1px solid ${({theme:e})=>e.colors.primary200};
993
+ background: ${({theme:e})=>e.colors.primary100};
994
+
995
+ ${si} {
996
+ background: ${({theme:e})=>e.colors.primary200};
997
+ path {
998
+ fill: ${({theme:e})=>e.colors.primary600};
999
+ }
1000
+ }
1001
+
1002
+ ${z.Z} {
1003
+ color: ${({theme:e})=>e.colors.primary600};
1004
+ }
1005
+ }
1006
+ `;function Lr({children:e,icon:t,onClick:n}){return r.createElement("button",{type:"button",onClick:n},r.createElement(Ly,{borderRadius:"borderRadius"},r.createElement(ie.K,{spacing:1,style:{justifyContent:"center",alignItems:"center"}},r.createElement(si,{"data-testid":"component-card-icon",icon:t}),r.createElement(z.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},e))))}Lr.defaultProps={icon:"dice-d6",onClick(){}},Lr.propTypes={children:s().node.isRequired,icon:s().string,onClick:s().func};const Sy=j.default.div`
1007
+ display: grid;
1008
+ grid-template-columns: repeat(auto-fit, ${140/16}rem);
1009
+ grid-gap: ${({theme:e})=>e.spaces[1]};
1010
+ `,Sr=({category:e,components:t,variant:n,isOpen:o,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,q.useIntl)(),c=()=>{l(e)};return r.createElement($n.U,{expanded:o,onToggle:c,size:"S"},r.createElement(Nn.B,{variant:n,title:i({id:e,defaultMessage:e}),togglePosition:"left"}),r.createElement(Vn.v,null,r.createElement(T.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},r.createElement(Sy,null,t.map(({componentUid:u,info:{displayName:d,icon:m}})=>r.createElement(Lr,{key:u,icon:m,onClick:a(u)},i({id:d,defaultMessage:d})))))))};Sr.defaultProps={components:[],isOpen:!1,variant:"primary"},Sr.propTypes={category:s().string.isRequired,components:s().array,isOpen:s().bool,onAddComponent:s().func.isRequired,onToggle:s().func.isRequired,variant:s().oneOf(["primary","secondary"])};const xy=Sr,xr=({components:e,isOpen:t,onClickAddComponent:n})=>{const{formatMessage:o}=(0,q.useIntl)(),{getComponentLayout:a}=Ye(),[l,i]=(0,r.useState)(""),c=(0,r.useMemo)(()=>{const m=e.map(f=>{const{category:h,info:b}=a(f);return{componentUid:f,category:h,info:b}}),g=Dy()(m,"category");return Object.keys(g).reduce((f,h)=>(f.push({category:h,components:g[h]}),f),[])},[e,a]);(0,r.useEffect)(()=>{t&&c.length>0&&i(c[0].category)},[t,c]);const u=m=>()=>{n(m),i("")},d=m=>{i(g=>g===m?"":m)};return t?r.createElement(T.x,{paddingBottom:6},r.createElement(T.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},r.createElement(B.k,{justifyContent:"center"},r.createElement(z.Z,{fontWeight:"bold",textColor:"neutral600"},o({id:E("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),r.createElement(T.x,{paddingTop:2},r.createElement(Xa.k,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:m,components:g},f)=>r.createElement(xy,{key:m,category:m,components:g,onAddComponent:u,isOpen:m===l,onToggle:d,variant:f%2===1?"primary":"secondary"})))))):null};xr.defaultProps={components:[],isOpen:!1},xr.propTypes={components:s().array,isOpen:s().bool,onClickAddComponent:s().func.isRequired};const ky=xr,kr=({name:e,addComponentToDynamicZone:t,formErrors:n,isCreatingEntry:o,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentUp:c,moveComponentDown:u,removeComponentFromDynamicZone:d,dynamicDisplayedComponents:m,fieldSchema:g,metadatas:f})=>{var h;const[b,C]=(0,r.useState)(!1),k=(0,y.useNotification)(),{getComponentLayout:P,components:O}=Ye(),F=m.length,v=f.description?{id:f.description,defaultMessage:f.description}:null,{max:R=1/0,min:I=-1/0}=g,w=(0,r.useMemo)(()=>Object.keys(n).filter(K=>K===e).map(K=>n[K]),[n,e]),U=I-F,Z=w.length>0,N=w.length>0&&M()(w,[0,"id"],"").includes("min"),Q=Z&&M()(w,[0,"id"],"")==="components.Input.error.validation.max",_=K=>{C(!1);const $=P(K);t(e,$,O,Z)},V=()=>{F<R?C(K=>!K):k({type:"info",message:{id:E("components.notification.info.maximum-requirement")}})},A=(K,$)=>()=>{u(K,$)},H=(K,$)=>()=>{c(K,$)},S=(K,$)=>()=>{d(K,$)};return!a&&(o||!l&&!o)?r.createElement(y.NotAllowedInput,{description:v,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:i,name:e}):r.createElement(ie.K,{spacing:6},F>0&&r.createElement(T.x,null,r.createElement(Ty,{intlDescription:v,label:f.label,labelAction:i,name:e,numberOfComponents:F,required:g.required||!1}),m.map((K,$)=>{const D=a&&$<F-1,x=a&&$>0;return r.createElement(Py,{componentUid:K,formErrors:n,key:$,index:$,isFieldAllowed:a,onMoveComponentDownClick:A(e,$),onMoveComponentUpClick:H(e,$),name:e,onRemoveComponentClick:S(e,$),showDownIcon:D,showUpIcon:x})})),r.createElement(wy,{hasError:Z,hasMaxError:Q,hasMinError:N,isDisabled:!a,label:f.label,missingComponentNumber:U,isOpen:b,name:e,onClick:V}),r.createElement(ky,{isOpen:b,components:(h=g.components)!=null?h:[],onClickAddComponent:_}))};kr.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},kr.propTypes={addComponentToDynamicZone:s().func.isRequired,dynamicDisplayedComponents:s().array,fieldSchema:s().shape({components:s().array.isRequired,max:s().number,min:s().number,required:s().bool}),formErrors:s().object.isRequired,isCreatingEntry:s().bool.isRequired,isFieldAllowed:s().bool.isRequired,isFieldReadable:s().bool.isRequired,labelAction:s().element,metadatas:s().shape({description:s().string,label:s().string}).isRequired,moveComponentUp:s().func.isRequired,moveComponentDown:s().func.isRequired,name:s().string.isRequired,removeComponentFromDynamicZone:s().func.isRequired};const Fy=(0,r.memo)(kr,Je()),Ay=Md(Fy,Id);var Xe=p(41578);const cn=()=>({type:Xe.ZA}),Fr=e=>({type:Xe.Id,data:e}),Ar=(e,t=!1)=>({type:Xe.TP,rawQuery:e,isSingleType:t}),ai=()=>({type:Xe.c2}),ii=(e,t)=>({type:Xe.w7,componentsDataStructure:e,contentTypeDataStructure:t}),de=e=>({type:Xe.d0,status:e}),et=e=>({type:Xe.t9,data:e}),jy=()=>({type:Xe.tE}),jr=e=>e["content-manager_editViewCrudReducer"];var $y=p(98399),Ny=Object.defineProperty,li=Object.getOwnPropertySymbols,Vy=Object.prototype.hasOwnProperty,qy=Object.prototype.propertyIsEnumerable,ci=(e,t,n)=>t in e?Ny(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,By=(e,t)=>{for(var n in t||(t={}))Vy.call(t,n)&&ci(e,n,t[n]);if(li)for(var n of li(t))qy.call(t,n)&&ci(e,n,t[n]);return e},tt=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const $r=({allLayoutData:e,children:t,slug:n,id:o,origin:a})=>{const l=(0,at.useQueryClient)(),i=(0,y.useNotification)(),{setCurrentStep:c}=(0,y.useGuidedTour)(),{trackUsage:u}=(0,y.useTracking)(),{push:d,replace:m}=(0,J.useHistory)(),[{rawQuery:g}]=(0,y.useQueryParams)(),f=(0,pe.useDispatch)(),{componentsDataStructure:h,contentTypeDataStructure:b,data:C,isLoading:k,status:P}=(0,pe.useSelector)(jr),O=ds(n),F=(0,r.useRef)(!0),v=(0,r.useRef)(u),R=(0,r.useRef)(e),I=o===null,w=(0,r.useMemo)(()=>I&&!a?null:ge(`collection-types/${n}/${a||o}`),[n,o,I,a]),U=(0,r.useCallback)($=>a?(0,y.contentManagementUtilRemoveFieldsFromData)($,R.current.contentType,R.current.components):$,[a]),Z=(0,r.useCallback)($=>{const D=Yo($,R.current.contentType,R.current.components);return(0,y.formatContentTypeData)(D,R.current.contentType,R.current.components)},[]);(0,r.useEffect)(()=>{const $=Object.keys(e.components).reduce((L,G)=>{const ne=Zt(M()(e,["components",G,"attributes"],{}),e.components);return L[G]=(0,y.formatContentTypeData)(ne,e.components[G],e.components),L},{}),D=Zt(e.contentType.attributes,e.components),x=(0,y.formatContentTypeData)(D,e.contentType,e.components);f(ii($,x))},[e,f]),(0,r.useEffect)(()=>()=>{f(ai())},[f]),(0,r.useEffect)(()=>{const D=Ae().CancelToken.source(),x=G=>tt(void 0,null,function*(){f(cn());try{const{data:ne}=yield me.be.get(w,{cancelToken:G.token});f(Fr(Z(U(ne))))}catch(ne){if(Ae().isCancel(ne))return;$y.error(ne);const re=M()(ne,"response.status",null);if(re===404){d(O);return}re===403&&(i({type:"info",message:{id:E("permissions.not-allowed.update")}}),d(O))}}),L=()=>tt(void 0,null,function*(){yield f(cn()),yield f(Ar(g))});return F.current?(w?x(D):L(),()=>{D.cancel("Operation canceled by the user.")}):()=>{}},[U,Z,d,w,f,g,O,i]);const N=(0,r.useCallback)($=>{const D=$.response.data;let x=M()(D,["error","message"],"Bad Request");Array.isArray(x)&&(x=M()(x,["0","messages","0","id"])),typeof x=="string"&&i({type:"warning",message:x})},[i]),Q=(0,r.useCallback)($=>tt(void 0,null,function*(){try{v.current("willDeleteEntry",$);const{data:D}=yield me.be.delete(ge(`collection-types/${n}/${o}`));return i({type:"success",message:{id:E("success.record.delete")}}),v.current("didDeleteEntry",$),Promise.resolve(D)}catch(D){return v.current("didNotDeleteEntry",By({error:D},$)),Promise.reject(D)}}),[o,n,i]),_=(0,r.useCallback)(()=>{m(O)},[O,m]),V=(0,r.useCallback)(($,D)=>tt(void 0,null,function*(){const x=`${ge(`collection-types/${n}`)}${g}`;try{f(de("submit-pending"));const{data:L}=yield me.be.post(x,$);return v.current("didCreateEntry",D),i({type:"success",message:{id:E("success.record.save")}}),c("contentManager.success"),l.invalidateQueries(["relation"]),f(et(Z(L))),f(de("resolved")),m(`/content-manager/collectionType/${n}/${L.id}${g}`),Promise.resolve(L)}catch(L){return N(L),v.current("didNotCreateEntry",{error:L,trackerProperty:D}),f(de("resolved")),Promise.reject(L)}}),[Z,N,m,n,f,g,i,c,l]),A=(0,r.useCallback)(()=>tt(void 0,null,function*(){try{v.current("willCheckDraftRelations");const $=ge(`collection-types/${n}/${o}/actions/numberOfDraftRelations`);f(de("draft-relation-check-pending"));const D=yield me.be.get($);return v.current("didCheckDraftRelations"),f(de("resolved")),D.data.data}catch($){return N($),f(de("resolved")),Promise.reject($)}}),[N,o,n,f]),H=(0,r.useCallback)(()=>tt(void 0,null,function*(){try{v.current("willPublishEntry");const $=ge(`collection-types/${n}/${o}/actions/publish`);f(de("publish-pending"));const{data:D}=yield me.be.post($);return v.current("didPublishEntry"),f(et(Z(D))),f(de("resolved")),i({type:"success",message:{id:E("success.record.publish")}}),Promise.resolve(D)}catch($){return N($),f(de("resolved")),Promise.reject($)}}),[Z,N,o,n,f,i]),S=(0,r.useCallback)(($,D)=>tt(void 0,null,function*(){const x=ge(`collection-types/${n}/${o}`);try{v.current("willEditEntry",D),f(de("submit-pending"));const{data:L}=yield me.be.put(x,$);return v.current("didEditEntry",{trackerProperty:D}),i({type:"success",message:{id:E("success.record.save")}}),l.invalidateQueries(["relation"]),f(et(Z(L))),f(de("resolved")),Promise.resolve(L)}catch(L){return v.current("didNotEditEntry",{error:L,trackerProperty:D}),N(L),f(de("resolved")),Promise.reject(L)}}),[Z,N,n,o,f,i,l]),K=(0,r.useCallback)(()=>tt(void 0,null,function*(){const $=ge(`collection-types/${n}/${o}/actions/unpublish`);f(de("unpublish-pending"));try{v.current("willUnpublishEntry");const{data:D}=yield me.be.post($);return v.current("didUnpublishEntry"),i({type:"success",message:{id:E("success.record.unpublish")}}),f(et(Z(D))),f(de("resolved")),Promise.resolve(D)}catch(D){return f(de("resolved")),N(D),Promise.reject(D)}}),[Z,N,o,n,f,i]);return t({componentsDataStructure:h,contentTypeDataStructure:b,data:C,isCreatingEntry:I,isLoadingForData:k,onDelete:Q,onDeleteSucceeded:_,onPost:V,onPublish:H,onDraftRelationCheck:A,onPut:S,onUnpublish:K,status:P,redirectionLink:O})};$r.defaultProps={id:null,origin:null},$r.propTypes={allLayoutData:s().exact({components:s().object.isRequired,contentType:s().shape({apiID:s().string.isRequired,attributes:s().object.isRequired,info:s().object.isRequired,isDisplayed:s().bool.isRequired,kind:s().string.isRequired,layouts:s().object.isRequired,metadatas:s().object.isRequired,options:s().object.isRequired,pluginOptions:s().object,settings:s().object.isRequired,uid:s().string.isRequired}).isRequired}).isRequired,children:s().func.isRequired,id:s().string,origin:s().string,slug:s().string.isRequired};const zy=(0,r.memo)($r,Je());var Zy=p(86834),Le=p.n(Zy),Wy=p(89793),Ft=p.n(Wy),_y=p(3040),X=p.n(_y),Uy=p(39161),Hy=p(56236),Gy=p.n(Hy),Ky=p(10268),ui=p.n(Ky),Qy=p(86349),Yy=p.n(Qy);const Nr=(e,t,n,o)=>{const a=e.slice();return a.splice(t,1),a.splice(n,0,o),a};var Jy=p(77236),Xy=p.n(Jy);const eh=({browserState:e,serverState:t},n,o)=>{const a=(c,u)=>M()(c,["attributes",u,"type"],""),l=(c,u)=>M()(c,["attributes",...u],""),i=(c,u,d)=>Object.keys(c).reduce((m,g)=>{const f=a(d,g),h=M()(c,g),b=M()(u,g),C=l(d,[g,"component"]),k=l(d,[g,"repeatable"]);let P;switch(f){case"json":P=JSON.parse(h);break;case"time":{P=h,h&&h.split(":").length<3&&(P=`${h}:00`);break}case"media":l(d,[g,"multiple"])===!0?P=h?h.filter(O=>!(O instanceof File)):null:P=M()(h,0)instanceof File?null:M()(h,"id",null);break;case"component":k?P=h&&h.map((O,F)=>i(O,(b!=null?b:[])[F],o[C])):P=h&&i(h,b,o[C]);break;case"relation":{let O=b!=null?b:[];const F=h.reduce((R,I)=>O.find(w=>w.id===I.id)?R:[...R,{id:I.id}],[]);P={disconnect:O.reduce((R,I)=>h.find(w=>w.id===I.id)?R:[...R,{id:I.id}],[]),connect:F};break}case"dynamiczone":P=h.map((O,F)=>i(O,(b!=null?b:[])[F],o[O.__component]));break;default:P=th(h,"id")}return m[g]=P,m},{});return i(e,t,n)},th=(e,t)=>Xy()(e)?e.map(n=>n[t]?n[t]:n):is()(e)?e[t]:e,nh=eh;var rh=p(51355),oh=p.n(rh),sh=p(95919),ah=p.n(sh),ih=p(78746),yt=p.n(ih),he=p(5173);function At(e){return["integer","biginteger","decimal","float","number"].includes(e)}var lh=Object.defineProperty,ch=Object.defineProperties,uh=Object.getOwnPropertyDescriptors,di=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,ph=Object.prototype.propertyIsEnumerable,pi=(e,t,n)=>t in e?lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t)=>{for(var n in t||(t={}))dh.call(t,n)&&pi(e,n,t[n]);if(di)for(var n of di(t))ph.call(t,n)&&pi(e,n,t[n]);return e},fi=(e,t)=>ch(e,uh(t));he.kM(he.nK,"defined",function(){return this.test("defined",y.translatedErrors.required,e=>e!==void 0)}),he.kM(he.IX,"notEmptyMin",function(e){return this.test("notEmptyMin",y.translatedErrors.min,t=>Le()(t)?!0:t.length>=e)}),he.kM(he.Z_,"isInferior",function(e,t){return this.test("isInferior",e,function(n){return!n||Number.isNaN(yt()(n))?!0:yt()(t)>=yt()(n)})}),he.kM(he.Z_,"isSuperior",function(e,t){return this.test("isSuperior",e,function(n){return!n||Number.isNaN(yt()(n))?!0:yt()(n)>=yt()(t)})});const mh=e=>M()(e,["attributes"],{}),Vr=(e,{components:t},n={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const o=mh(e);return he.Ry().shape(Object.keys(o).reduce((a,l)=>{const i=o[l];if(i.type!=="relation"&&i.type!=="component"&&i.type!=="dynamiczone"){const c=fh(i.type,i,n);a[l]=c}if(i.type==="relation"&&(a[l]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(i.relationType)?he.Ry().nullable():he.IX().nullable()),i.type==="component"){const c=Vr(t[i.component],{components:t},fi(mi({},n),{isFromComponent:!0}));if(i.repeatable===!0){const{min:d,max:m,required:g}=i;let f=he.Vo(h=>{let b=he.IX().of(c);return d?g?b=b.min(d,y.translatedErrors.min):g!==!0&&Le()(h)?b=b.nullable():b=b.min(d,y.translatedErrors.min):g&&!n.isDraft&&(b=b.min(1,y.translatedErrors.required)),m&&(b=b.max(m,y.translatedErrors.max)),b});return a[l]=f,a}const u=he.Vo(d=>d!==void 0?i.required===!0&&!n.isDraft?c.defined():c.nullable():i.required===!0?he.Ry().defined():he.Ry().nullable());return a[l]=u,a}if(i.type==="dynamiczone"){let c=he.IX().of(he.Vo(({__component:m})=>Vr(t[m],{components:t},fi(mi({},n),{isFromComponent:!0}))));const{max:u,min:d}=i;d?i.required?c=c.test("min",y.translatedErrors.min,m=>n.isCreatingEntry?m&&m.length>=d:m===void 0?!0:m!==null&&m.length>=d).test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):c=c.notEmptyMin(d):i.required&&!n.isDraft&&(c=c.test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),u&&(c=c.max(u,y.translatedErrors.max)),a[l]=c}return a},{}))},fh=(e,t,n)=>{let o=he.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(e)&&(o=he.Z_()),e==="json"&&(o=he.nK(y.translatedErrors.json).test("isJSON",y.translatedErrors.json,a=>{if(a===void 0)return!0;try{return JSON.parse(a),!0}catch(l){return!1}}).nullable()),e==="email"&&(o=o.email(y.translatedErrors.email)),["number","integer","float","decimal"].includes(e)&&(o=he.Rx().transform(a=>ah()(a)?void 0:a).typeError()),e==="biginteger"&&(o=he.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(e)&&(o=he.hT()),Object.keys(t).forEach(a=>{const l=t[a];if(!!l||!oh()(l)&&Number.isInteger(Math.floor(l))||l===0)switch(a){case"required":{n.isDraft||(e==="password"&&n.isCreatingEntry&&(o=o.required(y.translatedErrors.required)),e!=="password"&&(n.isCreatingEntry?o=o.required(y.translatedErrors.required):o=o.test("required",y.translatedErrors.required,i=>i===void 0&&!n.isFromComponent?!0:At(e)?i===0?!0:!!i:e==="boolean"?i!==null:e==="date"||e==="datetime"?typeof i=="string"?!Le()(i):!Le()(i==null?void 0:i.toString()):!Le()(i))));break}case"max":{e==="biginteger"?o=o.isInferior(y.translatedErrors.max,l):o=o.max(l,y.translatedErrors.max);break}case"maxLength":o=o.max(l,y.translatedErrors.maxLength);break;case"min":{e==="biginteger"?o=o.isSuperior(y.translatedErrors.min,l):o=o.min(l,y.translatedErrors.min);break}case"minLength":{n.isDraft||(o=o.min(l,y.translatedErrors.minLength));break}case"regex":o=o.matches(new RegExp(l),{message:y.translatedErrors.regex,excludeEmptyString:!t.required});break;case"lowercase":["text","textarea","email","string"].includes(e)&&(o=o.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(e)&&(o=o.strict().uppercase());break;case"positive":At(e)&&(o=o.positive());break;case"negative":At(e)&&(o=o.negative());break;default:o=o.nullable()}}),o},gi=Vr,nt=(e,t=()=>!1)=>{const n=o=>Object.entries(o).reduce((a,[l,i])=>{if(t(i)&&(a=[...a,l]),i.type==="component"){const c=e[i.component].attributes,d=n(c).map(m=>`${l}.${m}`);a=[...a,d]}else if(i.type==="dynamiczone"){const u=i.components.flatMap(d=>n({[d]:{type:"component",component:d}}).map(m=>m.split(`${d}.`)[1])).filter(d=>Boolean(d)).map(d=>`${l}.${d}`);a=[...a,u]}return a.flat()},[]);return n},gh=(e,t)=>{const n=(o,a,l,i)=>o&&(e===a&&o[a]!==void 0?(X()(o,a,t),o):(Array.isArray(o[a])&&o[a].forEach(c=>{i.slice(l+1).reduce(n,c)}),o[a]));return n};var yh=Object.defineProperty,hh=Object.defineProperties,bh=Object.getOwnPropertyDescriptors,yi=Object.getOwnPropertySymbols,vh=Object.prototype.hasOwnProperty,Eh=Object.prototype.propertyIsEnumerable,hi=(e,t,n)=>t in e?yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jt=(e,t)=>{for(var n in t||(t={}))vh.call(t,n)&&hi(e,n,t[n]);if(yi)for(var n of yi(t))Eh.call(t,n)&&hi(e,n,t[n]);return e},qr=(e,t)=>hh(e,bh(t));const Ch={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}},Ph=(e,t)=>(0,Ht.default)(e,n=>{switch(t.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:o,allComponents:a}=t,l=nt(a,d=>d.type==="relation")(o.attributes),i=jt({},e.componentsDataStructure[o.uid]),c=nt(a,d=>d.type==="component"&&d.repeatable)(o.attributes),u=l.reduce((d,m)=>{const[g]=m.split(".");return c.includes(g)||X()(d,m,[]),d},i);X()(n,["modifiedData",...t.keys],u);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:o,allComponents:a,componentLayoutData:l,shouldCheckErrors:i}=t;i&&(n.shouldCheckErrors=!e.shouldCheckErrors),t.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(n.modifiedDZName=o[0]);const c=M()(e,["modifiedData",...o],[]),u=t.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?qr(jt({},e.componentsDataStructure[l.uid]),{__component:l.uid}):qr(jt({},e.componentsDataStructure[l.uid]),{__temp_key__:Zo(c)+1}),d=nt(a,h=>h.type==="relation")(l.attributes),m=nt(a,h=>h.type==="component"&&h.repeatable)(l.attributes),g=d.reduce((h,b)=>{const[C]=b.split(".");return m.includes(C)||X()(h,b,[]),h},u),f=Array.isArray(c)?[...c,g]:[g];X()(n,["modifiedData",...o],f);break}case"LOAD_RELATION":{const o=["initialData",...t.keys],a=["modifiedData",...t.keys],{value:l}=t,i=M()(e,o),c=M()(e,a);X()(n,o,ui()([...l,...i],"id")),X()(n,a,ui()([...l,...c],"id"));break}case"CONNECT_RELATION":{const o=["modifiedData",...t.keys],{value:a,toOneRelation:l}=t;if(l)X()(n,o,[a]);else{const c=[...M()(e,o),a];X()(n,o,c)}break}case"DISCONNECT_RELATION":{const o=["modifiedData",...t.keys],{id:a}=t,i=M()(e,[...o]).filter(c=>c.id!==a);X()(n,o,i);break}case"INIT_FORM":{const{initialValues:o,relationalFieldPaths:a=[],componentPaths:l=[],repeatableComponentPaths:i=[],dynamicZonePaths:c=[],setModifiedDataOnly:u}=t,d=Ve()(o),m=a.map(g=>g.split(".")).reduce((g,f)=>{const[h]=f;if(e.modifiedData&&M()(e.modifiedData,h)){const b=Ve()(M()(e.modifiedData,h));X()(g,h,Yy()(b,M()(o,h)))}else if(i.includes(h)||c.includes(h)||l.includes(h)){const b=gh(f.slice(-1)[0],[]);f.reduce(b,g)}else X()(g,f,[]);return g},d);u||(n.initialData=m),n.modifiedData=m,n.formErrors={},n.modifiedDZName=null,n.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_FIELD":{const o=M()(e,["modifiedData",...t.pathToComponent]),a=M()(e,["modifiedData",...t.pathToComponent,t.dragIndex]),l=Nr(o,t.dragIndex,t.hoverIndex,a);X()(n,["modifiedData",...t.pathToComponent],l);break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:o,dynamicZoneName:a,shouldCheckErrors:l}=t;l&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=e.modifiedData[a],c=t.type==="MOVE_COMPONENT_UP"?o-1:o+1,u=e.modifiedData[a][o],d=Nr(i,o,c,u);X()(n,["modifiedData",t.dynamicZoneName],d);break}case"MOVE_FIELD":{const o=M()(e,["modifiedData",...t.keys],[]).slice(),a=M()(e,["modifiedData",...t.keys,t.dragIndex]),l=Nr(o,t.dragIndex,t.overIndex,a);X()(n,["modifiedData",...t.keys],l);break}case"ON_CHANGE":{const[o]=t.keys;if(t.shouldSetInitialValue&&X()(n,["initialData",...t.keys],t.value),t.keys.length===2&&M()(e,["modifiedData",o])===null){X()(n,["modifiedData",o],{[t.keys[1]]:t.value});break}X()(n,["modifiedData",...t.keys],t.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors),n.modifiedData[t.dynamicZoneName].splice(t.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const o=["modifiedData",...t.keys];X()(n,o,null);break}case"REMOVE_PASSWORD_FIELD":{Gy()(n,["modifiedData",...t.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const o=t.keys.length-1,a=["modifiedData",...Bn()(t.keys,o)];Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=M()(e,a).slice();i.splice(parseInt(t.keys[o],10),1),X()(n,a,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{n.componentsDataStructure=t.componentsDataStructure,n.contentTypeDataStructure=t.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{n.modifiedDZName=null,n.formErrors=t.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{n.publishConfirmation=jt({},t.publishConfirmation);break}case"RESET_PUBLISH_CONFIRMATION":{n.publishConfirmation=qr(jt({},e.publishConfirmation),{show:!1});break}default:return n}});var Oh=Object.defineProperty,bi=Object.getOwnPropertySymbols,Rh=Object.prototype.hasOwnProperty,wh=Object.prototype.propertyIsEnumerable,vi=(e,t,n)=>t in e?Oh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,un=(e,t)=>{for(var n in t||(t={}))Rh.call(t,n)&&vi(e,n,t[n]);if(bi)for(var n of bi(t))wh.call(t,n)&&vi(e,n,t[n]);return e},dn=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const Br=({allLayoutData:e,allowedActions:{canRead:t,canUpdate:n},children:o,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:c,initialValues:u,isCreatingEntry:d,isLoadingForData:m,isSingleType:g,onPost:f,onPublish:h,onDraftRelationCheck:b,onPut:C,onUnpublish:k,readActionAllowedFields:P,redirectToPreviousPage:O,slug:F,status:v,updateActionAllowedFields:R})=>{const[I,w]=(0,r.useReducer)(Ph,Ch),{formErrors:U,initialData:Z,modifiedData:N,modifiedDZName:Q,shouldCheckErrors:_,publishConfirmation:V}=I,{setModifiedDataOnly:A}=(0,pe.useSelector)(jr),H=(0,pe.useDispatch)(),S=(0,y.useNotification)(),{lockApp:K,unlockApp:$}=(0,y.useOverlayBlocker)(),D=M()(e,["contentType"],{}),x=(0,r.useMemo)(()=>M()(D,["options","draftAndPublish"],!1),[D]),L=(0,r.useMemo)(()=>x&&!Z.publishedAt,[x,Z.publishedAt]),{trackUsage:G}=(0,y.useTracking)(),{formatMessage:ne}=(0,q.useIntl)(),re=(0,r.useRef)(G),fe=(0,r.useMemo)(()=>m||d?!1:t===!1&&n===!1,[m,d,t,n]);(0,r.useEffect)(()=>{v==="resolved"?$():K()},[K,$,v]),(0,r.useEffect)(()=>{m||$e()},[_]),(0,r.useEffect)(()=>{const ee=Object.keys(U);if(ee.length>0){const te=ee[0],se=document.getElementById(te);se&&se.focus()}},[U]),(0,r.useEffect)(()=>{fe&&S({type:"info",message:{id:E("permissions.not-allowed.update")}})},[fe,S]),(0,r.useEffect)(()=>{w({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]);const{components:W}=e,ue=gs(u);(0,r.useEffect)(()=>{if(u&&(D==null?void 0:D.attributes)&&!Ft()(ue,u)){const ee=nt(W,Ie=>Ie.type==="relation")(D.attributes),te=nt(W,Ie=>Ie.type==="component"&&!Ie.repeatable)(D.attributes),se=nt(W,Ie=>Ie.type==="component"&&Ie.repeatable)(D.attributes),Te=nt(W,Ie=>Ie.type==="dynamiczone")(D.attributes);w({type:"INIT_FORM",initialValues:u,relationalFieldPaths:ee,componentPaths:te,repeatableComponentPaths:se,dynamicZonePaths:Te,setModifiedDataOnly:A}),A&&H(jy())}},[u,D,W,A,H,ue]);const _e=(0,r.useCallback)(ee=>(te,se,Te,Ie=!1)=>{re.current("didAddComponentToDynamicZone"),w({type:ee,keys:te.split("."),componentLayoutData:se,allComponents:Te,shouldCheckErrors:Ie})},[]),ve=_e("ADD_COMPONENT_TO_DYNAMIC_ZONE"),je=(0,r.useCallback)((ee,te,se)=>{w({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:ee.split("."),componentLayoutData:te,allComponents:se})},[]),Be=(0,r.useCallback)(({name:ee,value:te,toOneRelation:se})=>{w({type:"CONNECT_RELATION",keys:ee.split("."),value:te,toOneRelation:se})},[]),Ge=(0,r.useCallback)(({target:{name:ee,value:te}})=>{w({type:"LOAD_RELATION",keys:ee.split("."),value:te})},[]),Ke=_e("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Ee=(0,r.useMemo)(()=>{const ee={isCreatingEntry:d,isDraft:L,isFromComponent:!1};return gi(D,{components:e.components||{}},ee)},[e.components,D,d,L]),$e=(0,r.useCallback)((...ee)=>dn(void 0,[...ee],function*(te={}){let se={};const Te=Ve()(N);Le()(Te)||X()(Te,te.path,te.value);try{yield Ee.validate(Te,{abortEarly:!1})}catch(Ie){se=(0,y.getYupInnerErrors)(Ie),Q&&(se=Object.keys(se).reduce((Wc,Oo)=>(Oo.split(".")[0]!==Q&&(Wc[Oo]=se[Oo]),Wc),{}))}w({type:"SET_FORM_ERRORS",errors:se})}),[Q,N,Ee]),Ct=(0,r.useCallback)(({target:{name:ee,value:te,type:se}},Te=!1)=>{let Ie=te;if(["text","textarea","string","email","uid","select","select-one","number"].includes(se)&&!te&&te!==0&&(Ie=null),se==="password"&&!te){w({type:"REMOVE_PASSWORD_FIELD",keys:ee.split(".")});return}w({type:"ON_CHANGE",keys:ee.split("."),value:Ie,shouldSetInitialValue:Te})},[]),Zc=(0,r.useCallback)((ee,te)=>{const se=Lu(Ve()(ee),"__temp_key__");return nh({browserState:se,serverState:te},D,e.components)},[e.components,D]),Po=(0,r.useMemo)(()=>x?L?{status:"draft"}:{}:{},[x,L]),YC=(0,r.useCallback)(ee=>dn(void 0,null,function*(){return ee.preventDefault(),w({type:"RESET_PUBLISH_CONFIRMATION"})}),[]),JC=(0,r.useCallback)(ee=>dn(void 0,null,function*(){ee.preventDefault();let te={};try{yield Ee.validate(N,{abortEarly:!1})}catch(se){te=(0,y.getYupInnerErrors)(se)}try{if(Le()(te)){const se=Zc(N,Z);d?yield f(se,Po):yield C(se,Po)}}catch(se){te=un(un({},te),(0,y.getAPIInnerErrors)(se,{getTrad:E}))}w({type:"SET_FORM_ERRORS",errors:te})}),[Zc,d,N,Z,f,C,Po,Ee]),XC=(0,r.useCallback)(()=>dn(void 0,null,function*(){const ee=gi(D,{components:M()(e,"components",{})},{isCreatingEntry:d,isDraft:!1,isFromComponent:!1}),te=yield b();if(!V.show&&te>0){w({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:te}});return}w({type:"RESET_PUBLISH_CONFIRMATION"});let se={};try{yield ee.validate(N,{abortEarly:!1})}catch(Te){se=(0,y.getYupInnerErrors)(Te)}try{Le()(se)&&(yield h())}catch(Te){se=un(un({},se),(0,y.getAPIInnerErrors)(Te,{getTrad:E}))}w({type:"SET_FORM_ERRORS",errors:se})}),[e,D,d,N,V.show,h,b]),Pt=(0,r.useCallback)(ee=>{const te=Object.keys(U).some(Te=>Te.split(".")[0]===ee);return!Le()(U)&&te},[U]),eP=(0,r.useCallback)((ee,te)=>{re.current("changeComponentsOrder"),w({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:ee,currentIndex:te,shouldCheckErrors:Pt(ee)})},[Pt]),tP=(0,r.useCallback)((ee,te)=>{re.current("changeComponentsOrder"),w({type:"MOVE_COMPONENT_UP",dynamicZoneName:ee,currentIndex:te,shouldCheckErrors:Pt(ee)})},[Pt]),nP=(0,r.useCallback)((ee,te,se)=>{w({type:"MOVE_COMPONENT_FIELD",pathToComponent:ee,dragIndex:te,hoverIndex:se})},[]),rP=(0,r.useCallback)(({name:ee,id:te})=>{w({type:"DISCONNECT_RELATION",keys:ee.split("."),id:te})},[]),oP=(0,r.useCallback)((ee,te)=>{re.current("removeComponentFromDynamicZone"),w({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:ee,index:te,shouldCheckErrors:Pt(ee)})},[Pt]),sP=(0,r.useCallback)((ee,te)=>{w({type:"REMOVE_COMPONENT_FROM_FIELD",keys:ee.split("."),componentUid:te})},[]),aP=(0,r.useCallback)((ee,te)=>{w({type:"REMOVE_REPEATABLE_FIELD",keys:ee.split("."),componentUid:te})},[]),iP=(0,r.useCallback)(()=>{w({type:"TRIGGER_FORM_VALIDATION"})},[]);return fe?r.createElement(J.Redirect,{to:c}):N?r.createElement(y.ContentManagerEditViewDataManagerContext.Provider,{value:{addComponentToDynamicZone:ve,addNonRepeatableComponentToField:je,connectRelation:Be,addRepeatableComponentToField:Ke,allLayoutData:e,checkFormErrors:$e,createActionAllowedFields:i,formErrors:U,hasDraftAndPublish:x,initialData:Z,isCreatingEntry:d,isSingleType:g,shouldNotRunValidations:L,status:v,layout:D,loadRelation:Ge,modifiedData:N,moveComponentDown:eP,moveComponentField:nP,moveComponentUp:tP,onChange:Ct,onPublish:XC,onUnpublish:k,disconnectRelation:rP,readActionAllowedFields:P,redirectToPreviousPage:O,removeComponentFromDynamicZone:oP,removeComponentFromField:sP,removeRepeatableField:aP,slug:F,triggerFormValidation:iP,updateActionAllowedFields:R,onPublishPromptDismissal:YC,publishConfirmation:V}},m||!d&&!Z.id?r.createElement(Uy.Main,{"aria-busy":"true"},r.createElement(y.LoadingIndicatorPage,null)):r.createElement(r.Fragment,null,r.createElement(J.Prompt,{when:!Ft()(N,Z),message:ne({id:"global.prompt.unsaved"})}),r.createElement("form",{noValidate:!0,onSubmit:JC},o))):null};Br.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},Br.propTypes={allLayoutData:s().object.isRequired,allowedActions:s().object.isRequired,children:s().node.isRequired,componentsDataStructure:s().object.isRequired,contentTypeDataStructure:s().object.isRequired,createActionAllowedFields:s().array.isRequired,from:s().string,initialValues:s().object,isCreatingEntry:s().bool.isRequired,isLoadingForData:s().bool.isRequired,isSingleType:s().bool.isRequired,onPost:s().func.isRequired,onPublish:s().func.isRequired,onDraftRelationCheck:s().func.isRequired,onPut:s().func.isRequired,onUnpublish:s().func.isRequired,readActionAllowedFields:s().array.isRequired,redirectToPreviousPage:s().func,slug:s().string.isRequired,status:s().string.isRequired,updateActionAllowedFields:s().array.isRequired};const Mh=Br,it=e=>ge(`single-types/${e}`),Th=e=>Object.values(e||{}).reduce((t,n)=>Object.assign(t,n),{});var Ih=Object.defineProperty,pn=Object.getOwnPropertySymbols,Ei=Object.prototype.hasOwnProperty,Ci=Object.prototype.propertyIsEnumerable,Pi=(e,t,n)=>t in e?Ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oi=(e,t)=>{for(var n in t||(t={}))Ei.call(t,n)&&Pi(e,n,t[n]);if(pn)for(var n of pn(t))Ci.call(t,n)&&Pi(e,n,t[n]);return e},Dh=(e,t)=>{var n={};for(var o in e)Ei.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&pn)for(var o of pn(e))t.indexOf(o)<0&&Ci.call(e,o)&&(n[o]=e[o]);return n};const Ri=(e={})=>{const t=Oi(Oi({},e),Th(e.plugins)),{plugins:n,_q:o}=t,a=Dh(t,["plugins","_q"]);return o&&X()(a,"_q",encodeURIComponent(o)),`${(0,He.stringify)(a,{encode:!1,addQueryPrefix:!0})}`};var Lh=Object.defineProperty,wi=Object.getOwnPropertySymbols,Sh=Object.prototype.hasOwnProperty,xh=Object.prototype.propertyIsEnumerable,Mi=(e,t,n)=>t in e?Lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kh=(e,t)=>{for(var n in t||(t={}))Sh.call(t,n)&&Mi(e,n,t[n]);if(wi)for(var n of wi(t))xh.call(t,n)&&Mi(e,n,t[n]);return e},lt=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const Ti=({allLayoutData:e,children:t,slug:n})=>{const o=(0,at.useQueryClient)(),{trackUsage:a}=(0,y.useTracking)(),{push:l}=(0,J.useHistory)(),{setCurrentStep:i}=(0,y.useGuidedTour)(),c=(0,r.useRef)(a),[u,d]=(0,r.useState)(!0),[{query:m,rawQuery:g}]=(0,y.useQueryParams)(),f=Ri(m),h=(0,y.useNotification)(),b=(0,pe.useDispatch)(),{componentsDataStructure:C,contentTypeDataStructure:k,data:P,isLoading:O,status:F}=(0,pe.useSelector)(jr),v=(0,r.useCallback)(V=>{const A=Yo(V,e.contentType,e.components);return(0,y.formatContentTypeData)(A,e.contentType,e.components)},[e]);(0,r.useEffect)(()=>()=>{b(ai())},[b]),(0,r.useEffect)(()=>{const V=Object.keys(e.components).reduce((S,K)=>{const $=Zt(M()(e,["components",K,"attributes"],{}),e.components);return S[K]=(0,y.formatContentTypeData)($,e.components[K],e.components),S},{}),A=Zt(e.contentType.attributes,e.components),H=(0,y.formatContentTypeData)(A,e.contentType,e.components);b(ii(V,H))},[e,b]),(0,r.useEffect)(()=>{const A=Ae().CancelToken.source();return(S=>lt(void 0,null,function*(){b(cn()),d(!0);try{const{data:K}=yield me.be.get(it(`${n}${f}`),{cancelToken:S.token});b(Fr(v(K))),d(!1)}catch(K){if(Ae().isCancel(K))return;const $=M()(K,"response.status",null);$===404&&b(Ar(g,!0)),$===403&&(h({type:"info",message:{id:E("permissions.not-allowed.update")}}),l("/"))}}))(A),()=>A.cancel("Operation canceled by the user.")},[v,l,n,b,f,g,h]);const R=(0,r.useCallback)(V=>{const A=V.response.data;let H=M()(A,["error","message"],"Bad Request");Array.isArray(H)&&(H=M()(H,["0","messages","0","id"])),typeof H=="string"&&h({type:"warning",message:H})},[h]),I=(0,r.useCallback)(V=>lt(void 0,null,function*(){try{c.current("willDeleteEntry",V);const{data:A}=yield me.be.delete(it(`${n}${f}`));return h({type:"success",message:{id:E("success.record.delete")}}),c.current("didDeleteEntry",V),Promise.resolve(A)}catch(A){return c.current("didNotDeleteEntry",kh({error:A},V)),R(A),Promise.reject(A)}}),[n,R,h,f]),w=(0,r.useCallback)(()=>{d(!0),b(Ar(g,!0))},[b,g]),U=(0,r.useCallback)((V,A)=>lt(void 0,null,function*(){const H=it(`${n}${g}`);try{b(de("submit-pending"));const{data:S}=yield me.be.put(H,V);return c.current("didCreateEntry",A),h({type:"success",message:{id:E("success.record.save")}}),i("contentManager.success"),o.invalidateQueries(["relation"]),b(et(v(S))),d(!1),b(de("resolved")),Promise.resolve(S)}catch(S){return c.current("didNotCreateEntry",{error:S,trackerProperty:A}),R(S),b(de("resolved")),Promise.reject(S)}}),[v,R,n,b,g,h,i,o]),Z=(0,r.useCallback)(()=>lt(void 0,null,function*(){try{c.current("willCheckDraftRelations");const V=it(`${n}/actions/numberOfDraftRelations`);b(de("draft-relation-check-pending"));const A=yield me.be.get(V);return c.current("didCheckDraftRelations"),b(de("resolved")),A.data.data}catch(V){return R(V),b(de("resolved")),Promise.reject(V)}}),[R,n,b]),N=(0,r.useCallback)(()=>lt(void 0,null,function*(){try{c.current("willPublishEntry");const V=it(`${n}/actions/publish${f}`);b(de("publish-pending"));const{data:A}=yield me.be.post(V);return c.current("didPublishEntry"),h({type:"success",message:{id:E("success.record.publish")}}),b(et(v(A))),b(de("resolved")),Promise.resolve(A)}catch(V){return R(V),b(de("resolved")),Promise.reject(V)}}),[v,R,n,f,b,h]),Q=(0,r.useCallback)((V,A)=>lt(void 0,null,function*(){const H=it(`${n}${g}`);try{c.current("willEditEntry",A),b(de("submit-pending"));const{data:S}=yield me.be.put(H,V);return h({type:"success",message:{id:E("success.record.save")}}),c.current("didEditEntry",{trackerProperty:A}),o.invalidateQueries(["relation"]),b(et(v(S))),b(de("resolved")),Promise.resolve(S)}catch(S){return R(S),c.current("didNotEditEntry",{error:S,trackerProperty:A}),b(de("resolved")),Promise.reject(S)}}),[v,R,n,b,g,h,o]),_=(0,r.useCallback)(()=>lt(void 0,null,function*(){const V=it(`${n}/actions/unpublish${f}`);b(de("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:A}=yield me.be.post(V);c.current("didUnpublishEntry"),h({type:"success",message:{id:E("success.record.unpublish")}}),b(et(v(A))),b(de("resolved"))}catch(A){b(de("resolved")),R(A)}}),[v,h,R,n,b,f]);return t({componentsDataStructure:C,contentTypeDataStructure:k,data:P,isCreatingEntry:u,isLoadingForData:O,onDelete:I,onDeleteSucceeded:w,onPost:U,onDraftRelationCheck:Z,onPublish:N,onPut:Q,onUnpublish:_,redirectionLink:"/",status:F})};Ti.propTypes={allLayoutData:s().shape({components:s().object.isRequired,contentType:s().object.isRequired}).isRequired,children:s().func.isRequired,slug:s().string.isRequired};const Fh=(0,r.memo)(Ti);var Ah=p(56243),jh=Object.defineProperty,Ii=Object.getOwnPropertySymbols,$h=Object.prototype.hasOwnProperty,Nh=Object.prototype.propertyIsEnumerable,Di=(e,t,n)=>t in e?jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t)=>{for(var n in t||(t={}))$h.call(t,n)&&Di(e,n,t[n]);if(Ii)for(var n of Ii(t))Nh.call(t,n)&&Di(e,n,t[n]);return e};function Vh(e,t){return n=>{const o=t();return r.createElement(e,Li(Li({},n),o))}}const qh=Vh;function Bh(){const{initialData:e,hasDraftAndPublish:t}=(0,y.useCMEditViewDataManager)(),n=e.publishedAt!==void 0&&e.publishedAt!==null;return{hasDraftAndPublish:t,isPublished:n}}const zh=Bh;var Zh=Object.defineProperty,Si=Object.getOwnPropertySymbols,Wh=Object.prototype.hasOwnProperty,_h=Object.prototype.propertyIsEnumerable,xi=(e,t,n)=>t in e?Zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uh=(e,t)=>{for(var n in t||(t={}))Wh.call(t,n)&&xi(e,n,t[n]);if(Si)for(var n of Si(t))_h.call(t,n)&&xi(e,n,t[n]);return e};const Hh=(0,j.default)(Ah.default)`
1011
+ width: ${(0,y.pxToRem)(6)};
1012
+ height: ${(0,y.pxToRem)(6)};
1013
+ * {
1014
+ fill: ${({theme:e,$bulletColor:t})=>e.colors[t]};
1015
+ }
1016
+ `,ki=({hasDraftAndPublish:e,isPublished:t})=>{const{formatMessage:n}=(0,q.useIntl)();if(!e)return null;const o={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=t?o.published:o.draft;return r.createElement(T.x,Uh({hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5},a.box),r.createElement(T.x,{as:B.k},r.createElement(Hh,{$bulletColor:a.bulletColor}),r.createElement(T.x,{paddingLeft:3},r.createElement(z.Z,{textColor:a.textColor},n({id:E("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),r.createElement(z.Z,{fontWeight:"bold",textColor:a.textColor},t&&n({id:E("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!t&&n({id:E("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};ki.propTypes={hasDraftAndPublish:s().bool.isRequired,isPublished:s().bool.isRequired};const Gh=qh(ki,zh);var zr=p(9026);const Zr=60*1e3,Wr=Zr*60,mn=Wr*24,Fi=mn*30,Ai=mn*365,Kh=e=>e<Zr?{unit:"second",value:-Math.round(e/1e3)}:e<Wr?{unit:"minute",value:-Math.round(e/Zr)}:e<mn?{unit:"hour",value:-Math.round(e/Wr)}:e<Fi?{unit:"day",value:-Math.round(e/mn)}:e<Ai?{unit:"month",value:-Math.round(e/Fi)}:{unit:"year",value:-Math.round(e/Ai)};var ji=p(64421);const Qh=()=>{const{formatMessage:e,formatRelativeTime:t}=(0,q.useIntl)(),{initialData:n,isCreatingEntry:o}=(0,y.useCMEditViewDataManager)(),a=(0,r.useRef)(Date.now()),l=(u,d)=>{var m,g,f;const h=((m=n[d])==null?void 0:m.firstname)||"",b=((g=n[d])==null?void 0:g.lastname)||"",k=((f=n[d])==null?void 0:f.username)||(0,ji.Pp)(h,b),O=(n[u]?new Date(n[u]).getTime():Date.now())-a.current,{unit:F,value:v}=Kh(-O);return{at:t(v,F,{numeric:"auto"}),by:o?"-":k}},i=l("updatedAt","updatedBy"),c=l("createdAt","createdBy");return r.createElement(T.x,null,r.createElement(z.Z,{variant:"sigma",textColor:"neutral600",id:"additional-informations"},e({id:E("containers.Edit.information"),defaultMessage:"Information"})),r.createElement(T.x,{paddingTop:2,paddingBottom:6},r.createElement(zr.i,null)),r.createElement(ie.K,{spacing:4},r.createElement(B.k,{justifyContent:"space-between"},r.createElement(z.Z,{fontWeight:"bold"},e({id:E("containers.Edit.information.created"),defaultMessage:"Created"})),r.createElement(z.Z,null,c.at)),r.createElement(B.k,{justifyContent:"space-between"},r.createElement(z.Z,{fontWeight:"bold"},e({id:E("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(z.Z,null,c.by)),r.createElement(B.k,{justifyContent:"space-between"},r.createElement(z.Z,{fontWeight:"bold"},e({id:E("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"})),r.createElement(z.Z,null,i.at)),r.createElement(B.k,{justifyContent:"space-between"},r.createElement(z.Z,{fontWeight:"bold"},e({id:E("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(z.Z,null,i.by))))};var fn=p(29439),gn=p(22342),yn=p(96166),hn=p(88693),ht=p(66456),Yh=Object.defineProperty,$i=Object.getOwnPropertySymbols,Jh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Ni=(e,t,n)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vi=(e,t)=>{for(var n in t||(t={}))Jh.call(t,n)&&Ni(e,n,t[n]);if($i)for(var n of $i(t))Xh.call(t,n)&&Ni(e,n,t[n]);return e};function eb(e,t){return n=>{const o=t();return r.createElement(e,Vi(Vi({},n),o))}}const tb=eb;function nb(){const{initialData:e,isCreatingEntry:t,isSingleType:n,status:o,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:u,publishConfirmation:d,onPublishPromptDismissal:m}=(0,y.useCMEditViewDataManager)();return{initialData:e,isCreatingEntry:t,isSingleType:n,status:o,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:u,publishConfirmation:d,onPublishPromptDismissal:m}}const rb=nb,qi=(0,j.default)(B.k)`
1017
+ text-align: center;
1018
+ `,Bi=({allowedActions:{canUpdate:e,canCreate:t,canPublish:n},initialData:o,isCreatingEntry:a,isSingleType:l,hasDraftAndPublish:i,layout:c,modifiedData:u,onPublish:d,onUnpublish:m,status:g,publishConfirmation:{show:f,draftCount:h},onPublishPromptDismissal:b})=>{const{goBack:C}=(0,J.useHistory)(),[k,P]=(0,r.useState)(!1),{formatMessage:O}=(0,q.useIntl)(),F=M()(c,["settings","mainField"],"id"),v=M()(c,["info","displayName"],"NOT FOUND"),R=!Ft()(o,u)||a&&!Le()(u);let w=O({id:E("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!a&&!l&&(w=o[F]||v),l&&(w=v);let U=null;if(a&&t&&(U=r.createElement(ie.K,{horizontal:!0,spacing:2},i&&r.createElement(ye.z,{disabled:!0,startIcon:r.createElement(ht.Z,null),variant:"secondary"},O({id:"app.utils.publish",defaultMessage:"Publish"})),r.createElement(ye.z,{disabled:!R,isLoading:g==="submit-pending",type:"submit"},O({id:E("containers.Edit.submit"),defaultMessage:"Save"})))),!a&&e){const _=i&&n,V=!Le()(o.publishedAt),A=V?g==="unpublish-pending":g==="publish-pending",H=V?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},S=V?()=>P(!0):()=>d();U=r.createElement(B.k,null,_&&r.createElement(ye.z,{disabled:R,loading:A,onClick:S,startIcon:r.createElement(ht.Z,null),variant:"secondary"},O(H)),r.createElement(T.x,{paddingLeft:_?2:0},r.createElement(ye.z,{disabled:!R,loading:g==="submit-pending",type:"submit"},O({id:E("containers.Edit.submit"),defaultMessage:"Save"}))))}const Z=()=>P(_=>!_),N=()=>{Z(),m()},Q=`${O({id:E("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return r.createElement(r.Fragment,null,r.createElement(oe.T,{title:w.toString(),primaryAction:U,subtitle:Q,navigationAction:r.createElement(y.Link,{startIcon:r.createElement(fn.Z,null),onClick:_=>{_.preventDefault(),C()},to:"/"},O({id:"global.back",defaultMessage:"Back"}))}),r.createElement(gn.V,{onClose:Z,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:k},r.createElement(yn.a,{icon:r.createElement(Lt.default,null)},r.createElement(ie.K,{spacing:2},r.createElement(B.k,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(z.Z,{id:"confirm-description"},O({id:E("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>r.createElement("br",null)}))),r.createElement(B.k,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(z.Z,{id:"confirm-description"},O({id:E("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),r.createElement(hn.c,{startAction:r.createElement(ye.z,{onClick:Z,variant:"tertiary"},O({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.z,{variant:"danger-light",onClick:N},O({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),r.createElement(gn.V,{onClose:b,title:O({id:E("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:f},r.createElement(yn.a,{icon:r.createElement(Lt.default,null)},r.createElement(ie.K,{spacing:2},r.createElement(qi,{justifyContent:"center"},r.createElement(z.Z,{id:"confirm-description"},h,O({id:E("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:_=>r.createElement(z.Z,{fontWeight:"bold"},_),count:h}))),r.createElement(qi,{justifyContent:"center"},r.createElement(z.Z,{id:"confirm-description"},O({id:E("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),r.createElement(hn.c,{startAction:r.createElement(ye.z,{onClick:b,variant:"tertiary"},O({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.z,{variant:"success",onClick:d},O({id:E("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};Bi.propTypes={allowedActions:s().shape({canUpdate:s().bool.isRequired,canCreate:s().bool.isRequired,canPublish:s().bool.isRequired}).isRequired,initialData:s().object.isRequired,isCreatingEntry:s().bool.isRequired,isSingleType:s().bool.isRequired,status:s().string.isRequired,layout:s().object.isRequired,hasDraftAndPublish:s().bool.isRequired,modifiedData:s().object.isRequired,onPublish:s().func.isRequired,onUnpublish:s().func.isRequired,publishConfirmation:s().shape({show:s().bool.isRequired,draftCount:s().number.isRequired}).isRequired,onPublishPromptDismissal:s().func.isRequired};const ob=(0,r.memo)(Bi,Je()),sb=tb(ob,rb),ab=e=>{if(!e.layouts)return[];const t=e.layouts.edit,n=e.attributes,o=i=>(0,Y.get)(n,[i,"type"],"");let a=0;const l=[];return t.forEach(i=>{const c=i.some(({name:u})=>o(u)==="dynamiczone");l[a]||(l[a]=[]),c?(a=a===0&&(0,Y.isEmpty)(l[0])?0:a+1,l[a]||(l[a]=[]),l[a].push(i),a+=1):l[a].push(i)}),l.filter(i=>i.length>0)},ib=(e,t)=>{const n=o=>{const a=(0,y.findMatchingPermissions)(e,[{action:`plugin::content-manager.explorer.${o}`,subject:t}]);return(0,Y.uniq)((0,Y.flatMap)(a,"properties.fields"))};return{createActionAllowedFields:n("create"),readActionAllowedFields:n("read"),updateActionAllowedFields:n("update")}},lb=e=>{if(!e)return[];const n=[...e.contentType.layouts.edit,...Object.values(e.components).flatMap(a=>a.layouts.edit)].flat().filter(a=>a.fieldSchema.customField).map(a=>a.fieldSchema.customField);return[...new Set(n)]};var cb=Object.defineProperty,zi=Object.getOwnPropertySymbols,ub=Object.prototype.hasOwnProperty,db=Object.prototype.propertyIsEnumerable,Zi=(e,t,n)=>t in e?cb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wi=(e,t)=>{for(var n in t||(t={}))ub.call(t,n)&&Zi(e,n,t[n]);if(zi)for(var n of zi(t))db.call(t,n)&&Zi(e,n,t[n]);return e};function pb(e,t){return n=>{const o=t();return r.createElement(e,Wi(Wi({},n),o))}}const mb=pb;function fb(){const{hasDraftAndPublish:e,modifiedData:t}=(0,y.useCMEditViewDataManager)();let n={};return e&&(n=(0,Y.isEmpty)(t.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:e,trackerProperty:n}}const gb=fb;var yb=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const _i=({isCreatingEntry:e,onDelete:t,onDeleteSucceeded:n,trackerProperty:o})=>{const[a,l]=(0,r.useState)(!1),[i,c]=(0,r.useState)(!1),{formatMessage:u}=(0,q.useIntl)(),d=(0,y.useNotification)(),m=()=>l(f=>!f),g=()=>yb(void 0,null,function*(){try{c(!0),yield t(o),c(!1),m(),n()}catch(f){const h=M()(f,"response.payload.message",u({id:E("error.record.delete")}));c(!1),m(),d({type:"warning",message:h})}});return e?null:r.createElement(r.Fragment,null,r.createElement(ye.z,{onClick:m,size:"S",startIcon:r.createElement(ze.default,null),variant:"danger-light"},u({id:E("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),r.createElement(y.ConfirmDialog,{isConfirmButtonLoading:i,isOpen:a,onConfirm:g,onToggleDialog:m}))};_i.propTypes={isCreatingEntry:s().bool.isRequired,onDelete:s().func.isRequired,onDeleteSucceeded:s().func.isRequired,trackerProperty:s().object.isRequired};const hb=(0,r.memo)(_i,Je()),bb=mb(hb,gb),_r=({columns:e,customFieldInputs:t})=>r.createElement(qe.r,{gap:4},e.map(({fieldSchema:n,labelAction:o,metadatas:a,name:l,size:i,queryInfos:c})=>{if(n.type==="component"){const{component:d,max:m,min:g,repeatable:f=!1,required:h=!1}=n;return r.createElement(Ce.P,{col:i,s:12,xs:12,key:d},r.createElement(ln,{componentUid:d,labelAction:o,isRepeatable:f,intlLabel:{id:a.label,defaultMessage:a.label},max:m,min:g,name:l,required:h}))}return r.createElement(Ce.P,{col:i,key:l,s:12,xs:12},r.createElement(yr,{size:i,fieldSchema:n,keys:l,labelAction:o,metadatas:a,queryInfos:c,customFieldInputs:t}))}));_r.defaultProps={customFieldInputs:{}},_r.propTypes={columns:s().array.isRequired,customFieldInputs:s().object};const vb=_r,Ur=e=>e["content-manager_editViewLayoutManager"].currentLayout,Eb=(0,It.P1)(Ur,e=>{var t;return ab((t=e==null?void 0:e.contentType)!=null?t:{})}),Cb=(0,It.P1)(Ur,e=>lb(e)),Ui=ce.Z.contentManager,Pb=[{action:"plugin::content-type-builder.read",subject:null}],Hr=({allowedActions:e,isSingleType:t,goBack:n,slug:o,id:a,origin:l,userPermissions:i})=>{const{trackUsage:c}=(0,y.useTracking)(),{formatMessage:u}=(0,q.useIntl)(),{layout:d,formattedContentTypeLayout:m,customFieldUids:g}=(0,pe.useSelector)(R=>({layout:Ur(R),formattedContentTypeLayout:Eb(R),customFieldUids:Cb(R)})),{isLazyLoading:f,lazyComponentStore:h}=hr(g),{createActionAllowedFields:b,readActionAllowedFields:C,updateActionAllowedFields:k}=ib(i,o),P=t?Ui.singleTypesConfigurations:Ui.collectionTypesConfigurations,O=`/content-manager/${t?"singleType":"collectionType"}/${o}/configurations/edit`,F=t?Fh:zy,v=R=>R.every(I=>I.every(w=>w.fieldSchema.type==="dynamiczone"));return f?r.createElement(y.LoadingIndicatorPage,null):r.createElement(F,{allLayoutData:d,slug:o,id:a,origin:l},({componentsDataStructure:R,contentTypeDataStructure:I,data:w,isCreatingEntry:U,isLoadingForData:Z,onDelete:N,onDeleteSucceeded:Q,onPost:_,onPublish:V,onDraftRelationCheck:A,onPut:H,onUnpublish:S,redirectionLink:K,status:$})=>r.createElement(Mh,{allowedActions:e,allLayoutData:d,createActionAllowedFields:b,componentsDataStructure:R,contentTypeDataStructure:I,from:K,initialValues:w,isCreatingEntry:U,isLoadingForData:Z,isSingleType:t,onPost:_,onPublish:V,onDraftRelationCheck:A,onPut:H,onUnpublish:S,readActionAllowedFields:C,redirectToPreviousPage:n,slug:o,status:$,updateActionAllowedFields:k},r.createElement(be.o,{"aria-busy":$!=="resolved"},r.createElement(sb,{allowedActions:e}),r.createElement(mt.D,null,r.createElement(qe.r,{gap:4},r.createElement(Ce.P,{col:9,s:12},r.createElement(ie.K,{spacing:6},m.map((D,x)=>{if(v(D)){const{0:{0:{name:L,fieldSchema:G,metadatas:ne,labelAction:re}}}=D;return r.createElement(T.x,{key:x},r.createElement(qe.r,{gap:4},r.createElement(Ce.P,{col:12,s:12,xs:12},r.createElement(Ay,{name:L,fieldSchema:G,labelAction:re,metadatas:ne}))))}return r.createElement(T.x,{key:x,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},r.createElement(ie.K,{spacing:6},D.map((L,G)=>r.createElement(vb,{columns:L,customFieldInputs:h,key:G}))))}))),r.createElement(Ce.P,{col:3,s:12},r.createElement(ie.K,{spacing:2},r.createElement(Gh,null),r.createElement(T.x,{as:"aside","aria-labelledby":"additional-informations",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},r.createElement(Qh,null),r.createElement(Yt,{area:"contentManager.editView.informations"})),r.createElement(T.x,{as:"aside","aria-labelledby":"links"},r.createElement(ie.K,{spacing:2},r.createElement(Yt,{area:"contentManager.editView.right-links",slug:o}),o!=="strapi::administrator"&&r.createElement(y.CheckPermissions,{permissions:Pb},r.createElement(y.LinkButton,{onClick:()=>{c("willEditEditLayout")},size:"S",startIcon:r.createElement(pt.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${o}`,variant:"secondary"},u({id:E("link-to-ctb"),defaultMessage:"Edit the model"}))),r.createElement(y.CheckPermissions,{permissions:P},r.createElement(y.LinkButton,{size:"S",startIcon:r.createElement(yd.Z,null),style:{width:"100%"},to:O,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),e.canDelete&&r.createElement(bb,{isCreatingEntry:U,onDelete:N,onDeleteSucceeded:Q}))))))))))};Hr.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},Hr.propTypes={allowedActions:s().shape({canRead:s().bool.isRequired,canUpdate:s().bool.isRequired,canCreate:s().bool.isRequired,canDelete:s().bool.isRequired}).isRequired,id:s().string,isSingleType:s().bool,goBack:s().func.isRequired,origin:s().string,slug:s().string.isRequired,userPermissions:s().array};const Ob=(0,r.memo)(Hr);var Rb=Object.defineProperty,wb=Object.defineProperties,Mb=Object.getOwnPropertyDescriptors,Hi=Object.getOwnPropertySymbols,Tb=Object.prototype.hasOwnProperty,Ib=Object.prototype.propertyIsEnumerable,Gi=(e,t,n)=>t in e?Rb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Db=(e,t)=>{for(var n in t||(t={}))Tb.call(t,n)&&Gi(e,n,t[n]);if(Hi)for(var n of Hi(t))Ib.call(t,n)&&Gi(e,n,t[n]);return e},Lb=(e,t)=>wb(e,Mb(t));const Gr=e=>{const t=(0,r.useMemo)(()=>Bo(e.slug),[e.slug]),{isLoading:n,allowedActions:o}=(0,y.useRBAC)(t,e.userPermissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Ob,Lb(Db({},e),{allowedActions:o}))};Gr.defaultProps={permissions:[]},Gr.propTypes={permissions:s().array,slug:s().string.isRequired,userPermissions:s().array.isRequired};const Sb=(0,r.memo)(Gr,Je());var xb=Object.defineProperty,kb=Object.defineProperties,Fb=Object.getOwnPropertyDescriptors,bn=Object.getOwnPropertySymbols,Ki=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,Yi=(e,t,n)=>t in e?xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ab=(e,t)=>{for(var n in t||(t={}))Ki.call(t,n)&&Yi(e,n,t[n]);if(bn)for(var n of bn(t))Qi.call(t,n)&&Yi(e,n,t[n]);return e},jb=(e,t)=>kb(e,Fb(t)),$b=(e,t)=>{var n={};for(var o in e)Ki.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&bn)for(var o of bn(e))t.indexOf(o)<0&&Qi.call(e,o)&&(n[o]=e[o]);return n};const Ji=e=>{var t=e,{layout:n}=t,o=$b(t,["layout"]);const a=(0,pe.useSelector)(So),l=(0,pe.useDispatch)(),[{query:i}]=(0,y.useQueryParams)(),{runHookWaterfall:c}=(0,y.useStrapiApp)(),u=fs(i,o.slug,"editView");return(0,r.useEffect)(()=>{const d=c(Kt.Eo,{layout:n,query:i});return l(fd(d.layout,i)),()=>{l(md())}},[n,l,i,c]),!a||!u?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Sb,jb(Ab({},o),{userPermissions:u}))};Ji.propTypes={layout:s().shape({components:s().object.isRequired,contentType:s().shape({uid:s().string.isRequired,settings:s().object.isRequired,metadatas:s().object.isRequired,options:s().object.isRequired,attributes:s().object.isRequired}).isRequired}).isRequired};const vn=Ji;var Nb=p(23940),$t=p.n(Nb),Vb=p(3704),qb=p.n(Vb),Bb=Object.defineProperty,zb=Object.defineProperties,Zb=Object.getOwnPropertyDescriptors,Xi=Object.getOwnPropertySymbols,Wb=Object.prototype.hasOwnProperty,_b=Object.prototype.propertyIsEnumerable,el=(e,t,n)=>t in e?Bb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ub=(e,t)=>{for(var n in t||(t={}))Wb.call(t,n)&&el(e,n,t[n]);if(Xi)for(var n of Xi(t))_b.call(t,n)&&el(e,n,t[n]);return e},Hb=(e,t)=>zb(e,Zb(t));const Kr=e=>e.reduce((t,n)=>t+n.size,0),Gb=e=>e.reduce((t,n,o)=>{const a={rowId:o,rowContent:n};return t.concat(a)},[]),bt=e=>e.reduce((t,n)=>{let o=[];const a=n.rowContent.reduce((c,u)=>{const d=Kr(c);return u.name==="_TEMP_"||(d+u.size<=12?c.push(u):o.push(u)),c},[]),l=t.length===0?0:Math.max.apply(Math,t.map(c=>c.rowId))+1,i=Kr(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),t.push({rowId:l,rowContent:a}),o.length>0){const c=Kr(o);c<12&&o.push({name:"_TEMP_",size:12-c}),t.push({rowId:l+1,rowContent:o}),o=[]}return t},[]).filter(t=>t.rowContent.length>0).filter(t=>t.rowContent.length===1?t.rowContent[0].name!=="_TEMP_":!0),Kb=e=>e.reduce((t,n)=>{const o=n.rowContent.filter(a=>a.name!=="_TEMP_");return t.concat([o])},[]),tl=e=>{switch(e){case"boolean":case"date":case"integer":case"float":case"biginteger":case"decimal":case"time":return 4;case"json":case"component":case"richtext":case"dynamiczone":return 12;default:return 6}},Qb=(e,t=[])=>t.reduce((n,{rowContent:o})=>{var a,l;const i=(l=(a=o.find(c=>c.name===e))==null?void 0:a.size)!=null?l:null;return i&&(n=i),n},null),Yb=(e,t,n=[])=>n.map(o=>(o.rowContent=o.rowContent.map(a=>a.name===e?Hb(Ub({},a),{size:t}):a),o)),Qr={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}},Jb=(e=Qr,t)=>(0,Ht.default)(e,n=>{var o,a,l;const i=["modifiedData","layouts","edit"];switch(t.type){case"MOVE_ROW":{const c=M()(e,i,[]),{fromIndex:u,toIndex:d}=t;X()(n,i,zt(c,u,d));break}case"ON_ADD_FIELD":{const c=Ve()(e),u=tl(M()(c,["modifiedData","attributes",t.name,"type"],"")),d=M()(c,i,[]).length,m=[...i,d-1,"rowContent"],g=M()(c,m,[]);let f=M()(c,i,[]);Array.isArray(g)?X()(f,[d>0?d-1:0,"rowContent"],[...g,{name:t.name,size:u}]):X()(f,[d>0?d-1:0,"rowContent"],[{name:t.name,size:u}]);const h=bt(f);X()(n,i,h);break}case"ON_CHANGE":{X()(n,["modifiedData",...t.keys],t.value);break}case"ON_CHANGE_META":{X()(n,["metaForm","metadata",...t.keys],t.value);break}case"ON_CHANGE_SIZE":{X()(n,["metaForm","size"],t.value);break}case"ON_RESET":{n.modifiedData=e.initialData;break}case"REMOVE_FIELD":{const c=M()(e,[...i,t.rowIndex,"rowContent"],[]);let u=Ve()(e);if(c.length===1||c.length===2&&M()(c,[1,"name"],"")==="_TEMP_"){const m=M()(e,i,[]);X()(u,i,m.filter((g,f)=>t.rowIndex!==f))}else X()(u,[...i,t.rowIndex,"rowContent"],c.filter((m,g)=>g!==t.fieldIndex));const d=bt(M()(u,i,[]));X()(n,i,d);break}case"REORDER_DIFF_ROW":{const c=M()(e,[...i,t.dragRowIndex,"rowContent"],[]),u=M()(e,[...i,t.hoverRowIndex,"rowContent"],[]),d=M()(e,[...i,t.dragRowIndex,"rowContent",t.dragIndex],{}),m=[...u,d];let g=Ve()(e);X()(g,[...i,t.dragRowIndex,"rowContent"],c.filter((h,b)=>t.dragIndex!==b)),X()(g,[...i,t.hoverRowIndex,"rowContent"],zt(m,m.length-1,t.hoverIndex));const f=bt(M()(g,i,[]));X()(n,i,f);break}case"REORDER_ROW":{const c=Ve()(e),u=M()(c,[...i,t.dragRowIndex,"rowContent"],[]);X()(c,[...i,t.dragRowIndex,"rowContent"],zt(u,t.dragIndex,t.hoverIndex));const d=bt(M()(c,i,[]));X()(n,i,d);break}case"SET_FIELD_TO_EDIT":{n.metaToEdit=t.name,n.metaForm={metadata:M()(e,["modifiedData","metadatas",t.name,"edit"],{}),size:(l=Qb(t.name,(a=(o=e.modifiedData)==null?void 0:o.layouts)==null?void 0:a.edit))!=null?l:tl()};break}case"SUBMIT_META_FORM":{X()(n,["modifiedData","metadatas",e.metaToEdit,"edit"],e.metaForm.metadata);const c=Ve()(M()(e,i,[])),u=Yb(e.metaToEdit,e.metaForm.size,c);u.length>0&&X()(n,i,bt(u));break}case"SUBMIT_SUCCEEDED":{n.initialData=e.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{n.metaToEdit="",n.metaForm={};break}default:return n}});var Xb=Object.defineProperty,e0=Object.defineProperties,t0=Object.getOwnPropertyDescriptors,nl=Object.getOwnPropertySymbols,n0=Object.prototype.hasOwnProperty,r0=Object.prototype.propertyIsEnumerable,rl=(e,t,n)=>t in e?Xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o0=(e,t)=>{for(var n in t||(t={}))n0.call(t,n)&&rl(e,n,t[n]);if(nl)for(var n of nl(t))r0.call(t,n)&&rl(e,n,t[n]);return e},s0=(e,t)=>e0(e,t0(t));const a0=(e,t,n)=>{let o=(0,Y.cloneDeep)(t);return(0,Y.set)(o,["layouts","edit"],bt(Gb(t.layouts.edit))),s0(o0({},e),{initialData:o,modifiedData:o,componentLayouts:n})};var We=p(34853),ol=p(45112);const sl=({componentUid:e})=>{const{componentLayouts:t}=ot(),{formatMessage:n}=(0,q.useIntl)(),o=M()(t,[e],{}),a=M()(o,["layouts","edit"],[]);return r.createElement(T.x,{padding:3},a.map((l,i)=>r.createElement(qe.r,{gap:4,key:i},l.map(c=>r.createElement(Ce.P,{key:c.name,col:c.size},r.createElement(T.x,{paddingTop:2},r.createElement(B.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},r.createElement(z.Z,{textColor:"neutral800"},c.name))))))),r.createElement(T.x,{paddingTop:2},r.createElement(y.Link,{startIcon:r.createElement(ol.Z,null),to:`/content-manager/components/${e}/configurations/edit`},n({id:E("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};sl.propTypes={componentUid:s().string.isRequired};const i0=sl,al=(0,j.default)(B.k)`
1019
+ border-radius: 50%;
1020
+ svg {
1021
+ & > * {
1022
+ fill: ${({theme:e})=>e.colors.neutral500};
1023
+ }
1024
+ width: 12px;
1025
+ height: 12px;
1026
+ }
1027
+ `,l0=(0,j.default)(B.k)`
1028
+ text-decoration: none;
1029
+ &:hover {
1030
+ ${({theme:e})=>`
1031
+ background: ${e.colors.primary100};
1032
+ svg {
1033
+ & > * {
1034
+ fill: ${e.colors.primary600};
1035
+ }
1036
+ }
1037
+ ${z.Z} {
1038
+ color: ${e.colors.primary600};
1039
+ }
1040
+ ${al} {
1041
+ background: ${e.colors.primary200};
1042
+ }
1043
+ border-color: ${e.colors.primary200};
1044
+ `}
1045
+ }
1046
+ `,il=({components:e})=>{const{componentLayouts:t}=ot();return r.createElement(ie.K,{spacing:2,horizontal:!0,overflow:"scroll hidden",padding:3},e.map(n=>r.createElement(l0,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:n,padding:2,direction:"column",borderColor:"neutral200",as:J.Link,to:`/content-manager/components/${n}/configurations/edit`},r.createElement(al,{width:`${32/16}rem`,height:`${32/16}rem`,background:"neutral150",justifyContent:"center",alignItems:"center",padding:2},r.createElement(jn.G,{icon:M()(t,[n,"info","icon"],"")})),r.createElement(T.x,{paddingTop:1},r.createElement(z.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},M()(t,[n,"info","displayName"],""))))))};il.propTypes={components:s().arrayOf(s().string).isRequired};const c0=il,ll=(0,j.default)(Re.h)`
1047
+ background-color: transparent;
1048
+ path {
1049
+ fill: ${({theme:e})=>e.colors.neutral600};
1050
+ }
1051
+ `,Yr=({attribute:e,onEditField:t,onDeleteField:n,children:o})=>{const{formatMessage:a}=(0,q.useIntl)();return r.createElement(T.x,{overflow:"hidden",width:"100%"},r.createElement(B.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},r.createElement(z.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},o),r.createElement(B.k,null,r.createElement(ll,{label:a({id:E("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:o}),onClick:t,icon:r.createElement(pt.Z,null),noBorder:!0}),r.createElement(ll,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:o}),"data-testid":"delete-field",onClick:n,icon:r.createElement(ze.default,null),noBorder:!0}))),(e==null?void 0:e.type)==="component"&&r.createElement(i0,{componentUid:e.component}),(e==null?void 0:e.type)==="dynamiczone"&&r.createElement(c0,{components:e.components}))};Yr.defaultProps={attribute:void 0},Yr.propTypes={attribute:s().shape({components:s().array,component:s().string,type:s().string}),onEditField:s().func.isRequired,onDeleteField:s().func.isRequired,children:s().string.isRequired};const u0=Yr,d0=(0,j.default)(B.k)`
1052
+ position: relative;
1053
+ ${({isFirst:e,isLast:t,hasHorizontalPadding:n})=>e?`
1054
+ padding-right: 4px;
1055
+ `:t?`
1056
+ padding-left: 4px;
1057
+ `:n?`
1058
+ padding: 0 4px;
1059
+ `:""}
1060
+ ${({showRightCarret:e,showLeftCarret:t,theme:n})=>e?`
1061
+ &:after {
1062
+ content: '';
1063
+ position: absolute;
1064
+ right: -1px;
1065
+ background-color: ${n.colors.primary600};
1066
+ width: 2px;
1067
+ height: 100%;
1068
+ align-self: stretch;
1069
+ z-index: 1;
1070
+ }
1071
+ `:t?`
1072
+ &:before {
1073
+ content: '';
1074
+ position: absolute;
1075
+ left: -1px;
1076
+ background-color: ${n.colors.primary600};
1077
+ width: 2px;
1078
+ height: 100%;
1079
+ align-self: stretch;
1080
+ z-index: 1;
1081
+ }
1082
+ `:""};
1083
+ `,p0=(0,j.default)(dt.Z)`
1084
+ height: ${12/16}rem;
1085
+ width: ${12/16}rem;
1086
+ path {
1087
+ fill: ${({theme:e})=>e.colors.neutral600};
1088
+ }
1089
+ `,m0=(0,j.default)(B.k)`
1090
+ display: ${({dragStart:e})=>e?"none":"flex"};
1091
+ opacity: ${({isDragging:e,isFullSize:t,isHidden:n})=>e&&!t?.2:e&&t||n?0:1};
1092
+ `,f0=(0,j.default)(B.k)`
1093
+ cursor: all-scroll;
1094
+ border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
1095
+ `,Jr=({attribute:e,children:t,index:n,lastIndex:o,moveItem:a,moveRow:l,name:i,onDeleteField:c,onEditField:u,rowIndex:d,size:m})=>{const[g,f]=(0,r.useState)(!1),h=i==="_TEMP_",{setIsDraggingSibling:b}=ot(),C=m===12,k=(0,r.useRef)(null),P=(0,r.useRef)(null),[{clientOffset:O,isOver:F},v]=(0,Fe.useDrop)({accept:De.EDIT_FIELD,hover(S,K){if(!P.current||S.size!==12)return;const $=K.getItem().index,D=n,x=K.getItem().rowIndex,L=d;if($===D&&x===L)return;const G=P.current.getBoundingClientRect(),ne=(G.bottom-G.top)/2,fe=K.getClientOffset().y-G.top;x<L&&fe<ne||x>L&&fe>ne||(l(x,L),S.rowIndex=L,S.itemIndex=D)},drop(S,K){if(!P.current)return;const $=K.getItem().index,D=n,x=K.getItem().rowIndex,L=d;if(S.size===12||$===D&&x===L)return;const G=P.current.getBoundingClientRect();if(Math.abs(K.getClientOffset().x-G.left)>G.width/1.8){a($,D+1,x,L),S.itemIndex=D+1,S.rowIndex=L;return}a($,D,x,L),S.itemIndex=D,S.rowIndex=L},collect:S=>({canDrop:S.canDrop(),clientOffset:S.getClientOffset(),isOver:S.isOver(),isOverCurrent:S.isOver({shallow:!0}),itemType:S.getItemType()})}),[{isDragging:R,getItem:I},w,U]=(0,Fe.useDrag)({type:De.EDIT_FIELD,item(){return b(!0),{index:n,labelField:t,rowIndex:d,name:i,size:m}},canDrag(){return i!=="_TEMP_"},collect:S=>({isDragging:S.isDragging(),getItem:S.getItem()}),end(){b(!1)}});(0,r.useEffect)(()=>{U((0,vr.rX)(),{captureDraggingState:!0})},[U]);const Z={dragRef:w(k),dropRef:v(P)};let N=!1,Q=!1;if(P.current&&O){const S=P.current.getBoundingClientRect();N=F&&I.size!==12&&Math.abs(O.x-S.left)<S.width/2,Q=F&&I.size!==12&&Math.abs(O.x-S.left)>S.width/2,i==="_TEMP_"&&(N=F&&I.size!==12,Q=!1)}const _=()=>e&&C?`${74/16}rem`:`${32/16}rem`,V=n===0&&!C,A=n===o&&!C,H=n!==0&&!C;return r.createElement(Ce.P,{col:m},r.createElement(d0,{ref:Z.dropRef,showLeftCarret:N,showRightCarret:Q,isFirst:V,isLast:A,hasHorizontalPadding:H,onDrag:()=>{C&&!g&&f(!0)},onDragEnd:()=>{C&&f(!1)}},g&&C&&r.createElement(T.x,{width:"100%",height:"2px",background:"primary600"}),r.createElement(m0,{width:C&&g?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:_(),alignItems:"stretch",isDragging:R,dragStart:g,isFullSize:C,isHidden:h},r.createElement(f0,{as:"span",type:"button",ref:Z.dragRef,onClick:S=>S.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(p0,null)),!h&&r.createElement(u0,{attribute:e,onEditField:u,onDeleteField:c},t))))};Jr.defaultProps={attribute:void 0},Jr.propTypes={attribute:s().shape({components:s().array,component:s().string,type:s().string}),children:s().string.isRequired,index:s().number.isRequired,moveItem:s().func.isRequired,moveRow:s().func.isRequired,name:s().string.isRequired,onDeleteField:s().func.isRequired,onEditField:s().func.isRequired,rowIndex:s().number.isRequired,lastIndex:s().number.isRequired,size:s().number.isRequired};const g0=Jr,cl=({rowItem:e,onRemoveField:t,rowId:n,rowIndex:o,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:c,modifiedData:u,moveRow:d,moveItem:m}=ot(),g=M()(c,[e.name],{}),f=M()(u,["metadatas",e.name,"edit","label"],"");return r.createElement(g0,{onEditField:()=>i(e.name),onDeleteField:()=>t(n,a),attribute:g,index:a,lastIndex:l,rowIndex:o,name:e.name,size:e.size,moveRow:d,moveItem:m},f||e.name)};cl.propTypes={index:s().number.isRequired,lastIndex:s().number.isRequired,onRemoveField:s().func.isRequired,rowId:s().number.isRequired,rowIndex:s().number.isRequired,rowItem:s().object.isRequired};const y0=cl,ul=({row:e,onRemoveField:t,rowIndex:n})=>r.createElement(qe.r,null,e.rowContent.map((o,a)=>r.createElement(y0,{key:o.name,rowItem:o,index:a,rowId:e.rowId,onRemoveField:t,rowIndex:n,lastIndex:e.rowContent.length-1})));ul.propTypes={onRemoveField:s().func.isRequired,row:s().object.isRequired,rowIndex:s().number.isRequired};const h0=ul,b0=[{action:"plugin::content-type-builder.read",subject:null}],v0=()=>{const{trackUsage:e}=(0,y.useTracking)(),{formatMessage:t}=(0,q.useIntl)(),{slug:n,modifiedData:o,isContentTypeView:a}=ot(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,c=M()(o,"category",""),u=l==="content-types"?n:`${c}/${n}`,d=()=>{e("willEditEditLayout")};return n==="strapi::administrator"?null:r.createElement(y.CheckPermissions,{permissions:b0},r.createElement(y.LinkButton,{to:`${i}/${u}`,onClick:d,size:"S",startIcon:r.createElement(pt.Z,null),variant:"secondary"},t({id:E(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))},dl=({editLayout:e,fields:t,onRemoveField:n,onAddField:o})=>{const{formatMessage:a}=(0,q.useIntl)();return r.createElement(ie.K,{spacing:4},r.createElement(B.k,{justifyContent:"space-between"},r.createElement("div",null,r.createElement(T.x,null,r.createElement(z.Z,{fontWeight:"bold"},a({id:E("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),r.createElement(T.x,null,r.createElement(z.Z,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(v0,null)),r.createElement(T.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(ie.K,{spacing:2},e.map((l,i)=>r.createElement(h0,{key:l.rowId,row:l,rowIndex:i,onRemoveField:n})),r.createElement(We.O,{id:"label",label:a({id:E("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ye.z,"data-testid":"add-field",fullWidth:!0,startIcon:r.createElement(kt.default,null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(l=>r.createElement(We.s,{key:l,onClick:()=>o(l)},l))))))};dl.propTypes={editLayout:s().array.isRequired,fields:s().array.isRequired,onAddField:s().func.isRequired,onRemoveField:s().func.isRequired};const E0=dl;var pl=p(85025),ml=p(55225),fl=p(31600),gl=p(11406),En=p(88675),C0=p(73779),P0=p(22348),yl=p(7184),Xr=p(43475),O0=p(82512),eo=p(83218),R0=p(17757),Nt=p(32031),w0=p(872),M0=p(1176),T0=p(15431);const hl={biginteger:r.createElement(Nt.Z,null),boolean:r.createElement(C0.Z,null),date:r.createElement(En.Z,null),datetime:r.createElement(En.Z,null),decimal:r.createElement(Nt.Z,null),email:r.createElement(P0.Z,null),enum:r.createElement(yl.Z,null),enumeration:r.createElement(yl.Z,null),file:r.createElement(Xr.Z,null),files:r.createElement(Xr.Z,null),float:r.createElement(Nt.Z,null),integer:r.createElement(Nt.Z,null),media:r.createElement(Xr.Z,null),number:r.createElement(Nt.Z,null),relation:r.createElement(O0.Z,null),string:r.createElement(eo.Z,null),text:r.createElement(eo.Z,null),richtext:r.createElement(eo.Z,null),time:r.createElement(En.Z,null),timestamp:r.createElement(En.Z,null),json:r.createElement(w0.Z,null),uid:r.createElement(R0.Z,null),component:r.createElement(M0.Z,null),dynamiczone:r.createElement(T0.Z,null)},to=({type:e,customFieldUid:t})=>{const n=(0,y.useCustomFields)();let o=hl[e];if(t){const l=n.get(t).icon;l&&(o=r.createElement(T.x,{marginRight:3,width:7,height:6},r.createElement(l,null)))}return hl[e]?o:null};to.defaultProps={customFieldUid:null},to.propTypes={type:s().string.isRequired,customFieldUid:s().string};const bl=to,I0=e=>e.reduce((t,n)=>{const o=(0,Y.get)(n,["attributes"],{}),a=Object.keys(o).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes((0,Y.get)(o,[l,"type"],"")));return t[n.uid]=a,t},{}),vl=e=>{let t;switch(e){case"description":case"label":case"placeholder":t="text";break;case"mainField":t="select";break;case"editable":t="bool";break;default:t=""}const n=E(e==="mainField"?"containers.SettingPage.editSettings.entry.title":`form.Input.${e}`);return{type:t,label:{id:n}}};var Vt=p(9139),D0=Object.defineProperty,Cn=Object.getOwnPropertySymbols,El=Object.prototype.hasOwnProperty,Cl=Object.prototype.propertyIsEnumerable,Pl=(e,t,n)=>t in e?D0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,no=(e,t)=>{for(var n in t||(t={}))El.call(t,n)&&Pl(e,n,t[n]);if(Cn)for(var n of Cn(t))Cl.call(t,n)&&Pl(e,n,t[n]);return e},L0=(e,t)=>{var n={};for(var o in e)El.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Cn)for(var o of Cn(e))t.indexOf(o)<0&&Cl.call(e,o)&&(n[o]=e[o]);return n};const ro=e=>{var t=e,{type:n,options:o,onChange:a,value:l,name:i}=t,c=L0(t,["type","options","onChange","value","name"]);const{formatMessage:u}=(0,q.useIntl)();switch(n){case"text":return r.createElement(er.o,no({onChange:a,value:l,name:i},c));case"bool":return r.createElement(Vt.s,no({onChange:d=>{a({target:{name:i,value:d.target.checked}})},checked:l,name:i,onLabel:u({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:u({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"})},c));case"select":return r.createElement(Ze.P,no({value:l,name:i,onChange:d=>a({target:{name:i,value:d}})},c),o.map(d=>r.createElement(Pe.W,{key:d,value:d},d)));default:return null}};ro.defaultProps={options:void 0},ro.propTypes={type:s().string.isRequired,options:s().arrayOf(s().string),onChange:s().func.isRequired,value:s().oneOfType([s().string,s().bool]).isRequired,name:s().string.isRequired};const S0=ro,x0=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],k0=["dynamiczone","component","json","richtext"],F0=[1,5,10,15,30,60],A0=["datetime","time"],Ol=({onMetaChange:e,onSizeChange:t})=>{const{formatMessage:n}=(0,q.useIntl)(),{modifiedData:o,selectedField:a,attributes:l,fieldForm:i}=ot(),c=(0,r.useMemo)(An,[]),{schemas:u}=(0,pe.useSelector)(P=>c(P),pe.shallowEqual),d=(0,r.useMemo)(()=>{if(!a)return[];const P=M()(o,["metadatas",a,"edit"],{});return Object.keys(P).filter(O=>O!=="visible")},[a,o]),m=(0,r.useMemo)(()=>I0(u),[u]),g=(0,r.useCallback)(P=>{if(P!=="relation"&&P!=="component")return[];const O=P==="component"?"component":"targetModel",F=M()(o,["attributes",a,O],"");return M()(m,[F],[])},[a,m,o]),f=d.map(P=>{const O=M()(l,[a,"type"]);return["component","dynamiczone"].includes(O)&&!["label","description"].includes(P)||O==="component"&&P!=="label"||["media","json","boolean"].includes(O)&&P==="placeholder"||P==="step"?null:r.createElement(Ce.P,{col:6,key:P},r.createElement(S0,{type:vl(P).type,hint:P==="mainField"?n({id:E("containers.SettingPage.editSettings.relation-field.description")}):"",label:n({id:M()(vl(P),"label.id","app.utils.defaultMessage")}),name:P,onChange:e,value:M()(i,["metadata",P],""),options:g(O)}))}),h=!k0.includes(l[a].type),b=r.createElement(Ce.P,{col:6,key:"size"},r.createElement(Ze.P,{value:i==null?void 0:i.size,name:"size",onChange:P=>{t({name:a,value:P})},label:n({id:E("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},x0.map(([P,O])=>r.createElement(Pe.W,{key:P,value:P},O)))),C=A0.includes(l[a].type),k=r.createElement(Ce.P,{col:6,key:"step"},r.createElement(Ze.P,{value:M()(i,["metadata","step"],1),name:"step",onChange:P=>e({target:{name:"step",value:P}}),label:n({id:E("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},F0.map(P=>r.createElement(Pe.W,{key:P,value:P},P))));return r.createElement(r.Fragment,null,f,h&&b,C&&k)};Ol.propTypes={onMetaChange:s().func.isRequired,onSizeChange:s().func.isRequired};const j0=Ol,$0=(0,j.default)(B.k)`
1096
+ svg {
1097
+ width: ${32/16}rem;
1098
+ height: ${24/16}rem;
1099
+ margin-right: ${({theme:e})=>e.spaces[3]};
1100
+ }
1101
+ `,oo=({onToggle:e,onMetaChange:t,onSizeChange:n,onSubmit:o,type:a,customFieldUid:l})=>{const{selectedField:i}=ot(),{formatMessage:c}=(0,q.useIntl)(),u=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return r.createElement(pl.P,{onClose:e,labelledBy:"title"},r.createElement("form",{onSubmit:o},r.createElement(ml.x,null,r.createElement($0,null,r.createElement(bl,{type:u(),customFieldUid:l}),r.createElement(z.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:E("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:$t()(i)})))),r.createElement(fl.f,null,r.createElement(qe.r,{gap:4},r.createElement(j0,{onMetaChange:t,onSizeChange:n}))),r.createElement(gl.m,{startActions:r.createElement(ye.z,{onClick:e,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};oo.defaultProps={customFieldUid:null},oo.propTypes={customFieldUid:s().string,onSubmit:s().func.isRequired,onToggle:s().func.isRequired,onMetaChange:s().func.isRequired,onSizeChange:s().func.isRequired,type:s().string.isRequired};const N0=oo,V0=(e,t,n)=>me.be.put(ge(n?`content-types/${t}/configuration`:`components/${t}/configuration`),e),so=({mainLayout:e,components:t,isContentTypeView:n,slug:o,updateLayout:a})=>{const[l,i]=(0,r.useReducer)(Jb,Qr,()=>a0(Qr,e,t)),[c,u]=(0,r.useState)(!1),{trackUsage:d}=(0,y.useTracking)(),m=(0,y.useNotification)(),{goBack:g}=(0,J.useHistory)(),[f,h]=(0,r.useState)(!1),[b,C]=(0,r.useState)(!1),{componentLayouts:k,initialData:P,modifiedData:O,metaToEdit:F,metaForm:v}=l,{formatMessage:R}=(0,q.useIntl)(),I=M()(e,["info","displayName"],""),w=M()(O,["attributes"],{}),U=Object.keys(w).filter(W=>{const ue=M()(w,[W,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ue)&&!!ue}),Z=M()(O,["layouts","edit"],[]),N=qb()(Z,"rowContent"),Q=Object.keys(O.attributes).filter(W=>M()(O,["metadatas",W,"edit","visible"],!1)===!0).filter(W=>N.findIndex(ue=>ue.name===W)===-1).sort(),_=({target:{name:W,value:ue}})=>{i({type:"ON_CHANGE",keys:W.split("."),value:ue})},V=()=>{h(W=>!W)},A=()=>{C(W=>!W)},H=({target:{name:W,value:ue}})=>{i({type:"ON_CHANGE_META",keys:W.split("."),value:ue})},S=({name:W,value:ue})=>{i({type:"ON_CHANGE_SIZE",name:W,value:ue})},K=W=>{W.preventDefault(),i({type:"SUBMIT_META_FORM"}),V()},$=W=>{W.preventDefault(),A()},D=(0,at.useMutation)(W=>V0(W,o,n),{onSuccess({data:W}){a&&a(W.data),i({type:"SUBMIT_SUCCEEDED"}),A(),d("didEditEditSettings")},onError(){m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:x}=D,L=()=>{const W=or()(Ve()(O),["layouts","metadatas","settings"]);X()(W,"layouts.edit",Kb(W.layouts.edit)),D.mutate(W)},G=(W,ue)=>{i({type:"MOVE_RELATION",fromIndex:W,toIndex:ue})},ne=(W,ue)=>{i({type:"MOVE_FIELD",fromIndex:W,toIndex:ue})},re=(W,ue,_e,ve)=>{i(_e===ve?{type:"REORDER_ROW",dragRowIndex:_e,dragIndex:W,hoverIndex:ue}:{type:"REORDER_DIFF_ROW",dragIndex:W,hoverIndex:ue,dragRowIndex:_e,hoverRowIndex:ve})},fe=(W,ue)=>{i({type:"MOVE_ROW",fromIndex:W,toIndex:ue})};return r.createElement(Ne,{isContentTypeView:n,attributes:w,modifiedData:O,slug:o,componentLayouts:k,selectedField:F,fieldForm:v,onMoveRelation:G,onMoveField:ne,moveRow:fe,moveItem:re,setEditFieldToSelect:W=>{i({type:"SET_FIELD_TO_EDIT",name:W}),V()},isDraggingSibling:c,setIsDraggingSibling:u},r.createElement(be.o,null,r.createElement("form",{onSubmit:$},r.createElement(oe.T,{title:R({id:E("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${$t()(I)}`},{name:$t()(I)}),subtitle:R({id:E("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:r.createElement(y.Link,{startIcon:r.createElement(fn.Z,null),onClick:W=>{W.preventDefault(),g()},to:"/"},R({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.z,{disabled:Ft()(P,O),startIcon:r.createElement(ht.Z,null),type:"submit"},R({id:"global.save",defaultMessage:"Save"}))}),r.createElement(mt.D,null,r.createElement(T.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(ie.K,{spacing:4},r.createElement(z.Z,{variant:"delta",as:"h2"},R({id:E("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(qe.r,null,r.createElement(Ce.P,{col:6,s:12},r.createElement(Ze.P,{label:R({id:E("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:R({id:E("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:W=>{_({target:{name:"settings.mainField",value:W===""?null:W}})},value:O.settings.mainField},U.map(W=>r.createElement(Pe.W,{key:W,value:W},W))))),r.createElement(T.x,{paddingTop:2,paddingBottom:2},r.createElement(zr.i,null)),r.createElement(z.Z,{variant:"delta",as:"h3"},R({id:E("containers.SettingPage.view"),defaultMessage:"View"})),r.createElement(E0,{attributes:w,editLayout:Z,fields:Q,onAddField:W=>{i({type:"ON_ADD_FIELD",name:W})},onRemoveField:(W,ue)=>{i({type:"REMOVE_FIELD",rowIndex:W,fieldIndex:ue})}})))),r.createElement(y.ConfirmDialog,{bodyText:{id:E("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ht.Z,null),isConfirmButtonLoading:x,isOpen:b,onToggleDialog:A,onConfirm:L,variantRightButton:"success-light"})),f&&r.createElement(N0,{onSubmit:K,onToggle:V,onMetaChange:H,onSizeChange:S,type:M()(w,[F,"type"],""),customFieldUid:M()(w,[F,"customField"],"")})))};so.defaultProps={isContentTypeView:!1,updateLayout:null},so.propTypes={components:s().object.isRequired,isContentTypeView:s().bool,mainLayout:s().shape({attributes:s().object.isRequired,info:s().object.isRequired,layouts:s().shape({list:s().array.isRequired,edit:s().array.isRequired}).isRequired,metadatas:s().object.isRequired,options:s().object.isRequired}).isRequired,slug:s().string.isRequired,updateLayout:s().func};const ao=so;var vt=p(37617);const q0=()=>({type:vt.ZA}),B0=(e,t)=>({type:vt.Id,pagination:e,data:t}),z0=()=>({type:vt.MP});function Z0(){return{type:vt.c2}}const W0=({components:e,contentType:t})=>{const{layouts:n}=t;return{contentType:t,components:e,displayedHeaders:n.list,type:vt.Zz}},io=e=>({type:vt.Rp,target:e});var Rl=p(13055),wl=p(99223),lo=p(94638),_0=p(70664);const U0=()=>e=>e["content-manager_listView"]||_0.E,H0=()=>(0,It.P1)(U0(),e=>e),Ml=e=>{const{displayedHeaders:t}=e["content-manager_listView"];return t},G0=H0;var K0=p(44426),Q0=p(35658),Y0=p(94547),co=p(19786),J0=p(47765),X0=p(69033),ev=Object.defineProperty,Pn=Object.getOwnPropertySymbols,Tl=Object.prototype.hasOwnProperty,Il=Object.prototype.propertyIsEnumerable,Dl=(e,t,n)=>t in e?ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tv=(e,t)=>{for(var n in t||(t={}))Tl.call(t,n)&&Dl(e,n,t[n]);if(Pn)for(var n of Pn(t))Il.call(t,n)&&Dl(e,n,t[n]);return e},nv=(e,t)=>{var n={};for(var o in e)Tl.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Pn)for(var o of Pn(e))t.indexOf(o)<0&&Il.call(e,o)&&(n[o]=e[o]);return n};const rv=(0,j.default)(B.k)`
1102
+ position: relative;
1103
+ border-radius: 50%;
1104
+ width: 26px;
1105
+ height: 26px;
1106
+ border: 1px solid ${({theme:e})=>e.colors.neutral200};
1107
+ background: ${({theme:e})=>e.colors.neutral150};
1108
+ padding-left: 1px;
1109
+
1110
+ span {
1111
+ line-height: 0.6rem;
1112
+ font-size: 0.6rem;
1113
+ }
1114
+ `,Ll=e=>{var t=e,{children:n}=t,o=nv(t,["children"]);return r.createElement(rv,tv({justifyContent:"center",alignItems:"center",as:"span"},o),r.createElement(z.Z,{variant:"sigma",textColor:"neutral600"},n))};Ll.propTypes={children:s().string.isRequired};const Sl=Ll,uo=({url:e,mime:t,alternativeText:n,name:o,ext:a,formats:l})=>{var i;const c=(0,y.prefixFileUrlWithBackendUrl)(e);if(t.includes("image")){const m=((i=l==null?void 0:l.thumbnail)==null?void 0:i.url)||null,g=(0,y.prefixFileUrlWithBackendUrl)(m)||c;return r.createElement(X0.q,{src:g,alt:n||o,preview:!0})}const u=(0,y.getFileExtension)(a),d=o.length>100?`${o.substring(0,100)}...`:o;return r.createElement(St.u,{description:d},r.createElement(Sl,null,u))};uo.defaultProps={alternativeText:null,formats:null},uo.propTypes={alternativeText:s().string,ext:s().string.isRequired,formats:s().object,mime:s().string.isRequired,name:s().string.isRequired,url:s().string.isRequired};const xl=uo;var ov=p(25898),sv=Object.defineProperty,kl=Object.getOwnPropertySymbols,av=Object.prototype.hasOwnProperty,iv=Object.prototype.propertyIsEnumerable,Fl=(e,t,n)=>t in e?sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lv=(e,t)=>{for(var n in t||(t={}))av.call(t,n)&&Fl(e,n,t[n]);if(kl)for(var n of kl(t))iv.call(t,n)&&Fl(e,n,t[n]);return e};const Al=({value:e})=>r.createElement(ov.H,null,e.map((t,n)=>{const o=`${t.id}${n}`;if(n===3){const a=`+${e.length-3}`;return r.createElement(Sl,{key:o,preview:!1},a)}return n>3?null:r.createElement(xl,lv({key:o},t))}));Al.propTypes={value:s().arrayOf(s().shape({alternativeText:s().string,ext:s().string.isRequired,formats:s().object,mime:s().string.isRequired,name:s().string.isRequired,url:s().string.isRequired})).isRequired};const cv=Al;var jl=p(6518),uv=p(97405),dv=p(51064),pv=p.n(dv);const $l=({type:e,value:t})=>{const{formatDate:n,formatTime:o,formatNumber:a}=(0,q.useIntl)();let l=t;if(e==="date"&&(l=n(pv()(t),{dateStyle:"full"})),e==="datetime"&&(l=n(t,{dateStyle:"full",timeStyle:"short"})),e==="time"){const[i,c,u]=t.split(":"),d=new Date;d.setHours(i),d.setMinutes(c),d.setSeconds(u),l=o(d,{numeric:"auto",style:"short"})}return["float","decimal"].includes(e)&&(l=a(t,{maximumFractionDigits:20})),["integer","biginteger"].includes(e)&&(l=a(t,{maximumFractionDigits:0})),Ha()(l)};$l.propTypes={type:s().string.isRequired,value:s().any.isRequired};const Et=$l;var mv=Object.defineProperty,Nl=Object.getOwnPropertySymbols,fv=Object.prototype.hasOwnProperty,gv=Object.prototype.propertyIsEnumerable,Vl=(e,t,n)=>t in e?mv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yv=(e,t)=>{for(var n in t||(t={}))fv.call(t,n)&&Vl(e,n,t[n]);if(Nl)for(var n of Nl(t))gv.call(t,n)&&Vl(e,n,t[n]);return e},hv=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const bv=(0,j.default)(z.Z)`
1115
+ max-width: 500px;
1116
+ `,vv=(e,t)=>hv(void 0,null,function*(){const{data:{results:n,pagination:o}}=yield me.be.get(e);return t(),{results:n,pagination:o}}),ql=({fieldSchema:e,metadatas:t,name:n,entityId:o,value:a,contentType:l})=>{const{formatMessage:i}=(0,q.useIntl)(),{notifyStatus:c}=(0,lo.G)(),u=(0,r.useMemo)(()=>ge(`relations/${l.uid}/${o}/${n.split(".")[0]}`),[o,n,l]),[d,m]=(0,r.useState)(!1),g=r.createElement(B.k,{gap:1,wrap:"nowrap"},r.createElement(jl.C,null,a.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:a.count})),f=()=>{const C=i({id:E("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(C)},{data:h,status:b}=(0,at.useQuery)([e.targetModel,o],()=>vv(u,f),{enabled:d,staleTime:0});return r.createElement(T.x,yv({},y.stopPropagation),r.createElement(We.O,{label:g,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},b!=="success"&&r.createElement(We.s,{"aria-disabled":!0},r.createElement(uv.a,{small:!0},i({id:E("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),b==="success"&&r.createElement(r.Fragment,null,h==null?void 0:h.results.map(C=>r.createElement(We.s,{key:C.id,"aria-disabled":!0},r.createElement(bv,{ellipsis:!0},r.createElement(Et,{type:t.mainField.schema.type,value:C[t.mainField.name]||C.id})))),(h==null?void 0:h.pagination.total)>10&&r.createElement(We.s,{"aria-disabled":!0,"aria-label":i({id:E("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},r.createElement(z.Z,null,"\u2026")))))};ql.propTypes={contentType:s().shape({uid:s().string.isRequired}).isRequired,fieldSchema:s().shape({relation:s().string,targetModel:s().string,type:s().string.isRequired}).isRequired,metadatas:s().shape({mainField:s().shape({name:s().string.isRequired,schema:s().shape({type:s().string.isRequired}).isRequired})}).isRequired,name:s().string.isRequired,entityId:s().oneOfType([s().string,s().number]).isRequired,value:s().object.isRequired};const Ev=ql,Cv=(0,j.default)(z.Z)`
1117
+ max-width: 500px;
1118
+ `,Bl=({metadatas:e,value:t})=>{var n;return r.createElement(Cv,{textColor:"neutral800",ellipsis:!0},r.createElement(Et,{type:e.mainField.schema.type,value:(n=t[e.mainField.name])!=null?n:t.id}))};Bl.propTypes={metadatas:s().shape({mainField:s().shape({name:s().string.isRequired,schema:s().shape({type:s().string.isRequired}).isRequired})}).isRequired,value:s().object.isRequired};const Pv=Bl;var Ov=Object.defineProperty,zl=Object.getOwnPropertySymbols,Rv=Object.prototype.hasOwnProperty,wv=Object.prototype.propertyIsEnumerable,Zl=(e,t,n)=>t in e?Ov(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mv=(e,t)=>{for(var n in t||(t={}))Rv.call(t,n)&&Zl(e,n,t[n]);if(zl)for(var n of zl(t))wv.call(t,n)&&Zl(e,n,t[n]);return e};const Tv=(0,j.default)(z.Z)`
1119
+ max-width: 500px;
1120
+ `,Wl=({value:e,metadatas:t})=>{const{formatMessage:n}=(0,q.useIntl)(),{mainField:{type:o,name:a}}=t,l=r.createElement(r.Fragment,null,r.createElement(jl.C,null,e.length)," ",n({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:e.length}));return r.createElement(T.x,Mv({},y.stopPropagation),r.createElement(We.O,{label:l,size:"S"},e.map(i=>r.createElement(We.s,{key:i.id,"aria-disabled":!0},r.createElement(Tv,{ellipsis:!0},r.createElement(Et,{type:o,value:i[a]||i.id}))))))};Wl.propTypes={metadatas:s().shape({mainField:s().shape({name:s().string,type:s().string,value:s().string})}).isRequired,value:s().array.isRequired};const Iv=Wl,Dv=(0,j.default)(z.Z)`
1121
+ max-width: 250px;
1122
+ `,_l=({value:e,metadatas:t})=>{const{mainField:n}=t,o=e[n.name];return r.createElement(St.u,{label:o},r.createElement(Dv,{textColor:"neutral800",ellipsis:!0},r.createElement(Et,{type:n.type,value:o})))};_l.propTypes={metadatas:s().shape({mainField:s().shape({name:s().string,type:s().string,value:s().string})}).isRequired,value:s().object.isRequired};const Lv=_l;var Sv=p(80022),Ul=p.n(Sv);function Hl(e){return["oneToOne","manyToOne","oneToOneMorph"].includes(e)}function xv(e,t,n,o){if(e==="component"){const{mainField:{name:a,type:l}}=n;if(o!=null&&o.repeatable)return t.length>0;const i=t==null?void 0:t[a];return a==="id"&&![void 0,null].includes(i)?!0:At(l)&&l!=="biginteger"&&a!=="id"?Ul()(i):!Le()(i)}return e==="relation"?Hl(o.relation)?!Le()(t):(t==null?void 0:t.count)>0:At(e)&&e!=="biginteger"?Ul()(t):e==="boolean"?t!==null:!Le()(t)}var kv=Object.defineProperty,Gl=Object.getOwnPropertySymbols,Fv=Object.prototype.hasOwnProperty,Av=Object.prototype.propertyIsEnumerable,Kl=(e,t,n)=>t in e?kv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jv=(e,t)=>{for(var n in t||(t={}))Fv.call(t,n)&&Kl(e,n,t[n]);if(Gl)for(var n of Gl(t))Av.call(t,n)&&Kl(e,n,t[n]);return e};const Ql=(0,j.default)(z.Z)`
1123
+ max-width: 300px;
1124
+ `,po=({content:e,fieldSchema:t,metadatas:n,name:o,rowId:a,contentType:l})=>{const{type:i}=t;if(!xv(i,e,n,t))return r.createElement(z.Z,{textColor:"neutral800"},"-");switch(i){case"media":return t.multiple?r.createElement(cv,{value:e}):r.createElement(xl,jv({},e));case"relation":return Hl(t.relation)?r.createElement(Pv,{metadatas:n,value:e}):r.createElement(Ev,{fieldSchema:t,metadatas:n,value:e,name:o,entityId:a,contentType:l});case"component":return t.repeatable===!0?r.createElement(Iv,{value:e,metadatas:n}):r.createElement(Lv,{value:e,metadatas:n});case"string":return r.createElement(St.u,{description:e},r.createElement(Ql,{ellipsis:!0,textColor:"neutral800"},r.createElement(Et,{type:i,value:e})));default:return r.createElement(Ql,{ellipsis:!0,textColor:"neutral800"},r.createElement(Et,{type:i,value:e}))}};po.defaultProps={content:void 0},po.propTypes={content:s().any,contentType:s().shape({uid:s().string.isRequired}).isRequired,fieldSchema:s().shape({component:s().string,multiple:s().bool,type:s().string.isRequired,repeatable:s().bool,relation:s().string}).isRequired,metadatas:s().object.isRequired,name:s().string.isRequired,rowId:s().oneOfType([s().string,s().number]).isRequired};const $v=po;var Nv=Object.defineProperty,Vv=Object.defineProperties,qv=Object.getOwnPropertyDescriptors,On=Object.getOwnPropertySymbols,Yl=Object.prototype.hasOwnProperty,Jl=Object.prototype.propertyIsEnumerable,Xl=(e,t,n)=>t in e?Nv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qt=(e,t)=>{for(var n in t||(t={}))Yl.call(t,n)&&Xl(e,n,t[n]);if(On)for(var n of On(t))Jl.call(t,n)&&Xl(e,n,t[n]);return e},Bv=(e,t)=>Vv(e,qv(t)),zv=(e,t)=>{var n={};for(var o in e)Yl.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&On)for(var o of On(e))t.indexOf(o)<0&&Jl.call(e,o)&&(n[o]=e[o]);return n};const mo=({canCreate:e,canDelete:t,contentType:n,headers:o,entriesToDelete:a,onClickDelete:l,onSelectRow:i,withMainAction:c,withBulkActions:u,rows:d})=>{const{push:m,location:{pathname:g}}=(0,J.useHistory)(),{formatMessage:f}=(0,q.useIntl)(),{trackUsage:h}=(0,y.useTracking)(),b=ps();return r.createElement(Q0.p,null,d.map((C,k)=>{const P=a.findIndex(F=>F===C.id)!==-1,O=f({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:k});return r.createElement(Y0.Tr,qt({key:C.id},(0,y.onRowClick)({fn(){h("willEditEntryFromList"),m({pathname:`${g}/${C.id}`,state:{from:g},search:b})},condition:u})),c&&r.createElement(co.Td,qt({},y.stopPropagation),r.createElement(K0.C,{"aria-label":f({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,ji.Pp)(C.firstname,C.lastname)}),checked:P,onChange:()=>{i({name:C.id,value:!P})}})),o.map(F=>{var v=F,{key:R,cellFormatter:I,name:w}=v,U=zv(v,["key","cellFormatter","name"]);return r.createElement(co.Td,{key:R},typeof I=="function"?I(C,qt({key:R,name:w},U)):r.createElement($v,Bv(qt({content:C[w.split(".")[0]],name:w,contentType:n},U),{rowId:C.id})))}),u&&r.createElement(co.Td,null,r.createElement(B.k,qt({justifyContent:"end"},y.stopPropagation),r.createElement(Re.h,{forwardedAs:J.Link,onClick:()=>{h("willEditEntryFromButton")},to:{pathname:`${g}/${C.id}`,state:{from:g},search:b},label:f({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:O}),noBorder:!0,icon:r.createElement(pt.Z,null)}),e&&r.createElement(T.x,{paddingLeft:1},r.createElement(Re.h,{forwardedAs:J.Link,to:{pathname:`${g}/create/clone/${C.id}`,state:{from:g},search:b},label:f({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:O}),noBorder:!0,icon:r.createElement(J0.Z,null)})),t&&r.createElement(T.x,{paddingLeft:1},r.createElement(Re.h,{onClick:()=>{h("willDeleteEntryFromList"),l(C.id)},label:f({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:O}),noBorder:!0,icon:r.createElement(ze.default,null)})))))}))};mo.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},mo.propTypes={canCreate:s().bool,canDelete:s().bool,contentType:s().shape({uid:s().string.isRequired}).isRequired,entriesToDelete:s().array,headers:s().array.isRequired,onClickDelete:s().func,onSelectRow:s().func,rows:s().array,withBulkActions:s().bool,withMainAction:s().bool};const Zv=mo;var Wv=Object.defineProperty,Rn=Object.getOwnPropertySymbols,ec=Object.prototype.hasOwnProperty,tc=Object.prototype.propertyIsEnumerable,nc=(e,t,n)=>t in e?Wv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_v=(e,t)=>{for(var n in t||(t={}))ec.call(t,n)&&nc(e,n,t[n]);if(Rn)for(var n of Rn(t))tc.call(t,n)&&nc(e,n,t[n]);return e},Uv=(e,t)=>{var n={};for(var o in e)ec.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Rn)for(var o of Rn(e))t.indexOf(o)<0&&tc.call(e,o)&&(n[o]=e[o]);return n};const rc=e=>{var t=e,{area:n}=t,o=Uv(t,["area"]);const a=hs(n);return a?r.createElement("ul",null,a.map(l=>l.Component(o)?r.createElement(T.x,{key:l.name,padding:3,style:{textAlign:"center"}},r.createElement(l.Component,_v({},o))):null)):null};rc.propTypes={area:s().string.isRequired};const oc=rc,sc=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:o})=>{const{formatMessage:a}=(0,q.useIntl)();return r.createElement(gn.V,{onClose:n,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(yn.a,{icon:r.createElement(Lt.default,null)},r.createElement(ie.K,{spacing:2},r.createElement(B.k,{justifyContent:"center"},r.createElement(z.Z,{id:"confirm-description"},a({id:E("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),r.createElement(B.k,null,r.createElement(oc,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(hn.c,{startAction:r.createElement(ye.z,{onClick:n,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.z,{onClick:o,variant:"danger-light",startIcon:r.createElement(ze.default,null),id:"confirm-delete",loading:e},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};sc.propTypes={isConfirmButtonLoading:s().bool.isRequired,isOpen:s().bool.isRequired,onConfirm:s().func.isRequired,onToggleDialog:s().func.isRequired};const Hv=sc,ac=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:o})=>{const{formatMessage:a}=(0,q.useIntl)();return r.createElement(gn.V,{onClose:n,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(yn.a,{icon:r.createElement(Lt.default,null)},r.createElement(ie.K,{spacing:2},r.createElement(B.k,{justifyContent:"center"},r.createElement(z.Z,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),r.createElement(B.k,null,r.createElement(oc,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(hn.c,{startAction:r.createElement(ye.z,{onClick:n,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.z,{onClick:o,variant:"danger-light",startIcon:r.createElement(ze.default,null),id:"confirm-delete",loading:e},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};ac.propTypes={isConfirmButtonLoading:s().bool.isRequired,isOpen:s().bool.isRequired,onConfirm:s().func.isRequired,onToggleDialog:s().func.isRequired};const Gv=ac;var Kv=Object.defineProperty,Qv=Object.defineProperties,Yv=Object.getOwnPropertyDescriptors,ic=Object.getOwnPropertySymbols,Jv=Object.prototype.hasOwnProperty,Xv=Object.prototype.propertyIsEnumerable,lc=(e,t,n)=>t in e?Kv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wn=(e,t)=>{for(var n in t||(t={}))Jv.call(t,n)&&lc(e,n,t[n]);if(ic)for(var n of ic(t))Xv.call(t,n)&&lc(e,n,t[n]);return e},Mn=(e,t)=>Qv(e,Yv(t));const eE=(0,j.default)(ia.q)`
1125
+ width: min-content;
1126
+ `,fo=({canCreate:e,canDelete:t,contentTypeName:n,action:o,isBulkable:a,isLoading:l,onConfirmDelete:i,onConfirmDeleteAll:c,layout:u,rows:d})=>{const{runHookWaterfall:m}=(0,y.useStrapiApp)(),g=u.contentType.options.draftAndPublish||!1,{formatMessage:f}=(0,q.useIntl)(),h=(0,pe.useSelector)(Ml),b=(0,r.useMemo)(()=>{const k=m(Kt.No,{displayedHeaders:h,layout:u}).displayedHeaders.map(P=>{const{metadatas:O}=P;if(P.fieldSchema.type==="relation"){const F=`${P.name}.${P.metadatas.mainField.name}`;return Mn(wn({},P),{metadatas:Mn(wn({},O),{label:f({id:E(`containers.ListPage.table-headers.${P.name}`),defaultMessage:O.label})}),name:F})}return Mn(wn({},P),{metadatas:Mn(wn({},O),{label:f({id:E(`containers.ListPage.table-headers.${P.name}`),defaultMessage:O.label})})})});return g?[...k,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:f({id:E("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(P){const O=P.publishedAt,F=O?"success":"secondary";return r.createElement(eE,{showBullet:!1,variant:F,size:"S"},r.createElement(z.Z,{fontWeight:"bold",textColor:`${F}700`},f({id:E(`containers.List.${O?"published":"draft"}`),defaultMessage:O?"Published":"Draft"})))}}]:k},[m,h,u,g,f]);return r.createElement(y.DynamicTable,{components:{ConfirmDialogDelete:Gv,ConfirmDialogDeleteAll:Hv},contentType:n,action:o,isLoading:l,headers:b,onConfirmDelete:i,onConfirmDeleteAll:c,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:d,withBulkActions:!0,withMainAction:t&&a},r.createElement(Zv,{canCreate:e,canDelete:t,contentType:u.contentType,headers:b,rows:d,withBulkActions:!0,withMainAction:t&&a}))};fo.defaultProps={action:void 0},fo.propTypes={canCreate:s().bool.isRequired,canDelete:s().bool.isRequired,contentTypeName:s().string.isRequired,action:s().node,isBulkable:s().bool.isRequired,isLoading:s().bool.isRequired,layout:s().exact({components:s().object.isRequired,contentType:s().shape({attributes:s().object.isRequired,metadatas:s().object.isRequired,layouts:s().shape({list:s().array.isRequired}).isRequired,options:s().object.isRequired,settings:s().object.isRequired}).isRequired}).isRequired,onConfirmDelete:s().func.isRequired,onConfirmDeleteAll:s().func.isRequired,rows:s().array.isRequired};const tE=fo,nE=["json","component","media","richtext","dynamiczone","password"],rE=["createdAt","updatedAt"],oE=(e,t)=>{const{allPermissions:n}=(0,y.useRBACProvider)(),o=(0,y.findMatchingPermissions)(n,[{action:"plugin::content-manager.explorer.read",subject:t}]),a=M()(o,["0","properties","fields"],[]);return Object.keys(M()(e,["attributes"]),{}).filter(c=>{const u=M()(e,["attributes",c],{});return!(!u.type||nE.includes(u.type)||!a.includes(c)&&c!=="id"&&!rE.includes(c))}).sort()};var sE=p(5644);const cc=({displayedFilters:e})=>{const[t,n]=(0,r.useState)(!1),{formatMessage:o}=(0,q.useIntl)(),a=(0,r.useRef)(),{trackUsage:l}=(0,y.useTracking)(),i=()=>{t||l("willFilterEntries"),n(c=>!c)};return r.createElement(r.Fragment,null,r.createElement(T.x,{paddingTop:1,paddingBottom:1},r.createElement(ye.z,{variant:"tertiary",ref:a,startIcon:r.createElement(sE.Z,null),onClick:i,size:"S"},o({id:"app.utils.filters",defaultMessage:"Filters"})),t&&r.createElement(y.FilterPopoverURLQuery,{displayedFilters:e,isVisible:t,onToggle:i,source:a})),r.createElement(y.FilterListURLQuery,{filtersSchema:e}))};cc.propTypes={displayedFilters:s().arrayOf(s().shape({name:s().string.isRequired,metadatas:s().shape({label:s().string}),fieldSchema:s().shape({type:s().string})})).isRequired};const aE=cc,uc=({contentType:e,slug:t,metadatas:n})=>{const{formatMessage:o}=(0,q.useIntl)(),l=oE(e,t).map(i=>{const c=e.attributes[i],{type:u,enum:d}=c,m={name:"didFilterEntries",properties:{useRelation:u==="relation"}},{mainField:g,label:f}=n[i].list;return{name:i,metadatas:{label:o({id:f,defaultMessage:f})},fieldSchema:{type:u,options:d,mainField:g},trackedEvent:m}});return r.createElement(aE,{displayedFilters:l})};uc.propTypes={contentType:s().object.isRequired,metadatas:s().object.isRequired,slug:s().string.isRequired};const iE=uc,lE=e=>Object.keys(e).reduce((n,o)=>{const a=e[o];return Fo(a)&&n.push(o),n},[]).sort(),dc=({layout:e})=>{const t=(0,pe.useDispatch)(),n=(0,pe.useSelector)(Ml),{trackUsage:o}=(0,y.useTracking)(),{formatMessage:a}=(0,q.useIntl)(),l=lE(e.contentType.attributes).map(u=>{const d=e.contentType.metadatas[u].list;return{name:u,intlLabel:{id:d.label,defaultMessage:d.label}}}),i=n.map(({name:u})=>u),c=u=>{if(o("didChangeDisplayedFields"),u.length<i.length){const d=i.filter(m=>u.indexOf(m)===-1);t(io({name:d[0],value:!0}))}else{const d=u.filter(m=>i.indexOf(m)===-1);t(io({name:d[0],value:!1}))}};return r.createElement(T.x,{paddingTop:1,paddingBottom:1},r.createElement(Ze.P,{"aria-label":"change displayed fields",value:i,onChange:c,customizeContent:u=>a({id:E("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:u.length}),multi:!0,size:"S"},l.map(u=>r.createElement(Pe.W,{key:u.name,value:u.name},a({id:u.intlLabel.id||u.name,defaultMessage:u.intlLabel.defaultMessage||u.name})))))};dc.propTypes={layout:s().shape({contentType:s().shape({attributes:s().object.isRequired,metadatas:s().object.isRequired,layouts:s().shape({list:s().array.isRequired}).isRequired,options:s().object.isRequired,settings:s().object.isRequired}).isRequired}).isRequired};const cE=(0,r.memo)(dc),go=({pagination:e})=>r.createElement(T.x,{paddingTop:4},r.createElement(B.k,{alignItems:"flex-end",justifyContent:"space-between"},r.createElement(y.PageSizeURLQuery,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),r.createElement(y.PaginationURLQuery,{pagination:e})));go.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},go.propTypes={pagination:s().shape({page:s().number,pageCount:s().number,pageSize:s().number,total:s().number})};const uE=go;var dE=p(98399),pE=Object.defineProperty,mE=Object.defineProperties,fE=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,gE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,mc=(e,t,n)=>t in e?pE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hE=(e,t)=>{for(var n in t||(t={}))gE.call(t,n)&&mc(e,n,t[n]);if(pc)for(var n of pc(t))yE.call(t,n)&&mc(e,n,t[n]);return e},bE=(e,t)=>mE(e,fE(t)),yo=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const vE=ce.Z.contentManager,EE=(0,j.default)(T.x)`
1127
+ svg {
1128
+ path {
1129
+ fill: ${({theme:e})=>e.colors.neutral900};
1130
+ }
1131
+ }
1132
+ `;function fc({canCreate:e,canDelete:t,canRead:n,data:o,getData:a,getDataSucceeded:l,isLoading:i,layout:c,pagination:u,slug:d}){const{total:m}=u,{contentType:{metadatas:g,settings:{bulkable:f,filterable:h,searchable:b}}}=c,C=(0,y.useNotification)(),{trackUsage:k}=(0,y.useTracking)(),{refetchPermissions:P}=(0,y.useRBACProvider)(),O=(0,r.useRef)(k),F=(0,r.useRef)(P),{notifyStatus:v}=(0,lo.G)();(0,y.useFocusWhenNavigate)();const[{query:R}]=(0,y.useQueryParams)(),I=Ri(R),w=(0,He.stringify)({plugins:R.plugins},{encode:!1}),{pathname:U}=(0,J.useLocation)(),{push:Z}=(0,J.useHistory)(),{formatMessage:N}=(0,q.useIntl)(),Q=c.contentType,_=M()(Q,"options.draftAndPublish",!1),V=(0,r.useRef)(""),A=(0,r.useCallback)((L,G)=>yo(this,null,function*(){a();try{const ne=G?{cancelToken:G.token}:null,{data:{results:re,pagination:fe}}=yield me.be.get(L,ne);v(N({id:E("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:fe.count})),l(fe,re)}catch(ne){if(Ae().isCancel(ne))return;if(M()(ne,"response.status",null)===403){yield F.current(),C({type:"info",message:{id:E("permissions.not-allowed.update")}}),Z("/");return}dE.error(ne),C({type:"warning",message:{id:E("error.model.fetch")}})}}),[N,a,l,v,Z,C]),H=(0,r.useCallback)(L=>yo(this,null,function*(){try{yield me.be.post(ge(`collection-types/${d}/actions/bulkDelete`),{ids:L});const G=ge(`collection-types/${d}${I}`);A(G),O.current("didBulkDeleteEntries")}catch(G){C({type:"warning",message:{id:E("error.record.delete")}})}}),[A,I,d,C]),S=(0,r.useCallback)(L=>yo(this,null,function*(){try{yield me.be.delete(ge(`collection-types/${d}/${L}`));const G=ge(`collection-types/${d}${I}`);A(G),C({type:"success",message:{id:E("success.record.delete")}})}catch(G){const ne=M()(G,"response.payload.message",N({id:E("error.record.delete")}));C({type:"warning",message:ne})}}),[d,I,A,C,N]);(0,r.useEffect)(()=>{const G=Ae().CancelToken.source(),ne=n,re=ge(`collection-types/${d}${I}`);return ne&&re.includes(V.current)&&A(re,G),()=>{V.current=d,G.cancel("Operation canceled by the user.")}},[n,a,d,I,l,A]);const K=N({id:E("header.name"),defaultMessage:"Content"}),$=N({id:Q.info.displayName,defaultMessage:Q.info.displayName||K}),D=n?N({id:E("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,x=L=>e?r.createElement(ye.z,bE(hE({},L),{forwardedAs:J.Link,onClick:()=>{const G=_?{status:"draft"}:{};O.current("willCreateEntry",G)},to:{pathname:`${U}/create`,search:R.plugins?w:""},startIcon:r.createElement(kt.default,null),style:{textDecoration:"none"}}),N({id:E("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return r.createElement(be.o,{"aria-busy":i},r.createElement(oe.T,{primaryAction:x(),subtitle:D,title:$,navigationAction:r.createElement(y.Link,{startIcon:r.createElement(fn.Z,null),to:"/content-manager/"},N({id:"global.back",defaultMessage:"Back"}))}),!n&&r.createElement(wl.Z,{endActions:r.createElement(Yt,{area:"contentManager.listView.actions"})}),n&&r.createElement(wl.Z,{endActions:r.createElement(r.Fragment,null,r.createElement(Yt,{area:"contentManager.listView.actions"}),r.createElement(cE,{layout:c}),r.createElement(y.CheckPermissions,{permissions:vE.collectionTypesConfigurations},r.createElement(EE,{paddingTop:1,paddingBottom:1},r.createElement(Re.h,{onClick:()=>{k("willEditListLayout")},forwardedAs:J.Link,to:{pathname:`${d}/configurations/list`,search:w},icon:r.createElement(ol.Z,null),label:N({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:r.createElement(r.Fragment,null,b&&r.createElement(y.SearchURLQuery,{label:N({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:$}),placeholder:N({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),h&&r.createElement(iE,{contentType:Q,slug:d,metadatas:g}))}),r.createElement(mt.D,null,n?r.createElement(r.Fragment,null,r.createElement(tE,{canCreate:e,canDelete:t,contentTypeName:$,onConfirmDeleteAll:H,onConfirmDelete:S,isBulkable:f,isLoading:i,layout:c,rows:o,action:x({variant:"secondary"})}),r.createElement(uE,{pagination:{pageCount:(u==null?void 0:u.pageCount)||1}})):r.createElement(y.NoPermissions,null)))}fc.propTypes={canCreate:s().bool.isRequired,canDelete:s().bool.isRequired,canRead:s().bool.isRequired,data:s().array.isRequired,layout:s().exact({components:s().object.isRequired,contentType:s().shape({attributes:s().object.isRequired,metadatas:s().object.isRequired,info:s().shape({displayName:s().string.isRequired}).isRequired,layouts:s().shape({list:s().array.isRequired}).isRequired,options:s().object.isRequired,settings:s().object.isRequired}).isRequired}).isRequired,isLoading:s().bool.isRequired,getData:s().func.isRequired,getDataSucceeded:s().func.isRequired,pagination:s().shape({total:s().number.isRequired,pageCount:s().number}).isRequired,slug:s().string.isRequired};const CE=G0();function PE(e){return(0,Rl.bindActionCreators)({getData:q0,getDataSucceeded:B0,onChangeListHeaders:io,onResetListHeaders:z0},e)}const OE=(0,pe.connect)(CE,PE),RE=(0,Rl.compose)(OE)((0,r.memo)(fc,Je()));var wE=Object.defineProperty,gc=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,yc=(e,t,n)=>t in e?wE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hc=(e,t)=>{for(var n in t||(t={}))ME.call(t,n)&&yc(e,n,t[n]);if(gc)for(var n of gc(t))TE.call(t,n)&&yc(e,n,t[n]);return e};const ho=e=>{const t=(0,r.useMemo)(()=>Bo(e.slug),[e.slug]),{isLoading:n,allowedActions:o}=(0,y.useRBAC)(t,e.permissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(RE,hc(hc({},e),o))};ho.defaultProps={permissions:[]},ho.propTypes={permissions:s().array,slug:s().string.isRequired};const IE=(0,r.memo)(ho,(e,t)=>{const n=(0,y.difference)(e,t);return Object.keys(n).filter(a=>a!=="state").length>0});var DE=Object.defineProperty,LE=Object.defineProperties,SE=Object.getOwnPropertyDescriptors,Tn=Object.getOwnPropertySymbols,bc=Object.prototype.hasOwnProperty,vc=Object.prototype.propertyIsEnumerable,Ec=(e,t,n)=>t in e?DE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xE=(e,t)=>{for(var n in t||(t={}))bc.call(t,n)&&Ec(e,n,t[n]);if(Tn)for(var n of Tn(t))vc.call(t,n)&&Ec(e,n,t[n]);return e},kE=(e,t)=>LE(e,SE(t)),FE=(e,t)=>{var n={};for(var o in e)bc.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Tn)for(var o of Tn(e))t.indexOf(o)<0&&vc.call(e,o)&&(n[o]=e[o]);return n};const Cc=e=>{var t=e,{layout:n}=t,o=FE(t,["layout"]);const a=(0,pe.useDispatch)(),{replace:l}=(0,J.useHistory)(),[{query:i,rawQuery:c}]=(0,y.useQueryParams)(),u=fs(i,o.slug,"listView"),d=ds(o.slug);return(0,r.useEffect)(()=>{c||l(d)},[c,l,d]),(0,r.useEffect)(()=>{a(W0(n))},[a,n]),(0,r.useEffect)(()=>()=>{a(Z0())},[a]),u?r.createElement(IE,kE(xE({},o),{layout:n,permissions:u})):null};Cc.propTypes={layout:s().exact({components:s().object.isRequired,contentType:s().shape({attributes:s().object.isRequired,metadatas:s().object.isRequired,layouts:s().shape({list:s().array.isRequired}).isRequired,options:s().object.isRequired,settings:s().object.isRequired,pluginOptions:s().object}).isRequired}).isRequired,slug:s().string.isRequired};const AE=Cc,jE=(e,t)=>me.be.put(ge(`content-types/${t}/configuration`),e),bo=({modifiedData:e,onChange:t,sortOptions:n})=>{const{formatMessage:o}=(0,q.useIntl)(),{settings:a,metadatas:l}=e;return r.createElement(ie.K,{spacing:4},r.createElement(z.Z,{variant:"delta",as:"h2"},o({id:E("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(ie.K,{horizontal:!0,justifyContent:"space-between",spacing:4},r.createElement(T.x,{width:"100%"},r.createElement(Vt.s,{label:o({id:E("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{t({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:o({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:o({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable})),r.createElement(T.x,{width:"100%"},r.createElement(Vt.s,{label:o({id:E("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{t({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:o({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:o({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable})),r.createElement(T.x,{width:"100%"},r.createElement(Vt.s,{label:o({id:E("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{t({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:o({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:o({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable}))),r.createElement(qe.r,{gap:4},r.createElement(Ce.P,{s:12,col:6},r.createElement(Ze.P,{label:o({id:E("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:o({id:E("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>t({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:e.settings.pageSize||""},[10,20,50,100].map(i=>r.createElement(Pe.W,{key:i,value:i},i)))),r.createElement(Ce.P,{s:12,col:3},r.createElement(Ze.P,{label:o({id:E("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>t({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:e.settings.defaultSortBy||""},n.map(i=>r.createElement(Pe.W,{key:i,value:i},l[i].list.label||i)))),r.createElement(Ce.P,{s:12,col:3},r.createElement(Ze.P,{label:o({id:E("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>t({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:e.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>r.createElement(Pe.W,{key:i,value:i},i))))))};bo.defaultProps={modifiedData:{},sortOptions:[]},bo.propTypes={modifiedData:s().object,onChange:s().func.isRequired,sortOptions:s().array};const $E=bo,vo=j.default.button`
1133
+ display: flex;
1134
+ align-items: center;
1135
+ height: ${({theme:e})=>e.spaces[7]};
1136
+
1137
+ &:last-child {
1138
+ padding: 0 ${({theme:e})=>e.spaces[3]};
1139
+ }
1140
+ `,Pc=(0,j.default)(vo)`
1141
+ padding: 0 ${({theme:e})=>e.spaces[3]};
1142
+ border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
1143
+ cursor: all-scroll;
1144
+
1145
+ svg {
1146
+ width: ${12/16}rem;
1147
+ height: ${12/16}rem;
1148
+ }
1149
+ `,NE=(0,j.default)(B.k)`
1150
+ max-height: ${32/16}rem;
1151
+ cursor: pointer;
1152
+
1153
+ svg {
1154
+ width: ${10/16}rem;
1155
+ height: ${10/16}rem;
1156
+
1157
+ path {
1158
+ fill: ${({theme:e})=>e.colors.neutral600};
1159
+ }
1160
+ }
1161
+
1162
+ &:hover {
1163
+ background-color: ${({theme:e})=>e.colors.primary100};
1164
+ border-color: ${({theme:e})=>e.colors.primary200};
1165
+
1166
+ svg {
1167
+ path {
1168
+ fill: ${({theme:e})=>e.colors.primary600};
1169
+ }
1170
+ }
1171
+
1172
+ ${z.Z} {
1173
+ color: ${({theme:e})=>e.colors.primary600};
1174
+ }
1175
+
1176
+ ${Pc} {
1177
+ border-right: 1px solid ${({theme:e})=>e.colors.primary200};
1178
+ }
1179
+ }
1180
+ `,VE=(0,j.default)(T.x)`
1181
+ &:last-child {
1182
+ padding-right: ${({theme:e})=>e.spaces[3]};
1183
+ }
1184
+ `,Oc=({index:e,isDraggingSibling:t,labelField:n,onClickEditField:o,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:c})=>{const{formatMessage:u}=(0,q.useIntl)(),d=(0,r.useRef)(null),m=(0,r.useRef)(null),[,g]=(0,r.useState)(!1),f=(0,r.useRef)(),h=To(n),b=()=>{f.current&&f.current.click()},[,C]=(0,Fe.useDrop)({accept:De.FIELD,hover(v,R){if(!m.current)return;const I=v.index,w=e;if(I===w)return;const U=m.current.getBoundingClientRect(),Z=(U.right-U.left)/2,Q=R.getClientOffset().x-U.left;I>w&&Q>Z||I<w&&Q<Z||(a(I,w),v.index=w)}}),[{isDragging:k},P,O]=(0,Fe.useDrag)({type:De.FIELD,item(){return{index:e,labelField:n,name:i}},collect:v=>({isDragging:v.isDragging()}),end(){c(!1)}});(0,r.useEffect)(()=>{O((0,vr.rX)(),{captureDraggingState:!1})},[O]),(0,r.useEffect)(()=>{k&&c(!0)},[k,c]),(0,r.useEffect)(()=>{t||g(v=>!v)},[t]);const F={dragRef:P(d),dropRef:C(m)};return r.createElement(VE,{ref:F?F.dropRef:null},k&&r.createElement(xn,{transparent:!0,labelField:h}),!k&&t&&r.createElement(xn,{isSibling:!0,labelField:h}),!k&&!t&&r.createElement(NE,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:k},r.createElement(ie.K,{horizontal:!0,spacing:3},r.createElement(Pc,{as:"span","aria-label":u({id:E("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:n}),onClick:v=>v.stopPropagation(),ref:F.dragRef,type:"button"},r.createElement(dt.Z,null)),r.createElement(z.Z,{fontWeight:"bold"},h)),r.createElement(B.k,{paddingLeft:3},r.createElement(vo,{ref:f,onClick:v=>{v.stopPropagation(),o(i)},"aria-label":u({id:E("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:n}),type:"button"},r.createElement(pt.Z,null)),r.createElement(vo,{onClick:l,"data-testid":`delete-${i}`,"aria-label":u({id:E("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:n}),type:"button"},r.createElement(Dn.default,null)))))};Oc.propTypes={index:s().number.isRequired,isDraggingSibling:s().bool.isRequired,labelField:s().string.isRequired,name:s().string.isRequired,onClickEditField:s().func.isRequired,onMoveField:s().func.isRequired,onRemoveField:s().func.isRequired,setIsDraggingSibling:s().func.isRequired};const qE=Oc,Rc=(0,j.default)(T.x)`
1185
+ flex: ${({size:e})=>e};
1186
+ `,BE=(0,j.default)(Rc)`
1187
+ overflow-x: scroll;
1188
+ overflow-y: hidden;
1189
+ `,zE=(0,j.default)(Rc)`
1190
+ max-width: ${32/16}rem;
1191
+ `,wc=({displayedFields:e,listRemainingFields:t,metadatas:n,onAddField:o,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:c}=(0,q.useIntl)(),[u,d]=(0,r.useState)(!1),[m,g]=(0,r.useState)(null),f=(0,r.useRef)();function h(...C){g("add"),o(...C)}function b(...C){g("remove"),i(...C)}return(0,r.useEffect)(()=>{m==="add"&&(f==null?void 0:f.current)&&(f.current.scrollLeft=f.current.scrollWidth)},[e,m]),r.createElement(r.Fragment,null,r.createElement(T.x,{paddingBottom:4},r.createElement(z.Z,{variant:"delta",as:"h2"},c({id:E("containers.SettingPage.view"),defaultMessage:"View"}))),r.createElement(B.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},r.createElement(BE,{size:"1",paddingBottom:4,ref:f},r.createElement(ie.K,{horizontal:!0,spacing:3},e.map((C,k)=>r.createElement(qE,{key:C,index:k,isDraggingSibling:u,onMoveField:l,onClickEditField:a,onRemoveField:P=>b(P,k),name:C,labelField:n[C].list.label||C,setIsDraggingSibling:d})))),r.createElement(zE,{size:"auto",paddingBottom:4},r.createElement(We.O,{label:c({id:E("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:Re.h,icon:r.createElement(kt.default,null),disabled:t.length<=0,"data-testid":"add-field"},t.map(C=>r.createElement(We.s,{key:C,onClick:()=>h(C)},n[C].list.label||C))))))};wc.propTypes={displayedFields:Se.PropTypes.array.isRequired,listRemainingFields:Se.PropTypes.array.isRequired,metadatas:Se.PropTypes.objectOf(Se.PropTypes.shape({list:Se.PropTypes.shape({label:Se.PropTypes.string})})).isRequired,onAddField:Se.PropTypes.func.isRequired,onClickEditField:Se.PropTypes.func.isRequired,onMoveField:Se.PropTypes.func.isRequired,onRemoveField:Se.PropTypes.func.isRequired};const ZE=wc,WE=(0,j.default)(B.k)`
1192
+ svg {
1193
+ width: ${32/16}rem;
1194
+ height: ${24/16}rem;
1195
+ margin-right: ${({theme:e})=>e.spaces[3]};
1196
+ }
1197
+ `,Mc=({attributes:e,fieldForm:t,fieldToEdit:n,onCloseModal:o,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:c}=(0,q.useIntl)(),u=e[n].relationType;let d=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(u)&&(d=!0),r.createElement(pl.P,{onClose:o,labelledBy:"title"},r.createElement("form",{onSubmit:l},r.createElement(ml.x,null,r.createElement(WE,null,r.createElement(bl,{type:i}),r.createElement(z.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:E("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:$t()(n)})))),r.createElement(fl.f,null,r.createElement(qe.r,{gap:4},r.createElement(Ce.P,{s:12,col:6},r.createElement(er.o,{id:"label-input",label:c({id:E("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>a(m),value:t.label,hint:c({id:E("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),d&&r.createElement(Ce.P,{s:12,col:6},r.createElement(Vt.s,{"data-testid":"Enable sort on this field",checked:t.sortable,label:c({id:E("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>a({target:{name:"sortable",value:m.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),r.createElement(gl.m,{startActions:r.createElement(ye.z,{onClick:o,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Mc.propTypes={attributes:s().objectOf(s().shape({relationType:s().string})).isRequired,fieldForm:s().shape({label:s().string,sortable:s().bool}).isRequired,fieldToEdit:s().string.isRequired,onChangeEditLabel:s().func.isRequired,onCloseModal:s().func.isRequired,onSubmit:s().func.isRequired,type:s().string.isRequired};const _E=Mc;var UE=Object.defineProperty,HE=Object.defineProperties,GE=Object.getOwnPropertyDescriptors,Tc=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,QE=Object.prototype.propertyIsEnumerable,Ic=(e,t,n)=>t in e?UE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YE=(e,t)=>{for(var n in t||(t={}))KE.call(t,n)&&Ic(e,n,t[n]);if(Tc)for(var n of Tc(t))QE.call(t,n)&&Ic(e,n,t[n]);return e},JE=(e,t)=>HE(e,GE(t));const XE=(e,t)=>JE(YE({},e),{initialData:t,modifiedData:t}),Eo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}},eC=(e=Eo,t)=>(0,Ht.default)(e,n=>{const o=["modifiedData","layouts","list"];switch(t.type){case"ADD_FIELD":{const a=M()(e,o,[]);X()(n,o,[...a,t.item]);break}case"MOVE_FIELD":{const a=M()(e,o,[]),{originalIndex:l,atIndex:i}=t;X()(n,o,zt(a,l,i));break}case"ON_CHANGE":{X()(n,["modifiedData",...t.keys.split(".")],t.value);break}case"ON_CHANGE_FIELD_METAS":{X()(n,["fieldForm",t.name],t.value);break}case"REMOVE_FIELD":{const a=M()(e,o,[]);X()(n,o,a.filter((l,i)=>t.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=t;n.fieldToEdit=a,n.fieldForm.label=M()(n,["modifiedData","metadatas",a,"list","label"],""),n.fieldForm.sortable=M()(n,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{n.fieldForm={},n.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",e.fieldToEdit,"list"];X()(n,[...a,"label"],e.fieldForm.label),X()(n,[...a,"sortable"],e.fieldForm.sortable);break}default:return n}}),tC=["media","richtext","dynamiczone","relation","component","json"];var nC=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const Dc=({layout:e,slug:t})=>{const{formatMessage:n}=(0,q.useIntl)(),{trackUsage:o}=(0,y.useTracking)(),a=ps(),l=(0,y.useNotification)(),{refetchData:i}=(0,r.useContext)(Do),[c,u]=(0,r.useState)(!1),d=()=>u(x=>!x),[m,g]=(0,r.useState)(!1),f=()=>g(x=>!x),[h,b]=(0,r.useReducer)(eC,Eo,()=>XE(Eo,e)),{fieldToEdit:C,fieldForm:k,initialData:P,modifiedData:O}=h,{attributes:F}=e,v=O.layouts.list,R=()=>{const{settings:{pageSize:x,defaultSortBy:L,defaultSortOrder:G},kind:ne,uid:re}=P,fe=`${L}:${G}`,W=`${(0,He.stringify)({page:1,pageSize:x,sort:fe},{encode:!1})}${a?`&${a}`:""}`;return`/content-manager/${ne}/${re}?${W}`},I=({target:{name:x,value:L}})=>{b({type:"ON_CHANGE",keys:x,value:x==="settings.pageSize"?parseInt(L,10):L})},w=()=>nC(void 0,null,function*(){const x=or()(O,["layouts","settings","metadatas"]);A.mutate(x)}),U=x=>{b({type:"ADD_FIELD",item:x})},Z=(x,L)=>{x.stopPropagation(),v.length===1?l({type:"info",message:{id:E("notification.info.minimumFields")}}):b({type:"REMOVE_FIELD",index:L})},N=x=>{x.preventDefault(),d(),o("willSaveContentTypeLayout")},Q=x=>{b({type:"SET_FIELD_TO_EDIT",fieldToEdit:x}),f()},_=()=>{b({type:"UNSET_FIELD_TO_EDIT"}),f()},V=x=>{x.preventDefault(),f(),b({type:"SUBMIT_FIELD_FORM"})},A=(0,at.useMutation)(x=>jE(x,t),{onSuccess(){o("didEditListSettings"),i()},onError(){l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:H}=A,S=({target:{name:x,value:L}})=>{b({type:"ON_CHANGE_FIELD_METAS",name:x,value:L})},K=Object.entries(F).reduce((x,L)=>{const[G,ne]=L,re=Fo(ne),fe=v.includes(G);return re&&!fe&&x.push(G),x},[]).sort(),$=Object.entries(F).reduce((x,L)=>{const[G,{type:ne}]=L;return tC.includes(ne)||x.push(G),x},[]),D=(x,L)=>{b({type:"MOVE_FIELD",originalIndex:x,atIndex:L})};return r.createElement(le.A,null,r.createElement(be.o,{"aria-busy":H},r.createElement("form",{onSubmit:N},r.createElement(oe.T,{navigationAction:r.createElement(y.Link,{startIcon:r.createElement(fn.Z,null),to:R,id:"go-back"},n({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.z,{size:"S",startIcon:r.createElement(ht.Z,null),disabled:Ft()(O,P),type:"submit"},n({id:"global.save",defaultMessage:"Save"})),subtitle:n({id:E("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:n({id:E("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:$t()(O.info.displayName)})}),r.createElement(mt.D,null,r.createElement(T.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement($E,{modifiedData:O,onChange:I,sortOptions:$}),r.createElement(T.x,{paddingTop:6,paddingBottom:6},r.createElement(zr.i,null)),r.createElement(ZE,{listRemainingFields:K,displayedFields:v,onAddField:U,onClickEditField:Q,onMoveField:D,onRemoveField:Z,metadatas:O.metadatas}))),r.createElement(y.ConfirmDialog,{bodyText:{id:E("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ht.Z,null),isConfirmButtonLoading:H,isOpen:c,onToggleDialog:d,onConfirm:w,variantRightButton:"success-light"})),m&&r.createElement(_E,{attributes:F,fieldForm:k,fieldToEdit:C,onChangeEditLabel:S,onCloseModal:_,onSubmit:V,type:M()(F,[C,"type"],"text")})))};Dc.propTypes={layout:s().shape({uid:s().string.isRequired,settings:s().shape({bulkable:s().bool,defaultSortBy:s().string,defaultSortOrder:s().string,filterable:s().bool,pageSize:s().number,searchable:s().bool}).isRequired,metadatas:s().object.isRequired,options:s().object.isRequired,attributes:s().objectOf(s().shape({type:s().string})).isRequired}).isRequired,slug:s().string.isRequired};const rC=(0,r.memo)(Dc),oC=()=>r.createElement(T.x,{padding:8},r.createElement(y.AnErrorOccurred,null)),Lc=ce.Z.contentManager,Sc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:o,updateLayout:a}=as(e),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,r.useMemo)(()=>{let m={},g={};return o.contentType&&(m=_t(o.contentType)),o.components&&(g=Object.keys(o.components).reduce((f,h)=>(f[h]=_t(o.components[h]),f),{})),{rawContentTypeLayout:m,rawComponentsLayouts:g}},[o]);if((0,Y.get)(o,["contentType","uid"],null)!==e||n)return r.createElement(y.LoadingIndicatorPage,null);const u=({location:{state:m},history:{goBack:g},match:{params:{id:f,origin:h}}},b)=>r.createElement(b,{slug:e,layout:o,state:m,goBack:g,id:f,origin:h}),d=[{path:"create/clone/:origin",comp:vn},{path:"create",comp:vn},{path:":id",comp:vn},{path:"",comp:AE}].map(({path:m,comp:g})=>r.createElement(J.Route,{key:m,path:`${t}/${m}`,render:f=>u(f,g)}));return r.createElement(eu.ErrorBoundary,{FallbackComponent:oC},r.createElement(Lo.Provider,{value:o},r.createElement(J.Switch,null,r.createElement(J.Route,{path:`${t}/configurations/list`},r.createElement(y.CheckPagePermissions,{permissions:Lc.collectionTypesConfigurations},r.createElement(rC,{layout:l,slug:e,updateLayout:a}))),r.createElement(J.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:Lc.collectionTypesConfigurations},r.createElement(ao,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),d)))};Sc.propTypes={match:s().shape({url:s().string.isRequired,params:s().shape({slug:s().string.isRequired}).isRequired}).isRequired};const sC=(0,r.memo)(Sc);var xc=p(57678),aC=p(98399),iC=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const lC=ce.Z.contentManager,cC=()=>{const[{isLoading:e,data:t},n]=(0,r.useReducer)(xc.Z,xc.q),o=(0,r.useMemo)(An,[]),{schemas:a}=(0,pe.useSelector)(i=>o(i),pe.shallowEqual),{uid:l}=(0,J.useParams)();return(0,r.useEffect)(()=>{const c=Ae().CancelToken.source();return(d=>iC(void 0,null,function*(){try{n(cn());const{data:{data:m}}=yield me.be.get(ge(`components/${l}/configuration`),{cancelToken:d.token});n(Fr(Uo(m,a,"component")))}catch(m){if(Ae().isCancel(m))return;aC.error(m)}}))(c),()=>{c.cancel("Operation canceled by the user.")}},[l,a]),e?r.createElement(y.LoadingIndicatorPage,null):r.createElement(y.CheckPagePermissions,{permissions:lC.componentsConfigurations},r.createElement(ao,{components:t.components,mainLayout:t.component,slug:l}))},uC=(0,r.memo)(cC);var dC=p(9695),pC=p(54725);const mC=()=>{const{formatMessage:e}=(0,q.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(be.o,null,r.createElement(oe.T,{title:e({id:E("header.name"),defaultMessage:"Content"})}),r.createElement(mt.D,null,r.createElement(dC.x,{action:r.createElement(y.LinkButton,{variant:"secondary",startIcon:r.createElement(kt.default,null),to:"/plugins/content-type-builder/content-types/create-content-type"},e({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:e({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:r.createElement(pC.default,{width:"10rem"}),shadow:"tableShadow"})))},fC=()=>{const{formatMessage:e}=(0,q.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(be.o,null,r.createElement(oe.T,{title:e({id:E("header.name"),defaultMessage:"Content"})}),r.createElement(mt.D,null,r.createElement(y.NoPermissions,null)))},gC=ce.Z.contentManager,kc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:o,updateLayout:a}=as(e),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,r.useMemo)(()=>{let c={},u={};return o.contentType&&(u=_t(o.contentType)),o.components&&(c=Object.keys(o.components).reduce((d,m)=>(d[m]=_t(o.components[m]),d),{})),{rawContentTypeLayout:u,rawComponentsLayouts:c}},[o]);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Lo.Provider,{value:o},r.createElement(J.Switch,null,r.createElement(J.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:gC.singleTypesConfigurations},r.createElement(ao,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),r.createElement(J.Route,{path:t,render:({location:{state:c},history:{goBack:u}})=>r.createElement(vn,{layout:o,slug:e,isSingleType:!0,state:c,goBack:u})})))};kc.propTypes={match:s().shape({url:s().string.isRequired,params:s().shape({slug:s().string.isRequired}).isRequired}).isRequired};const yC=(0,r.memo)(kc);var hC=p(58469),bC=p(59578),Fc=p.n(bC),vC=p(90700),EC=p(8598),CC=p(77013),PC=p(79318),OC=p(66618),RC=Object.defineProperty,wC=Object.defineProperties,MC=Object.getOwnPropertyDescriptors,Ac=Object.getOwnPropertySymbols,TC=Object.prototype.hasOwnProperty,IC=Object.prototype.propertyIsEnumerable,jc=(e,t,n)=>t in e?RC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DC=(e,t)=>{for(var n in t||(t={}))TC.call(t,n)&&jc(e,n,t[n]);if(Ac)for(var n of Ac(t))IC.call(t,n)&&jc(e,n,t[n]);return e},LC=(e,t)=>wC(e,MC(t));const $c=(e,t)=>(0,hC.ZP)(e,Fc()(t),{keys:[n=>Fc()(n.title)]}),SC=()=>{const[e,t]=(0,r.useState)(""),{formatMessage:n}=(0,q.useIntl)(),o=(0,r.useMemo)(Ku,[]),{collectionTypeLinks:a,singleTypeLinks:l}=(0,pe.useSelector)(h=>o(h),pe.shallowEqual),i=h=>h.map(b=>LC(DC({},b),{title:n({id:b.title,defaultMessage:b.title})})),c=i(a),u=i(l),d=[{id:"collectionTypes",title:{id:E("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:ke()($c(c,e),h=>h.title.toLowerCase())},{id:"singleTypes",title:{id:E("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:ke()($c(u,e),h=>h.title.toLowerCase())}],m=()=>{t("")},g=({target:{value:h}})=>{t(h)},f=n({id:E("header.name"),defaultMessage:"Content"});return r.createElement(vC.m,{ariaLabel:f},r.createElement(EC.p,{label:f,searchable:!0,value:e,onChange:g,onClear:m,searchLabel:n({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),r.createElement(CC.Z,null,d.map(h=>{const b=n({id:h.title.id,defaultMessage:h.title.defaultMessage},h.title.values);return r.createElement(PC.D,{key:h.id,label:b,badgeLabel:h.links.length.toString()},h.links.map(C=>{const k=C.search?`?${C.search}`:"";return r.createElement(OC.E,{as:J.NavLink,key:C.uid,to:`${C.to}${k}`},C.title)}))})))};var Co=p(92886);const xC=()=>({type:Co.ZA}),kC=()=>({type:Co.c2}),FC=(e,t,n,o)=>({type:Co.ix,data:{authorizedCtLinks:e,authorizedStLinks:t,components:o,contentTypeSchemas:n}}),Nc=(e,t,n=[])=>e.filter(o=>o.isDisplayed).map(o=>{const a=[{action:"plugin::content-manager.explorer.create",subject:o.uid},{action:"plugin::content-manager.explorer.read",subject:o.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:o.uid}],i=t==="collectionTypes"?a:l,c=n.find(({uid:d})=>d===o.uid);let u=null;if(c){const d={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};u=(0,He.stringify)(d,{encode:!1})}return{permissions:i,search:u,kind:o.kind,title:o.info.displayName,to:`/content-manager/${o.kind}/${o.uid}`,uid:o.uid,name:o.uid,isDisplayed:o.isDisplayed}}),AC=(e,t)=>{const[n,o]=(0,Y.chain)(e).groupBy("kind").map((a,l)=>({name:l,links:a})).sortBy("name").value();return{collectionTypesSectionLinks:Nc((0,Y.get)(n,"links",[]),"collectionTypes",t),singleTypesSectionLinks:Nc((0,Y.get)(o,"links",[]),"singleTypes")}},Vc=(e,t)=>t.map(({permissions:n})=>(0,y.hasPermissions)(e,n));var jC=p(98399),$C=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const NC=(e,t,n)=>$C(void 0,null,function*(){try{const{data:{data:o}}=yield me.be.get(ge("content-types-settings")),{collectionTypesSectionLinks:a,singleTypesSectionLinks:l}=AC(e,o),i=Vc(t,a),c=yield Promise.all(i),u=a.filter((f,h)=>c[h]),d=Vc(t,l),m=yield Promise.all(d),g=l.filter((f,h)=>m[h]);return{authorizedCtLinks:u,authorizedStLinks:g}}catch(o){return jC.error(o),n({type:"warning",message:{id:"notification.error"}}),{authorizedCtLinks:[],authorizedStLinks:[],contentTypes:[]}}});var VC=p(98399),qC=Object.defineProperty,BC=Object.defineProperties,zC=Object.getOwnPropertyDescriptors,qc=Object.getOwnPropertySymbols,ZC=Object.prototype.hasOwnProperty,WC=Object.prototype.propertyIsEnumerable,Bc=(e,t,n)=>t in e?qC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_C=(e,t)=>{for(var n in t||(t={}))ZC.call(t,n)&&Bc(e,n,t[n]);if(qc)for(var n of qc(t))WC.call(t,n)&&Bc(e,n,t[n]);return e},UC=(e,t)=>BC(e,zC(t)),HC=(e,t,n)=>new Promise((o,a)=>{var l=u=>{try{c(n.next(u))}catch(d){a(d)}},i=u=>{try{c(n.throw(u))}catch(d){a(d)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,i);c((n=n.apply(e,t)).next())});const GC=()=>{const e=(0,pe.useDispatch)(),t=(0,y.useNotification)(),n=(0,pe.useSelector)(Dt()),o=(0,r.useRef)(),{allPermissions:a}=(0,y.useRBACProvider)(),{runHookWaterfall:l}=(0,y.useStrapiApp)(),c=Ae().CancelToken.source(),{notifyStatus:u}=(0,lo.G)(),{formatMessage:d}=(0,q.useIntl)(),m=()=>HC(void 0,null,function*(){e(xC());try{const[{data:{data:g}},{data:{data:f}}]=yield Promise.all(["components","content-types"].map(O=>me.be.get(ge(O),{cancelToken:c.token})));u(d({id:E("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const{authorizedCtLinks:h,authorizedStLinks:b}=yield NC(f,a,t),{ctLinks:C}=l(Kt.LK,{ctLinks:h,models:f}),{stLinks:k}=l(Kt.dV,{stLinks:b,models:f}),P=FC(C,k,f,g);e(P)}catch(g){if(Ae().isCancel(g))return;VC.error(g),t({type:"warning",message:{id:"notification.error"}})}});return o.current=m,(0,r.useEffect)(()=>(o.current(),()=>{c.cancel("Operation canceled by the user."),e(kC())}),[e,t]),UC(_C({},n),{refetchData:o.current})},KC=ce.Z.contentManager,zc=()=>{const e=(0,J.useRouteMatch)("/content-manager/:kind/:uid"),{status:t,collectionTypeLinks:n,singleTypeLinks:o,models:a,refetchData:l}=GC(),i=ke()([...n,...o],f=>f.title.toLowerCase()),{pathname:c}=(0,J.useLocation)(),{formatMessage:u}=(0,q.useIntl)(),{startSection:d}=(0,y.useGuidedTour)(),m=(0,r.useRef)(d);if((0,r.useEffect)(()=>{m.current&&m.current("contentManager")},[]),t==="loading")return r.createElement(be.o,{"aria-busy":"true"},r.createElement(oe.T,{title:u({id:E("header.name"),defaultMessage:"Content"})}),r.createElement(y.LoadingIndicatorPage,null));const g=a.filter(({isDisplayed:f})=>f);return i.length===0&&g.length>0&&c!=="/content-manager/403"?r.createElement(J.Redirect,{to:"/content-manager/403"}):g.length===0&&c!=="/content-manager/no-content-types"?r.createElement(J.Redirect,{to:"/content-manager/no-content-types"}):!e&&i.length>0?r.createElement(J.Redirect,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):r.createElement(le.A,{sideNav:r.createElement(SC,null)},r.createElement(Xc,null),r.createElement(Do.Provider,{value:{refetchData:l}},r.createElement(J.Switch,null,r.createElement(J.Route,{path:"/content-manager/components/:uid/configurations/edit"},r.createElement(y.CheckPagePermissions,{permissions:KC.componentsConfigurations},r.createElement(uC,null))),r.createElement(J.Route,{path:"/content-manager/collectionType/:slug",component:sC}),r.createElement(J.Route,{path:"/content-manager/singleType/:slug",component:yC}),r.createElement(J.Route,{path:"/content-manager/403"},r.createElement(fC,null)),r.createElement(J.Route,{path:"/content-manager/no-content-types"},r.createElement(mC,null)),r.createElement(J.Route,{path:"",component:y.NotFound}))))};function QC(){const{formatMessage:e}=(0,q.useIntl)();return r.createElement(r.Fragment,null,r.createElement(ut.Helmet,{title:e({id:E("plugin.name"),defaultMessage:"Content Manager"})}),r.createElement(zc,null))}},57544:()=>{},59599:()=>{},42310:()=>{},33842:()=>{},85695:()=>{}}]);