@nocobase/plugin-comments 2.1.0-alpha.10 → 2.1.0-alpha.12

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.
@@ -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([["936"],{907: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(310),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))))})}}]);
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))))})}}]);
@@ -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([["767"],{674: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(658),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))))})},658: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))})}}]);
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))})}}]);
@@ -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
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/reactive-react"),require("@formily/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/reactive-react","@formily/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/reactive-react"),require("@formily/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/reactive-react"],e["@formily/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,i,a,c,l,u,s){return function(){var f,p,d,m={310:function(e,t,n){"use strict";n.d(t,{w:function(){return s},x:function(){return f}});var r=n(230),o=n(342),i=n(155),a=n.n(i);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,i.createContext)({});function s(e){(0,r.useField)();var t,n=(0,r.useFieldSchema)(),s=function(e){if(Array.isArray(e))return e}(t=(0,i.useState)(!1))||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),2!==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 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,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 a().createElement(u.Provider,{value:{createAble:f,setCreateAble:b}},e.children)}function f(){return(0,i.useContext)(u)}},404:function(e,t,n){"use strict";n.d(t,{Bd:function(){return c},CL:function(){return a},CU:function(){return i}});var r=n(768),o=n(953),i="comments";function a(e){return(0,r.tval)(e,{ns:i})}function c(){return(0,o.useTranslation)(i)}},631:function(e){e.exports=function(e,t){return"u">typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},375:function(e){"use strict";e.exports=r},230:function(e){"use strict";e.exports=n},726:function(e){"use strict";e.exports=t},342:function(e){"use strict";e.exports=l},694:function(e){"use strict";e.exports=o},768:function(e){"use strict";e.exports=u},59:function(e){"use strict";e.exports=c},185:function(e){"use strict";e.exports=i},773:function(e){"use strict";e.exports=s},155:function(e){"use strict";e.exports=a},953:function(t){"use strict";t.exports=e}},b={};function y(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.m=m,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""+({767:"a564785a909e8601",903:"6a2f06a3e1754176",936:"6077e08ddb076fa2",984:"0fc2cb10b31385d0"})[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,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var l=a[c];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-comments:"+n){o=l;break}}o||(i=!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),i&&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),i=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;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==f[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);a&&a(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(){"use strict";var e=window.__webpack_public_path__||"/";"/"!==e.charAt(e.length-1)&&(e+="/"),y.p=e+"static/plugins/@nocobase/plugin-comments/dist/client/"}(),!function(){"use strict";y.r(j),y.d(j,{PluginCommentClient:function(){return e0},default:function(){return e1}});var e,t={};y.r(t),y.d(t,{CommentActionGroupModel:function(){return e_},CommentActionModel:function(){return eA},DeleteCommentActionModel:function(){return eB},EditCommentActionModel:function(){return eL},QuoteReplyActionModel:function(){return eV}});var n=y(342),r=y(155),o=y.n(r),i=y(404);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function 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),a(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"),a(e,"title",(0,i.CL)("Comment Collection")),a(e,"order",2),a(e,"color","orange"),a(e,"default",{fields:[{name:"content",type:"text",length:"long",interface:"vditor",deletable:!1,uiSchema:{type:"string",title:(0,i.CL)("Comment Content"),interface:"vditor","x-component":"MarkdownVditor"}}]}),a(e,"presetFieldsDisabled",!0),a(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=y(631),p=(0,n.lazy)(function(){return f("imported_-7i2rou_component",y.e("767").then(y.bind(y,674)))},"CommentList").CommentList,d=(0,n.lazy)(function(){return f("imported_-1af5cgs_component",y.e("984").then(y.bind(y,627)))},"CommentItem").CommentItem,m=(0,n.lazy)(function(){return f("imported_1bnm9jt_component",y.e("936").then(y.bind(y,907)))},"CommentDecorator").CommentDecorator,b=(0,n.lazy)(function(){return f("imported_-1mv867o_component",y.e("903").then(y.bind(y,194)))},"CommentSubmit").CommentSubmit,h=function(){return null};h.ActionBar=n.ActionBar,h.List=p,h.Item=d,h.Decorator=m,h.Submit=b;var v=y(310),g=y(230),O=y(773),w=y.n(O);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 x(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 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.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,g.useFieldSchema)(),i=(0,n.useFormBlockContext)().form,a=(0,g.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:i,onSubmit:function(e){var t,r=e.filter;r=(0,n.removeNullCondition)(r),w().set(o,"x-decorator-props.params.filter",r),a.decoratorProps.params=x(P({},o["x-decorator-props"].params),{page:1}),c.emit("patch",{schema:(S(t={},"x-uid",o["x-uid"]),S(t,"x-decorator-props",o["x-decorator-props"]),t)})}}}},{name:"RecordsPerPage",type:"select",useComponentProps:function(){var e,t,r=(0,g.useField)(),o=(0,g.useFieldSchema)(),a=(0,n.useBlockRequestContext)().service,c=(0,i.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,i=r.decoratorProps.params||{};i.pageSize=e,r.decoratorProps.params=i,o["x-decorator-props"].params=i,a.run(x(P({},null==(t=a.params)?void 0:t[0]),{pageSize:e,page:1})),l.emit("patch",{schema:(S(n={},"x-uid",o["x-uid"]),S(n,"x-decorator-props",o["x-decorator-props"]),n)})}}}},{name:"divider",type:"divider"},{name:"EnableCreate",type:"switch",useComponentProps:function(){var e=(0,v.x)(),t=e.setCreateAble,n=e.createAble;return{title:(0,(0,i.Bd)().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=y(375),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,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var I=function(e){var t,r,i=e.filterCollections,a=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(E.CommentOutlined,null),onlyCurrentDataSource:c,hideSearch:l,filter:i,filterOtherRecordsCollection:a,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,i={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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(A({dataSource:n.dataSource,rowKey:e.filterTargetKey||"id",association:"".concat(t.collectionName,".").concat(t.name)})):f(A({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 i=t.apply(e,n);function a(e){_(i,r,o,a,c,"next",e)}function c(e){_(i,r,o,a,c,"throw",e)}a(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 T(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 R(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 M(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,a,c=(0,g.useField)(),l=(0,i.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=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==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}}(e)||function(e){if(e){if("string"==typeof e)return T(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 T(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=M(R({},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==(a=c.data)?void 0:a.hidden)||!p)&&.1},onClick:function(){f(!0)}},l("Edit"))}function D(e){return o().createElement(n.ActionInitializer,M(R({},e),{schema:{type:"void",title:'{{t("Edit")}}',"x-component":"UpdateCommentActionButton"}}))}function z(){var e,t=(0,g.useField)(),a=(0,i.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},a("Quote Reply"))}function F(e){var t={type:"void",title:(0,(0,i.Bd)().t)("Quote Reply"),"x-component":"QuoteReplyCommentActionButton"};return o().createElement(n.ActionInitializer,M(R({},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.CL)("Quote Reply"),Component:"QuoteReplyCommentActionInitializer",schema:{"x-action":"create","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}}]}]}),L=y(694),N=y(59),G=y(726);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))}),V=y(953);function $(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,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.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,G.observer)(function(e){var t,a,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=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==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 $(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 $(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,L.useFlowModel)(),m=d.context.markdown;(0,r.useEffect)(function(){p({content:u})},[u]);var b=d.collection.getFields(),y=d.resource,h=(0,r.useCallback)(function(e){p({content:e})},[]),v=(0,V.useTranslation)().t,g=Q(),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,i={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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(W({},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 i=e.apply(t,n);function a(e){K(i,r,o,a,c,"next",e)}function c(e){K(i,r,o,a,c,"throw",e)}a(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=b.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[b]);return(void 0===l||l)&&(C||x)?O(o().createElement("div",{style:{marginTop:10},className:"".concat(w," ").concat(j)},m.edit((a=W({},k),c=c={value:null==f?void 0:f.content,quoteFlag:!0,onChange:function(e){h(e)},enableContextSelect:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(a,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(a,e,Object.getOwnPropertyDescriptor(c,e))}),a)),o().createElement(N.Button,{disabled:!S,onClick:function(){return P()},type:"primary",style:{marginTop:10}},v("Comment",{ns:i.CU})))):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,G.observer)(function(e){var t,n,i,a,c,l=e.resource,u=e.handlePageChange,s=e.dataSource,f=Q(),p=f.wrapSSR,d=f.hashId,m=f.componentCls,b=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=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==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 Y(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 Y(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=b[0],h=b[1],v=(0,L.useFlowModel)();return v.context.defineMethod("setQuoteContent",function(e){h(e)}),p(o().createElement("div",{className:"".concat(m," ").concat(d)},o().createElement(N.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==(a=l.getMeta())?void 0:a.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(i)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(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(L.FlowModelRenderer,{model:n})}))}):null)),o().createElement(H,{defaultValue:y})))}),J=y(768);function Z(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var ee=(0,G.observer)(function(){var e=(0,L.useFlowModel)(),t=e.context.record;return o().createElement(L.DndProvider,null,o().createElement("div",{style:{textAlign:"right"}},o().createElement(N.Space,{size:0,style:{gap:0}},e.mapSubModels("actions",function(n,r){var i=n.createFork({},"".concat(t.id,"_").concat(r));return i.context.defineProperty("record",{get:function(){return t}}),i.context.defineMethod("setEditing",function(){e.context.setEditing()}),o().createElement(L.Droppable,{model:i,key:i.uid},o().createElement(L.FlowModelRenderer,{model:i,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:L.DragHandler,sort:1}]}))}),o().createElement(L.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,i={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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 i=t.apply(e,n);function a(e){Z(i,r,o,a,c,"next",e)}function c(e){Z(i,r,o,a,c,"throw",e)}a(void 0)})})()}},o().createElement(L.FlowSettingsButton,{icon:o().createElement(E.SettingOutlined,null)},e.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,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.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 a(e){en(i,r,o,a,c,"next",e)}function c(e){en(i,r,o,a,c,"throw",e)}a(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:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)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={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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,i=e.t,a=e.ctx,c=eo((0,r.useState)(null),2),l=c[0],u=c[1];return(0,r.useEffect)(function(){t&&er(function(){var e,r;return ei(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,o.renderWithFullContext(t,a)];case 1:return e=c.sent(),u(n.render(i(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},ec=(0,G.observer)(function(e){var t,n=e.value,a=e.resource,c=e.model,l=(0,V.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=c.context.markdown;c.context.defineMethod("setEditing",function(){f(!0)});var h=(0,r.useCallback)(function(){return er(function(){return ei(this,function(e){switch(e.label){case 0:return[4,a.update(null==n?void 0:n.id,{content:d})];case 1:return e.sent(),a.refresh(),[2]}})})()},[a,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(N.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.CU})),o().createElement(N.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(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(b,"-item-editor-button-area")},o().createElement(N.Button,{type:"primary",onClick:function(){f(!1),h()}},l("Update Comment",{ns:i.CU})),o().createElement(N.Button,{onClick:function(){f(!1)}},l("Cancel")))))))});function el(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.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 a(e){el(i,r,o,a,c,"next",e)}function c(e){el(i,r,o,a,c,"throw",e)}a(void 0)})}}function es(e,t,n){return t=ey(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,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="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=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={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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 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(ec,{value:this.context.record,resource:this.context.blockModel.resource,model:this})}}]),t}(L.FlowModel),ej=function(e){function t(){var e;return ef(this,t),e=es(this,t,arguments),em(e,"handlePageChange",function(t){return eu(function(){var n;return eO(this,function(r){switch(r.label){case 0:var o,i;if(o=e.resource,null!=(i=L.MultiRecordResource)&&"u">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]}})})()}),e}return eh(t,e),ed(t,[{key:"createResource",value:function(e,t){var n=this.context.createResource(L.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(){return eu(function(){return eO(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(N.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){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 eS(e,t,n){return t=ex(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,eE()?Reflect.construct(t,n||[],ex(e).constructor):t.apply(e,n))}function eP(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(ej,"scene",n.BlockSceneEnum.oam),ej.registerFlow({key:"commentsSettings",title:(0,L.escapeT)("Comments settings",{ns:"comments"}),sort:150,steps:{pageSize:{title:(0,L.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"}}}),ej.define({label:(0,L.escapeT)("Comments",{ns:"comments"}),searchable:!0,searchPlaceholder:(0,L.escapeT)("Search"),createModelOptions:{use:"CommentsBlockModel",subModels:{items:[{use:"CommentItemModel"}]}},sort:550});var eA=function(e){function t(){return eP(this,t),eS(this,t,arguments)}return eC(t,e),t}(n.ActionModel),e_=function(e){function t(){return eP(this,t),eS(this,t,arguments)}return eC(t,e),t}(n.ActionGroupModel);function eI(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.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,L.escapeT)("Comment action",{ns:"comments"})});function eT(e){return(eT=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eR(e,t){return(eR=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eM=function(){return!!e})()}var eB=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,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eT(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,eM()?Reflect.construct(t,r||[],eT(this).constructor):t.apply(this,r)),i="defaultProps",a={type:"link",title:(0,L.escapeT)("Delete")},i in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eR(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 eD(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}eB.define({label:(0,L.escapeT)("Delete"),toggleable:!0}),eB.registerFlow({key:"deleteSettings",title:(0,L.escapeT)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,L.escapeT)("Delete record"),content:(0,L.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={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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 i=n.apply(e,t);function a(e){eI(i,r,o,a,c,"next",e)}function c(e){eI(i,r,o,a,c,"throw",e)}a(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 eL=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,a;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)&&"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,eq()?Reflect.construct(t,r||[],ez(this).constructor):t.apply(this,r)),i="defaultProps",a={type:"link",title:(0,L.escapeT)("Edit")},i in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,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 eN(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}eL.define({label:(0,L.escapeT)("Edit"),toggleable:!0}),eL.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={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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 i=n.apply(e,t);function a(e){eD(i,r,o,a,c,"next",e)}function c(e){eD(i,r,o,a,c,"throw",e)}a(void 0)})})()}}}});function eG(e){return(eG=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 eV=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,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eG(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,eQ()?Reflect.construct(t,r||[],eG(this).constructor):t.apply(this,r)),i="defaultProps",a={type:"link",title:(0,L.escapeT)("Quote reply",{ns:"comments"})},i in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,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 e$(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.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 a(e){e$(i,r,o,a,c,"next",e)}function c(e){e$(i,r,o,a,c,"throw",e)}a(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)}eV.define({label:(0,L.escapeT)("Quote reply",{ns:"comments"}),toggleable:!0}),eV.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={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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(a){return r=e.model.context.blockModel,o=null!=(t=null==(n=e.record)?void 0:n.content)?t:"",i="".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")),r.context.setQuoteContent(i),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){eN(i,r,o,a,c,"next",e)}function c(e){eN(i,r,o,a,c,"throw",e)}a(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={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:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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 e0=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,t;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return e=a,t=arguments,e=eH(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,eJ()?Reflect.construct(e,t||[],eH(this).constructor):e.apply(this,t))}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&eY(a,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(){return eK(function(){return eZ(this,function(e){return this.app.dataSourceManager.addCollectionTemplates([s]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.comment",{title:(0,i.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,i.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:I,Comment:h,UpdateCommentActionInitializer:D,UpdateCommentActionButton:B,QuoteReplyCommentActionButton:z,QuoteReplyCommentActionInitializer:F}),this.app.addScopes({useCommentBlockDecoratorProps:k}),this.schemaSettingsManager.add(C),this.schemaInitializerManager.add(q),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:ej,CommentItemModel:ew},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)}}(a.prototype,o),a}(eX(n.Plugin)),e1=e0}(),j}()});
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},154: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""+({23:"d6cb66951ac0256b",512:"368c84f7cea53df3",871:"c142b4fff9aa5fd3",88:"c712257bdff37eb5"})[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={},S=window.__nocobase_public_path__||"";if(!S&&window.location&&window.location.pathname){var P=window.location.pathname||"/",x=P.indexOf("/v2/");S=x>=0?P.slice(0,x+1):"/"}return S&&(S=S.replace(/\/v2\/?$/,"/")),S||(S="/"),"/"!==S.charAt(S.length-1)&&(S+="/"),y.p=S+"static/plugins/@nocobase/plugin-comments/dist/client/",!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 eQ}});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(154),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 I=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 _(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 _(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 _(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))}),Q=y(953);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 $(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 V(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 V(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,Q.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){$(a,r,o,i,c,"next",e)}function c(e){$(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,Q.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 eI(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 e_(e){return(e_=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=e_(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||[],e_(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){eI(a,r,o,i,c,"next",e)}function c(e){eI(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 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=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 eV(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 e$(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){eV(a,r,o,i,c,"next",e)}function c(e){eV(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)}eQ.define({label:(0,q.escapeT)("Quote reply",{ns:"comments"}),toggleable:!0}),eQ.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 e$(function(){return eJ(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return e$(function(){return eJ(this,function(e){return[2]})})()}},{key:"load",value:function(){return e$(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:I,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}()});
@@ -8,17 +8,17 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.10",
11
+ "@nocobase/client": "2.1.0-alpha.12",
12
12
  "react": "18.2.0",
13
- "@nocobase/server": "2.1.0-alpha.10",
13
+ "@nocobase/flow-engine": "2.1.0-alpha.12",
14
+ "@nocobase/server": "2.1.0-alpha.12",
14
15
  "@formily/core": "2.3.7",
15
16
  "@formily/react": "2.3.7",
16
17
  "antd": "5.24.2",
17
18
  "dayjs": "1.11.13",
18
19
  "lodash": "4.17.21",
19
- "@nocobase/utils": "2.1.0-alpha.10",
20
+ "@nocobase/utils": "2.1.0-alpha.12",
20
21
  "react-i18next": "11.18.6",
21
22
  "@ant-design/icons": "5.6.1",
22
- "@nocobase/flow-engine": "2.1.0-alpha.10",
23
23
  "@formily/reactive-react": "2.3.7"
24
24
  };
@@ -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 type { FlowSchemaContribution } from '@nocobase/flow-engine';
10
+ export declare const flowSchemaContribution: FlowSchemaContribution;
@@ -0,0 +1,255 @@
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
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var flow_schema_contributions_exports = {};
28
+ __export(flow_schema_contributions_exports, {
29
+ flowSchemaContribution: () => flowSchemaContribution
30
+ });
31
+ module.exports = __toCommonJS(flow_schema_contributions_exports);
32
+ const genericFilterSchemaId = "urn:nocobase:schema:plugin-comments:generic-filter";
33
+ const emptyObjectSchema = {
34
+ type: "object",
35
+ additionalProperties: false
36
+ };
37
+ const genericFilterSchema = {
38
+ $id: genericFilterSchemaId,
39
+ definitions: {
40
+ filterCondition: {
41
+ type: "object",
42
+ properties: {
43
+ path: {
44
+ type: "string"
45
+ },
46
+ operator: {
47
+ type: "string"
48
+ },
49
+ value: {},
50
+ noValue: {
51
+ type: "boolean"
52
+ }
53
+ },
54
+ required: ["path"],
55
+ additionalProperties: true,
56
+ allOf: [
57
+ {
58
+ not: {
59
+ required: ["logic"]
60
+ }
61
+ },
62
+ {
63
+ not: {
64
+ required: ["items"]
65
+ }
66
+ }
67
+ ]
68
+ },
69
+ filterGroup: {
70
+ type: "object",
71
+ properties: {
72
+ logic: {
73
+ type: "string",
74
+ enum: ["$and", "$or"]
75
+ },
76
+ items: {
77
+ type: "array",
78
+ items: {
79
+ oneOf: [
80
+ { $ref: `${genericFilterSchemaId}#/definitions/filterCondition` },
81
+ { $ref: `${genericFilterSchemaId}#/definitions/filterGroup` }
82
+ ]
83
+ }
84
+ }
85
+ },
86
+ required: ["logic", "items"],
87
+ additionalProperties: true,
88
+ allOf: [
89
+ {
90
+ not: {
91
+ required: ["path"]
92
+ }
93
+ },
94
+ {
95
+ not: {
96
+ required: ["operator"]
97
+ }
98
+ },
99
+ {
100
+ not: {
101
+ required: ["value"]
102
+ }
103
+ },
104
+ {
105
+ not: {
106
+ required: ["noValue"]
107
+ }
108
+ }
109
+ ]
110
+ }
111
+ },
112
+ type: "object",
113
+ properties: {
114
+ logic: {
115
+ type: "string",
116
+ enum: ["$and", "$or"]
117
+ },
118
+ items: {
119
+ type: "array",
120
+ items: {
121
+ oneOf: [
122
+ { $ref: `${genericFilterSchemaId}#/definitions/filterCondition` },
123
+ { $ref: `${genericFilterSchemaId}#/definitions/filterGroup` }
124
+ ]
125
+ }
126
+ }
127
+ },
128
+ required: ["logic", "items"],
129
+ additionalProperties: true,
130
+ allOf: [
131
+ {
132
+ not: {
133
+ required: ["path"]
134
+ }
135
+ },
136
+ {
137
+ not: {
138
+ required: ["operator"]
139
+ }
140
+ },
141
+ {
142
+ not: {
143
+ required: ["value"]
144
+ }
145
+ },
146
+ {
147
+ not: {
148
+ required: ["noValue"]
149
+ }
150
+ }
151
+ ]
152
+ };
153
+ const commentItemModelInternalSchemaContribution = {
154
+ use: "CommentItemModel",
155
+ title: "Comment item",
156
+ source: "plugin",
157
+ strict: false,
158
+ exposure: "internal",
159
+ stepParamsSchema: emptyObjectSchema,
160
+ skeleton: {
161
+ uid: "comment-item-uid",
162
+ use: "CommentItemModel"
163
+ },
164
+ docs: {
165
+ minimalExample: {
166
+ uid: "comment-item-1",
167
+ use: "CommentItemModel"
168
+ }
169
+ }
170
+ };
171
+ const commentsBlockModelSchemaContribution = {
172
+ use: "CommentsBlockModel",
173
+ title: "Comments block",
174
+ source: "plugin",
175
+ strict: false,
176
+ stepParamsSchema: {
177
+ type: "object",
178
+ properties: {
179
+ commentsSettings: {
180
+ type: "object",
181
+ properties: {
182
+ pageSize: {
183
+ type: "object",
184
+ properties: {
185
+ pageSize: {
186
+ type: "number",
187
+ enum: [5, 10, 20, 50, 100, 200]
188
+ }
189
+ },
190
+ additionalProperties: false
191
+ },
192
+ dataScope: {
193
+ type: "object",
194
+ properties: {
195
+ filter: genericFilterSchema
196
+ },
197
+ additionalProperties: false
198
+ }
199
+ },
200
+ additionalProperties: true
201
+ }
202
+ },
203
+ additionalProperties: true
204
+ },
205
+ subModelSlots: {
206
+ items: {
207
+ type: "array",
208
+ uses: ["CommentItemModel"],
209
+ description: "Comment item renderers."
210
+ }
211
+ },
212
+ skeleton: {
213
+ uid: "todo-uid",
214
+ use: "CommentsBlockModel",
215
+ stepParams: {
216
+ commentsSettings: {
217
+ pageSize: {
218
+ pageSize: 20
219
+ }
220
+ }
221
+ },
222
+ subModels: {
223
+ items: []
224
+ }
225
+ },
226
+ docs: {
227
+ minimalExample: {
228
+ uid: "comments-users",
229
+ use: "CommentsBlockModel",
230
+ stepParams: {
231
+ commentsSettings: {
232
+ pageSize: {
233
+ pageSize: 20
234
+ }
235
+ }
236
+ },
237
+ subModels: {
238
+ items: []
239
+ }
240
+ }
241
+ }
242
+ };
243
+ const flowSchemaContribution = {
244
+ inventory: {
245
+ publicTreeRoots: ["CommentsBlockModel"]
246
+ },
247
+ models: [commentItemModelInternalSchemaContribution, commentsBlockModelSchemaContribution],
248
+ defaults: {
249
+ source: "plugin"
250
+ }
251
+ };
252
+ // Annotate the CommonJS export names for ESM import in node:
253
+ 0 && (module.exports = {
254
+ flowSchemaContribution
255
+ });
@@ -14,9 +14,11 @@
14
14
  * This program is offered under a commercial license.
15
15
  * For more information, see <https://www.nocobase.com/agreement>
16
16
  */
17
+ import type { FlowSchemaContribution } from '@nocobase/flow-engine';
17
18
  import { Plugin } from '@nocobase/server';
18
19
  export declare class PluginCommentServer extends Plugin {
19
20
  afterAdd(): Promise<void>;
21
+ getFlowSchemaContributions(): FlowSchemaContribution;
20
22
  beforeLoad(): Promise<void>;
21
23
  load(): Promise<void>;
22
24
  install(): Promise<void>;
@@ -31,9 +31,13 @@ __export(plugin_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(plugin_exports);
33
33
  var import_server = require("@nocobase/server");
34
+ var import_flow_schema_contributions = require("./flow-schema-contributions");
34
35
  class PluginCommentServer extends import_server.Plugin {
35
36
  async afterAdd() {
36
37
  }
38
+ getFlowSchemaContributions() {
39
+ return import_flow_schema_contributions.flowSchemaContribution;
40
+ }
37
41
  async beforeLoad() {
38
42
  }
39
43
  async load() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-comments",
3
- "version": "2.1.0-alpha.10",
3
+ "version": "2.1.0-alpha.12",
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.",
@@ -28,5 +28,5 @@
28
28
  "@nocobase/server": "2.x",
29
29
  "@nocobase/test": "2.x"
30
30
  },
31
- "gitHead": "ce790d46c0a5768ca9618c7d0d77ab8300de75c8"
31
+ "gitHead": "f12c4a75470590b1670ce54510b96ef94c2cd7a2"
32
32
  }
@@ -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([["984"],{627: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(404),d=n(658);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")))))))})},658: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))})}}]);
@@ -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([["903"],{194: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(310),u=n(404),s=n(658);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"))))}},658: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))})}}]);