@nocobase/plugin-comments 2.1.0-beta.8 → 2.2.0-alpha.1

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 (32) hide show
  1. package/client-v2.d.ts +2 -0
  2. package/client-v2.js +1 -0
  3. package/dist/client/23.41e3f0e01c284099.js +10 -0
  4. package/dist/client/{26ed8f932127afec.js → 512.11ad262f24201bae.js} +1 -1
  5. package/dist/client/871.8da01ba1475c51b7.js +10 -0
  6. package/dist/client/88.98817a8e01e02a7b.js +10 -0
  7. package/dist/client/index.js +1 -1
  8. package/dist/client/models/CommentsBlockModel.d.ts +1 -1
  9. package/dist/client-v2/638.c5152390d43e7475.js +10 -0
  10. package/dist/client-v2/716.0fffbfd9f6f60ddd.js +10 -0
  11. package/dist/client-v2/index.d.ts +10 -0
  12. package/dist/client-v2/index.js +10 -0
  13. package/dist/client-v2/locale.d.ts +11 -0
  14. package/dist/client-v2/models/CommentActions.d.ts +10 -0
  15. package/dist/client-v2/models/CommentItem.d.ts +38 -0
  16. package/dist/client-v2/models/CommentList.d.ts +21 -0
  17. package/dist/client-v2/models/CommentSubmit.d.ts +15 -0
  18. package/dist/client-v2/models/CommentsBlockModel.d.ts +28 -0
  19. package/dist/client-v2/models/actions/CommentActionGroupModel.d.ts +14 -0
  20. package/dist/client-v2/models/actions/DeleteCommentActionModel.d.ts +15 -0
  21. package/dist/client-v2/models/actions/EditCommentActionModel.d.ts +15 -0
  22. package/dist/client-v2/models/actions/QuoteReplyActionModel.d.ts +15 -0
  23. package/dist/client-v2/models/actions/index.d.ts +12 -0
  24. package/dist/client-v2/models/utils.d.ts +9 -0
  25. package/dist/client-v2/plugin.d.ts +13 -0
  26. package/dist/externalVersion.js +7 -5
  27. package/dist/locale/en-US.json +5 -1
  28. package/dist/locale/zh-CN.json +4 -0
  29. package/package.json +5 -2
  30. package/dist/client/260481019096d1d7.js +0 -10
  31. package/dist/client/2f8d64984e7c9bd3.js +0 -10
  32. package/dist/client/d75d43be6a3bbb6b.js +0 -10
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["23"],{970:function(e,t,n){n.r(t),n.d(t,{CommentSubmit:function(){return b}});var r=n(230),o=n(155),a=n.n(o),i=n(59),l=n(342),c=n(198),u=n(872),s=n(830);function p(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function b(){var e,t=(0,r.useField)(),n=(0,o.useCallback)(function(e){t.setValue(f(d({},t.value),{content:e}))},[t]),b=(0,u.Bd)().t,m=(0,s.A)(),y=m.wrapSSR,g=m.componentCls,h=m.hashId,v=(0,o.useMemo)(function(){var e,n;return(null==(n=t.value)||null==(e=n.content)?void 0:e.trim().length)>0},[t.value]),x=(0,l.useBlockRequestContext)(),w=x.resource,O=x.service,k=(0,o.useCallback)(function(){var e;return(e=function(){var e,r,o,a,i,l,c;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(u){switch(u.label){case 0:return[4,w.create({values:t.value})];case 1:return u.sent(),n(""),l=(null==O||null==(r=O.data)||null==(e=r.meta)?void 0:e.count)||0,c=Math.ceil((l+1)/((null==O||null==(a=O.data)||null==(o=a.meta)?void 0:o.pageSize)||10)),O.run(f(d({},null==(i=O.params)?void 0:i[0]),{page:c})),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){p(a,r,o,i,l,"next",e)}function l(e){p(a,r,o,i,l,"throw",e)}i(void 0)})})()},[w,t,O,n]),j=(0,c.x)().createAble,C=(0,l.useACLActionParamsContext)(),P=!(0,l.useDesignable)().designable&&((null==t||null==(e=t.data)?void 0:e.hidden)||!C),S=(0,l.useCollectionFields)(),I=(0,o.useMemo)(function(){var e,t;return null==(t=S.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[S]);return!j||P?null:y(a().createElement("div",{style:{marginTop:10},className:"".concat(g," ").concat(h)},a().createElement(r.RecursionField,{basePath:t.address,name:"content",schema:{type:"string","x-component":"MarkdownVditor","x-component-props":f(d({},I),{onChange:function(e){n(e)}}),"x-read-pretty":!1,"x-read-only":!1,name:"content"}}),a().createElement(i.Button,{disabled:!v,onClick:function(){return k()},type:"primary",style:{marginTop:10}},b("Comment"))))}},830:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.A=(0,n(342).genStyleHook)("nb-comment",function(e){var t,n,o=e.componentCls;return r({},o,(r(n={},"".concat(o,"-item-container-container"),r({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),r(n,"".concat(o,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),r(n,"".concat(o,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),r(n,".ant-list-pagination",{marginTop:e.marginXS}),r(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),r(n,"".concat(o,"-item-title"),(r(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"32px"},"".concat(o,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),r(t,"".concat(o,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),r(n,"".concat(o,"-item-editor"),r({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(o,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))})}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["893"],{376:function(e,n,t){t.r(n),t.d(n,{CommentDecorator:function(){return i}});var c=t(772),o=t(156),r=t.n(o),a=t(868),i=(0,c.withDynamicSchemaProps)(function(e){var n;return r().createElement(a.u,e,r().createElement(c.List.Decorator,e,r().createElement(c.CollectionManagerProvider,{dataSource:e.dataSource},r().createElement(c.CollectionProvider,{name:"".concat(null!=(n=e.association)?n:e.collection)},e.children))))})}}]);
10
+ "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["512"],{755:function(e,n,t){t.r(n),t.d(n,{CommentDecorator:function(){return i}});var c=t(342),o=t(155),r=t.n(o),a=t(198),i=(0,c.withDynamicSchemaProps)(function(e){var n;return r().createElement(a.w,e,r().createElement(c.List.Decorator,e,r().createElement(c.CollectionManagerProvider,{dataSource:e.dataSource},r().createElement(c.CollectionProvider,{name:"".concat(null!=(n=e.association)?n:e.collection)},e.children))))})}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["871"],{762:function(e,t,n){n.r(t),n.d(t,{CommentList:function(){return f}});var r=n(230),o=n(59),i=n(155),a=n.n(i),l=n(830),c=n(342);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var f=(0,c.withDynamicSchemaProps)(function(e){var t,n,f,m=(0,r.useFieldSchema)(),b=(0,r.useField)(),g=(function(e){if(Array.isArray(e))return e}(t=(0,i.useState)(new Map))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return u(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return u(e,1)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],y=(0,l.A)(),h=y.wrapSSR,v=y.hashId,O=y.componentCls,x=(0,c.useBlockRequestContext)().service,S=x.run,w=x.params,j=null==x||null==(n=x.data)?void 0:n.meta,k=(0,i.useCallback)(function(e){return g.has(e)||g.set(e,new r.Schema({type:"object",properties:s({},e,m.properties.item)})),g.get(e)},[m.properties,g]),C=(0,i.useCallback)(function(e,t){S(d(p({},null==w?void 0:w[0]),{page:e,pageSize:t}))},[S,w]);return(null==x?void 0:x.loading)?a().createElement("div",{style:{display:"flex",justifyContent:"center"}},a().createElement(o.Spin,{spinning:!0})):h(a().createElement("div",{className:"".concat(O," ").concat(v)},a().createElement(o.List,d(p({},e),{pagination:(null==j?void 0:j.count)>0&&{onChange:C,total:(null==j?void 0:j.count)||0,pageSize:(null==j?void 0:j.pageSize)||10,current:(null==j?void 0:j.page)||1}}),a().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==(f=b.value)?void 0:f.length)?b.value.map(function(e,t){var n=0===t,o=t===b.value.length-1;return a().createElement("div",{key:t,style:{position:"relative",padding:"".concat(n?0:"10px"," 0 ").concat(o?0:"10px"," 0")}},a().createElement(r.RecursionField,{basePath:b.address,name:t,onlyRenderProperties:!0,schema:k(t)}))}):null))))})},830:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.A=(0,n(342).genStyleHook)("nb-comment",function(e){var t,n,o=e.componentCls;return r({},o,(r(n={},"".concat(o,"-item-container-container"),r({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),r(n,"".concat(o,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),r(n,"".concat(o,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),r(n,".ant-list-pagination",{marginTop:e.marginXS}),r(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),r(n,"".concat(o,"-item-title"),(r(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"32px"},"".concat(o,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),r(t,"".concat(o,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),r(n,"".concat(o,"-item-editor"),r({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(o,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))})}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["88"],{67:function(e,t,n){n.r(t),n.d(t,{CommentItem:function(){return m}});var r=n(230),o=n(342),a=n(59),c=n(185),i=n.n(c),l=n(155),u=n.n(l),s=n(872),d=n(830);function p(e,t,n,r,o,a,c){try{var i=e[a](c),l=i.value}catch(e){n(e);return}i.done?t(l):Promise.resolve(l).then(r,o)}var m=(0,r.observer)(function(e){var t,n,c,m,f,b,v,y=e.editing,h=e.setEditing,g=(0,r.useField)(),w=(0,s.Bd)().t,x=(0,d.A)().componentCls,O=(0,o.useCollectionParentRecordData)(),k=(0,o.useBlockRequestContext)(),E=k.resource,P=k.service,j=(0,l.useCallback)(function(){var e;return(e=function(){var e,t;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var u=[i,l];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,E.update({filterByTk:null==(e=g.value)?void 0:e.id,values:{content:null==g||null==(t=g.value)?void 0:t.content}})];case 1:return n.sent(),P.refresh(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function c(e){p(a,r,o,c,i,"next",e)}function i(e){p(a,r,o,c,i,"throw",e)}c(void 0)})})()},[E,P,g.value]),C=(0,o.useCollectionFields)(),S=(0,l.useMemo)(function(){var e,t;return null==(t=C.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[C]);return u().createElement(o.RecordProvider,{record:g.value,parent:O},u().createElement("div",{className:"".concat(x,"-item-container")},u().createElement("div",{className:"".concat(x,"-item-container-line")}),u().createElement(a.Card,{size:"small",title:u().createElement("div",{className:"".concat(x,"-item-title")},u().createElement("div",{className:"".concat(x,"-item-title-left")},u().createElement("span",null,null==g||null==(m=g.value)||null==(c=m.createdBy)?void 0:c.nickname),u().createElement("span",null,w("commented")),u().createElement(a.Tooltip,{title:i()(null==g||null==(f=g.value)?void 0:f.createdAt).format("YYYY-MM-DD HH:mm:ss")},u().createElement("span",null,i()(null==g||null==(b=g.value)?void 0:b.createdAt).fromNow()))),u().createElement("div",{className:"".concat(x,"-item-title-right")},e.children))},u().createElement("div",{className:"".concat(x,"-item-editor")},u().createElement(r.RecursionField,{basePath:g.address,name:"content",schema:{type:"string",name:"content","x-component":"MarkdownVditor","x-component-props":(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},S),n=n={value:null==g||null==(v=g.value)?void 0:v.content},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),"x-read-pretty":!0}}),y&&u().createElement("div",{className:"".concat(x,"-item-editor-button-area")},u().createElement(a.Button,{type:"primary",onClick:function(){h(!1),j(),g.form.setFieldState("".concat(g.address,".content"),function(e){e.pattern="readPretty"})}},w("Update Comment")),u().createElement(a.Button,{onClick:function(){g.form.setFieldState("".concat(g.address,".content"),function(e){e.pattern="readPretty"}),h(!1)}},w("Cancel")))))))})},830:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.A=(0,n(342).genStyleHook)("nb-comment",function(e){var t,n,o=e.componentCls;return r({},o,(r(n={},"".concat(o,"-item-container-container"),r({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),r(n,"".concat(o,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),r(n,"".concat(o,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),r(n,".ant-list-pagination",{marginTop:e.marginXS}),r(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),r(n,"".concat(o,"-item-title"),(r(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"32px"},"".concat(o,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),r(t,"".concat(o,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),r(n,"".concat(o,"-item-editor"),r({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(o,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))})}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/reactive-react"),require("dayjs"),require("react"),require("@nocobase/flow-engine"),require("lodash"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-comments",["@formily/reactive-react","dayjs","react","@nocobase/flow-engine","lodash","@nocobase/client","@formily/react","@nocobase/utils/client","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-comments"]=t(require("@formily/reactive-react"),require("dayjs"),require("react"),require("@nocobase/flow-engine"),require("lodash"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-comments"]=t(e["@formily/reactive-react"],e.dayjs,e.react,e["@nocobase/flow-engine"],e.lodash,e["@nocobase/client"],e["@formily/react"],e["@nocobase/utils/client"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,c,a,l,u,s){return function(){var f,p,d,m,b,y,h={868:function(e,t,n){"use strict";n.d(t,{C:function(){return f},u:function(){return s}});var r=n(505),o=n(772),i=n(156),c=n.n(i);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=(0,i.createContext)({});function s(e){(0,r.useField)();var t,n=(0,r.useFieldSchema)(),s=(t=(0,i.useState)(!1),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return a(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=s[0],p=s[1],d=(0,o.useDesignable)().dn;(0,i.useEffect)(function(){var e,t=null==(e=d.current["x-component-props"])?void 0:e.createAble;p(void 0===t||t)},[]);var m=(0,i.useCallback)(function(e){var t,r=Object.assign({},n["x-component-props"],e);n["x-component-props"]=r,d.emit("patch",{schema:(l(t={},"x-uid",n["x-uid"]),l(t,"x-component-props",n["x-component-props"]),t)}),d.refresh()},[d,n]),b=(0,i.useCallback)(function(e){m({createAble:e}),p(e)},[p,m]);return c().createElement(u.Provider,{value:{createAble:f,setCreateAble:b}},e.children)}function f(){return(0,i.useContext)(u)}},551:function(e,t,n){"use strict";n.d(t,{$G:function(){return a},A7:function(){return i},Ul:function(){return c}});var r=n(584),o=n(238),i="comments";function c(e){return(0,r.tval)(e,{ns:i})}function a(){return(0,o.useTranslation)(i)}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=l},505:function(e){"use strict";e.exports=c},754:function(t){"use strict";t.exports=e},772:function(e){"use strict";e.exports=i},667:function(e){"use strict";e.exports=r},584:function(e){"use strict";e.exports=a},721:function(e){"use strict";e.exports=u},760:function(e){"use strict";e.exports=t},467:function(e){"use strict";e.exports=o},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=s}},v={};function g(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return h[e](n,n.exports,g),n.exports}g.m=h,g.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return g.d(t,{a:t}),t},g.d=function(e,t){for(var n in t)g.o(t,n)&&!g.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},g.f={},g.e=function(e){return Promise.all(Object.keys(g.f).reduce(function(t,n){return g.f[n](e,t),t},[]))},g.u=function(e){return""+({452:"260481019096d1d7",656:"2f8d64984e7c9bd3",779:"d75d43be6a3bbb6b",893:"26ed8f932127afec"})[e]+".js"},g.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),g.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},p="@nocobase/plugin-comments:",g.l=function(e,t,n,r){if(f[e])return void f[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var l=c[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==p+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,g.nc&&o.setAttribute("nonce",g.nc),o.setAttribute("data-webpack",p+n),o.src=e),f[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),i&&document.head.appendChild(o)},g.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(d=window.__webpack_public_path__||"/").endsWith("/")||(d+="/"),g.p=d+"static/plugins/@nocobase/plugin-comments/dist/client/",m={909:0},g.f.j=function(e,t){var n=g.o(m,e)?m[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=m[e]=[t,r]});t.push(n[2]=r);var o=g.p+g.u(e),i=Error();g.l(o,function(t){if(g.o(m,e)&&(0!==(n=m[e])&&(m[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},b=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==m[e]})){for(n in i)g.o(i,n)&&(g.m[n]=i[n]);c&&c(g)}for(e&&e(t);a<o.length;a++)r=o[a],g.o(m,r)&&m[r]&&m[r][0](),m[r]=0},(y=self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).forEach(b.bind(null,0)),y.push=b.bind(null,y.push.bind(y));var O={};return!function(){"use strict";g.r(O),g.d(O,{PluginCommentClient:function(){return e0},default:function(){return e1}});var e,t={};g.r(t),g.d(t,{CommentActionGroupModel:function(){return e_},CommentActionModel:function(){return eA},DeleteCommentActionModel:function(){return eD},EditCommentActionModel:function(){return eN},QuoteReplyActionModel:function(){return e$}});var n=g(772),r=g(156),o=g.n(r),i=g(551);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,r,o;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return r=t,o=arguments,r=a(r),c(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(r,o||[],a(this).constructor):r.apply(this,o)),"name","comment"),c(e,"title",(0,i.Ul)("Comment Collection")),c(e,"order",2),c(e,"color","orange"),c(e,"default",{fields:[{name:"content",type:"text",length:"long",interface:"vditor",deletable:!1,uiSchema:{type:"string",title:(0,i.Ul)("Comment Content"),interface:"vditor","x-component":"MarkdownVditor"}}]}),c(e,"presetFieldsDisabled",!0),c(e,"configurableProperties",(0,n.getConfigurableProperties)("title","name","inherits","category","description","presetFields")),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e),t}(n.CollectionTemplate),f=g(581),p=(0,n.lazy)(function(){return f("imported_-7i2rou_component",g.e("779").then(g.bind(g,191)))},"CommentList").CommentList,d=(0,n.lazy)(function(){return f("imported_-1af5cgs_component",g.e("452").then(g.bind(g,476)))},"CommentItem").CommentItem,m=(0,n.lazy)(function(){return f("imported_1bnm9jt_component",g.e("893").then(g.bind(g,376)))},"CommentDecorator").CommentDecorator,b=(0,n.lazy)(function(){return f("imported_-1mv867o_component",g.e("656").then(g.bind(g,942)))},"CommentSubmit").CommentSubmit,y=function(){return null};y.ActionBar=n.ActionBar,y.List=p,y.Item=d,y.Decorator=m,y.Submit=b;var h=g(868),v=g(505),w=g(467),S=g.n(w);function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){P(e,t,n[t])})}return e}function x(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var C=new n.SchemaSettings({name:"blockSettings:comment",items:[{name:"title",Component:n.SchemaSettingsBlockTitleItem},{name:"blockLinkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,i.$G)().t)("Block Linkage rules",{ns:"client"}),category:n.LinkageRuleCategory.block}}},{name:"SetTheDataScope",Component:n.SchemaSettingsDataScope,useComponentProps:function(){var e,t,r=(0,n.useCollection_deprecated)().name,o=(0,v.useFieldSchema)(),i=(0,n.useFormBlockContext)().form,c=(0,v.useField)(),a=(0,n.useDesignable)().dn;return{collectionName:r,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:i,onSubmit:function(e){var t,r=e.filter;r=(0,n.removeNullCondition)(r),S().set(o,"x-decorator-props.params.filter",r),c.decoratorProps.params=x(j({},o["x-decorator-props"].params),{page:1}),a.emit("patch",{schema:(P(t={},"x-uid",o["x-uid"]),P(t,"x-decorator-props",o["x-decorator-props"]),t)})}}}},{name:"RecordsPerPage",type:"select",useComponentProps:function(){var e,t,r=(0,v.useField)(),o=(0,v.useFieldSchema)(),c=(0,n.useBlockRequestContext)().service,a=(0,i.$G)().t,l=(0,n.useDesignable)().dn;return{title:a("Records per page",{ns:"client"}),value:(null==(t=r.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:function(e){var t,n,i=r.decoratorProps.params||{};i.pageSize=e,r.decoratorProps.params=i,o["x-decorator-props"].params=i,c.run(x(j({},null==(t=c.params)?void 0:t[0]),{pageSize:e,page:1})),l.emit("patch",{schema:(P(n={},"x-uid",o["x-uid"]),P(n,"x-decorator-props",o["x-decorator-props"]),n)})}}}},{name:"divider",type:"divider"},{name:"EnableCreate",type:"switch",useComponentProps:function(){var e=(0,h.C)(),t=e.setCreateAble,n=e.createAble;return{title:(0,(0,i.$G)().t)("Enable Create"),checked:n,onChange:t}}},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});function k(e){var t,r,o;return e.association&&(o=(0,n.useParentRecordCommon)(e.association)),{parentRecord:o,params:{pageSize:(null==e||null==(t=e.params)?void 0:t.pageSize)||20,appends:["createdBy"],sort:["createdAt"],filter:null==e||null==(r=e.params)?void 0:r.filter}}}var E=g(482),A=function(e){var t=e.collectionName,n=e.dataSource,r=e.association;return e.rowKey,{type:"void","x-acl-action":"".concat(r||t,":view"),"x-decorator":"Comment.Decorator","x-use-decorator-props":"useCommentBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:n,association:r,readPretty:!0,action:"list",runWhenParamsChanged:!0},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:comment",properties:{list:{type:"array","x-component":"Comment.List",properties:{item:{type:"object","x-component":"Comment.Item","x-read-pretty":!0,properties:{actionBar:{type:"void","x-align":"left","x-initializer":"comment:configureItemActions","x-component":"ActionBar","x-component-props":{layout:"one-column"}}}}}},submit:{type:"string","x-component":"Comment.Submit","x-acl-action":"".concat(r||t,":create"),"x-decorator":"ACLCollectionProvider","x-decorator-props":{collection:t,dataSource:n,association:r}}}}};function _(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}var T=function(e){var t,r,i,c,a=e.filterCollections,l=e.filterOtherRecordsCollection,u=e.onlyCurrentDataSource,s=e.hideSearch,f=e.showAssociationFields,p=e.hideOtherRecordsInPopup,d=(0,n.useSchemaInitializer)().insert,m=(0,n.useSchemaInitializerItem)(),b=(0,n.useCollectionManager_deprecated)().getCollection;return o().createElement(n.DataBlockInitializer,(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},m),c=c={componentType:"Comment",icon:o().createElement(E.CommentOutlined,null),onlyCurrentDataSource:u,hideSearch:s,filter:a,filterOtherRecordsCollection:l,showAssociationFields:f,hideOtherRecordsInPopup:p,onCreateBlockSchema:(t=function(e){var t,n,r,o;return function(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(i){return t=e.item,n=e.fromOthersInPopup,r=b(t.name,t.dataSource),(o=t.associationField)&&!n?d(A({dataSource:t.dataSource,rowKey:r.filterTargetKey||"id",association:"".concat(o.collectionName,".").concat(o.name)})):d(A({collectionName:t.name,dataSource:t.dataSource,rowKey:(null==r?void 0:r.filterTargetKey)||"id"})),[2]})},r=function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function c(e){_(i,r,o,c,a,"next",e)}function a(e){_(i,r,o,c,a,"throw",e)}c(void 0)})},function(e){return r.apply(this,arguments)}),alwaysRenderMenu:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(c)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))}),i))};function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function R(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function D(){var e,t,c,a=(0,v.useField)(),l=(0,i.$G)().t,u=(e=(0,r.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return I(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],f=u[1],p=(0,n.useACLActionParamsContext)(),d=(0,n.useDesignable)().designable;return((0,r.useEffect)(function(){var e=a.address.slice(0,a.address.length-2);a.form.setFieldState(e.concat("content"),function(e){e.pattern=s?"editable":"readPretty"}),a.form.setFieldState(e,function(e){e.componentProps=R(M({},e.componentProps),{editing:s,setEditing:f})})},[s,a.address,a.form]),!d&&((null==a||null==(t=a.data)?void 0:t.hidden)||!p))?null:o().createElement("a",{style:{fontSize:14,opacity:d&&((null==a||null==(c=a.data)?void 0:c.hidden)||!p)&&.1},onClick:function(){f(!0)}},l("Edit"))}function B(e){return o().createElement(n.ActionInitializer,R(M({},e),{schema:{type:"void",title:'{{t("Edit")}}',"x-component":"UpdateCommentActionButton"}}))}function z(){var e,t=(0,v.useField)(),c=(0,i.$G)().t,a=(0,n.useACLActionParamsContext)(),l=(0,n.useDesignable)().designable,u=(0,r.useCallback)(function(){var e,n=t.address.slice(0,t.address.length-4).concat("submit.content"),r=t.address.slice(0,t.address.length-2).concat("content"),o=null!=(e=t.form.getValuesIn(r))?e:"";t.form.setValuesIn(n,"".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")))},[t.address,t.form]);return!l&&((null==t||null==(e=t.data)?void 0:e.hidden)||!a)?null:o().createElement("a",{style:{fontSize:14},onClick:u},c("Quote Reply"))}function F(e){var t={type:"void",title:(0,(0,i.$G)().t)("Quote Reply"),"x-component":"QuoteReplyCommentActionButton"};return o().createElement(n.ActionInitializer,R(M({},e),{schema:t}))}var q=new n.SchemaInitializer({name:"comment:configureItemActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",name:"enableActions",title:'{{t("Enable actions")}}',children:[{name:"edit",title:'{{t("Edit")}}',Component:"UpdateCommentActionInitializer",schema:{"x-action":"update","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){var e=(0,n.useCollection_deprecated)();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"delete",title:'{{t("Delete")}}',Component:"DestroyActionInitializer",schema:{"x-component":"Action.Link","x-action":"destroy","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}},{name:"reply",title:(0,i.Ul)("Quote Reply"),Component:"QuoteReplyCommentActionInitializer",schema:{"x-action":"create","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}}]}]}),N=g(667),G=g(721),L=g(754);function U(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=(0,n.genStyleHook)("nb-comment",function(e){var t,n,r=e.componentCls;return U({},r,(U(n={},"".concat(r,"-item-container-container"),U({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),U(n,"".concat(r,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),U(n,"".concat(r,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),U(n,".ant-list-pagination",{marginTop:e.marginXS}),U(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),U(n,"".concat(r,"-item-title"),(U(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},"".concat(r,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),U(t,"".concat(r,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),U(n,"".concat(r,"-item-editor"),U({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(r,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))}),$=g(238);function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function K(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var H=(0,L.observer)(function(e){var t,c,a,l,u=e.createAble,s=e.defaultValue,f=(t=(0,r.useState)(null),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return V(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return V(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=f[0],d=f[1],m=(0,N.useFlowModel)(),b=m.context.markdown;(0,r.useEffect)(function(){d({content:s})},[s]);var y=m.collection.getFields(),h=m.resource,v=(0,r.useCallback)(function(e){d({content:e})},[]),g=(0,$.useTranslation)().t,O=Q(),w=O.wrapSSR,S=O.componentCls,P=O.hashId,j=(0,r.useMemo)(function(){var e;return(null==p||null==(e=p.content)?void 0:e.trim().length)>0},[p]),x=(0,r.useCallback)((c=function(){var e,t;return function(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,h.create(W({},p))];case 1:return n.sent(),v(""),t=Math.ceil(((null==h||null==(e=h.getMeta())?void 0:e.count)||0)/((null==h?void 0:h.getPageSize())||10)),h.setPage(t),h.refresh(),d(null),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var o=c.apply(e,t);function i(e){K(o,n,r,i,a,"next",e)}function a(e){K(o,n,r,i,a,"throw",e)}i(void 0)})}),[h,v,p]),C=(0,n.useACLActionParamsContext)(),k=(0,n.useDesignable)().designable,E=(0,r.useMemo)(function(){var e,t;return null==(t=y.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[y]);return(void 0===u||u)&&(k||C)?w(o().createElement("div",{style:{marginTop:10},className:"".concat(S," ").concat(P)},b.edit((a=W({},E),l=l={value:null==p?void 0:p.content,quoteFlag:!0,onChange:function(e){v(e)},enableContextSelect:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a)),o().createElement(G.Button,{disabled:!j,onClick:function(){return x()},type:"primary",style:{marginTop:10}},g("Comment",{ns:i.A7})))):null});function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var X=(0,L.observer)(function(e){var t,n,i,c,a,l=e.resource,u=e.handlePageChange,s=e.dataSource,f=Q(),p=f.wrapSSR,d=f.hashId,m=f.componentCls,b=(t=(0,r.useState)(""),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return Y(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=b[0],h=b[1],v=(0,N.useFlowModel)();return v.context.defineMethod("setQuoteContent",function(e){h(e)}),p(o().createElement("div",{className:"".concat(m," ").concat(d)},o().createElement(G.List,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),i=i={pagination:(null==l||null==(c=l.getMeta())?void 0:c.count)>0&&{onChange:u,total:(null==l||null==(a=l.getMeta())?void 0:a.count)||0,pageSize:l.getPageSize()||10,current:l.getPage()||1}},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(i)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}),n),o().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==s?void 0:s.length)?s.map(function(e,t){var n=0===t,r=t===s.length-1;return o().createElement("div",{key:t,style:{position:"relative",padding:"".concat(n?0:"10px"," 0 ").concat(r?0:"10px"," 0")}},v.mapSubModels("items",function(t){var n=t.createFork({},"".concat(e.id,"-").concat(e.content));return n.context.defineProperty("record",{get:function(){return e},cache:!1}),o().createElement(N.FlowModelRenderer,{model:n})}))}):null)),o().createElement(H,{defaultValue:y})))}),J=g(584);function Z(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}var ee=(0,L.observer)(function(){var e,t,n=(0,N.useFlowModel)(),r=n.context.record;return o().createElement(N.DndProvider,null,o().createElement("div",{style:{textAlign:"right"}},o().createElement(G.Space,{size:0,style:{gap:0}},n.mapSubModels("actions",function(e,t){var i=e.createFork({},"".concat(r.id,"_").concat(t));return i.context.defineProperty("record",{get:function(){return r}}),i.context.defineMethod("setEditing",function(){n.context.setEditing()}),o().createElement(N.Droppable,{model:i,key:i.uid},o().createElement(N.FlowModelRenderer,{model:i,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:N.DragHandler,sort:1}]}))}),o().createElement(N.AddSubModelButton,{key:"comment-actions-add",model:n,subModelKey:"actions",subModelBaseClasses:["CommentActionGroupModel"],afterSubModelInit:(e=function(e){return function(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return[2]})},t=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){Z(i,r,o,c,a,"next",e)}function a(e){Z(i,r,o,c,a,"throw",e)}c(void 0)})},function(e){return t.apply(this,arguments)})},o().createElement(N.FlowSettingsButton,{icon:o().createElement(E.SettingOutlined,null)},n.translate("Actions"))))))});function et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function en(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function er(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){en(i,r,o,c,a,"next",e)}function a(e){en(i,r,o,c,a,"throw",e)}c(void 0)})}}function eo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return et(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return et(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ei(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var ec=function(e){var t=e.value,n=e.markdown,o=e.liquid,i=e.t,c=e.ctx,a=eo((0,r.useState)(null),2),l=a[0],u=a[1];return(0,r.useEffect)(function(){t&&er(function(){var e,r;return ei(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,o.renderWithFullContext(t,c)];case 1:return e=a.sent(),u(n.render(i(e),{ellipsis:!1,textOnly:!1})),[3,3];case 2:return r=a.sent(),u('<pre style="color:red;"> 渲染错误: '.concat(r.message,"</pre>")),[3,3];case 3:return[2]}})})()},[t]),l},ea=(0,L.observer)(function(e){var t,n=e.value,c=e.resource,a=e.model,l=(0,$.useTranslation)().t,u=eo((0,r.useState)(!1),2),s=u[0],f=u[1],p=eo((0,r.useState)(null),2),d=p[0],m=p[1],b=Q().componentCls,y=a.context.markdown;a.context.defineMethod("setEditing",function(){f(!0)});var h=(0,r.useCallback)(er(function(){return ei(this,function(e){switch(e.label){case 0:return[4,c.update(null==n?void 0:n.id,{content:d})];case 1:return e.sent(),c.refresh(),[2]}})}),[c,n,d]);return o().createElement("div",{key:n.id},o().createElement("div",{className:"".concat(b,"-item-container")},o().createElement("div",{className:"".concat(b,"-item-container-line")}),o().createElement(G.Card,{size:"small",title:o().createElement("div",{className:"".concat(b,"-item-title")},o().createElement("div",{className:"".concat(b,"-item-title-left")},o().createElement("span",null,null==n||null==(t=n.createdBy)?void 0:t.nickname),o().createElement("span",null,l("commented",{ns:i.A7})),o().createElement(G.Tooltip,{title:(0,J.dayjs)(null==n?void 0:n.createdAt).format("YYYY-MM-DD HH:mm:ss")},o().createElement("span",null,(0,J.dayjs)(null==n?void 0:n.createdAt).fromNow()))),o().createElement("div",{className:"".concat(b,"-item-title-right")},o().createElement(ee,null)))},o().createElement("div",{className:"".concat(b,"-item-editor")},s?y.edit({value:null==n?void 0:n.content,onChange:function(e){m(e)},enableContextSelect:!1}):o().createElement(ec,{value:null==n?void 0:n.content,markdown:a.context.markdown,liquid:a.context.liquid,t:l,ctx:a.context}),s&&o().createElement("div",{className:"".concat(b,"-item-editor-button-area")},o().createElement(G.Button,{type:"primary",onClick:function(){f(!1),h()}},l("Update Comment",{ns:i.A7})),o().createElement(G.Button,{onClick:function(){f(!1)}},l("Cancel")))))))});function el(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function eu(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){el(i,r,o,c,a,"next",e)}function a(e){el(i,r,o,c,a,"throw",e)}c(void 0)})}}function es(e,t,n){return t=ey(t),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,eg()?Reflect.construct(t,n||[],ey(e).constructor):t.apply(e,n))}function ef(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function ep(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ed(e,t,n){return t&&ep(e.prototype,t),n&&ep(e,n),e}function em(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eb(e,t,n){return(eb="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ey(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function ey(e){return(ey=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eh(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ev(e,t)}function ev(e,t){return(ev=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eg=function(){return!!e})()}function eO(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var ew=function(e){function t(){return ef(this,t),es(this,t,arguments)}return eh(t,e),ed(t,[{key:"onInit",value:function(e){eb(ey(t.prototype),"onInit",this).call(this,e)}},{key:"render",value:function(){return o().createElement(ea,{value:this.context.record,resource:this.context.blockModel.resource,model:this})}}]),t}(N.FlowModel),eS=function(e){function t(){var e,n;return ef(this,t),e=es(this,t,arguments),em(e,"handlePageChange",(n=eu(function(t){var n;return eO(this,function(r){switch(r.label){case 0:var o,i;if(o=e.resource,null!=(i=N.MultiRecordResource)&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?!i[Symbol.hasInstance](o):!(o instanceof i))return[3,2];return(n=e.resource).setPage(t),n.loading=!0,[4,e.refresh()];case 1:r.sent(),r.label=2;case 2:return[2]}})}),function(e){return n.apply(this,arguments)})),e}return eh(t,e),ed(t,[{key:"createResource",value:function(e,t){var n=this.context.createResource(N.MultiRecordResource);return n.setPageSize(this.props.pageSize),n.addAppends("createdBy"),n}},{key:"onInit",value:function(e){eb(ey(t.prototype),"onInit",this).call(this,e)}},{key:"getCurrentRecord",value:function(){var e=this.resource.getData();return Array.isArray(e)?e[0]:e}},{key:"refresh",value:function(){var e=this;return eu(function(){return eO(this,function(t){switch(t.label){case 0:return[4,e.resource.refresh()];case 1:return t.sent(),[2]}})})()}},{key:"renderComponent",value:function(){var e,t,n=this.resource.getData(),r=this.resource;return"comment"!==this.collection.template?o().createElement(G.Alert,{message:this.context.t("The current collection is not a comment collection, so the comment block cannot be used.",{ns:"comments"}),type:"warning",showIcon:!0}):o().createElement(X,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){em(e,t,n[t])})}return e}({},this.props),t=t={dataSource:n,resource:r,handlePageChange:this.handlePageChange},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))}}],[{key:"filterCollection",value:function(e){return"comment"===e.template}}]),t}(n.CollectionBlockModel);function eP(e,t,n){return t=ex(t),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,eE()?Reflect.construct(t,n||[],ex(e).constructor):t.apply(e,n))}function ej(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function ex(e){return(ex=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eC(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ek(e,t)}function ek(e,t){return(ek=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eE=function(){return!!e})()}em(eS,"scene",n.BlockSceneEnum.oam),eS.registerFlow({key:"commentsSettings",title:(0,N.escapeT)("Comments settings",{ns:"comments"}),sort:150,steps:{pageSize:{title:(0,N.escapeT)("Page size"),uiSchema:{pageSize:{"x-component":"Select","x-decorator":"FormItem",enum:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]}},defaultParams:{pageSize:20},handler:function(e,t){e.model.resource.loading=!0;var n=e.model.resource;n.setPage(1),n.setPageSize(t.pageSize)}},dataScope:{use:"dataScope"}}}),eS.define({label:(0,N.escapeT)("Comments",{ns:"comments"}),searchable:!0,searchPlaceholder:(0,N.escapeT)("Search"),createModelOptions:{use:"CommentsBlockModel",subModels:{items:[{use:"CommentItemModel"}]}},sort:550});var eA=function(e){function t(){return ej(this,t),eP(this,t,arguments)}return eC(t,e),t}(n.ActionModel),e_=function(e){function t(){return ej(this,t),eP(this,t,arguments)}return eC(t,e),t}(n.ActionGroupModel);function eT(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}(e="baseClass")in e_?Object.defineProperty(e_,e,{value:eA,enumerable:!0,configurable:!0,writable:!0}):e_[e]=eA,e_.define({label:(0,N.escapeT)("Comment action",{ns:"comments"})});function eI(e){return(eI=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eM(e,t){return(eM=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eR=function(){return!!e})()}var eD=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,i,c;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eI(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eR()?Reflect.construct(t,r||[],eI(this).constructor):t.apply(this,r)),i="defaultProps",c={type:"link",title:(0,N.escapeT)("Delete")},i in o?Object.defineProperty(o,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[i]=c,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eM(n,e),t=[{key:"getAclActionName",value:function(){return"destroy"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eA);function eB(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}eD.define({label:(0,N.escapeT)("Delete"),toggleable:!0}),eD.registerFlow({key:"deleteSettings",title:(0,N.escapeT)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,N.escapeT)("Delete record"),content:(0,N.escapeT)("Are you sure you want to delete it?")}},delete:{handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(!e.resource)return e.message.error(e.t("No resource selected for deletion")),[2];if(!e.record)return e.message.error(e.t("No resource or record selected for deletion")),[2];return[4,e.resource.destroy(e.record[e.collection.filterTargetKey])];case 1:return t.sent(),e.message.success(e.t("Record deleted successfully")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function c(e){eT(i,r,o,c,a,"next",e)}function a(e){eT(i,r,o,c,a,"throw",e)}c(void 0)})})()}}}});function ez(e){return(ez=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eF(e,t){return(eF=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eq(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eq=function(){return!!e})()}var eN=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,i,c;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=ez(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eq()?Reflect.construct(t,r||[],ez(this).constructor):t.apply(this,r)),i="defaultProps",c={type:"link",title:(0,N.escapeT)("Edit")},i in o?Object.defineProperty(o,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[i]=c,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eF(n,e),t=[{key:"getAclActionName",value:function(){return"update"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eA);function eG(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}eN.define({label:(0,N.escapeT)("Edit"),toggleable:!0}),eN.registerFlow({key:"editCommentSettings",on:"click",steps:{edit:{handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return e.model,e.setEditing(),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function c(e){eB(i,r,o,c,a,"next",e)}function a(e){eB(i,r,o,c,a,"throw",e)}c(void 0)})})()}}}});function eL(e){return(eL=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eU(e,t){return(eU=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eQ=function(){return!!e})()}var e$=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,i,c;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eL(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eQ()?Reflect.construct(t,r||[],eL(this).constructor):t.apply(this,r)),i="defaultProps",c={type:"link",title:(0,N.escapeT)("Quote reply",{ns:"comments"})},i in o?Object.defineProperty(o,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[i]=c,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eU(n,e),t=[{key:"getAclActionName",value:function(){return"create"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eA);function eV(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function eK(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){eV(i,r,o,c,a,"next",e)}function a(e){eV(i,r,o,c,a,"throw",e)}c(void 0)})}}function eW(e,t,n){return(eW=eJ()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&eY(o,n.prototype),o}).apply(null,arguments)}e$.define({label:(0,N.escapeT)("Quote reply",{ns:"comments"}),toggleable:!0}),e$.registerFlow({key:"quoteReplySettings",on:"click",steps:{quoteReply:{handler:function(e,t){var n;return(n=function(){var t,n,r,o,i;return function(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(c){return n=e.model.context.blockModel,o=null!=(r=null==(t=e.record)?void 0:t.content)?r:"",i="".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")),n.context.setQuoteContent(i),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function c(e){eG(i,r,o,c,a,"next",e)}function a(e){eG(i,r,o,c,a,"throw",e)}c(void 0)})})()}}}});function eH(e){return(eH=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eY(e,t){return(eY=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eX(e){var t="function"==typeof Map?new Map:void 0;return(eX=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return eW(e,arguments,eH(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eY(n,e)})(e)}function eJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eJ=function(){return!!e})()}function eZ(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,r=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var e0=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=eH(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eJ()?Reflect.construct(e,t||[],eH(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&eY(c,e),o=[{key:"afterAdd",value:function(){return eK(function(){return eZ(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return eK(function(){return eZ(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return eK(function(){return eZ(this,function(o){return e.app.dataSourceManager.addCollectionTemplates([s]),e.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.comment",{title:(0,i.Ul)("Comment"),Component:"CommentBlockInitializer",useComponentProps:function(){return{filterCollections:function(e){return"comment"===e.collection.template}}}}),e.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.comment",{title:(0,i.Ul)("Comment"),Component:"CommentBlockInitializer",useVisible:function(){var e=(0,n.useCollection)();return(0,r.useMemo)(function(){return e.fields.some(function(e){return(0,n.canMakeAssociationBlock)(e)&&["hasMany","belongsToMany"].includes(e.type)})},[e.fields])},useComponentProps:function(){var e=(0,n.useCollectionManager)();return{onlyCurrentDataSource:!0,filterCollections:function(t){var n=t.associationField;if(n){if(!["hasMany","belongsToMany"].includes(n.type))return!1;var r=e.getCollection(n.target);return(null==r?void 0:r.template)==="comment"}return!1},filterOtherRecordsCollection:function(e){return(null==e?void 0:e.template)==="comment"},showAssociationFields:!0,hideOtherRecordsInPopup:!1,hideSearch:!0}}}),e.app.addComponents({CommentBlockInitializer:T,Comment:y,UpdateCommentActionInitializer:B,UpdateCommentActionButton:D,QuoteReplyCommentActionButton:z,QuoteReplyCommentActionInitializer:F}),e.app.addScopes({useCommentBlockDecoratorProps:k}),e.schemaSettingsManager.add(C),e.schemaInitializerManager.add(q),e.flowEngine.registerModels(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({CommentsBlockModel:eS,CommentItemModel:ew},t)),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,o),c}(eX(n.Plugin)),e1=e0}(),O}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/react"),require("@formily/reactive-react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-comments",["react-i18next","@formily/react","@formily/reactive-react","@ant-design/icons","@nocobase/flow-engine","dayjs","react","antd","@nocobase/client","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-comments"]=t(require("react-i18next"),require("@formily/react"),require("@formily/reactive-react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-comments"]=t(e["react-i18next"],e["@formily/react"],e["@formily/reactive-react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.dayjs,e.react,e.antd,e["@nocobase/client"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,a,i,c,l,u,s){return function(){"use strict";var f,p,d,b={198:function(e,t,n){n.d(t,{w:function(){return s},x:function(){return f}});var r=n(230),o=n(342),a=n(155),i=n.n(a);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=(0,a.createContext)({});function s(e){(0,r.useField)();var t,n=(0,r.useFieldSchema)(),s=function(e){if(Array.isArray(e))return e}(t=(0,a.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return c(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return c(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1],d=(0,o.useDesignable)().dn;(0,a.useEffect)(function(){var e,t=null==(e=d.current["x-component-props"])?void 0:e.createAble;p(void 0===t||t)},[]);var b=(0,a.useCallback)(function(e){var t,r=Object.assign({},n["x-component-props"],e);n["x-component-props"]=r,d.emit("patch",{schema:(l(t={},"x-uid",n["x-uid"]),l(t,"x-component-props",n["x-component-props"]),t)}),d.refresh()},[d,n]),m=(0,a.useCallback)(function(e){b({createAble:e}),p(e)},[p,b]);return i().createElement(u.Provider,{value:{createAble:f,setCreateAble:m}},e.children)}function f(){return(0,a.useContext)(u)}},872:function(e,t,n){n.d(t,{Bd:function(){return c},CL:function(){return i},CU:function(){return a}});var r=n(768),o=n(953),a="comments";function i(e){return(0,r.tval)(e,{ns:a})}function c(){return(0,o.useTranslation)(a)}},375:function(e){e.exports=r},230:function(e){e.exports=t},726:function(e){e.exports=n},342:function(e){e.exports=l},694:function(e){e.exports=o},768:function(e){e.exports=u},59:function(e){e.exports=c},185:function(e){e.exports=a},773:function(e){e.exports=s},155:function(e){e.exports=i},953:function(t){t.exports=e}},m={};function y(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return b[e](n,n.exports,y),n.exports}y.m=b,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+"."+({23:"41e3f0e01c284099",512:"11ad262f24201bae",871:"8da01ba1475c51b7",88:"98817a8e01e02a7b"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},y.l=function(e,t,n,r){if(h[e])return void h[e].push(t);if(void 0!==n)for(var o,a,i=document.getElementsByTagName("script"),c=0;c<i.length;c++){var l=i[c];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-comments:"+n){o=l;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-comments:"+n),o.src=e),h[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),a&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(v=y.g.location+"");var h,v,g=y.g.document;if(!v&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(v=g.currentScript.src),!v)){var O=g.getElementsByTagName("script");if(O.length)for(var w=O.length-1;w>-1&&(!v||!/^http(s?):/.test(v));)v=O[w--].src}if(!v)throw Error("Automatic publicPath is not supported in this browser");y.p=v.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},y.f.j=function(e,t){var n=y.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),a=Error();y.l(o,function(t){if(y.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],a=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==f[e]})){for(n in a)y.o(a,n)&&(y.m[n]=a[n]);i&&i(y)}for(e&&e(t);c<o.length;c++)r=o[c],y.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(d=self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d));var j={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-comments/dist/client/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",i=a.indexOf(o);e=i>=0?a.slice(0,i+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-comments/dist/client/"}y.p=e}(),!function(){y.r(j),y.d(j,{PluginCommentClient:function(){return eZ},default:function(){return e0}});var e,t={};y.r(t),y.d(t,{CommentActionGroupModel:function(){return eA},CommentActionModel:function(){return eE},DeleteCommentActionModel:function(){return eM},EditCommentActionModel:function(){return eq},QuoteReplyActionModel:function(){return e$}});var n=y(342),r=y(155),o=y.n(r),a=y(872);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,r,o;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return r=t,o=arguments,r=c(r),i(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(r,o||[],c(this).constructor):r.apply(this,o)),"name","comment"),i(e,"title",(0,a.CL)("Comment Collection")),i(e,"order",2),i(e,"color","orange"),i(e,"default",{fields:[{name:"content",type:"text",length:"long",interface:"vditor",deletable:!1,uiSchema:{type:"string",title:(0,a.CL)("Comment Content"),interface:"vditor","x-component":"MarkdownVditor"}}]}),i(e,"presetFieldsDisabled",!0),i(e,"configurableProperties",(0,n.getConfigurableProperties)("title","name","inherits","category","description","presetFields")),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e),t}(n.CollectionTemplate),f=(0,n.lazy)(function(){return y.e("871").then(y.bind(y,762))},"CommentList").CommentList,p=(0,n.lazy)(function(){return y.e("88").then(y.bind(y,67))},"CommentItem").CommentItem,d=(0,n.lazy)(function(){return y.e("512").then(y.bind(y,755))},"CommentDecorator").CommentDecorator,b=(0,n.lazy)(function(){return y.e("23").then(y.bind(y,970))},"CommentSubmit").CommentSubmit,m=function(){return null};m.ActionBar=n.ActionBar,m.List=f,m.Item=p,m.Decorator=d,m.Submit=b;var h=y(198),v=y(230),g=y(773),O=y.n(g);function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){w(e,t,n[t])})}return e}function P(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var x=new n.SchemaSettings({name:"blockSettings:comment",items:[{name:"title",Component:n.SchemaSettingsBlockTitleItem},{name:"blockLinkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,a.Bd)().t)("Block Linkage rules",{ns:"client"}),category:n.LinkageRuleCategory.block}}},{name:"SetTheDataScope",Component:n.SchemaSettingsDataScope,useComponentProps:function(){var e,t,r=(0,n.useCollection_deprecated)().name,o=(0,v.useFieldSchema)(),a=(0,n.useFormBlockContext)().form,i=(0,v.useField)(),c=(0,n.useDesignable)().dn;return{collectionName:r,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:a,onSubmit:function(e){var t,r=e.filter;r=(0,n.removeNullCondition)(r),O().set(o,"x-decorator-props.params.filter",r),i.decoratorProps.params=P(S({},o["x-decorator-props"].params),{page:1}),c.emit("patch",{schema:(w(t={},"x-uid",o["x-uid"]),w(t,"x-decorator-props",o["x-decorator-props"]),t)})}}}},{name:"RecordsPerPage",type:"select",useComponentProps:function(){var e,t,r=(0,v.useField)(),o=(0,v.useFieldSchema)(),i=(0,n.useBlockRequestContext)().service,c=(0,a.Bd)().t,l=(0,n.useDesignable)().dn;return{title:c("Records per page",{ns:"client"}),value:(null==(t=r.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:function(e){var t,n,a=r.decoratorProps.params||{};a.pageSize=e,r.decoratorProps.params=a,o["x-decorator-props"].params=a,i.run(P(S({},null==(t=i.params)?void 0:t[0]),{pageSize:e,page:1})),l.emit("patch",{schema:(w(n={},"x-uid",o["x-uid"]),w(n,"x-decorator-props",o["x-decorator-props"]),n)})}}}},{name:"divider",type:"divider"},{name:"EnableCreate",type:"switch",useComponentProps:function(){var e=(0,h.x)(),t=e.setCreateAble,n=e.createAble;return{title:(0,(0,a.Bd)().t)("Enable Create"),checked:n,onChange:t}}},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});function C(e){var t,r,o;return e.association&&(o=(0,n.useParentRecordCommon)(e.association)),{parentRecord:o,params:{pageSize:(null==e||null==(t=e.params)?void 0:t.pageSize)||20,appends:["createdBy"],sort:["createdAt"],filter:null==e||null==(r=e.params)?void 0:r.filter}}}var k=y(375),E=function(e){var t=e.collectionName,n=e.dataSource,r=e.association;return e.rowKey,{type:"void","x-acl-action":"".concat(r||t,":view"),"x-decorator":"Comment.Decorator","x-use-decorator-props":"useCommentBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:n,association:r,readPretty:!0,action:"list",runWhenParamsChanged:!0},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:comment",properties:{list:{type:"array","x-component":"Comment.List",properties:{item:{type:"object","x-component":"Comment.Item","x-read-pretty":!0,properties:{actionBar:{type:"void","x-align":"left","x-initializer":"comment:configureItemActions","x-component":"ActionBar","x-component-props":{layout:"one-column"}}}}}},submit:{type:"string","x-component":"Comment.Submit","x-acl-action":"".concat(r||t,":create"),"x-decorator":"ACLCollectionProvider","x-decorator-props":{collection:t,dataSource:n,association:r}}}}};function A(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var _=function(e){var t,r,a=e.filterCollections,i=e.filterOtherRecordsCollection,c=e.onlyCurrentDataSource,l=e.hideSearch,u=e.showAssociationFields,s=e.hideOtherRecordsInPopup,f=(0,n.useSchemaInitializer)().insert,p=(0,n.useSchemaInitializerItem)(),d=(0,n.useCollectionManager_deprecated)().getCollection;return o().createElement(n.DataBlockInitializer,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},p),r=r={componentType:"Comment",icon:o().createElement(k.CommentOutlined,null),onlyCurrentDataSource:c,hideSearch:l,filter:a,filterOtherRecordsCollection:i,showAssociationFields:u,hideOtherRecordsInPopup:s,onCreateBlockSchema:function(e){var t,n=e.item,r=e.fromOthersInPopup;return(t=function(){var e,t;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(o){return e=d(n.name,n.dataSource),(t=n.associationField)&&!r?f(E({dataSource:n.dataSource,rowKey:e.filterTargetKey||"id",association:"".concat(t.collectionName,".").concat(t.name)})):f(E({collectionName:n.name,dataSource:n.dataSource,rowKey:(null==e?void 0:e.filterTargetKey)||"id"})),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){A(a,r,o,i,c,"next",e)}function c(e){A(a,r,o,i,c,"throw",e)}i(void 0)})})()},alwaysRenderMenu:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))};function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function R(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function M(){var e,t,i,c=(0,v.useField)(),l=(0,a.Bd)().t,u=function(e){if(Array.isArray(e))return e}(e=(0,r.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return I(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return I(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=u[0],f=u[1],p=(0,n.useACLActionParamsContext)(),d=(0,n.useDesignable)().designable;return((0,r.useEffect)(function(){var e=c.address.slice(0,c.address.length-2);c.form.setFieldState(e.concat("content"),function(e){e.pattern=s?"editable":"readPretty"}),c.form.setFieldState(e,function(e){e.componentProps=R(T({},e.componentProps),{editing:s,setEditing:f})})},[s,c.address,c.form]),!d&&((null==c||null==(t=c.data)?void 0:t.hidden)||!p))?null:o().createElement("a",{style:{fontSize:14,opacity:d&&((null==c||null==(i=c.data)?void 0:i.hidden)||!p)&&.1},onClick:function(){f(!0)}},l("Edit"))}function B(e){return o().createElement(n.ActionInitializer,R(T({},e),{schema:{type:"void",title:'{{t("Edit")}}',"x-component":"UpdateCommentActionButton"}}))}function D(){var e,t=(0,v.useField)(),i=(0,a.Bd)().t,c=(0,n.useACLActionParamsContext)(),l=(0,n.useDesignable)().designable,u=(0,r.useCallback)(function(){var e,n=t.address.slice(0,t.address.length-4).concat("submit.content"),r=t.address.slice(0,t.address.length-2).concat("content"),o=null!=(e=t.form.getValuesIn(r))?e:"";t.form.setValuesIn(n,"".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")))},[t.address,t.form]);return!l&&((null==t||null==(e=t.data)?void 0:e.hidden)||!c)?null:o().createElement("a",{style:{fontSize:14},onClick:u},i("Quote Reply"))}function z(e){var t={type:"void",title:(0,(0,a.Bd)().t)("Quote Reply"),"x-component":"QuoteReplyCommentActionButton"};return o().createElement(n.ActionInitializer,R(T({},e),{schema:t}))}var F=new n.SchemaInitializer({name:"comment:configureItemActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",name:"enableActions",title:'{{t("Enable actions")}}',children:[{name:"edit",title:'{{t("Edit")}}',Component:"UpdateCommentActionInitializer",schema:{"x-action":"update","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){var e=(0,n.useCollection_deprecated)();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"delete",title:'{{t("Delete")}}',Component:"DestroyActionInitializer",schema:{"x-component":"Action.Link","x-action":"destroy","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}},{name:"reply",title:(0,a.CL)("Quote Reply"),Component:"QuoteReplyCommentActionInitializer",schema:{"x-action":"create","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}}]}]}),q=y(694),L=y(59),N=y(726);function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var U=(0,n.genStyleHook)("nb-comment",function(e){var t,n,r=e.componentCls;return G({},r,(G(n={},"".concat(r,"-item-container-container"),G({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),G(n,"".concat(r,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),G(n,"".concat(r,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),G(n,".ant-list-pagination",{marginTop:e.marginXS}),G(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),G(n,"".concat(r,"-item-title"),(G(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},"".concat(r,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),G(t,"".concat(r,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),G(n,"".concat(r,"-item-editor"),G({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(r,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))}),$=y(953);function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var W=(0,N.observer)(function(e){var t,i,c,l=e.createAble,u=e.defaultValue,s=function(e){if(Array.isArray(e))return e}(t=(0,r.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return Q(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Q(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1],d=(0,q.useFlowModel)(),b=d.context.markdown;(0,r.useEffect)(function(){p({content:u})},[u]);var m=d.collection.getFields(),y=d.resource,h=(0,r.useCallback)(function(e){p({content:e})},[]),v=(0,$.useTranslation)().t,g=U(),O=g.wrapSSR,w=g.componentCls,j=g.hashId,S=(0,r.useMemo)(function(){var e;return(null==f||null==(e=f.content)?void 0:e.trim().length)>0},[f]),P=(0,r.useCallback)(function(){var e;return(e=function(){var e,t;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,y.create(K({},f))];case 1:return n.sent(),h(""),t=Math.ceil(((null==y||null==(e=y.getMeta())?void 0:e.count)||0)/((null==y?void 0:y.getPageSize())||10)),y.setPage(t),y.refresh(),p(null),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){V(a,r,o,i,c,"next",e)}function c(e){V(a,r,o,i,c,"throw",e)}i(void 0)})})()},[y,h,f]),x=(0,n.useACLActionParamsContext)(),C=(0,n.useDesignable)().designable,k=(0,r.useMemo)(function(){var e,t;return null==(t=m.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[m]);return(void 0===l||l)&&(C||x)?O(o().createElement("div",{style:{marginTop:10},className:"".concat(w," ").concat(j)},b.edit((i=K({},k),c=c={value:null==f?void 0:f.content,quoteFlag:!0,onChange:function(e){h(e)},enableContextSelect:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(c)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))}),i)),o().createElement(L.Button,{disabled:!S,onClick:function(){return P()},type:"primary",style:{marginTop:10}},v("Comment",{ns:a.CU})))):null});function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Y=(0,N.observer)(function(e){var t,n,a,i,c,l=e.resource,u=e.handlePageChange,s=e.dataSource,f=U(),p=f.wrapSSR,d=f.hashId,b=f.componentCls,m=function(e){if(Array.isArray(e))return e}(t=(0,r.useState)(""))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return H(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),y=m[0],h=m[1],v=(0,q.useFlowModel)();return v.context.defineMethod("setQuoteContent",function(e){h(e)}),p(o().createElement("div",{className:"".concat(b," ").concat(d)},o().createElement(L.List,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),a=a={pagination:(null==l||null==(i=l.getMeta())?void 0:i.count)>0&&{onChange:u,total:(null==l||null==(c=l.getMeta())?void 0:c.count)||0,pageSize:l.getPageSize()||10,current:l.getPage()||1}},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}),n),o().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==s?void 0:s.length)?s.map(function(e,t){var n=0===t,r=t===s.length-1;return o().createElement("div",{key:t,style:{position:"relative",padding:"".concat(n?0:"10px"," 0 ").concat(r?0:"10px"," 0")}},v.mapSubModels("items",function(t){var n=t.createFork({},"".concat(e.id,"-").concat(e.content));return n.context.defineProperty("record",{get:function(){return e},cache:!1}),o().createElement(q.FlowModelRenderer,{model:n})}))}):null)),o().createElement(W,{defaultValue:y})))}),X=y(768);function J(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var Z=(0,N.observer)(function(){var e=(0,q.useFlowModel)(),t=e.context.record;return o().createElement(q.DndProvider,null,o().createElement("div",{style:{textAlign:"right"}},o().createElement(L.Space,{size:0,style:{gap:0}},e.mapSubModels("actions",function(n,r){var a=n.createFork({},"".concat(t.id,"_").concat(r));return a.context.defineProperty("record",{get:function(){return t}}),a.context.defineMethod("setEditing",function(){e.context.setEditing()}),o().createElement(q.Droppable,{model:a,key:a.uid},o().createElement(q.FlowModelRenderer,{model:a,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:q.DragHandler,sort:1}]}))}),o().createElement(q.AddSubModelButton,{key:"comment-actions-add",model:e,subModelKey:"actions",subModelBaseClasses:["CommentActionGroupModel"],afterSubModelInit:function(e){var t;return(t=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){J(a,r,o,i,c,"next",e)}function c(e){J(a,r,o,i,c,"throw",e)}i(void 0)})})()}},o().createElement(q.FlowSettingsButton,{icon:o().createElement(k.SettingOutlined,null)},e.translate("Actions"))))))});function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function et(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function en(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){et(a,r,o,i,c,"next",e)}function c(e){et(a,r,o,i,c,"throw",e)}i(void 0)})}}function er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eo(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var ea=function(e){var t=e.value,n=e.markdown,o=e.liquid,a=e.t,i=e.ctx,c=er((0,r.useState)(null),2),l=c[0],u=c[1];return(0,r.useEffect)(function(){t&&en(function(){var e,r;return eo(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,o.renderWithFullContext(t,i)];case 1:return e=c.sent(),u(n.render(a(e),{ellipsis:!1,textOnly:!1})),[3,3];case 2:return r=c.sent(),u('<pre style="color:red;"> 渲染错误: '.concat(r.message,"</pre>")),[3,3];case 3:return[2]}})})()},[t]),l},ei=(0,N.observer)(function(e){var t,n=e.value,i=e.resource,c=e.model,l=(0,$.useTranslation)().t,u=er((0,r.useState)(!1),2),s=u[0],f=u[1],p=er((0,r.useState)(null),2),d=p[0],b=p[1],m=U().componentCls,y=c.context.markdown;c.context.defineMethod("setEditing",function(){f(!0)});var h=(0,r.useCallback)(function(){return en(function(){return eo(this,function(e){switch(e.label){case 0:return[4,i.update(null==n?void 0:n.id,{content:d})];case 1:return e.sent(),i.refresh(),[2]}})})()},[i,n,d]);return o().createElement("div",{key:n.id},o().createElement("div",{className:"".concat(m,"-item-container")},o().createElement("div",{className:"".concat(m,"-item-container-line")}),o().createElement(L.Card,{size:"small",title:o().createElement("div",{className:"".concat(m,"-item-title")},o().createElement("div",{className:"".concat(m,"-item-title-left")},o().createElement("span",null,null==n||null==(t=n.createdBy)?void 0:t.nickname),o().createElement("span",null,l("commented",{ns:a.CU})),o().createElement(L.Tooltip,{title:(0,X.dayjs)(null==n?void 0:n.createdAt).format("YYYY-MM-DD HH:mm:ss")},o().createElement("span",null,(0,X.dayjs)(null==n?void 0:n.createdAt).fromNow()))),o().createElement("div",{className:"".concat(m,"-item-title-right")},o().createElement(Z,null)))},o().createElement("div",{className:"".concat(m,"-item-editor")},s?y.edit({value:null==n?void 0:n.content,onChange:function(e){b(e)},enableContextSelect:!1}):o().createElement(ea,{value:null==n?void 0:n.content,markdown:c.context.markdown,liquid:c.context.liquid,t:l,ctx:c.context}),s&&o().createElement("div",{className:"".concat(m,"-item-editor-button-area")},o().createElement(L.Button,{type:"primary",onClick:function(){f(!1),h()}},l("Update Comment",{ns:a.CU})),o().createElement(L.Button,{onClick:function(){f(!1)}},l("Cancel")))))))});function ec(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function el(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ec(a,r,o,i,c,"next",e)}function c(e){ec(a,r,o,i,c,"throw",e)}i(void 0)})}}function eu(e,t,n){return t=em(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,ev()?Reflect.construct(t,n||[],em(e).constructor):t.apply(e,n))}function es(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function ef(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ep(e,t,n){return t&&ef(e.prototype,t),n&&ef(e,n),e}function ed(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eb(e,t,n){return(eb="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=em(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function em(e){return(em=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ey(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&eh(e,t)}function eh(e,t){return(eh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ev(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ev=function(){return!!e})()}function eg(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var eO=function(e){function t(){return es(this,t),eu(this,t,arguments)}return ey(t,e),ep(t,[{key:"onInit",value:function(e){eb(em(t.prototype),"onInit",this).call(this,e)}},{key:"render",value:function(){return o().createElement(ei,{value:this.context.record,resource:this.context.blockModel.resource,model:this})}}]),t}(q.FlowModel),ew=function(e){function t(){var e;return es(this,t),e=eu(this,t,arguments),ed(e,"handlePageChange",function(t){return el(function(){var n;return eg(this,function(r){switch(r.label){case 0:var o,a;if(o=e.resource,null!=(a=q.MultiRecordResource)&&"u">typeof Symbol&&a[Symbol.hasInstance]?!a[Symbol.hasInstance](o):!(o instanceof a))return[3,2];return(n=e.resource).setPage(t),n.loading=!0,[4,e.refresh()];case 1:r.sent(),r.label=2;case 2:return[2]}})})()}),e}return ey(t,e),ep(t,[{key:"createResource",value:function(e,t){var n=this.context.createResource(q.MultiRecordResource);return n.setPageSize(this.props.pageSize),n.addAppends("createdBy"),n}},{key:"onInit",value:function(e){eb(em(t.prototype),"onInit",this).call(this,e)}},{key:"getCurrentRecord",value:function(){var e=this.resource.getData();return Array.isArray(e)?e[0]:e}},{key:"refresh",value:function(){return el(function(){return eg(this,function(e){switch(e.label){case 0:return[4,this.resource.refresh()];case 1:return e.sent(),[2]}})}).call(this)}},{key:"renderComponent",value:function(){var e,t,n=this.resource.getData(),r=this.resource;return"comment"!==this.collection.template?o().createElement(L.Alert,{message:this.context.t("The current collection is not a comment collection, so the comment block cannot be used.",{ns:"comments"}),type:"warning",showIcon:!0}):o().createElement(Y,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ed(e,t,n[t])})}return e}({},this.props),t=t={dataSource:n,resource:r,handlePageChange:this.handlePageChange},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))}}],[{key:"filterCollection",value:function(e){return"comment"===e.template}}]),t}(n.CollectionBlockModel);function ej(e,t,n){return t=eP(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,ek()?Reflect.construct(t,n||[],eP(e).constructor):t.apply(e,n))}function eS(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function eP(e){return(eP=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ex(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&eC(e,t)}function eC(e,t){return(eC=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ek(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ek=function(){return!!e})()}ed(ew,"scene",n.BlockSceneEnum.oam),ew.registerFlow({key:"commentsSettings",title:(0,q.escapeT)("Comments settings",{ns:"comments"}),sort:150,steps:{pageSize:{title:(0,q.escapeT)("Page size"),uiSchema:{pageSize:{"x-component":"Select","x-decorator":"FormItem",enum:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]}},defaultParams:{pageSize:20},handler:function(e,t){e.model.resource.loading=!0;var n=e.model.resource;n.setPage(1),n.setPageSize(t.pageSize)}},dataScope:{use:"dataScope"}}}),ew.define({label:(0,q.escapeT)("Comments",{ns:"comments"}),searchable:!0,searchPlaceholder:(0,q.escapeT)("Search"),createModelOptions:{use:"CommentsBlockModel",subModels:{items:[{use:"CommentItemModel"}]}},sort:550});var eE=function(e){function t(){return eS(this,t),ej(this,t,arguments)}return ex(t,e),t}(n.ActionModel),eA=function(e){function t(){return eS(this,t),ej(this,t,arguments)}return ex(t,e),t}(n.ActionGroupModel);function e_(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}(e="baseClass")in eA?Object.defineProperty(eA,e,{value:eE,enumerable:!0,configurable:!0,writable:!0}):eA[e]=eE,eA.define({label:(0,q.escapeT)("Comment action",{ns:"comments"})});function eI(e){return(eI=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eT(e,t){return(eT=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eR=function(){return!!e})()}var eM=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eI(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eR()?Reflect.construct(t,r||[],eI(this).constructor):t.apply(this,r)),a="defaultProps",i={type:"link",title:(0,q.escapeT)("Delete")},a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eT(n,e),t=[{key:"getAclActionName",value:function(){return"destroy"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eE);function eB(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}eM.define({label:(0,q.escapeT)("Delete"),toggleable:!0}),eM.registerFlow({key:"deleteSettings",title:(0,q.escapeT)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,q.escapeT)("Delete record"),content:(0,q.escapeT)("Are you sure you want to delete it?")}},delete:{handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(!e.resource)return e.message.error(e.t("No resource selected for deletion")),[2];if(!e.record)return e.message.error(e.t("No resource or record selected for deletion")),[2];return[4,e.resource.destroy(e.record[e.collection.filterTargetKey])];case 1:return t.sent(),e.message.success(e.t("Record deleted successfully")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){e_(a,r,o,i,c,"next",e)}function c(e){e_(a,r,o,i,c,"throw",e)}i(void 0)})})()}}}});function eD(e){return(eD=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ez(e,t){return(ez=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eF=function(){return!!e})()}var eq=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eD(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eF()?Reflect.construct(t,r||[],eD(this).constructor):t.apply(this,r)),a="defaultProps",i={type:"link",title:(0,q.escapeT)("Edit")},a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ez(n,e),t=[{key:"getAclActionName",value:function(){return"update"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eE);function eL(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}eq.define({label:(0,q.escapeT)("Edit"),toggleable:!0}),eq.registerFlow({key:"editCommentSettings",on:"click",steps:{edit:{handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){return e.model,e.setEditing(),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){eB(a,r,o,i,c,"next",e)}function c(e){eB(a,r,o,i,c,"throw",e)}i(void 0)})})()}}}});function eN(e){return(eN=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eG(e,t){return(eG=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eU=function(){return!!e})()}var e$=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eN(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eU()?Reflect.construct(t,r||[],eN(this).constructor):t.apply(this,r)),a="defaultProps",i={type:"link",title:(0,q.escapeT)("Quote reply",{ns:"comments"})},a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eG(n,e),t=[{key:"getAclActionName",value:function(){return"create"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eE);function eQ(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function eV(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){eQ(a,r,o,i,c,"next",e)}function c(e){eQ(a,r,o,i,c,"throw",e)}i(void 0)})}}function eK(e,t,n){return(eK=eX()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&eH(o,n.prototype),o}).apply(null,arguments)}e$.define({label:(0,q.escapeT)("Quote reply",{ns:"comments"}),toggleable:!0}),e$.registerFlow({key:"quoteReplySettings",on:"click",steps:{quoteReply:{handler:function(e,t){var n;return(n=function(){var t,n,r,o,a;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(i){return r=e.model.context.blockModel,o=null!=(t=null==(n=e.record)?void 0:n.content)?t:"",a="".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")),r.context.setQuoteContent(a),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){eL(a,r,o,i,c,"next",e)}function c(e){eL(a,r,o,i,c,"throw",e)}i(void 0)})})()}}}});function eW(e){return(eW=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eH(e,t){return(eH=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eY(e){var t="function"==typeof Map?new Map:void 0;return(eY=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return eK(e,arguments,eW(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eH(n,e)})(e)}function eX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eX=function(){return!!e})()}function eJ(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var eZ=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=eW(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eX()?Reflect.construct(e,t||[],eW(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&eH(i,e),o=[{key:"afterAdd",value:function(){return eV(function(){return eJ(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return eV(function(){return eJ(this,function(e){return[2]})})()}},{key:"load",value:function(){return eV(function(){return eJ(this,function(e){return this.app.dataSourceManager.addCollectionTemplates([s]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.comment",{title:(0,a.CL)("Comment"),Component:"CommentBlockInitializer",useComponentProps:function(){return{filterCollections:function(e){return"comment"===e.collection.template}}}}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.comment",{title:(0,a.CL)("Comment"),Component:"CommentBlockInitializer",useVisible:function(){var e=(0,n.useCollection)();return(0,r.useMemo)(function(){return e.fields.some(function(e){return(0,n.canMakeAssociationBlock)(e)&&["hasMany","belongsToMany"].includes(e.type)})},[e.fields])},useComponentProps:function(){var e=(0,n.useCollectionManager)();return{onlyCurrentDataSource:!0,filterCollections:function(t){var n=t.associationField;if(n){if(!["hasMany","belongsToMany"].includes(n.type))return!1;var r=e.getCollection(n.target);return(null==r?void 0:r.template)==="comment"}return!1},filterOtherRecordsCollection:function(e){return(null==e?void 0:e.template)==="comment"},showAssociationFields:!0,hideOtherRecordsInPopup:!1,hideSearch:!0}}}),this.app.addComponents({CommentBlockInitializer:_,Comment:m,UpdateCommentActionInitializer:B,UpdateCommentActionButton:M,QuoteReplyCommentActionButton:D,QuoteReplyCommentActionInitializer:z}),this.app.addScopes({useCommentBlockDecoratorProps:C}),this.schemaSettingsManager.add(x),this.schemaInitializerManager.add(F),this.flowEngine.registerModels(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({CommentsBlockModel:ew,CommentItemModel:eO},t)),[2]})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,o),i}(eY(n.Plugin)),e0=eZ}(),j}()});
@@ -14,7 +14,7 @@ export declare class CommentItemModel extends FlowModel {
14
14
  render(): React.JSX.Element;
15
15
  }
16
16
  export declare class CommentsBlockModel extends CollectionBlockModel {
17
- static scene: import("@nocobase/client").BlockSceneType;
17
+ static scene: import("@nocobase/client-v2").BlockSceneType;
18
18
  static filterCollection(collection: any): boolean;
19
19
  createResource(ctx: any, params: any): MultiRecordResource<unknown>;
20
20
  onInit(options: any): void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_comments_client_v2=self.webpackChunk_nocobase_plugin_comments_client_v2||[]).push([["638"],{197:function(e,t,n){n.r(t),n.d(t,{CommentItemModel:function(){return Y},CommentsBlockModel:function(){return Z}});var r,o,l=n(485),a=n(694),c=n(59),u=n(155),i=n.n(u),s=n(488),f=n(768),d=n(375),p=(0,a.observer)(function(){var e=(0,a.useFlowModel)(),t=e.context.record;return i().createElement(a.DndProvider,null,i().createElement("div",{style:{textAlign:"right"}},i().createElement(c.Space,{size:0,style:{gap:0}},e.mapSubModels("actions",function(n,r){var o=n.createFork({},"".concat(t.id,"_").concat(r));return o.context.defineProperty("record",{get:function(){return t}}),o.context.defineMethod("setEditing",function(){e.context.setEditing()}),i().createElement(a.Droppable,{model:o,key:o.uid},i().createElement(a.FlowModelRenderer,{model:o,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:a.DragHandler,sort:1}]}))}),e.context.flowSettingsEnabled&&i().createElement(a.AddSubModelButton,{key:"comment-actions-add",model:e,subModelKey:"actions",subModelBaseClasses:["CommentActionGroupModel"]},i().createElement(a.FlowSettingsButton,{icon:i().createElement(d.SettingOutlined,null)},e.translate("Actions"))))))}),m=n(626);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n,r,o,l,a){try{var c=e[l](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){b(l,r,o,a,c,"next",e)}function c(e){b(l,r,o,a,c,"throw",e)}a(void 0)})}}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var i=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}var w={position:"relative"},S={position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0},x={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},k={backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6},E={marginRight:16,flexShrink:0},O={position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},j={marginTop:10,display:"flex",columnGap:5},P=function(e){var t=e.value,n=e.markdown,r=e.liquid,o=e.translate,l=e.context,a=h((0,u.useState)(null),2),c=a[0],s=a[1];return(0,u.useEffect)(function(){var e=!0;return v(function(){var a,c,u,f;return g(this,function(d){switch(d.label){case 0:if(!t)return s(null),[2];d.label=1;case 1:if(d.trys.push([1,5,,6]),!r)return[3,3];return[4,r.renderWithFullContext(t,l)];case 2:return c=d.sent(),[3,4];case 3:c=t,d.label=4;case 4:return a=c,u=(null==n?void 0:n.render)?n.render(o(a),{ellipsis:!1,textOnly:!1}):a,e&&s(u),[3,6];case 5:return f=d.sent(),e&&s(i().createElement("pre",{style:{color:"red"}},(0,m.u)(f,o("Render error")))),[3,6];case 6:return[2]}})})(),function(){e=!1}},[l,r,n,o,t]),i().createElement(i().Fragment,null,c)},C=(0,a.observer)(function(e){var t,n=e.value,r=e.resource,o=e.model,l=(0,s.kj)(),a=c.App.useApp().message,d=h((0,u.useState)(!1),2),y=d[0],b=d[1],C=h((0,u.useState)((null==n?void 0:n.content)||""),2),M=C[0],A=C[1],I=o.context.markdown;(0,u.useEffect)(function(){A((null==n?void 0:n.content)||"")},[null==n?void 0:n.content]),o.context.defineMethod("setEditing",function(){b(!0)});var z=(0,u.useCallback)(function(){return v(function(){var e;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,r.update(n.id,{content:M})];case 1:return t.sent(),[4,r.refresh()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),a.error((0,m.u)(e,l("Failed to update comment"))),[3,4];case 4:return[2]}})})()},[a,r,l,M,n.id]);return i().createElement("div",{key:n.id},i().createElement("div",{style:w},i().createElement("div",{style:S}),i().createElement(c.Card,{size:"small",styles:{header:{padding:0,fontWeight:"normal",backgroundColor:"#f6f8fa"}},title:i().createElement("div",{style:x},i().createElement("div",{style:k},i().createElement("span",{style:{fontWeight:"bold",fontSize:14}},null==n||null==(t=n.createdBy)?void 0:t.nickname),i().createElement("span",{style:{fontSize:14}},l("commented")),i().createElement(c.Tooltip,{title:(0,f.dayjs)(null==n?void 0:n.createdAt).format("YYYY-MM-DD HH:mm:ss")},i().createElement("span",{style:{fontSize:14}},(0,f.dayjs)(null==n?void 0:n.createdAt).fromNow()))),i().createElement("div",{style:E},i().createElement(p,null)))},i().createElement("div",{style:O},y&&(null==I?void 0:I.edit)?I.edit({value:M,onChange:function(e){A(e)},enableContextSelect:!1}):i().createElement(P,{value:null==n?void 0:n.content,markdown:o.context.markdown,liquid:o.context.liquid,translate:l,context:o.context}),y&&i().createElement("div",{style:j},i().createElement(c.Button,{type:"primary",onClick:function(){b(!1),z()}},l("Update Comment")),i().createElement(c.Button,{onClick:function(){b(!1)}},l("Cancel")))))))});function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(e,t,n,r,o,l,a){try{var c=e[l](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}var I=(0,a.observer)(function(e){var t,n,r,o=e.createAble,l=e.defaultValue,f=void 0===l?"":l,d=(0,a.useFlowModel)(),p=d.context.markdown,y=d.resource,b=(0,s.kj)(),v=c.App.useApp().message,h=function(e){if(Array.isArray(e))return e}(t=(0,u.useState)(f))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return M(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return M(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=h[0],w=h[1];(0,u.useEffect)(function(){w(f)},[f]);var S=(0,u.useMemo)(function(){return g.trim().length>0},[g]),x=(0,u.useMemo)(function(){var e,t,n;return null==(n=d.collection)||null==(t=n.getFields().find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[d.collection]),k=(0,u.useCallback)(function(){var e;return(e=function(){var e,t,n;return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var i=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,y.create({content:g})];case 1:return r.sent(),w(""),e=y.getMeta("count")||0,t=y.getPageSize()||10,y.setPage(Math.max(Math.ceil((e+1)/t),1)),[4,y.refresh()];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),v.error((0,m.u)(n,b("Failed to create comment"))),[3,4];case 4:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){A(l,r,o,a,c,"next",e)}function c(e){A(l,r,o,a,c,"throw",e)}a(void 0)})})()},[g,v,y,b]);return void 0===o||o?i().createElement("div",{style:{marginTop:10}},(null==p?void 0:p.edit)?p.edit((n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},(void 0===x?"undefined":x&&"u">typeof Symbol&&x.constructor===Symbol?"symbol":typeof x)=="object"?x:{}),r=r={value:g,quoteFlag:!0,onChange:function(e){w(e)},enableContextSelect:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n)):i().createElement(c.Input.TextArea,{value:g,onChange:function(e){return w(e.target.value)},autoSize:!0}),i().createElement(c.Button,{disabled:!S,onClick:k,type:"primary",style:{marginTop:10}},b("Comment"))):null});function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var _=(0,a.observer)(function(e){var t,n=e.resource,r=e.handlePageChange,o=e.dataSource,l=function(e){if(Array.isArray(e))return e}(t=(0,u.useState)(""))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return z(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return z(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=l[0],f=l[1],d=(0,a.useFlowModel)();return d.context.defineMethod("setQuoteContent",function(e){f(e)}),i().createElement("div",null,i().createElement(c.List,{pagination:(null==n?void 0:n.getMeta("count"))>0&&{onChange:r,total:(null==n?void 0:n.getMeta("count"))||0,pageSize:n.getPageSize()||10,current:n.getPage()||1}},i().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==o?void 0:o.length)?o.map(function(e,t){var n=t===o.length-1;return i().createElement("div",{key:e.id,style:{position:"relative",padding:"".concat(0===t?0:"10px"," 0 ").concat(n?0:"10px"," 0")}},d.mapSubModels("items",function(t){var n=t.createFork({},"".concat(e.id,"-").concat(e.content||""));return n.context.defineProperty("record",{get:function(){return e},cache:!1}),i().createElement(a.FlowModelRenderer,{key:n.uid,model:n})}))}):null)),i().createElement(I,{defaultValue:s}))});function F(e,t,n,r,o,l,a){try{var c=e[l](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function R(e,t,n){return t=q(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,W()?Reflect.construct(t,n||[],q(e).constructor):t.apply(e,n))}function B(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function D(e,t,n){return t&&T(e.prototype,t),n&&T(e,n),e}function G(e,t,n){return(G="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=q(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(W=function(){return!!e})()}var Y=function(e){function t(){return B(this,t),R(this,t,arguments)}return H(t,e),D(t,[{key:"render",value:function(){return i().createElement(C,{value:this.context.record,resource:this.context.blockModel.resource,model:this})}}]),t}(a.FlowModel),Z=function(e){function t(){return B(this,t),R(this,t,arguments)}return H(t,e),D(t,[{key:"resource",get:function(){return G(q(t.prototype),"resource",this)}},{key:"createResource",value:function(){var e=this.context.createResource(a.MultiRecordResource);return e.setPageSize(this.props.pageSize||20),e.addAppends("createdBy"),e}},{key:"handlePageChange",value:function(e){var t;return(t=function(){return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var i=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return this.resource.setPage(e),this.resource.loading=!0,[4,this.refresh()];case 1:return t.sent(),[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var l=t.apply(e,n);function a(e){F(l,r,o,a,c,"next",e)}function c(e){F(l,r,o,a,c,"throw",e)}a(void 0)})}).call(this)}},{key:"renderComponent",value:function(){var e=this,t=this.resource.getData();return"comment"!==this.collection.template?i().createElement(c.Alert,{message:this.context.t("The current collection is not a comment collection, so the comment block cannot be used.",{ns:"comments"}),type:"warning",showIcon:!0}):i().createElement(_,{dataSource:Array.isArray(t)?t:[],resource:this.resource,handlePageChange:function(t){e.handlePageChange(t)}})}}],[{key:"filterCollection",value:function(e){return"comment"===e.template}}]),t}(l.CollectionBlockModel);r="scene",o=l.BlockSceneEnum.oam,r in Z?Object.defineProperty(Z,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):Z[r]=o,Z.registerFlow({key:"commentsSettings",title:(0,s.MZ)("Comments settings"),on:"beforeRender",sort:150,steps:{pageSize:{title:(0,s.MZ)("Page size"),uiSchema:{pageSize:{"x-component":"Select","x-decorator":"FormItem",enum:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]}},defaultParams:{pageSize:20},handler:function(e,t){e.model.props.pageSize=t.pageSize,e.model.resource.loading=!0,e.model.resource.setPage(1),e.model.resource.setPageSize(t.pageSize)}},dataScope:{use:"dataScope"}}}),Z.define({label:(0,s.MZ)("Comments"),searchable:!0,searchPlaceholder:(0,s.MZ)("Search"),createModelOptions:{use:"CommentsBlockModel",subModels:{items:[{use:"CommentItemModel"}]}},sort:550})},626:function(e,t,n){n.d(t,{u:function(){return r}});var r=function(e,t){var n,r,o,l,a,c;return e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?(null==(l=e.response)||null==(o=l.data)||null==(r=o.errors)||null==(n=r[0])?void 0:n.message)||(null==(c=e.response)||null==(a=c.data)?void 0:a.message)||e.message||t:t}}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_comments_client_v2=self.webpackChunk_nocobase_plugin_comments_client_v2||[]).push([["716"],{519:function(e,t,r){r.r(t),r.d(t,{DeleteCommentActionModel:function(){return O},EditCommentActionModel:function(){return S},CommentActionGroupModel:function(){return y},QuoteReplyActionModel:function(){return C},CommentActionModel:function(){return p}});var n,o=r(485),u=r(488);function c(e,t,r){return t=l(t),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,s()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function i(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var p=function(e){function t(){return i(this,t),c(this,t,arguments)}return a(t,e),t}(o.ActionModel),y=function(e){function t(){return i(this,t),c(this,t,arguments)}return a(t,e),t}(o.ActionGroupModel);(n="baseClass")in y?Object.defineProperty(y,n,{value:p,enumerable:!0,configurable:!0,writable:!0}):y[n]=p,y.define({label:(0,u.MZ)("Comment action")});var b=r(626);function v(e,t,r,n,o,u,c){try{var i=e[u](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}var O=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=d(t),h(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,g()?Reflect.construct(t,n||[],d(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",title:(0,u.MZ)("Delete")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&m(r,e),t=[{key:"getAclActionName",value:function(){return"destroy"}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(p);function w(e,t,r,n,o,u,c){try{var i=e[u](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}h(O,"scene",o.ActionSceneEnum.record),O.define({label:(0,u.MZ)("Delete"),toggleable:!0}),O.registerFlow({key:"deleteSettings",title:(0,u.MZ)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,u.MZ)("Delete record"),content:(0,u.MZ)("Are you sure you want to delete it?")}},delete:{handler:function(e){var t;return(t=function(){var t;return function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var a=[i,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,a[0]&&(u=0)),u;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:if(r.trys.push([0,3,,4]),!e.resource||!e.record||!e.collection)return e.message.error(e.t("No resource or record selected for deletion")),[2];return[4,e.resource.destroy(e.record[e.collection.filterTargetKey||"id"])];case 1:return r.sent(),[4,e.resource.refresh()];case 2:return r.sent(),e.message.success(e.t("Record deleted successfully")),[3,4];case 3:return t=r.sent(),e.message.error((0,b.u)(t,e.t("Failed to delete comment"))),[3,4];case 4:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function c(e){v(u,n,o,c,i,"next",e)}function i(e){v(u,n,o,c,i,"throw",e)}c(void 0)})})()}}}});function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(k=function(){return!!e})()}var S=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=j(t),_(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,k()?Reflect.construct(t,n||[],j(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",title:(0,u.MZ)("Edit")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&P(r,e),t=[{key:"getAclActionName",value:function(){return"update"}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(p);function E(e,t,r,n,o,u,c){try{var i=e[u](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}_(S,"scene",o.ActionSceneEnum.record),S.define({label:(0,u.MZ)("Edit"),toggleable:!0}),S.registerFlow({key:"editCommentSettings",on:"click",steps:{edit:{handler:function(e){var t;return(t=function(){return function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var a=[i,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,a[0]&&(u=0)),u;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(t){return e.setEditing(),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function c(e){w(u,n,o,c,i,"next",e)}function i(e){w(u,n,o,c,i,"throw",e)}c(void 0)})})()}}}});function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}var C=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=M(t),x(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,R()?Reflect.construct(t,n||[],M(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",title:(0,u.MZ)("Quote reply")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&A(r,e),t=[{key:"getAclActionName",value:function(){return"create"}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(p);x(C,"scene",o.ActionSceneEnum.record),C.define({label:(0,u.MZ)("Quote reply"),toggleable:!0}),C.registerFlow({key:"quoteReplySettings",on:"click",steps:{quoteReply:{handler:function(e){var t;return(t=function(){var t,r,n,o,u;return function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var a=[i,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,a[0]&&(u=0)),u;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(c){return n=e.model.context.blockModel,o=null!=(t=null==(r=e.record)?void 0:r.content)?t:"",u="".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")),n.context.setQuoteContent(u),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function c(e){E(u,n,o,c,i,"next",e)}function i(e){E(u,n,o,c,i,"throw",e)}c(void 0)})})()}}}})},626:function(e,t,r){r.d(t,{u:function(){return n}});var n=function(e,t){var r,n,o,u,c,i;return e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?(null==(u=e.response)||null==(o=u.data)||null==(n=o.errors)||null==(r=n[0])?void 0:r.message)||(null==(i=e.response)||null==(c=i.data)?void 0:c.message)||e.message||t:t}}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export { default } from './plugin';
10
+ export * from './plugin';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-comments/client-v2",["@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-comments/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):e["@nocobase/plugin-comments/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var c,u,a,l={488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return i}});var r=n(694),o="comments";function i(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[o,"client"]},n))}}function c(e){return(0,r.tExpr)(e,{ns:[o,"client"]})}},375:function(e){e.exports=r},485:function(t){t.exports=e},694:function(e){e.exports=o},768:function(e){e.exports=i},59:function(e){e.exports=n},155:function(e){e.exports=t}},s={};function f(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return l[e](n,n.exports,f),n.exports}f.m=l,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({638:"c5152390d43e7475",716:"0fffbfd9f6f60ddd"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p={},f.l=function(e,t,n,r){if(p[e])return void p[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-comments/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-comments/client-v2:"+n),o.src=e),p[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(d=f.g.location+"");var p,d,b=f.g.document;if(!d&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(d=b.currentScript.src),!d)){var m=b.getElementsByTagName("script");if(m.length)for(var v=m.length-1;v>-1&&(!d||!/^http(s?):/.test(d));)d=m[v--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");f.p=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},f.f.j=function(e,t){var n=f.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=f.p+f.u(e),i=Error();f.l(o,function(t){if(f.o(c,e)&&(0!==(n=c[e])&&(c[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},u=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)f.o(i,n)&&(f.m[n]=i[n]);u&&u(f)}for(e&&e(t);a<o.length;a++)r=o[a],f.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(a=self.webpackChunk_nocobase_plugin_comments_client_v2=self.webpackChunk_nocobase_plugin_comments_client_v2||[]).forEach(u.bind(null,0)),a.push=u.bind(null,a.push.bind(a));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-comments/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(o);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-comments/dist/client-v2/"}f.p=e}(),!function(){f.r(h),f.d(h,{PluginCommentClientV2:function(){return a},default:function(){return l}});var e=f(485),t=f(488);function n(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function r(e,t,n){return(r=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var a=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&i(c,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return this.flowEngine.registerModelLoaders({CommentsBlockModel:{loader:function(){return f.e("638").then(f.bind(f,197))}},CommentItemModel:{loader:function(){return f.e("638").then(f.bind(f,197))}},CommentActionGroupModel:{loader:function(){return f.e("716").then(f.bind(f,519))}},EditCommentActionModel:{loader:function(){return f.e("716").then(f.bind(f,519))}},DeleteCommentActionModel:{loader:function(){return f.e("716").then(f.bind(f,519))}},QuoteReplyActionModel:{loader:function(){return f.e("716").then(f.bind(f,519))}}}),null==(n=this.app.pm.get("@nocobase/plugin-data-source-manager")||this.app.pm.get("data-source-manager"))||null==(e=n.registerCollectionTemplate)||e.call(n,{name:"comment",title:(0,t.MZ)("Comment Collection"),order:22,color:"orange",collection:{options:{template:"comment"},fields:[{name:"content",type:"text",length:"long",interface:"vditor",deletable:!1,uiSchema:{type:"string",title:(0,t.MZ)("Comment Content"),interface:"vditor","x-component":"MarkdownVditor"}}]},presetFields:{disabled:!0}}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var c=e.apply(t,r);function u(e){n(c,o,i,u,a,"next",e)}function a(e){n(c,o,i,u,a,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,r),c}(c(e.Plugin)),l=a}(),h}()});
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const NAMESPACE = "comments";
10
+ export declare function useT(): (key: string, options?: Record<string, any>) => string;
11
+ export declare function tExpr(key: string): string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare const CommentActions: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<unknown>>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { type MultiRecordResource } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ type CommentRecord = {
12
+ id: string | number;
13
+ content?: string;
14
+ createdAt?: string;
15
+ createdBy?: {
16
+ nickname?: string;
17
+ };
18
+ };
19
+ type MarkdownRuntime = {
20
+ edit: (props: Record<string, unknown>) => React.ReactNode;
21
+ render: (value: string, options: Record<string, unknown>) => React.ReactNode;
22
+ };
23
+ type LiquidRuntime = {
24
+ renderWithFullContext: (value: string, context: unknown) => Promise<string>;
25
+ };
26
+ type CommentItemProps = {
27
+ value: CommentRecord;
28
+ resource: MultiRecordResource;
29
+ model: {
30
+ context: {
31
+ markdown?: MarkdownRuntime;
32
+ liquid?: LiquidRuntime;
33
+ defineMethod: (name: string, method: (...args: unknown[]) => unknown) => void;
34
+ };
35
+ };
36
+ };
37
+ export declare const CommentItem: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CommentItemProps>>;
38
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { type MultiRecordResource } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ type CommentRecord = {
12
+ id: string | number;
13
+ content?: string;
14
+ };
15
+ type CommentListProps = {
16
+ resource: MultiRecordResource;
17
+ handlePageChange: (page: number) => void;
18
+ dataSource?: CommentRecord[];
19
+ };
20
+ export declare const CommentList: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CommentListProps>>;
21
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ type CommentSubmitProps = {
11
+ createAble?: boolean;
12
+ defaultValue?: string;
13
+ };
14
+ export declare const CommentSubmit: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CommentSubmitProps>>;
15
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { CollectionBlockModel } from '@nocobase/client-v2';
10
+ import { FlowModel, MultiRecordResource, type Collection } from '@nocobase/flow-engine';
11
+ import React from 'react';
12
+ type CommentsBlockStructure = {
13
+ subModels: {
14
+ items: CommentItemModel[];
15
+ };
16
+ };
17
+ export declare class CommentItemModel extends FlowModel {
18
+ render(): React.JSX.Element;
19
+ }
20
+ export declare class CommentsBlockModel extends CollectionBlockModel<CommentsBlockStructure> {
21
+ static scene: import("@nocobase/client-v2").BlockSceneType;
22
+ static filterCollection(collection: Collection): boolean;
23
+ get resource(): MultiRecordResource<any>;
24
+ createResource(): MultiRecordResource<unknown>;
25
+ handlePageChange(page: number): Promise<void>;
26
+ renderComponent(): React.JSX.Element;
27
+ }
28
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { ActionGroupModel, ActionModel } from '@nocobase/client-v2';
10
+ export declare class CommentActionModel extends ActionModel {
11
+ }
12
+ export declare class CommentActionGroupModel extends ActionGroupModel {
13
+ static baseClass: typeof CommentActionModel;
14
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { ButtonProps } from 'antd/es/button';
10
+ import { CommentActionModel } from './CommentActionGroupModel';
11
+ export declare class DeleteCommentActionModel extends CommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
15
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { ButtonProps } from 'antd/es/button';
10
+ import { CommentActionModel } from './CommentActionGroupModel';
11
+ export declare class EditCommentActionModel extends CommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
15
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { ButtonProps } from 'antd/es/button';
10
+ import { CommentActionModel } from './CommentActionGroupModel';
11
+ export declare class QuoteReplyActionModel extends CommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
15
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export * from './CommentActionGroupModel';
10
+ export * from './DeleteCommentActionModel';
11
+ export * from './EditCommentActionModel';
12
+ export * from './QuoteReplyActionModel';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const getErrorMessage: (error: unknown, fallback: string) => string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Application, Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginCommentClientV2 extends Plugin<any, Application> {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginCommentClientV2;
@@ -8,17 +8,19 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-beta.8",
11
+ "@nocobase/client": "2.2.0-alpha.1",
12
12
  "react": "18.2.0",
13
- "@nocobase/server": "2.1.0-beta.8",
13
+ "@nocobase/flow-engine": "2.2.0-alpha.1",
14
+ "@nocobase/client-v2": "2.2.0-alpha.1",
15
+ "@nocobase/plugin-data-source-manager": "2.2.0-alpha.1",
16
+ "@nocobase/server": "2.2.0-alpha.1",
14
17
  "@formily/core": "2.3.7",
15
18
  "@formily/react": "2.3.7",
16
19
  "antd": "5.24.2",
17
20
  "dayjs": "1.11.13",
18
- "lodash": "4.17.21",
19
- "@nocobase/utils": "2.1.0-beta.8",
21
+ "lodash": "4.18.1",
22
+ "@nocobase/utils": "2.2.0-alpha.1",
20
23
  "react-i18next": "11.18.6",
21
24
  "@ant-design/icons": "5.6.1",
22
- "@nocobase/flow-engine": "2.1.0-beta.8",
23
25
  "@formily/reactive-react": "2.3.7"
24
26
  };
@@ -8,8 +8,12 @@
8
8
  "Delete": "Delete",
9
9
  "Edit": "Edit",
10
10
  "Enable Create": "Allow adding comments",
11
+ "Failed to create comment": "Failed to create comment",
12
+ "Failed to delete comment": "Failed to delete comment",
13
+ "Failed to update comment": "Failed to update comment",
11
14
  "Quote Reply": "Quote reply",
12
15
  "Quote reply": "Quote reply",
16
+ "Render error": "Render error",
13
17
  "Update Comment": "Update comment",
14
18
  "commented": "commented"
15
- }
19
+ }
@@ -8,8 +8,12 @@
8
8
  "Delete": "删除",
9
9
  "Edit": "编辑",
10
10
  "Enable Create": "允许增加评论",
11
+ "Failed to create comment": "创建评论失败",
12
+ "Failed to delete comment": "删除评论失败",
13
+ "Failed to update comment": "更新评论失败",
11
14
  "Quote Reply": "引用并回复",
12
15
  "Quote reply": "引用并回复",
16
+ "Render error": "渲染错误",
13
17
  "Update Comment": "更新评论",
14
18
  "commented": "评论于",
15
19
  "The current collection is not a comment collection, so the comment block cannot be used.": "当前表不是评论表,无法使用评论区块。",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-comments",
3
- "version": "2.1.0-beta.8",
3
+ "version": "2.2.0-alpha.1",
4
4
  "displayName": "Comments",
5
5
  "displayName.zh-CN": "评论",
6
6
  "description": "Provides comment collection template and block to add commenting functionality for any collection.",
@@ -25,8 +25,11 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@nocobase/client": "2.x",
28
+ "@nocobase/client-v2": "2.x",
29
+ "@nocobase/flow-engine": "2.x",
30
+ "@nocobase/plugin-data-source-manager": "2.x",
28
31
  "@nocobase/server": "2.x",
29
32
  "@nocobase/test": "2.x"
30
33
  },
31
- "gitHead": "5099d561c5467292414c1e77ad6bad3730d97344"
34
+ "gitHead": "303663aba6c6eefa27e6a6435b4c0352074ec40f"
32
35
  }
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["452"],{476:function(e,t,n){n.r(t),n.d(t,{CommentItem:function(){return m}});var r=n(505),o=n(772),a=n(721),i=n(760),c=n.n(i),l=n(156),u=n.n(l),s=n(551),d=n(217);function p(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var m=(0,r.observer)(function(e){var t,n,i,m,f,b,v,y,h=e.editing,g=e.setEditing,w=(0,r.useField)(),x=(0,s.$G)().t,k=(0,d.Z)().componentCls,O=(0,o.useCollectionParentRecordData)(),E=(0,o.useBlockRequestContext)(),C=E.resource,P=E.service,j=(0,l.useCallback)((t=function(){var e,t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,C.update({filterByTk:null==(e=w.value)?void 0:e.id,values:{content:null==w||null==(t=w.value)?void 0:t.content}})];case 1:return n.sent(),P.refresh(),[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){p(a,r,o,i,c,"next",e)}function c(e){p(a,r,o,i,c,"throw",e)}i(void 0)})}),[C,P,w.value]),S=(0,o.useCollectionFields)(),R=(0,l.useMemo)(function(){var e,t;return null==(t=S.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[S]);return u().createElement(o.RecordProvider,{record:w.value,parent:O},u().createElement("div",{className:"".concat(k,"-item-container")},u().createElement("div",{className:"".concat(k,"-item-container-line")}),u().createElement(a.Card,{size:"small",title:u().createElement("div",{className:"".concat(k,"-item-title")},u().createElement("div",{className:"".concat(k,"-item-title-left")},u().createElement("span",null,null==w||null==(f=w.value)||null==(m=f.createdBy)?void 0:m.nickname),u().createElement("span",null,x("commented")),u().createElement(a.Tooltip,{title:c()(null==w||null==(b=w.value)?void 0:b.createdAt).format("YYYY-MM-DD HH:mm:ss")},u().createElement("span",null,c()(null==w||null==(v=w.value)?void 0:v.createdAt).fromNow()))),u().createElement("div",{className:"".concat(k,"-item-title-right")},e.children))},u().createElement("div",{className:"".concat(k,"-item-editor")},u().createElement(r.RecursionField,{basePath:w.address,name:"content",schema:{type:"string",name:"content","x-component":"MarkdownVditor","x-component-props":(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},R),i=i={value:null==w||null==(y=w.value)?void 0:y.content},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(i)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}),n),"x-read-pretty":!0}}),h&&u().createElement("div",{className:"".concat(k,"-item-editor-button-area")},u().createElement(a.Button,{type:"primary",onClick:function(){g(!1),j(),w.form.setFieldState("".concat(w.address,".content"),function(e){e.pattern="readPretty"})}},x("Update Comment")),u().createElement(a.Button,{onClick:function(){w.form.setFieldState("".concat(w.address,".content"),function(e){e.pattern="readPretty"}),g(!1)}},x("Cancel")))))))})},217:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.Z=(0,n(772).genStyleHook)("nb-comment",function(e){var t,n,o=e.componentCls;return r({},o,(r(n={},"".concat(o,"-item-container-container"),r({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),r(n,"".concat(o,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),r(n,"".concat(o,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),r(n,".ant-list-pagination",{marginTop:e.marginXS}),r(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),r(n,"".concat(o,"-item-title"),(r(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"32px"},"".concat(o,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),r(t,"".concat(o,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),r(n,"".concat(o,"-item-editor"),r({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(o,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))})}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["656"],{942:function(e,t,n){n.r(t),n.d(t,{CommentSubmit:function(){return b}});var r=n(505),o=n(156),a=n.n(o),i=n(721),l=n(772),c=n(868),u=n(551),s=n(217);function p(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function b(){var e,t,n=(0,r.useField)(),b=(0,o.useCallback)(function(e){n.setValue(f(d({},n.value),{content:e}))},[n]),m=(0,u.$G)().t,g=(0,s.Z)(),h=g.wrapSSR,y=g.componentCls,v=g.hashId,x=(0,o.useMemo)(function(){var e,t;return(null==(t=n.value)||null==(e=t.content)?void 0:e.trim().length)>0},[n.value]),w=(0,l.useBlockRequestContext)(),O=w.resource,k=w.service,C=(0,o.useCallback)((e=function(){var e,t,r,o,a,i,l;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(c){switch(c.label){case 0:return[4,O.create({values:n.value})];case 1:return c.sent(),b(""),i=(null==k||null==(t=k.data)||null==(e=t.meta)?void 0:e.count)||0,l=Math.ceil((i+1)/((null==k||null==(o=k.data)||null==(r=o.meta)?void 0:r.pageSize)||10)),k.run(f(d({},null==(a=k.params)?void 0:a[0]),{page:l})),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){p(a,r,o,i,l,"next",e)}function l(e){p(a,r,o,i,l,"throw",e)}i(void 0)})}),[O,n,k,b]),j=(0,c.C)().createAble,P=(0,l.useACLActionParamsContext)(),S=!(0,l.useDesignable)().designable&&((null==n||null==(t=n.data)?void 0:t.hidden)||!P),R=(0,l.useCollectionFields)(),z=(0,o.useMemo)(function(){var e,t;return null==(t=R.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[R]);return!j||S?null:h(a().createElement("div",{style:{marginTop:10},className:"".concat(y," ").concat(v)},a().createElement(r.RecursionField,{basePath:n.address,name:"content",schema:{type:"string","x-component":"MarkdownVditor","x-component-props":f(d({},z),{onChange:function(e){b(e)}}),"x-read-pretty":!1,"x-read-only":!1,name:"content"}}),a().createElement(i.Button,{disabled:!x,onClick:function(){return C()},type:"primary",style:{marginTop:10}},m("Comment"))))}},217:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.Z=(0,n(772).genStyleHook)("nb-comment",function(e){var t,n,o=e.componentCls;return r({},o,(r(n={},"".concat(o,"-item-container-container"),r({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),r(n,"".concat(o,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),r(n,"".concat(o,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),r(n,".ant-list-pagination",{marginTop:e.marginXS}),r(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),r(n,"".concat(o,"-item-title"),(r(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"32px"},"".concat(o,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),r(t,"".concat(o,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),r(n,"".concat(o,"-item-editor"),r({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(o,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))})}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_comments=self.webpackChunk_nocobase_plugin_comments||[]).push([["779"],{191:function(e,t,n){n.r(t),n.d(t,{CommentList:function(){return f}});var r=n(505),o=n(721),i=n(156),a=n.n(i),l=n(217),c=n(772);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var f=(0,c.withDynamicSchemaProps)(function(e){var t,n,f,m=(0,r.useFieldSchema)(),b=(0,r.useField)(),g=(t=(0,i.useState)(new Map),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(t,1)||function(e,t){if(e){if("string"==typeof e)return u(e,1);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}(t,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],y=(0,l.Z)(),h=y.wrapSSR,v=y.hashId,O=y.componentCls,x=(0,c.useBlockRequestContext)().service,S=x.run,w=x.params,j=null==x||null==(n=x.data)?void 0:n.meta,k=(0,i.useCallback)(function(e){return g.has(e)||g.set(e,new r.Schema({type:"object",properties:s({},e,m.properties.item)})),g.get(e)},[m.properties,g]),C=(0,i.useCallback)(function(e,t){S(d(p({},null==w?void 0:w[0]),{page:e,pageSize:t}))},[S,w]);return(null==x?void 0:x.loading)?a().createElement("div",{style:{display:"flex",justifyContent:"center"}},a().createElement(o.Spin,{spinning:!0})):h(a().createElement("div",{className:"".concat(O," ").concat(v)},a().createElement(o.List,d(p({},e),{pagination:(null==j?void 0:j.count)>0&&{onChange:C,total:(null==j?void 0:j.count)||0,pageSize:(null==j?void 0:j.pageSize)||10,current:(null==j?void 0:j.page)||1}}),a().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==(f=b.value)?void 0:f.length)?b.value.map(function(e,t){var n=0===t,o=t===b.value.length-1;return a().createElement("div",{key:t,style:{position:"relative",padding:"".concat(n?0:"10px"," 0 ").concat(o?0:"10px"," 0")}},a().createElement(r.RecursionField,{basePath:b.address,name:t,onlyRenderProperties:!0,schema:k(t)}))}):null))))})},217:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.Z=(0,n(772).genStyleHook)("nb-comment",function(e){var t,n,o=e.componentCls;return r({},o,(r(n={},"".concat(o,"-item-container-container"),r({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),r(n,"".concat(o,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),r(n,"".concat(o,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),r(n,".ant-list-pagination",{marginTop:e.marginXS}),r(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),r(n,"".concat(o,"-item-title"),(r(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"32px"},"".concat(o,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),r(t,"".concat(o,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),r(n,"".concat(o,"-item-editor"),r({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(o,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))})}}]);