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

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
- !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}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/react"),require("@formily/reactive-react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-comments",["react-i18next","@formily/react","@formily/reactive-react","@ant-design/icons","@nocobase/flow-engine","dayjs","react","antd","@nocobase/client","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-comments"]=t(require("react-i18next"),require("@formily/react"),require("@formily/reactive-react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-comments"]=t(e["react-i18next"],e["@formily/react"],e["@formily/reactive-react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.dayjs,e.react,e.antd,e["@nocobase/client"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,a,i,c,l,u,s){return function(){"use strict";var f,p,d,b={198:function(e,t,n){n.d(t,{w:function(){return s},x:function(){return f}});var r=n(230),o=n(342),a=n(155),i=n.n(a);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=(0,a.createContext)({});function s(e){(0,r.useField)();var t,n=(0,r.useFieldSchema)(),s=function(e){if(Array.isArray(e))return e}(t=(0,a.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return c(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return c(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1],d=(0,o.useDesignable)().dn;(0,a.useEffect)(function(){var e,t=null==(e=d.current["x-component-props"])?void 0:e.createAble;p(void 0===t||t)},[]);var b=(0,a.useCallback)(function(e){var t,r=Object.assign({},n["x-component-props"],e);n["x-component-props"]=r,d.emit("patch",{schema:(l(t={},"x-uid",n["x-uid"]),l(t,"x-component-props",n["x-component-props"]),t)}),d.refresh()},[d,n]),m=(0,a.useCallback)(function(e){b({createAble:e}),p(e)},[p,b]);return i().createElement(u.Provider,{value:{createAble:f,setCreateAble:m}},e.children)}function f(){return(0,a.useContext)(u)}},872:function(e,t,n){n.d(t,{Bd:function(){return c},CL:function(){return i},CU:function(){return a}});var r=n(768),o=n(953),a="comments";function i(e){return(0,r.tval)(e,{ns:a})}function c(){return(0,o.useTranslation)(a)}},375:function(e){e.exports=r},230:function(e){e.exports=t},726:function(e){e.exports=n},342:function(e){e.exports=l},694:function(e){e.exports=o},768:function(e){e.exports=u},59:function(e){e.exports=c},185:function(e){e.exports=a},773:function(e){e.exports=s},155:function(e){e.exports=i},953:function(t){t.exports=e}},m={};function y(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return b[e](n,n.exports,y),n.exports}y.m=b,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+({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={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-comments/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-comments/dist/client/"}y.p=e}(),!function(){y.r(j),y.d(j,{PluginCommentClient:function(){return eZ},default:function(){return e0}});var e,t={};y.r(t),y.d(t,{CommentActionGroupModel:function(){return eA},CommentActionModel:function(){return eE},DeleteCommentActionModel:function(){return eM},EditCommentActionModel:function(){return eq},QuoteReplyActionModel:function(){return 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(773),O=y.n(g);function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){w(e,t,n[t])})}return e}function P(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var x=new n.SchemaSettings({name:"blockSettings:comment",items:[{name:"title",Component:n.SchemaSettingsBlockTitleItem},{name:"blockLinkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,a.Bd)().t)("Block Linkage rules",{ns:"client"}),category:n.LinkageRuleCategory.block}}},{name:"SetTheDataScope",Component:n.SchemaSettingsDataScope,useComponentProps:function(){var e,t,r=(0,n.useCollection_deprecated)().name,o=(0,v.useFieldSchema)(),a=(0,n.useFormBlockContext)().form,i=(0,v.useField)(),c=(0,n.useDesignable)().dn;return{collectionName:r,defaultFilter:(null==o||null==(t=o["x-decorator-props"])||null==(e=t.params)?void 0:e.filter)||{},form:a,onSubmit:function(e){var t,r=e.filter;r=(0,n.removeNullCondition)(r),O().set(o,"x-decorator-props.params.filter",r),i.decoratorProps.params=P(S({},o["x-decorator-props"].params),{page:1}),c.emit("patch",{schema:(w(t={},"x-uid",o["x-uid"]),w(t,"x-decorator-props",o["x-decorator-props"]),t)})}}}},{name:"RecordsPerPage",type:"select",useComponentProps:function(){var e,t,r=(0,v.useField)(),o=(0,v.useFieldSchema)(),i=(0,n.useBlockRequestContext)().service,c=(0,a.Bd)().t,l=(0,n.useDesignable)().dn;return{title:c("Records per page",{ns:"client"}),value:(null==(t=r.decoratorProps)||null==(e=t.params)?void 0:e.pageSize)||20,options:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}],onChange:function(e){var t,n,a=r.decoratorProps.params||{};a.pageSize=e,r.decoratorProps.params=a,o["x-decorator-props"].params=a,i.run(P(S({},null==(t=i.params)?void 0:t[0]),{pageSize:e,page:1})),l.emit("patch",{schema:(w(n={},"x-uid",o["x-uid"]),w(n,"x-decorator-props",o["x-decorator-props"]),n)})}}}},{name:"divider",type:"divider"},{name:"EnableCreate",type:"switch",useComponentProps:function(){var e=(0,h.x)(),t=e.setCreateAble,n=e.createAble;return{title:(0,(0,a.Bd)().t)("Enable Create"),checked:n,onChange:t}}},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});function C(e){var t,r,o;return e.association&&(o=(0,n.useParentRecordCommon)(e.association)),{parentRecord:o,params:{pageSize:(null==e||null==(t=e.params)?void 0:t.pageSize)||20,appends:["createdBy"],sort:["createdAt"],filter:null==e||null==(r=e.params)?void 0:r.filter}}}var k=y(375),E=function(e){var t=e.collectionName,n=e.dataSource,r=e.association;return e.rowKey,{type:"void","x-acl-action":"".concat(r||t,":view"),"x-decorator":"Comment.Decorator","x-use-decorator-props":"useCommentBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:n,association:r,readPretty:!0,action:"list",runWhenParamsChanged:!0},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:comment",properties:{list:{type:"array","x-component":"Comment.List",properties:{item:{type:"object","x-component":"Comment.Item","x-read-pretty":!0,properties:{actionBar:{type:"void","x-align":"left","x-initializer":"comment:configureItemActions","x-component":"ActionBar","x-component-props":{layout:"one-column"}}}}}},submit:{type:"string","x-component":"Comment.Submit","x-acl-action":"".concat(r||t,":create"),"x-decorator":"ACLCollectionProvider","x-decorator-props":{collection:t,dataSource:n,association:r}}}}};function A(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var _=function(e){var t,r,a=e.filterCollections,i=e.filterOtherRecordsCollection,c=e.onlyCurrentDataSource,l=e.hideSearch,u=e.showAssociationFields,s=e.hideOtherRecordsInPopup,f=(0,n.useSchemaInitializer)().insert,p=(0,n.useSchemaInitializerItem)(),d=(0,n.useCollectionManager_deprecated)().getCollection;return o().createElement(n.DataBlockInitializer,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},p),r=r={componentType:"Comment",icon:o().createElement(k.CommentOutlined,null),onlyCurrentDataSource:c,hideSearch:l,filter:a,filterOtherRecordsCollection:i,showAssociationFields:u,hideOtherRecordsInPopup:s,onCreateBlockSchema:function(e){var t,n=e.item,r=e.fromOthersInPopup;return(t=function(){var e,t;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(o){return e=d(n.name,n.dataSource),(t=n.associationField)&&!r?f(E({dataSource:n.dataSource,rowKey:e.filterTargetKey||"id",association:"".concat(t.collectionName,".").concat(t.name)})):f(E({collectionName:n.name,dataSource:n.dataSource,rowKey:(null==e?void 0:e.filterTargetKey)||"id"})),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){A(a,r,o,i,c,"next",e)}function c(e){A(a,r,o,i,c,"throw",e)}i(void 0)})})()},alwaysRenderMenu:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))};function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function R(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function M(){var e,t,i,c=(0,v.useField)(),l=(0,a.Bd)().t,u=function(e){if(Array.isArray(e))return e}(e=(0,r.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return I(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return I(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=u[0],f=u[1],p=(0,n.useACLActionParamsContext)(),d=(0,n.useDesignable)().designable;return((0,r.useEffect)(function(){var e=c.address.slice(0,c.address.length-2);c.form.setFieldState(e.concat("content"),function(e){e.pattern=s?"editable":"readPretty"}),c.form.setFieldState(e,function(e){e.componentProps=R(T({},e.componentProps),{editing:s,setEditing:f})})},[s,c.address,c.form]),!d&&((null==c||null==(t=c.data)?void 0:t.hidden)||!p))?null:o().createElement("a",{style:{fontSize:14,opacity:d&&((null==c||null==(i=c.data)?void 0:i.hidden)||!p)&&.1},onClick:function(){f(!0)}},l("Edit"))}function B(e){return o().createElement(n.ActionInitializer,R(T({},e),{schema:{type:"void",title:'{{t("Edit")}}',"x-component":"UpdateCommentActionButton"}}))}function D(){var e,t=(0,v.useField)(),i=(0,a.Bd)().t,c=(0,n.useACLActionParamsContext)(),l=(0,n.useDesignable)().designable,u=(0,r.useCallback)(function(){var e,n=t.address.slice(0,t.address.length-4).concat("submit.content"),r=t.address.slice(0,t.address.length-2).concat("content"),o=null!=(e=t.form.getValuesIn(r))?e:"";t.form.setValuesIn(n,"".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")))},[t.address,t.form]);return!l&&((null==t||null==(e=t.data)?void 0:e.hidden)||!c)?null:o().createElement("a",{style:{fontSize:14},onClick:u},i("Quote Reply"))}function z(e){var t={type:"void",title:(0,(0,a.Bd)().t)("Quote Reply"),"x-component":"QuoteReplyCommentActionButton"};return o().createElement(n.ActionInitializer,R(T({},e),{schema:t}))}var F=new n.SchemaInitializer({name:"comment:configureItemActions",title:'{{t("Configure actions")}}',icon:"SettingOutlined",items:[{type:"itemGroup",name:"enableActions",title:'{{t("Enable actions")}}',children:[{name:"edit",title:'{{t("Edit")}}',Component:"UpdateCommentActionInitializer",schema:{"x-action":"update","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){var e=(0,n.useCollection_deprecated)();return("view"!==e.template||(null==e?void 0:e.writableView))&&"sql"!==e.template}},{name:"delete",title:'{{t("Delete")}}',Component:"DestroyActionInitializer",schema:{"x-component":"Action.Link","x-action":"destroy","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}},{name:"reply",title:(0,a.CL)("Quote Reply"),Component:"QuoteReplyCommentActionInitializer",schema:{"x-action":"create","x-decorator":"ACLActionProvider","x-align":"left"},useVisible:function(){return"sql"!==(0,n.useCollection_deprecated)().template}}]}]}),q=y(694),L=y(59),N=y(726);function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var U=(0,n.genStyleHook)("nb-comment",function(e){var t,n,r=e.componentCls;return G({},r,(G(n={},"".concat(r,"-item-container-container"),G({},"&:first-child",{border:"5px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8})),G(n,"".concat(r,"-item-container-border"),{border:"1px solid #d0d7deb3",position:"relative",zIndex:1,borderRadius:8}),G(n,"".concat(r,"-item-container-line"),{position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0}),G(n,".ant-list-pagination",{marginTop:e.marginXS}),G(n,".ant-card-head",{padding:"0 !important",fontWeight:"normal",backgroundColor:"#f6f8fa"}),G(n,"".concat(r,"-item-title"),(G(t={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0 ",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},"".concat(r,"-item-title-left"),{backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6,"span:first-child":{fontWeight:"bold",fontSize:14},"span:not(:first-child)":{fontWeight:"normal",fontSize:14}}),G(t,"".concat(r,"-item-title-right"),{marginRight:16,flexShrink:0,".ant-space":{gap:"10px"}}),t)),G(n,"".concat(r,"-item-editor"),G({position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},"".concat(r,"-item-editor-button-area"),{marginTop:10,display:"flex",columnGap:5})),n))}),Q=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 V(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var W=(0,N.observer)(function(e){var t,i,c,l=e.createAble,u=e.defaultValue,s=function(e){if(Array.isArray(e))return e}(t=(0,r.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return $(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,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){V(a,r,o,i,c,"next",e)}function c(e){V(a,r,o,i,c,"throw",e)}i(void 0)})})()},[y,h,f]),x=(0,n.useACLActionParamsContext)(),C=(0,n.useDesignable)().designable,k=(0,r.useMemo)(function(){var e,t;return null==(t=m.find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[m]);return(void 0===l||l)&&(C||x)?O(o().createElement("div",{style:{marginTop:10},className:"".concat(w," ").concat(j)},b.edit((i=K({},k),c=c={value:null==f?void 0:f.content,quoteFlag:!0,onChange:function(e){h(e)},enableContextSelect:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(c)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))}),i)),o().createElement(L.Button,{disabled:!S,onClick:function(){return P()},type:"primary",style:{marginTop:10}},v("Comment",{ns:a.CU})))):null});function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Y=(0,N.observer)(function(e){var t,n,a,i,c,l=e.resource,u=e.handlePageChange,s=e.dataSource,f=U(),p=f.wrapSSR,d=f.hashId,b=f.componentCls,m=function(e){if(Array.isArray(e))return e}(t=(0,r.useState)(""))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return H(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return H(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),y=m[0],h=m[1],v=(0,q.useFlowModel)();return v.context.defineMethod("setQuoteContent",function(e){h(e)}),p(o().createElement("div",{className:"".concat(b," ").concat(d)},o().createElement(L.List,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),a=a={pagination:(null==l||null==(i=l.getMeta())?void 0:i.count)>0&&{onChange:u,total:(null==l||null==(c=l.getMeta())?void 0:c.count)||0,pageSize:l.getPageSize()||10,current:l.getPage()||1}},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}),n),o().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==s?void 0:s.length)?s.map(function(e,t){var n=0===t,r=t===s.length-1;return o().createElement("div",{key:t,style:{position:"relative",padding:"".concat(n?0:"10px"," 0 ").concat(r?0:"10px"," 0")}},v.mapSubModels("items",function(t){var n=t.createFork({},"".concat(e.id,"-").concat(e.content));return n.context.defineProperty("record",{get:function(){return e},cache:!1}),o().createElement(q.FlowModelRenderer,{model:n})}))}):null)),o().createElement(W,{defaultValue:y})))}),X=y(768);function J(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}var Z=(0,N.observer)(function(){var e=(0,q.useFlowModel)(),t=e.context.record;return o().createElement(q.DndProvider,null,o().createElement("div",{style:{textAlign:"right"}},o().createElement(L.Space,{size:0,style:{gap:0}},e.mapSubModels("actions",function(n,r){var a=n.createFork({},"".concat(t.id,"_").concat(r));return a.context.defineProperty("record",{get:function(){return t}}),a.context.defineMethod("setEditing",function(){e.context.setEditing()}),o().createElement(q.Droppable,{model:a,key:a.uid},o().createElement(q.FlowModelRenderer,{model:a,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:q.DragHandler,sort:1}]}))}),o().createElement(q.AddSubModelButton,{key:"comment-actions-add",model:e,subModelKey:"actions",subModelBaseClasses:["CommentActionGroupModel"],afterSubModelInit:function(e){var t;return(t=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){J(a,r,o,i,c,"next",e)}function c(e){J(a,r,o,i,c,"throw",e)}i(void 0)})})()}},o().createElement(q.FlowSettingsButton,{icon:o().createElement(k.SettingOutlined,null)},e.translate("Actions"))))))});function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function et(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function en(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){et(a,r,o,i,c,"next",e)}function c(e){et(a,r,o,i,c,"throw",e)}i(void 0)})}}function er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eo(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var ea=function(e){var t=e.value,n=e.markdown,o=e.liquid,a=e.t,i=e.ctx,c=er((0,r.useState)(null),2),l=c[0],u=c[1];return(0,r.useEffect)(function(){t&&en(function(){var e,r;return eo(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,o.renderWithFullContext(t,i)];case 1:return e=c.sent(),u(n.render(a(e),{ellipsis:!1,textOnly:!1})),[3,3];case 2:return r=c.sent(),u('<pre style="color:red;"> 渲染错误: '.concat(r.message,"</pre>")),[3,3];case 3:return[2]}})})()},[t]),l},ei=(0,N.observer)(function(e){var t,n=e.value,i=e.resource,c=e.model,l=(0,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 e_(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}(e="baseClass")in eA?Object.defineProperty(eA,e,{value:eE,enumerable:!0,configurable:!0,writable:!0}):eA[e]=eE,eA.define({label:(0,q.escapeT)("Comment action",{ns:"comments"})});function eI(e){return(eI=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eT(e,t){return(eT=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eR=function(){return!!e})()}var eM=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eI(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eR()?Reflect.construct(t,r||[],eI(this).constructor):t.apply(this,r)),a="defaultProps",i={type:"link",title:(0,q.escapeT)("Delete")},a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eT(n,e),t=[{key:"getAclActionName",value:function(){return"destroy"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eE);function eB(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}eM.define({label:(0,q.escapeT)("Delete"),toggleable:!0}),eM.registerFlow({key:"deleteSettings",title:(0,q.escapeT)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,q.escapeT)("Delete record"),content:(0,q.escapeT)("Are you sure you want to delete it?")}},delete:{handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(!e.resource)return e.message.error(e.t("No resource selected for deletion")),[2];if(!e.record)return e.message.error(e.t("No resource or record selected for deletion")),[2];return[4,e.resource.destroy(e.record[e.collection.filterTargetKey])];case 1:return t.sent(),e.message.success(e.t("Record deleted successfully")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){e_(a,r,o,i,c,"next",e)}function c(e){e_(a,r,o,i,c,"throw",e)}i(void 0)})})()}}}});function eD(e){return(eD=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ez(e,t){return(ez=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eF=function(){return!!e})()}var eq=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eD(t),o=e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eF()?Reflect.construct(t,r||[],eD(this).constructor):t.apply(this,r)),a="defaultProps",i={type:"link",title:(0,q.escapeT)("Edit")},a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ez(n,e),t=[{key:"getAclActionName",value:function(){return"update"}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eE);function eL(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}eq.define({label:(0,q.escapeT)("Edit"),toggleable:!0}),eq.registerFlow({key:"editCommentSettings",on:"click",steps:{edit:{handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:l(0)}),c(i,"throw",{value:l(1)}),c(i,"return",{value:l(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){return e.model,e.setEditing(),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){eB(a,r,o,i,c,"next",e)}function c(e){eB(a,r,o,i,c,"throw",e)}i(void 0)})})()}}}});function eN(e){return(eN=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eG(e,t){return(eG=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eU=function(){return!!e})()}var 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 e$(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function eV(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){e$(a,r,o,i,c,"next",e)}function c(e){e$(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 eV(function(){return eJ(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return eV(function(){return eJ(this,function(e){return[2]})})()}},{key:"load",value:function(){return eV(function(){return eJ(this,function(e){return this.app.dataSourceManager.addCollectionTemplates([s]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.comment",{title:(0,a.CL)("Comment"),Component:"CommentBlockInitializer",useComponentProps:function(){return{filterCollections:function(e){return"comment"===e.collection.template}}}}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.comment",{title:(0,a.CL)("Comment"),Component:"CommentBlockInitializer",useVisible:function(){var e=(0,n.useCollection)();return(0,r.useMemo)(function(){return e.fields.some(function(e){return(0,n.canMakeAssociationBlock)(e)&&["hasMany","belongsToMany"].includes(e.type)})},[e.fields])},useComponentProps:function(){var e=(0,n.useCollectionManager)();return{onlyCurrentDataSource:!0,filterCollections:function(t){var n=t.associationField;if(n){if(!["hasMany","belongsToMany"].includes(n.type))return!1;var r=e.getCollection(n.target);return(null==r?void 0:r.template)==="comment"}return!1},filterOtherRecordsCollection:function(e){return(null==e?void 0:e.template)==="comment"},showAssociationFields:!0,hideOtherRecordsInPopup:!1,hideSearch:!0}}}),this.app.addComponents({CommentBlockInitializer:_,Comment:m,UpdateCommentActionInitializer:B,UpdateCommentActionButton:M,QuoteReplyCommentActionButton:D,QuoteReplyCommentActionInitializer:z}),this.app.addScopes({useCommentBlockDecoratorProps:C}),this.schemaSettingsManager.add(x),this.schemaInitializerManager.add(F),this.flowEngine.registerModels(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({CommentsBlockModel:ew,CommentItemModel:eO},t)),[2]})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,o),i}(eY(n.Plugin)),e0=eZ}(),j}()});
@@ -8,17 +8,17 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.12",
11
+ "@nocobase/client": "2.1.0-alpha.14",
12
12
  "react": "18.2.0",
13
- "@nocobase/flow-engine": "2.1.0-alpha.12",
14
- "@nocobase/server": "2.1.0-alpha.12",
13
+ "@nocobase/server": "2.1.0-alpha.14",
15
14
  "@formily/core": "2.3.7",
16
15
  "@formily/react": "2.3.7",
17
16
  "antd": "5.24.2",
18
17
  "dayjs": "1.11.13",
19
18
  "lodash": "4.17.21",
20
- "@nocobase/utils": "2.1.0-alpha.12",
19
+ "@nocobase/utils": "2.1.0-alpha.14",
21
20
  "react-i18next": "11.18.6",
22
21
  "@ant-design/icons": "5.6.1",
22
+ "@nocobase/flow-engine": "2.1.0-alpha.14",
23
23
  "@formily/reactive-react": "2.3.7"
24
24
  };
@@ -14,11 +14,9 @@
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';
18
17
  import { Plugin } from '@nocobase/server';
19
18
  export declare class PluginCommentServer extends Plugin {
20
19
  afterAdd(): Promise<void>;
21
- getFlowSchemaContributions(): FlowSchemaContribution;
22
20
  beforeLoad(): Promise<void>;
23
21
  load(): Promise<void>;
24
22
  install(): Promise<void>;
@@ -31,13 +31,9 @@ __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");
35
34
  class PluginCommentServer extends import_server.Plugin {
36
35
  async afterAdd() {
37
36
  }
38
- getFlowSchemaContributions() {
39
- return import_flow_schema_contributions.flowSchemaContribution;
40
- }
41
37
  async beforeLoad() {
42
38
  }
43
39
  async load() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-comments",
3
- "version": "2.1.0-alpha.12",
3
+ "version": "2.1.0-alpha.14",
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": "f12c4a75470590b1670ce54510b96ef94c2cd7a2"
31
+ "gitHead": "d8735b541de0ff9557bba704de49c799b4962672"
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
- import type { FlowSchemaContribution } from '@nocobase/flow-engine';
10
- export declare const flowSchemaContribution: FlowSchemaContribution;
@@ -1,255 +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
- 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
- });