@nocobase/plugin-block-template 2.0.0-alpha.3 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt CHANGED
@@ -1,8 +1,8 @@
1
- Updated Date: April 1, 2025
1
+ Updated Date: October 2, 2025
2
2
 
3
3
  NocoBase License Agreement
4
4
 
5
- NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at #03-01 ROBINSON 112 ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("the User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
5
+ NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at 112 ROBINSON ROAD, #03-01, SINGAPORE ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("The User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
6
6
 
7
7
  This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
8
8
 
@@ -38,7 +38,7 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
38
38
  3. Disclaimer
39
39
  =============
40
40
 
41
- 3.1 The User shall not use the Software and Commercial Plugins to engage in activities that violate local laws and regulations, religious beliefs. All legal responsibilities and legal consequences arising from the use of Software and Commercial Plugins shall be borne by the User.
41
+ 3.1 The User shall not use the Software and Commercial Plugins to engage in activities that contravene applicable laws and regulations or offend against public order or religious prohibitions. All legal liabilities and consequences arising from the User’s use shall be borne by the User.
42
42
 
43
43
  3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
44
44
 
@@ -46,13 +46,13 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
46
46
  4. License Type
47
47
  ===============
48
48
 
49
- 4.1 The Software uses a dual license type of AGPL-3.0 Open Source License https://www.gnu.org/licenses/agpl-3..en.htm and Commercial License.
49
+ 4.1 This Agreement serves as the unified license agreement for NocoBase Software, applying to both the Community Edition and the Commercial Editions.
50
50
 
51
- 4.2 The Community Edition uses the AGPL-3.0 Open Source License https://www.gnu.org/licenses/agpl-3.0.en.html.
51
+ 4.2 For the Community Edition, this Agreement incorporates and references the full text of the GNU Affero General Public License v3.0 (“AGPL-3.0”, available at: https://www.gnu.org/licenses/agpl-3.0.html ). Community Edition users must comply with the AGPL-3.0 License as well as the supplementary terms set forth in this Agreement. In case of any inconsistency between AGPL-3.0 and this Agreement, the supplementary terms of this Agreement shall prevail.
52
52
 
53
- 4.3 The Commercial Edition (including Standard, Professional, and Enterprise Editions) uses the Commercial License.
53
+ 4.3 For the Commercial Edition (including Standard, Professional, and Enterprise Editions), only the Commercial License terms contained in this Agreement apply. Commercial Edition users are not subject to AGPL-3.0 obligations.
54
54
 
55
- 4.4 Commercial Plugins use the Commercial Plugin License.
55
+ 4.4 For Commercial Plugins, only the Commercial Plugin License terms contained in this Agreement apply.
56
56
 
57
57
  ================================================
58
58
  5. Rights and Obligations of Open Source License
@@ -68,9 +68,13 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
68
68
 
69
69
  5.5 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
70
70
 
71
- 5.6 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
71
+ 5.6 It is not allowed to provide to the public any form of no-code, zero-code, or low-code platform SaaS/PaaS products using the original or modified Software.
72
72
 
73
- 5.7 Comply with all requirements of the AGPL-3.0 agreement.
73
+ 5.7 Comply with all requirements of the AGPL-3.0 License, including but not limited to:
74
+ (a) Any modifications, extensions, or derivative works of the Software must be released under the AGPL-3.0 License;
75
+ (b) If Upper Layer Applications are provided as a network service (including SaaS or PaaS), the complete corresponding source code must be made available to all users of the service;
76
+ (c) The Software may not be combined with other software under incompatible licenses in a manner that would violate the AGPL-3.0 License;
77
+ (d) No additional contractual restrictions may be imposed when redistributing the Software.
74
78
 
75
79
  ===============================
76
80
  6. Rights of Commercial License
@@ -88,9 +92,14 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
88
92
 
89
93
  6.6 Can sell plugins developed for Software in the Marketplace.
90
94
 
91
- 6.7 The User with a Professional or Enterprise Edition License can sell Upper Layer Application to their clients.
95
+ 6.7 The User holding a Professional or Enterprise Edition License can sell Upper Layer Application to its Customers.
92
96
 
93
- 6.8 Not restricted by the AGPL-3.0 agreement.
97
+ 6.8 Exemption from AGPL-3.0 obligations, including but not limited to:
98
+ (a) the requirement to release source code of modifications, extensions, or derivative works;
99
+ (b) the requirement to provide source code when offering the Software as a network service;
100
+ (c) restrictions on combining the Software with other software under different license terms; and
101
+ (d) limitations on adding contractual terms for redistribution.
102
+ The User remains bound by this Agreement and by its commercial license contract.
94
103
 
95
104
  6.9 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
96
105
 
@@ -100,15 +109,15 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
100
109
 
101
110
  7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
102
111
 
103
- 7.2 It is not allowed to sell, transfer, lease, share, or distribute the Commercial License.
112
+ 7.2 It is not allowed to sell, transfer, lease, share, gift, or distribute the Commercial License.
104
113
 
105
114
  7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of no-code, zero-code, low-code platform, or developer tools developed based on Software.
106
115
 
107
- 7.4 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
116
+ 7.4 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS/PaaS products to the public using the original or modified Software.
108
117
 
109
- 7.5 It is not allowed for the User withot a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
118
+ 7.5 It is not allowed for the User holding a Standard Edition license to sell Upper Layer Application to Customers without a Commercial license.
110
119
 
111
- 7.6 It is not allowed for the User with a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
120
+ 7.6 It is not allowed for the User holding a Professional or Enterprise Edition license to sell Upper Layer Application to Customers without a Commercial license with access to further development and configuration.
112
121
 
113
122
  7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
114
123
 
@@ -122,13 +131,13 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
122
131
 
123
132
  8.1 Obtain a permanent Commercial Plugin License for the Commercial Plugin.
124
133
 
125
- 8.2 Get plugins upgrades and exclusive technical support during the upgrade validity period.
134
+ 8.2 Receive plugin upgrades and exclusive technical support during the upgrade validity period.
126
135
 
127
136
  8.3 Can be used for commercial purposes without restrictions on the number of applications or users.
128
137
 
129
- 8.4 The User with an Enterprise Edition License can use the Commercial Plugin in Upper Layer Applications sold to their customers.
138
+ 8.4 The User holding a Professional or Enterprise Edition License can use the Commercial Plugin in Upper Layer Applications sold to its customers.
130
139
 
131
- 8.5 Not restricted by the AGPL-3.0 agreement.
140
+ 8.5 Exemption from AGPL-3.0 obligations.
132
141
 
133
142
  8.6 If there are other agreements in the contract regarding the above rights, the contract agreement shall prevail.
134
143
 
@@ -144,9 +153,11 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
144
153
 
145
154
  9.4 It is not allowed to disclose the source code of Commercial Plugins to any third party.
146
155
 
147
- 9.5 If there is any violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
156
+ 9.5 It is not allowed for the User holding a Community or Standard Edition license to use Commercial Plugins in Upper Layer Applications sold to its customers. Such Commercial Plugins are limited to internal use within the licensed company only.
148
157
 
149
- 9.6 If there are other agreements in the contract regarding the above obligations, the contract agreement shall prevail.
158
+ 9.6 If there is any violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
159
+
160
+ 9.7 If there are other agreements in the contract regarding the above obligations, the contract agreement shall prevail.
150
161
 
151
162
  =============================================================
152
163
  10. Legal Jurisdiction, Interpretation, and Dispute Resolution
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@formily/json-schema"),require("react"),require("lodash"),require("@nocobase/plugin-mobile/client"),require("ahooks"),require("@nocobase/client"),require("react-router"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-template",["@formily/core","@formily/json-schema","react","lodash","@nocobase/plugin-mobile/client","ahooks","@nocobase/client","react-router","react-router-dom","@formily/react","@ant-design/icons","@nocobase/utils/client","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-block-template"]=t(require("@formily/core"),require("@formily/json-schema"),require("react"),require("lodash"),require("@nocobase/plugin-mobile/client"),require("ahooks"),require("@nocobase/client"),require("react-router"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd")):e["@nocobase/plugin-block-template"]=t(e["@formily/core"],e["@formily/json-schema"],e.react,e.lodash,e["@nocobase/plugin-mobile/client"],e.ahooks,e["@nocobase/client"],e["react-router"],e["react-router-dom"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/utils/client"],e.antd)}(self,function(e,t,r,n,o,i,a,l,c,u,s,p,f){return function(){"use strict";var d={482:function(e){e.exports=s},563:function(t){t.exports=e},625:function(e){e.exports=t},505:function(e){e.exports=u},772:function(e){e.exports=a},58:function(e){e.exports=o},584:function(e){e.exports=p},749:function(e){e.exports=i},721:function(e){e.exports=f},467:function(e){e.exports=n},156:function(e){e.exports=r},432:function(e){e.exports=l},128:function(e){e.exports=c}},m={};function v(e){var t=m[e];if(void 0!==t)return t.exports;var r=m[e]={exports:{}};return d[e](r,r.exports,v),r.exports}v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var r in t)v.o(t,r)&&!v.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var y={};return!function(){v.r(y),v.d(y,{PluginBlockTemplateClient:function(){return to},default:function(){return ti}});var e=v(625),t=v(772),r=v(156),n=v.n(r),o=JSON.parse('{"u2":"@nocobase/plugin-block-template"}');function i(){var e=(0,t.useApp)();return function(t){return e.i18n.t(t,{ns:[o.u2,"client"]})}}function a(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.u2,"', 'client'], nsMode: 'fallback' })}}")}var l=v(721),c=v(482),u="block-template",s={type:"object","x-component":"Action",title:'{{t("Add new", { ns: "'.concat(u,'" })}}'),"x-align":"right","x-component-props":{type:"primary",icon:"PlusOutlined",openMode:"drawer"},properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Add new", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormV2","x-use-decorator-props":function(){return{form:(0,r.useContext)(b)}},properties:{form:{type:"void",properties:{title:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},key:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},type:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},description:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:"Submit","x-component":"Action","x-use-component-props":"useCreateActionProps"}}}}}}},p=v(563),f=v(584);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(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.")}()}var b=(0,r.createContext)(null),h={name:"blockTemplates",filterTargetKey:"key",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:"{{t('Title')}}",required:!0,"x-component":"Input"}},{type:"string",name:"key",interface:"input",uiSchema:{type:"string",title:"{{t('Name')}}",required:!0,"x-component":"Input"}},{type:"string",name:"type",interface:"radioGroup",uiSchema:{type:"string",title:a("Type"),"x-component":"Radio.Group",enum:"{{ typeOptions }}"}},{type:"string",name:"description",interface:"textarea",uiSchema:{type:"string",title:"{{t('Description')}}","x-component":"Input.TextArea"}}]},x=v(128),g={type:"void",title:a("Edit"),"x-component":"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:a("Edit"),"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormProps",properties:{form:{type:"void",properties:{title:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},key:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-disabled":!0},type:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-disabled":!0},description:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:a("Submit"),"x-component":"Action","x-use-component-props":"useEditActionProps"}}}}}}},S={name:"bulkDestroySchema",type:"void","x-component":"Action","x-component-props":{openSize:"small",icon:"DeleteOutlined"},title:'{{t("Delete")}}',properties:{modal:{type:"void","x-component":"Action.Modal","x-decorator":"FormV2","x-use-decorator-props":function(){return{form:(0,r.useMemo)(function(){return(0,p.createForm)()},[])}},title:'{{t("Delete")}}',properties:{keepBlocks:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":a("Keep the created blocks?"),default:!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useBulkDestroyAction }}"}}}}}}}},k={type:"void",name:(0,f.uid)(),"x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:h.name,action:"list",params:{sort:"-createdAt"},showIndex:!0,dragSort:!1,rowKey:"key"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:20}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},bulkDestroySchema:S,addNew:{type:"void","x-component":function(){var e=m((0,r.useState)(!1),2),o=e[0],a=e[1],u=m((0,r.useState)(null),2),d=u[0],v=u[1],y=i();return n().createElement(t.ActionContextProvider,{value:{visible:o,setVisible:a}},n().createElement(l.Button,{icon:n().createElement(c.PlusOutlined,null),type:"primary",onClick:function(){v((0,p.createForm)({initialValues:{key:"t_".concat((0,f.uid)()),type:"Desktop"}})),a(!0)}},y("Add new")),n().createElement(b.Provider,{value:d},n().createElement(t.SchemaComponent,{schema:s})))}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:h.filterTargetKey,rowSelection:{type:"checkbox"}},properties:{title:{type:"void",title:'{{ t("Title") }}',"x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},key:{type:"void",title:'{{ t("Name") }}',"x-component":"TableV2.Column","x-component-props":{width:80},properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},type:{type:"void",title:a("Type"),"x-component":"TableV2.Column","x-component-props":{width:80},properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},description:{type:"void",title:'{{ t("Description") }}',"x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:a("Configure"),"x-component":function(){var e=(0,t.useFilterByTk)(),r=(0,t.useCollectionRecordData)(),o=i(),a="/admin/settings/block-templates/inherited/".concat(e);return"Mobile"===r.type&&(a="/m/block-templates/inherited/".concat(r.key,"/").concat(r.uid)),n().createElement(x.Link,{to:a},o("Configure"))}},editActionSchema:g,duplicate:{type:"void",title:'{{t("Duplicate", { ns: "'.concat(u,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Duplicate to new template", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input",required:!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDuplicateAction }}"}}}}}}}},delete:{type:"void",title:a("Delete"),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Delete", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal","x-component-props":{openSize:"small"},properties:{keepBlocks:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox",default:!0,"x-content":a("Keep the created blocks?")},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDeleteAction }}"}}}}}}}}}}}}}}}},O=v(505),w=v(467),P=v.n(w);function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function C(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var A=function(e){if(!e)return null;if("CustomRequestAction"===e["x-component"]&&(e["x-custom-request-id"]=e["x-custom-request-id"]||e["x-uid"]),e["x-uid"]=(0,f.uid)(),e.properties){var t=!0,r=!1,n=void 0;try{for(var o,i=Object.keys(e.properties)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;A(e.properties[a])}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}}return e};function T(){var e,n=l.App.useApp().message,o=(0,t.useAPIClient)(),i=(0,t.useCollectionRecordData)(),a=(0,t.useDataBlockResource)(),c=(0,t.useBlockRequestContext)().service,u=(0,t.useCollection)(),s=(0,O.useForm)(),p=(0,t.useActionContext)().setVisible,d=(e=(0,r.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return j(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],v=d[1];return{run:function(){var e;return(e=function(){var e,t,r,l,d,y;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(b){switch(b.label){case 0:if(m)return[2];return[4,s.submit()];case 1:if(b.sent(),v(!0),e=s.values,!u)throw Error("collection does not exist");return t=i.uid,[4,o.request({url:"uiSchemas:getJsonSchema/".concat(t)})];case 2:return r=b.sent().data,d=(l=A(P().cloneDeep(null==r?void 0:r.data)))["x-uid"],y="t_".concat((0,f.uid)()),[4,o.resource("uiSchemas").insert({values:{type:"void",name:y,"x-uid":"template-".concat(d),_isJSONSchemaObject:!0,properties:{template:l}}})];case 3:var h,x;return b.sent(),[4,a.create({values:(h=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},i),x=x={title:"".concat(e.title),key:y,uid:d},Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(x)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(x)).forEach(function(e){Object.defineProperty(h,e,Object.getOwnPropertyDescriptor(x,e))}),h)})];case 4:return b.sent(),[4,c.refresh()];case 5:return b.sent(),p(!1),v(!1),[4,s.reset()];case 6:return b.sent(),n.success("Duplicated!"),[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){C(i,n,o,a,l,"next",e)}function l(e){C(i,n,o,a,l,"throw",e)}a(void 0)})})()}}}function E(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function D(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var I=function(){var e=(0,t.useActionContext)().setVisible,r=l.App.useApp().message,n=(0,O.useForm)(),o=(0,t.useDataBlockResource)(),a=(0,t.useAPIClient)(),c=(0,t.useDataBlockRequest)().refresh,u=i();return{type:"primary",onClick:function(){var t;return(t=function(){var t,i,l,s,p;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(d){switch(d.label){case 0:return[4,n.submit()];case 1:return d.sent(),i=(t=n.values).key,l=(0,f.uid)(),s="Mobile"===t.type,p={type:"void",name:i,"x-uid":"template-".concat(l),_isJSONSchemaObject:!0,properties:{template:D(F({_isJSONSchemaObject:!0,version:"2.0",type:"void","x-component":"div"},s?{"x-component-props":{style:{padding:"10px",maxHeight:"100%",overflow:"scroll"}}}:{}),{properties:{blocks:{_isJSONSchemaObject:!0,version:"2.0",type:"void","x-decorator":"TemplateGridDecorator","x-component":"Grid","x-initializer":s?"mobile:addBlock":"page:addBlock","x-uid":(0,f.uid)(),"x-async":!1,"x-index":1,properties:{}}},"x-uid":l,"x-async":!0,"x-index":1})}},[4,o.create({values:D(F({},t),{uid:l})})];case 2:return d.sent(),[4,a.resource("uiSchemas").insert({values:p})];case 3:return d.sent(),n.reset(),c(),r.success(u("Saved successfully")),e(!1),n.values.key="t_".concat((0,f.uid)()),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){E(i,n,o,a,l,"next",e)}function l(e){E(i,n,o,a,l,"throw",e)}a(void 0)})})()}}};function B(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var M=function(){var e=(0,t.useActionContext)().setVisible,r=l.App.useApp().message,n=(0,O.useForm)(),o=(0,t.useDataBlockResource)(),a=(0,t.useCollection)(),c=(0,t.usePlugin)(to),u=i(),s=(0,t.useDataBlockRequest)().refresh;return{type:"primary",onClick:function(){var t;return(t=function(){var t;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return[4,n.submit()];case 1:return i.sent(),t=n.values,[4,o.update({values:t,filterByTk:t[a.filterTargetKey]})];case 2:return i.sent(),s(),r.success(u("Saved successfully")),c.templateInfos.set(t[a.filterTargetKey],t),e(!1),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){B(i,n,o,a,l,"next",e)}function l(e){B(i,n,o,a,l,"throw",e)}a(void 0)})})()}}};function R(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function q(){var e=l.App.useApp().message,r=(0,t.useCollectionRecordData)(),n=(0,t.useDataBlockResource)(),o=(0,t.useDataBlockRequest)(),a=o.data,c=o.refresh,u=o.run,s=(0,t.useCollection)(),p=i(),f=(0,O.useForm)();return{run:function(){var t;return(t=function(){var t,o,i,l,d,m,v;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(y){switch(y.label){case 0:if(!s)throw Error("collection does not exist");return[4,f.submit()];case 1:return y.sent(),l=f.values.keepBlocks,[4,n.destroy({filterByTk:r[s.filterTargetKey],removeSchema:!l})];case 2:return y.sent(),d=(null==a||null==(t=a.meta)?void 0:t.page)||1,m=(null==a||null==(o=a.meta)?void 0:o.pageSize)||20,d>(v=Math.max(Math.ceil((((null==a||null==(i=a.meta)?void 0:i.count)||0)-1)/m),1))?u({page:v,pageSize:m}):c(),e.success(p("Deleted successfully")),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){R(i,n,o,a,l,"next",e)}function l(e){R(i,n,o,a,l,"throw",e)}a(void 0)})})()}}}var N=function(){var e=(0,t.useCollectionRecordData)();return{form:(0,r.useMemo)(function(){return(0,p.createForm)({initialValues:e})},[e])}};function G(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var V=function(){var e=(0,t.useAPIClient)(),r=(0,t.useActionContext)().setVisible,n=(0,t.useDataBlockRequest)(),o=n.data,a=n.refresh,c=n.run,u=(0,O.useField)(),s=i(),p=(0,O.useForm)(),f=l.App.useApp().message,d=(0,t.useTableBlockProps)().onRowSelectionChange;return{run:function(){var t;return(t=function(){var t,n,i,l,m,v,y,b;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(h){switch(h.label){case 0:if(!(null==(m=null==(t=u.data)?void 0:t.selectedRowKeys)?void 0:m.length))return f.error(s("Please select the records you want to delete")),[2];return[4,e.request({method:"POST",url:"/blockTemplates:destroy",params:{filterByTk:m,removeSchema:!p.values.keepBlocks}})];case 1:return h.sent(),d([],[]),p.reset(),v=(null==o||null==(n=o.meta)?void 0:n.page)||1,y=(null==o||null==(i=o.meta)?void 0:i.pageSize)||20,v>(b=Math.max(Math.ceil((((null==o||null==(l=o.meta)?void 0:l.count)||0)-m.length)/y),1))?c({page:b,pageSize:y}):a(),r(!1),f.success(s("Deleted successfully")),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){G(i,n,o,a,l,"next",e)}function l(e){G(i,n,o,a,l,"throw",e)}a(void 0)})})()}}},z=function(){var e,r,o=(0,t.useSchemaComponentContext)(),a=i(),l=[{label:a("Desktop"),value:"Desktop"},{label:a("Mobile"),value:"Mobile"}];return n().createElement(t.ExtendCollectionsProvider,{collections:[h]},n().createElement(t.SchemaComponentContext.Provider,{value:(e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},o),r=r={designable:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e)},n().createElement(t.SchemaComponent,{schema:k,scope:{useCreateActionProps:I,useEditActionProps:M,useEditFormProps:N,useDeleteAction:q,useDuplicateAction:T,useBulkDestroyAction:V,typeOptions:l}})))},_=v(432),U=(0,r.createContext)({}),J=function(){var e,r=(0,_.useParams)(),o=l.theme.useToken().token,a=i(),c=(0,t.useRequest)({url:"blockTemplates:get/".concat(r.key)}),u=c.data,s=c.loading,p=((null==u?void 0:u.data)||{}).title;if(s)return n().createElement(l.Spin,null);var f=null==u||null==(e=u.data)?void 0:e.uid;return n().createElement(t.AllDataBlocksProvider,null,n().createElement("div",{style:{marginTop:-o.marginXXL,marginLeft:-o.marginLG,marginRight:-o.marginLG,padding:o.paddingLG,paddingTop:o.paddingMD,paddingBottom:o.paddingMD,background:o.colorBgContainer,display:"flex",alignItems:"center",justifyContent:"space-between"}},n().createElement(l.Breadcrumb,{items:[{title:n().createElement(x.Link,{to:"/admin/settings/block-templates"},a("Block template"))},{title:p}]})),n().createElement("div",{style:{marginTop:o.marginMD,position:"relative",zIndex:0}},n().createElement(U.Provider,{value:null==u?void 0:u.data},n().createElement(t.RemoteSchemaComponent,{uid:f}))))},L=v(58),K=v.n(L),W=function(){var e=(0,x.useParams)().key,o=(0,t.useRequest)({url:"blockTemplates:get/".concat(e)}),i=o.data,a=o.loading;return((0,r.useEffect)(function(){var e,t=document.querySelector(".ant-nb-mobile-tab-bar"),r=null==t||null==(e=t.style)?void 0:e.display;return t&&(t.style.display="none"),function(){var e=document.querySelector(".ant-nb-mobile-tab-bar");e&&(e.style.display=r)}},[]),a)?n().createElement(l.Spin,null):n().createElement(U.Provider,{value:null==i?void 0:i.data},n().createElement(L.MobilePage,null))},$=function(e){if(!e)return null;if(["Grid","Grid.Row","Grid.Col"].includes(e["x-component"])){var t=null,r=!0,n=!1,o=void 0;try{for(var i,a=Object.values(e.properties||{})[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=i.value;if(t=$(l))break}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}return t}return e},H=v(749);function X(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function Q(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){X(i,n,o,a,l,"next",e)}function l(e){X(i,n,o,a,l,"throw",e)}a(void 0)})}}function Y(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var Z=(0,r.createContext)({loading:!1,templates:[],handleTemplateClick:Q(function(){return Y(this,function(e){return[2]})})}),ee=function(){return(0,r.useContext)(Z)},et=function(e){var o,a=e.children,l=(0,t.useAPIClient)(),c=(0,t.usePlugin)(ti),u=(0,t.usePlugin)(K()),s=(0,t.useResource)("blockTemplates"),p=i(),f=window.location.pathname.startsWith(u.mobileBasename),d=(0,x.useLocation)(),m=n().useRef(d.pathname),v=(0,t.useCurrentUserContext)(),y=(0,t.useRequest)({url:"blockTemplates:list",method:"get",params:{filter:{configured:{$isTruly:!0},type:f?"Mobile":{$ne:"Mobile"}},paginate:!1}},{cacheKey:"blockTemplates",manual:!0}),b=y.data,h=y.loading,g=y.refresh;(0,r.useEffect)(function(){m.current.includes("/settings/block-templates/inherited")&&!d.pathname.includes("/settings/block-templates/inherited")&&g(),m.current=d.pathname},[d.pathname,g]),(0,r.useEffect)(function(){(null==v?void 0:v.data)&&g()},[v,g]);var S=(0,H.useMemoizedFn)((o=Q(function(e,t,r){var n,o,i,a,u,p,f,d,m,v,y,b,h,x,g,S,k,O,P,j;return Y(this,function(C){switch(C.label){case 0:return i=(n=e.item).uid,[4,l.request({url:"uiSchemas:getProperties/".concat(i)})];case 1:p=function(e,t,r){var n=null==e?void 0:e.properties;n=w.get(Object.values(n),"0.properties");var o=[];for(var i in n){var a=ea(n[i],!1,!0,void 0,t,r);a&&o.push($(a))}return o}(u=null==(a=C.sent().data)?void 0:a.data,n.key,t),c.setTemplateCache($(null==(o=u.properties)?void 0:o.blocks)),function(e){var t={},r=!0,n=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=i.value;w.merge(t,function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t["x-template-uid"]&&(r[t["x-template-uid"]]=t["x-uid"]),t.properties)for(var n in t.properties)e(t.properties[n],r);return r}(l))}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}var c=!0,u=!1,s=void 0;try{for(var p,f=e[Symbol.iterator]();!(c=(p=f.next()).done);c=!0){var d=p.value;!function e(t,r){var n,o=["x-uid","x-template-uid","x-template-root-uid","x-custom-request-id"];for(var i in t)!o.includes(i)&&(t[i]&&"string"==typeof t[i]&&(t[i]=r[t[i]]||t[i]),t[i]&&"object"==((n=t[i])&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&e(t[i],r))}(d,t)}}catch(e){u=!0,s=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw s}}}(p),f=!0,d=!1,m=void 0;try{for(v=p[Symbol.iterator]();!(f=(y=v.next()).done);f=!0)b=y.value,null==r||r(b)}catch(e){d=!0,m=e}finally{try{f||null==v.return||v.return()}finally{if(d)throw m}}h=[],x=function(e){if(e["x-template-root-uid"]&&h.push({templateKey:n.key,templateBlockUid:e["x-template-root-uid"],blockUid:e["x-uid"]}),e.properties)for(var t in e.properties)x(e.properties[t])},g=!0,S=!1,k=void 0;try{for(O=p[Symbol.iterator]();!(g=(P=O.next()).done);g=!0)j=P.value,x(j)}catch(e){S=!0,k=e}finally{try{g||null==O.return||O.return()}finally{if(S)throw k}}return s.link({values:h}),[2]}})}),function(e,t,r){return o.apply(this,arguments)}));return(0,r.useEffect)(function(){var e;null==b||null==(e=b.data)||e.forEach(function(e){c.templateInfos.set(e.key,e)})},[null==b?void 0:b.data,c.templateInfos]),(0,r.useEffect)(function(){(0,t.registerInitializerMenusGenerator)("block_template",function(e){var t,r,n,o=e.collection,i=e.association,a=e.item,l=(e.index,e.field),u=e.componentName,s=e.dataSource,p=(e.keyPrefix,e.name),f=(null==o?void 0:o.name)||(null==a||null==(t=a.options)?void 0:t.name),d=s||(null==a||null==(r=a.options)?void 0:r.dataSource)||(null==o?void 0:o.dataSource),m=window.location.pathname.includes("/admin/workflow");if((null==u?void 0:u.startsWith("mobile-"))&&(u=u.replace("mobile-","")),c.isInBlockTemplateConfigPage()||m)return null;l&&(f=null==l?void 0:l.target);var v="details"===p||"ReadPrettyFormItem"===u,y=null==b||null==(n=b.data)?void 0:n.filter(function(e){return(e.componentType===u||p===e.menuName||v&&"details"===e.menuName)&&e.collection===f&&e.dataSource===d}).map(function(e){return{type:"item",name:e.key,item:e,title:e.title,schemaInsertor:function(e,t){var r=t.item,n=(t.fromOthersInPopup,t.name),a={dataSourceName:d};return i&&("editForm"===n||"currentRecord"===n)&&(a.association=i),l?(a.association="".concat(null==o?void 0:o.name,".").concat(l.name),a.associationType=l.type):a.collectionName=f,a.currentRecord="currentRecord"===n&&v,"editForm"===n&&(a.currentRecord=!0),S(r,a,e)}}});return(null==y?void 0:y.length)?y:null})},[null==b?void 0:b.data,c.isInBlockTemplateConfigPage,S,p,c]),n().createElement(Z.Provider,{value:{loading:h,templates:(null==b?void 0:b.data)||[],handleTemplateClick:S}},a)};function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function en(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||ei(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ei(e,t){if(e){if("string"==typeof e)return er(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return er(e,t)}}function ea(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0;if(n||(n=(0,f.uid)()),"Grid"===e["x-component"]||"Grid.Row"===e["x-component"]||"Grid.Col"===e["x-component"]){var a,l,c=w.cloneDeep((a=en({},e),l=l={"x-uid":(0,f.uid)(),properties:{}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a));for(var u in t&&(c["x-virtual"]=!0),"TemplateGridDecorator"===c["x-decorator"]&&delete c["x-decorator"],c["x-linkage-rules"]&&delete c["x-linkage-rules"],e.properties){var s=ea(e.properties[u],t,r,n,o,i);r&&(n=(0,f.uid)()),s&&(c.properties[u]=s)}return c}var p={"x-uid":"".concat(n,"-").concat(e["x-uid"]),"x-template-uid":e["x-uid"],properties:{}};for(var d in t&&(p["x-virtual"]=!0),e["x-settings"]&&(p["x-settings"]=e["x-settings"]),r&&(p["x-template-root-uid"]=e["x-uid"],p["x-uid"]=n,p["x-template-version"]="1.0"),el.forEach(function(t){w.hasIn(e,t)&&w.set(p,t,w.get(e,t))}),o&&(p["x-block-template-key"]=o),"CustomRequestAction"===e["x-component"]&&(p["x-custom-request-id"]=e["x-custom-request-id"]||e["x-uid"]),"Action"===e["x-component"]&&w.get(e,"x-action-settings.schemaUid")&&(p["x-action-settings"]={schemaUid:""}),e["x-component"]||(p["x-no-component"]=!0),w.get(e,"x-filter-targets")&&(p["x-filter-targets"]=e["x-filter-targets"]),e.properties)p.properties[d]=ea(e.properties[d],t,!1,n,o);return r&&i&&function(e,t){var r,n,o,i,a,l,c=t.collectionName,u=t.dataSourceName,s=t.association,p=e["x-decorator"];"DetailsBlockProvider"===p?(r=t.collectionName,n=t.dataSourceName,o=t.association,i=t.currentRecord,a=t.associationType,e["x-decorator-props"]={action:"list",collection:o?null:r,association:o,dataSource:n,readPretty:!0,params:{pageSize:1}},e["x-acl-action"]="".concat(o||r,":view"),e["x-settings"]="blockSettings:detailsWithPagination",e["x-use-decorator-props"]="useDetailsWithPaginationDecoratorProps",(i||"hasOne"===a||"belongsTo"===a)&&(e["x-acl-action"]="".concat(o||r,":get"),e["x-decorator-props"].action="get",e["x-settings"]="blockSettings:details",e["x-use-decorator-props"]="useDetailsDecoratorProps"),i&&(e["x-is-current"]=!0)):"FormBlockProvider"===p?ec(e,t):p&&(e["x-decorator-props"]={action:"list",collection:c,association:s,dataSource:u});if(e.properties&&(null==(l=e["x-decorator-props"])?void 0:l.association)){var f=function(e,t){var r=e["x-decorator"];if(("DetailsBlockProvider"===r||"FormBlockProvider"===r)&&!(null==(n=e["x-decorator-props"])?void 0:n.association)&&t){var n,o,i=e["x-settings"];("blockSettings:editForm"===i||"blockSettings:details"===i)&&(e["x-decorator-props"].association=t,e["x-is-current"]=!0,e["x-acl-action"]="".concat(t,":").concat(null==(o=e["x-acl-action"])?void 0:o.split(":")[1]))}var a=e["x-decorator-props"];if(!a||!a.collection||a.association){var l=(null==a?void 0:a.association)||t;e.properties&&Object.values(e.properties).forEach(function(e){f(e,l)})}};Object.values(e.properties).forEach(function(t){var r;f(t,null==(r=e["x-decorator-props"])?void 0:r.association)})}}(p,i),p}et.displayName="BlockTemplateMenusProvider";var el=["x-decorator","x-decorator-props.collection","x-decorator-props.association","x-decorator-props.dataSource","x-decorator-props.action","x-decorator-props.params","x-acl-action","x-settings","x-use-decorator-props","x-is-current"];function ec(e,t){var r=t.collectionName,n=t.dataSourceName,o=t.association;if(t.currentRecord){e["x-decorator-props"]={action:"get",collection:r,association:o,dataSource:n},e["x-data-templates"]={display:!1},e["x-acl-action"]="".concat(o||r,":update"),e["x-settings"]="blockSettings:editForm",e["x-use-decorator-props"]="useEditFormBlockDecoratorProps",e["x-is-current"]=!0;var i=Object.keys(e.properties)[0];if(i){var a=Object.keys(e.properties[i].properties).find(function(e){return"grid"!==e});if(a){w.set(e,"properties.['".concat(i,"'].x-use-component-props"),"useEditFormBlockProps"),w.set(e,"properties.['".concat(i,"'].properties.['").concat(a,"'].x-initializer"),"editForm:configureActions");var l,c=w.get(e,"properties.".concat(i,".properties.").concat(a,".properties"),{});for(var u in c)(null==(l=c[u]["x-settings"])?void 0:l.includes("createSubmit"))&&(c[u]["x-settings"]="actionSettings:updateSubmit","useStepsFormSubmitActionProps"!==c[u]["x-use-component-props"]&&(c[u]["x-use-component-props"]="useUpdateActionProps"))}}}else e["x-decorator-props"]={collection:r,association:o,dataSource:n}}var eu=function(e){var t=e.value,o=e.onChange,a=eo((0,r.useState)(t),2),c=a[0],u=a[1],s=(0,r.useRef)(""),p=(0,r.useRef)(!1),f=i();(0,r.useEffect)(function(){u(t)},[t]),(0,r.useEffect)(function(){var e,t=function(){s.current&&s.current.focus()},r=new IntersectionObserver(function(e){e.some(function(e){return e.isIntersecting})&&t()});return(null==(e=s.current)?void 0:e.input)&&r.observe(s.current.input),function(){r.disconnect()}},[]);var d=function(e){p.current||(o(e.target.value),u(e.target.value))},m=function(e){"compositionend"===e.type?(p.current=!1,d(e)):p.current=!0};return n().createElement("div",{onClick:function(e){return e.stopPropagation()}},n().createElement(l.Input,{ref:s,allowClear:!0,style:{padding:"4px 8px",boxShadow:"none",borderRadius:0},bordered:!1,placeholder:f("Search and select template"),value:c,onClick:function(e){e.stopPropagation()},onChange:d,onCompositionStart:m,onCompositionEnd:m,onCompositionUpdate:m}),n().createElement(l.Divider,{style:{margin:0}}))},es={name:"templates",Component:function(){var e,o=(0,t.useSchemaInitializer)().insert,a=(0,t.usePlugin)(ti),u=eo((0,r.useState)(""),2),s=u[0],p=u[1],f=i(),d=ee(),m=d.templates,v=d.handleTemplateClick,y=d.loading,b=null==m?void 0:m.filter(function(e){return!e.dataSource}).filter(function(e){return!s||e.title.toLowerCase().includes(s.toLowerCase())}),h=[{key:"search",label:n().createElement(eu,{value:s,onChange:function(e){p(e)}}),onClick:function(e){e.domEvent.stopPropagation()}}].concat(function(e){if(Array.isArray(e))return er(e)}(e=(null==b?void 0:b.length)?b.map(function(e){return en({label:e.title},e)}):[{key:"empty",style:{height:150},label:n().createElement("div",{onClick:function(e){return e.stopPropagation()}},n().createElement(l.Empty,{image:l.Empty.PRESENTED_IMAGE_SIMPLE,description:f("No data")}))}])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ei(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());(0,r.useEffect)(function(){null==m||m.forEach(function(e){a.templateInfos.set(e.key,e)})},[m,a.templateInfos]);var x=(0,H.useMemoizedFn)(function(e){v(e,{},o)});return y?n().createElement("div",null,n().createElement(c.LoadingOutlined,null)," ",f("Templates")):n().createElement(t.SchemaInitializerItem,{closeInitializerMenuWhenClick:!0,title:'{{t("Block template")}}',icon:n().createElement(c.CopyOutlined,{style:{marginRight:0}}),items:h,name:"templates",onClick:x})},title:'{{t("Block template")}}',icon:"TableOutlined",wrap:function(e){return e},useVisible:function(){return!1}};function ep(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ef(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function ed(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||ev(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 em(e){return function(e){if(Array.isArray(e))return ep(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ev(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ev(e,t){if(e){if("string"==typeof e)return ep(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ep(e,t)}}function ey(e,t){if(!e)return null;if(e["x-uid"]===t)return e;if(e.properties)for(var r in e.properties){var n=ey(e.properties[r],t);if(n)return n}return null}function eb(e,t){var r=function(e,t){if(e["x-uid"]===t)return!0;for(var n in e.properties)if(r(e.properties[n],t))return!0;return!1};for(var n in e)if(r(e[n],t))return e[n];return null}function eh(e,t,r){if(!e)return null;if(e["x-uid"]===t&&e["x-virtual"])return{schema:e,insertTarget:null,insertPosition:"afterBegin"};for(var n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++){var i=n[o],a=eh(i,t,r);if(a){var l=a.insertPosition,c=a.insertTarget;if(!e["x-virtual"]&&i["x-virtual"]){var u=function(e,t){for(var n=t+1;n<e.length;n++)if(!e[n]["x-virtual"]&&e[n]["x-uid"]!==(null==r?void 0:r["x-uid"]))return e[n]["x-uid"];return null}(n,o);u?(l="beforeBegin",c=u):(l="beforeEnd",c=e["x-uid"])}return{schema:e["x-virtual"]?e:a.schema,insertTarget:c,insertPosition:l}}}return null}function ex(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=function(e){if(r.includes(e["x-uid"]))return null;var t={type:e.type,name:e.name,"x-uid":e["x-uid"],"x-template-uid":e["x-template-uid"],"x-template-root-uid":e["x-template-root-uid"]};if(e["x-template-uid"]||(t=ef({},w.omit(e,["properties"]))),delete t["x-virtual"],e.properties)for(var o in t.properties={},e.properties){var i=n(e.properties[o]);i&&(t.properties[o]=i)}return t};return new e.Schema(n(t)).toJSON()}function eg(e){if((e["x-toolbar"]||e["x-designer"])&&e["x-template-uid"]){var t,r="".concat((null==(t=e["x-toolbar-props"])?void 0:t.toolbarClassName)||"");w.merge(e,{"x-toolbar-props":{toolbarClassName:"".concat(r.includes("nb-in-template")?r:"".concat(r," nb-in-template"))}})}if(e.properties)for(var n in e.properties)eg(e.properties[n])}function eS(e,t,r){if(e["x-block-template-key"]){var n;e["x-template-title"]=null==(n=t.get(e["x-block-template-key"]))?void 0:n.title}if(r.has(e["x-uid"])&&(delete e["x-virtual"],r.delete(e["x-uid"])),e.properties)for(var o in e.properties)eS(e.properties[o],t,r)}var ek=["Grid","Grid.Row","Grid.Col"];function eO(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0,o=e.properties||{},i=e["x-component"];ek.includes(i)&&(r=em(r).concat([{schema:e,type:i,key:n||""}]));var a=!0,l=!1,c=void 0;try{for(var u,s=Object.entries(o)[Symbol.iterator]();!(a=(u=s.next()).done);a=!0){var p=ed(u.value,2),f=p[0],d=p[1];if(d){var m=d["x-component"];ek.includes(m)?eO(d,t,r,f):d["x-uid"]&&t.set(d["x-uid"],{schema:d,path:r,key:f})}}}catch(e){l=!0,c=e}finally{try{a||null==s.return||s.return()}finally{if(l)throw c}}}function ew(e){var t={properties:{}},r=!0,n=!1,o=void 0;try{for(var i,a=e.entries()[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=ed(i.value,2),c=(l[0],l[1]),u=t,s=!0,p=!1,f=void 0;try{for(var d,m=c.path.slice(1)[Symbol.iterator]();!(s=(d=m.next()).done);s=!0){var v=d.value;u.properties||(u.properties={}),u.properties[v.key]||(u.properties[v.key]=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}(ef({},v.schema),{properties:{}})),u=u.properties[v.key]}}catch(e){p=!0,f=e}finally{try{s||null==m.return||m.return()}finally{if(p)throw f}}u.properties=u.properties||{},u.properties[c.key]=c.schema}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}return t.properties}function eP(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function ej(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eC(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var eA=function(e,t){for(var r={insertPosition:"beforeBegin",insertTarget:null},n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++)n[o]["x-uid"]===t&&(r.insertPosition="beforeBegin",o===n.length-1?(r.insertPosition="beforeEnd",r.insertTarget=e["x-uid"]):(r.insertPosition="beforeBegin",r.insertTarget=n[o+1]["x-uid"]));return r},eT=function(e){return e?e["x-template-root-uid"]?e:eT(e.parent):null},eE=(0,O.observer)(function(e){var o,i=(0,O.useFieldSchema)(),a=(0,O.useField)(),l=(0,H.useUpdate)(),c=(0,r.useRef)("block"),u=(0,r.useRef)(null==(o=$(i))?void 0:o["x-uid"]),s=(0,t.useAPIClient)(),f=(0,r.useContext)(U),d=(0,O.useForm)(),m=(0,r.useContext)(t.SchemaComponentOnChangeContext).onChange;(0,r.useEffect)(function(){var e=d.subscribe(function(e){var t=e.type,r=e.payload;"blockAdded"===t&&s.resource("blockTemplates").update({filter:{key:f.key},values:{collection:r.collection,dataSource:r.dataSource,componentType:r.componentType,menuName:r.menuName}})});return function(){d.unsubscribe(e)}},[d]),i["x-initializer-props"]={style:{display:c.current}};var v=(0,r.useCallback)(function(e){var t=0,r=function(n){if(n["x-toolbar"]||n["x-settings"]){var o,i;n["x-toolbar-props"]=(o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},n["x-toolbar-props"]),i=i={initializer:"block"===e&&void 0},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(i)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))}),o),t++}!(t>0)&&n.properties&&Object.keys(n.properties).forEach(function(e){r(n.properties[e])})};r(i)},[i]),y=(0,r.useCallback)(function(e){var t=e?"none":"block";t!==c.current&&(c.current=t,a.decoratorProps.style={display:t},v(t),a.form.clearFormGraph(),l())},[l,a,v]),b=(0,r.useCallback)(function(e){if(f&&f.configured!==e){var t,r={configured:e};e||(r.dataSource=null,r.collection=null,r.componentType=null,r.menuName=null),s.resource("blockTemplates").update({filter:{key:f.key},values:r}),f.configured=e,!e&&u.current?s.request({url:"/uiSchemas:remove/".concat(u.current)}):u.current=null==(t=$(i))?void 0:t["x-uid"]}},[s,f,i]),h=(0,r.useCallback)(function(){var e=Object.keys(i.properties||{}).length>0;y(e),b(e)},[i,y,b]),x=(0,r.useCallback)(function(){h(),null==m||m(i)},[i,h,m]);return(0,O.useFormEffects)(function(){(0,p.onFieldReact)("blocks.*.*",function(){h()})}),(0,r.useEffect)(function(){h()},[h]),n().createElement(t.SchemaComponentOnChangeContext.Provider,{value:{onChange:x}},e.children)});function eF(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function eD(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eI(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var eB=function(e,t){for(var r={insertPosition:"beforeBegin",insertTarget:null},n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++)n[o]["x-uid"]===t&&(r.insertPosition="beforeBegin",o===n.length-1?(r.insertPosition="beforeEnd",r.insertTarget=e["x-uid"]):(r.insertPosition="beforeBegin",r.insertTarget=n[o+1]["x-uid"]));return r},eM=function(e){var t=P().cloneDeep(e),r=function(e){var t,n;if(delete e["x-template-uid"],delete e["x-template-root-uid"],delete e["x-template-version"],delete e["x-block-template-key"],delete e["x-template-root-ref"],delete e["x-template-title"],delete e["x-virtual"],(null==(n=e["x-toolbar-props"])||null==(t=n.toolbarClassName)?void 0:t.includes("nb-in-template"))&&(e["x-toolbar-props"].toolbarClassName=e["x-toolbar-props"].toolbarClassName.replace("nb-in-template","")),e["x-uid"]&&(e["x-uid"]=(0,f.uid)()),e.properties)for(var o in e.properties)e.properties[o]["x-template-root-uid"]||r(e.properties[o])};return r(t),t},eR={name:"template-convertToNormalBlockSettingItem",title:a("Convert to normal block"),Component:function(){var r=(0,t.useDesignable)().refresh,o=i(),a=(0,t.useAPIClient)(),c=(0,O.useForm)(),u=(0,O.useField)(),s=(0,t.useFormBlockProps)().form,p=(0,O.useFieldSchema)(),d=l.App.useApp(),m=d.modal,v=d.message;a.resource("blockTemplates");var y={okText:o("Yes"),cancelText:o("No")};return n().createElement(t.SchemaSettingsItem,{title:o("Convert to normal block"),onClick:function(){m.confirm(eI(eD({title:o("Convert to normal block"),content:o("Are you sure you want to convert this template block to a normal block?")},y),{onOk:function(){var t;return(t=function(){var t,n,i,l,d;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(m){switch(m.label){case 0:return i=eM(p.toJSON()),l=eB(p.parent,p["x-uid"]),[4,a.request({url:"/uiSchemas:remove/".concat(p["x-uid"])})];case 1:return m.sent(),d=new e.Schema(i),[4,a.request({url:"/uiSchemas:insertAdjacent/".concat(l.insertTarget,"?position=").concat(l.insertPosition),method:"post",data:{schema:d}})];case 2:return m.sent(),p.toJSON=function(){return d.toJSON()},r({refreshParentSchema:!0}),u.componentProps=eI(eD({},u.componentProps),{key:(0,f.uid)()}),(null==(t=u.parent)?void 0:t.componentProps)&&(u.parent.componentProps=eI(eD({},u.parent.componentProps),{key:(0,f.uid)()})),u.decoratorProps=eI(eD({},u.decoratorProps),{key:(0,f.uid)()}),(null==(n=u.parent)?void 0:n.decoratorProps)&&(u.parent.decoratorProps=eI(eD({},u.parent.decoratorProps),{key:(0,f.uid)()})),c.reset(),null==s||s.reset(),c.clearFormGraph("*",!1),null==s||s.clearFormGraph("*",!1),v.success(o("Converted successfully"),.2),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){eF(i,n,o,a,l,"next",e)}function l(e){eF(i,n,o,a,l,"throw",e)}a(void 0)})})()}}))}},o("Convert to normal block"))},useVisible:function(){var e=(0,O.useFieldSchema)();return null==e?void 0:e["x-template-root-uid"]}},eq=function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,O.useFieldSchema)();return!!P().get(t,"x-template-uid")&&(e||!P().get(t,"x-template-root-uid"))},eN={name:"template-disabledDeleteItem",title:a("Delete"),Component:function(){var e=i();return n().createElement(n().Fragment,null,n().createElement(t.SchemaSettingsDivider,null),n().createElement(t.SchemaSettingsItem,{disabled:!0,title:e("Delete")},n().createElement(l.Space,null,e("Delete"),n().createElement(l.Tooltip,{title:e("This is part of a template, deletion is not allowed")},n().createElement(c.QuestionCircleOutlined,null)))))},useVisible:function(){return eq(!1)}},eG={name:"template-revertSettingItem",title:a("Revert to template"),Component:function(){var r=(0,t.useDesignable)(),o=r.refresh,a=r.remove,c=(0,t.usePlugin)(ti),u=i(),s=(0,t.useAPIClient)(),p=(0,O.useForm)(),d=(0,O.useField)(),m=(0,t.useFormBlockProps)().form,v=(0,O.useFieldSchema)(),y=l.App.useApp(),b=y.modal,h=y.message;return n().createElement(n().Fragment,null,n().createElement(t.SchemaSettingsDivider,null),n().createElement(t.SchemaSettingsItem,{title:u("Revert to template"),onClick:function(){b.confirm(eC(ej({title:u("Revert to template"),content:u("Are you sure you want to revert all changes from the template?")},confirm),{onOk:function(){var t;return(t=function(){var t,r,n,i,l,y,b,x,g,S,k,O,w,j,C,A,T;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(E){switch(E.label){case 0:return i=P().get(v,"x-template-uid"),[4,s.request({url:"/uiSchemas:getJsonSchema/".concat(i)})];case 1:if(!(null==(l=null==(t=E.sent().data)?void 0:t.data)?void 0:l["x-uid"]))return a(null,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}),o({refreshParentSchema:!0}),p.reset(),p.clearFormGraph(),null==m||m.clearFormGraph(),h.success(u("Reset successfully"),.2),[2];(b=(y=eT(v))===v)?c.setTemplateCache(l):(null==(x=v["x-settings"])?void 0:x.includes("updateSubmit"))&&(l["x-settings"]="actionSettings:updateSubmit",l["x-use-component-props"]="useUpdateActionProps"),v["x-filter-targets"]&&(l["x-filter-targets"]=v["x-filter-targets"]),(g=ea(l,!1,b,null==y?void 0:y["x-uid"],null==y?void 0:y["x-block-template-key"]))["x-index"]=v["x-index"],S=!0,k=!1,O=void 0;try{for(w=el[Symbol.iterator]();!(S=(j=w.next()).done);S=!0)C=j.value,P().hasIn(v,C)&&P().set(g,C,P().get(v,C))}catch(e){k=!0,O=e}finally{try{S||null==w.return||w.return()}finally{if(k)throw O}}return"FormBlockProvider"===v["x-decorator"]&&"useEditFormBlockDecoratorProps"===v["x-use-decorator-props"]&&ec(g,{collectionName:v["x-decorator-props"].collection,dataSourceName:v["x-decorator-props"].dataSource,association:v["x-decorator-props"].association,currentRecord:!0}),A=eA(v.parent,v["x-uid"]),[4,s.request({url:"/uiSchemas:remove/".concat(v["x-uid"])})];case 2:return E.sent(),(T=new e.Schema(g)).name=v.name,[4,s.request({url:"/uiSchemas:insertAdjacent/".concat(A.insertTarget,"?position=").concat(A.insertPosition),method:"post",data:{schema:T}})];case 3:return E.sent(),v.toJSON=function(){if(T["x-template-root-uid"]||(null==(e=v.parent)?void 0:e["x-template-root-uid"]))t=T.toJSON();else{var e,t;t=P().merge(l,T.toJSON())}return eg(t),eS(t,c.templateInfos,c.savedSchemaUids),t},o({refreshParentSchema:!0}),d.componentProps=eC(ej({},l["x-component-props"]),{key:(0,f.uid)()}),(null==(r=d.parent)?void 0:r.componentProps)&&(d.parent.componentProps=eC(ej({},d.parent.componentProps),{key:(0,f.uid)()})),d.decoratorProps=eC(ej({},d.decoratorProps,l["x-decorator-props"]),{key:(0,f.uid)()}),(null==(n=d.parent)?void 0:n.decoratorProps)&&(d.parent.decoratorProps=eC(ej({},d.parent.decoratorProps),{key:(0,f.uid)()})),p.reset(),null==m||m.reset(),p.clearFormGraph("*",!1),null==m||m.clearFormGraph("*",!1),h.success(u("Reset successfully"),.2),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){eP(i,n,o,a,l,"next",e)}function l(e){eP(i,n,o,a,l,"throw",e)}a(void 0)})})()}}))}},u("Revert to template")))},useVisible:function(){var e=(0,O.useFieldSchema)();return eq()&&"settings:stepsFormStepTitleSettings"!==e["x-settings"]}};function eV(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ez(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function e_(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){ez(i,n,o,a,l,"next",e)}function l(e){ez(i,n,o,a,l,"throw",e)}a(void 0)})}}function eU(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){eU(e,t,r[t])})}return e}function eL(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function eK(e){return function(e){if(Array.isArray(e))return eV(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return eV(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eV(e,t)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eW(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var e$={TableBlockProvider:["Table","table"],FormBlockProvider:["FormItem","form"],DetailsBlockProvider:["Details","details"],"List.Decorator":["List","list"],"GridCard.Decorator":["GridCard","gridCard"],CalendarBlockProvider:["Calendar","calendar"],GanttBlockProvider:["Gantt","gantt"],KanbanBlockProvider:["Kanban","kanban"],FilterFormBlockProvider:["FilterFormItem","filterForm"],"AssociationFilter.Provider":["FilterCollapse","filterCollapse"]};function eH(e,t){return eX.apply(this,arguments)}function eX(){return(eX=e_(function(e,t){var r,n,o,i,a,l;return eW(this,function(c){switch(c.label){case 0:if("BlockTemplate"===e["x-component"]&&(n=null==(r=e["x-component-props"])?void 0:r.templateId)&&t.getTemplateById(n))return[2,!0];if(!e.properties)return[3,4];for(i in o=[],e.properties)o.push(i);a=0,c.label=1;case 1:if(!(a<o.length))return[3,4];return l=o[a],[4,eH(e.properties[l],t)];case 2:if(c.sent())return[2,!0];c.label=3;case 3:return a++,[3,1];case 4:return[2]}})})).apply(this,arguments)}var eQ=function(){var e=(0,x.useLocation)(),t=(0,O.useFieldSchema)();return(0,r.useMemo)(function(){if(!t||t["x-template-uid"])return!1;var r=e.pathname.startsWith("/admin/")||e.pathname.startsWith("/page/"),n=!e.pathname.includes("/popups/"),o=!e.pathname.startsWith("/admin/settings/"),i=!e.pathname.startsWith("/admin/workflow/workflows/"),a=!e.pathname.startsWith("/block-templates/inherited/");return r&&n&&o&&i&&a},[e.pathname,t])},eY={name:"saveAsTemplateSetting",Component:function(){var e,r=i(),o=(0,O.useFieldSchema)(),a=(0,O.useField)(),c=(0,t.useDesignable)().refresh,u=(0,O.useForm)(),s=(0,t.useAPIClient)(),p=(0,t.useResource)("blockTemplates"),d=(0,f.uid)(),m=l.App.useApp().message,v=(0,t.usePlugin)(to),y=ee().templates,b=(0,x.useLocation)(),h=(0,t.useSchemaSettings)().template,g=(0,t.useSchemaTemplateManager)();return n().createElement(t.SchemaSettingsModalItem,{title:r("Save as inherited template"),schema:{type:"object",title:r("Save as inherited template"),properties:{title:{type:"string","x-decorator":"FormItem",title:r("Title"),required:!0,"x-component":"Input"},key:{type:"string","x-decorator":"FormItem",title:r("Name"),"x-component":"Input","x-validator":"uid",required:!0,"x-value":"t_".concat((0,f.uid)()),description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},description:{type:"string","x-decorator":"FormItem",title:r("Description"),"x-component":"Input.TextArea"}}},onSubmit:(e=e_(function(e){var t,n,i,l,x,S,k,O,w,j,C,A,T,E,F,D,I,B,M;return eW(this,function(R){switch(R.label){case 0:var q,N,G;if(t=e.title,n=e.key,i=e.description,O=b.pathname.startsWith("/page/")?"Mobile":"Desktop",w=(0,f.uid)(),j="Mobile"===O,q=o.toJSON(),N={},(G=function(e,t){if(!e["x-template-root-uid"]&&(t=t||{},P().merge(t,P().omit(e,["x-uid","properties"])),t["x-uid"]=(0,f.uid)(),e.properties))for(var r in e.properties){var n,o;!e.properties[r]["x-template-root-uid"]&&(P().set(t,"properties.['".concat(r,"']"),{}),G(e.properties[r],t.properties[r]),"array"===e.type&&(null==(o=t.properties)||null==(n=o[r])?void 0:n.name)&&P().set(t,"properties.['".concat(r,"'].name"),r))}})(q,N),C=N,A=h)return[3,2];return[4,eH(C,g)];case 1:A=R.sent(),R.label=2;case 2:if(A)return m.error(r("This block is using some reference templates, please convert to duplicate template first.")),[2];return T={type:"void",name:n,"x-uid":"template-".concat(w),_isJSONSchemaObject:!0,properties:{template:eL(eJ({_isJSONSchemaObject:!0,version:"2.0",type:"void","x-component":"div"},j?{"x-component-props":{style:{padding:"10px",maxHeight:"100%",overflow:"scroll"}}}:{}),{properties:{blocks:{_isJSONSchemaObject:!0,version:"2.0",type:"void","x-decorator":"TemplateGridDecorator","x-component":"Grid","x-initializer":j?"mobile:addBlock":"page:addBlock","x-uid":d,"x-async":!1,"x-index":1,properties:{}}},"x-uid":w,"x-async":!0,"x-index":1})}},E=e$[o["x-decorator"]],F={title:t,key:n,type:O,description:i,uid:w,configured:!0,collection:null==(l=o["x-decorator-props"])?void 0:l.collection,dataSource:null==(x=o["x-decorator-props"])?void 0:x.dataSource,componentType:E[0],menuName:E[1]},[4,s.resource("blockTemplates").create({values:F})];case 3:return R.sent(),y.push(F),v.templateInfos.set(n,F),[4,s.resource("uiSchemas").insert({values:T})];case 4:return R.sent(),v.setTemplateCache(C),[4,s.request({url:"/uiSchemas:insertAdjacent/".concat(d,"?position=beforeEnd"),method:"POST",data:{schema:C,wrap:{name:(0,f.uid)(),type:"void","x-component":"Grid.Row","x-index":1,properties:eU({},(0,f.uid)(),{type:"void","x-component":"Grid.Col","x-index":1})}}})];case 5:return R.sent(),D=o.toJSON(),I=function(e,t){if(t&&(e["x-block-template-key"]=n,e["x-template-uid"]=t["x-uid"],t.properties))for(var r in t.properties)I(e.properties[r],t.properties[r])},B=["x-uid","version","x-template-uid","x-block-template-key","x-template-root-uid"].concat(eK(el)),M=function(e){var t=Object.keys(e),r=[eJ({},P().reduce(t,function(e,t){return e[t]=null,e},{}),P().pick(e,B))];if(e.properties)for(var n in e.properties)r.push.apply(r,eK(M(e.properties[n])));return r},D["x-template-root-uid"]=C["x-uid"],D["x-block-template-key"]=n,D["x-index"]=o["x-index"],I(D,C),[4,s.request({url:"/uiSchemas:batchPatch",method:"POST",data:M(D)})];case 6:return R.sent(),[4,p.link({values:{templateKey:n,templateBlockUid:C["x-uid"],blockUid:o["x-uid"]}})];case 7:return R.sent(),o.toJSON=function(){return eg(D),eS(D,v.templateInfos,v.savedSchemaUids),D},c({refreshParentSchema:!0}),a.componentProps=eL(eJ({},C["x-component-props"]),{key:(0,f.uid)()}),(null==(S=a.parent)?void 0:S.componentProps)&&(a.parent.componentProps=eL(eJ({},a.parent.componentProps),{key:(0,f.uid)()})),a.decoratorProps=eL(eJ({},a.decoratorProps,C["x-decorator-props"]),{key:(0,f.uid)()}),(null==(k=a.parent)?void 0:k.decoratorProps)&&(a.parent.decoratorProps=eL(eJ({},a.parent.decoratorProps),{key:(0,f.uid)()})),u.reset(),u.clearFormGraph("*",!1),m.success(r("Save as template successfully")),[2]}})}),function(t){return e.apply(this,arguments)})})},useVisible:function(){var e=eQ(),r=(0,t.useSchemaSettings)().template;return e&&!r}};function eZ(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var e0=function(e,r,n){if(e.Component===t.SchemaSettingsTemplate||e.Component===t.SchemaSettingsFormItemTemplate){var o=e.useVisible||function(){return!0};if(e.useVisible=function(){return!eq()&&o()},(null==r?void 0:r.type)==="divider"){var i=r.useVisible||function(){return!0};r.useVisible=function(){return!eq()&&i()}}if((null==n?void 0:n.type)==="divider"){var a=n.useVisible||function(){return!0};n.useVisible=function(){return!eq()&&a()}}}},e1=function(e,t){if("delete"===e.name||"remove"===e.name||"SchemaSettingDeleteItem"===e.name){var r=e.useVisible||function(){return!0};e.useVisible=function(){return!eq(!1)&&r()},(null==t?void 0:t.type)==="divider"&&(t.useVisible=function(){return!eq(!1)&&r()})}var n=e.items||e.children;if(n)for(var o=0;o<n.length;o++)e1(n[o],n[o-1])},e2=function(e,r){var n=["ChartV2BlockInitializer","WorkflowTodo.Initializer","ApprovalBlock.BlockInitializer"],o=!0,i=!1,a=void 0;try{for(var l,c=e[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)!function(){var e=l.value,o=r.schemaInitializerManager.get(e);if(["page:addBlock","mobile:addBlock"].includes(e)){var i,a=null==o||null==(i=o.items)?void 0:i.find(function(e){return"otherBlocks"===e.name});if(a){var c=(null==a?void 0:a.useVisible)||function(){return!0};a.useVisible=function(){var e=(0,t.usePlugin)(to);return c()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}}if(o&&o.items){var u=!0,s=!1,p=void 0;try{for(var f,d=o.items[Symbol.iterator]();!(u=(f=d.next()).done);u=!0){var m=f.value,v=!0,y=!1,b=void 0;try{for(var h,x=(m.children||[])[Symbol.iterator]();!(v=(h=x.next()).done);v=!0)!function(){var e=h.value;if(n.includes(e.Component)){var r=e.useVisible||function(){return!0};e.useVisible=function(){var e=(0,t.usePlugin)(to);return r()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}}()}catch(e){y=!0,b=e}finally{try{v||null==x.return||x.return()}finally{if(y)throw b}}}}catch(e){s=!0,p=e}finally{try{u||null==d.return||d.return()}finally{if(s)throw p}}}}()}catch(e){i=!0,a=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw a}}},e3=function(e){if(e.Component===t.SchemaSettingsConnectDataBlocks){var r=e.useVisible||function(){return!0};e.useVisible=function(){var e=(0,t.usePlugin)(to);return r()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}};function e4(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function e6(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){e4(i,n,o,a,l,"next",e)}function l(e){e4(i,n,o,a,l,"throw",e)}a(void 0)})}}function e5(e,t,r){return(e5=tt()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&e9(o,r.prototype),o}).apply(null,arguments)}function e8(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function e7(e){return(e7=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e9(e,t){return(e9=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(e){var t="function"==typeof Map?new Map:void 0;return(te=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,r)}function r(){return e5(e,arguments,e7(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e9(r,e)})(e)}function tt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tt=function(){return!!e})()}function tr(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var tn=new WeakMap,to=function(r){var n;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function o(){var e,r,n;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return r=o,n=arguments,r=e7(r),e8(e=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tt()?Reflect.construct(r,n||[],e7(this).constructor):r.apply(this,n)),"templateInfos",new Map),e8(e,"templateschemacache",{}),e8(e,"pageBlocks",{}),e8(e,"savedSchemaUids",new Set),e8(e,"injectInitializers",["page:addBlock","popup:common:addBlock","popup:addNew:addBlock","mobile:addBlock","mobile:popup:common:addBlock"]),e8(e,"setTemplateCache",function(t){t&&(e.templateschemacache[t["x-uid"]]=t)}),e8(e,"clearTemplateCache",function(t){delete e.templateschemacache[t]}),function(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}(e,tn,{writable:!0,value:function(){var r=setInterval(function(){if(!e.app.loading){clearInterval(r),e2(e.injectInitializers,e.app);var n=e.app.schemaSettingsManager.getAll();for(var o in n)!function(r){var n=e.app.schemaSettingsManager.get(r);if(n&&!r.startsWith("fieldSettings:component:")){for(var o=0;o<n.items.length;o++)e0(n.items[o],n.items[o-1],n.items[o+1]),e3(n.items[o]),e1(n.items[o],n.items[o-1]);var i=n.items.findIndex(function(e,t){var r=n.items[t+1];return"divider"===e.type&&((null==r?void 0:r.name)==="delete"||(null==r?void 0:r.name)==="remove")});-1===i||n.items.find(function(e){return"template-revertSettingItem"===e.name})?(n.add("template-revertSettingItem",eG),n.add("template-convertToNormalBlockSettingItem",eR)):n.items.splice(i,0,eG,eR),n.add("template-disabledDeleteItem",eN)}if(["blockSettings:calendar","blockSettings:createForm","blockSettings:details","blockSettings:detailsWithPagination","blockSettings:stepsForm","blockSettings:filterCollapse","blockSettings:filterForm","blockSettings:gantt","blockSettings:gridCard","blockSettings:kanban","blockSettings:list","blockSettings:table","blockSettings:tree","ReadPrettyFormSettings","GanttBlockSettings","FormV1Settings","FormSettings","FormItemSettings","FormDetailsSettings"].includes(r)){var a,l,c=n.items.findIndex(function(e){return e.Component===t.SchemaSettingsTemplate||e.Component===t.SchemaSettingsFormItemTemplate});-1!==c&&n.items.splice(c+1,0,(a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){e8(e,t,r[t])})}return e}({},eY),l=l={sort:n.items[c].sort},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a))}}(o)}},1e3)}}),e}return o.prototype=Object.create(r&&r.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),r&&e9(o,r),n=[{key:"afterAdd",value:function(){return e6(function(){return tr(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return e6(function(){return tr(this,function(e){return[2]})})()}},{key:"load",value:function(){var r=this;return e6(function(){var n,o,i,a,l,c,s,p;return tr(this,function(f){var d,m,v,y,b,h,x;e.Schema.registerPatches(function(e){if(e["x-template-infos"]){for(var t in e["x-template-infos"]){var n=e["x-template-infos"][t];r.templateInfos.set(t,n)}delete e["x-template-infos"]}if(e["x-template-schemas"]){for(var o in e["x-template-schemas"]){var i=e["x-template-schemas"][o];r.templateschemacache[o]=i}delete e["x-template-schemas"]}if(e["x-template-root-uid"]&&(e.version||e["x-template-root-ref"])){var a=function e(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,i=t["x-uid"],a=t["x-template-root-uid"],l=t["x-block-template-key"],c=t;if(a)c=function t(r,n,o,i,a,l){return r.properties&&!n.properties&&(n.properties={}),w.mergeWith(r,n,function(n,c,u,s,p){if(null==c)return n;if("default"===u&&"actionSettings:filter"===s["x-settings"])return c||n;if(w.isObject(c)){if(w.isArray(c))return c||n;if("properties"===u){var f=Object.keys(c),d=Object.keys(n||{});if(ek.includes(p["x-component"])&&ek.includes(s["x-component"])){var m=new Map,v=new Map;eO(s,m),eO(p,v);var y=!0,b=!1,h=void 0;try{for(var x,g=v.entries()[Symbol.iterator]();!(y=(x=g.next()).done);y=!0){var S=ed(x.value,2),k=(S[0],S[1]);if(k.schema["x-template-uid"]){var O=m.get(k.schema["x-template-uid"]);if(O){var P=t(O.schema||{},k.schema,k.schema["x-template-root-uid"]||o,i,a,l);k.path[k.path.length-1].schema.properties[k.key]=P,k.schema=P,m.delete(k.schema["x-template-uid"])}}}}catch(e){b=!0,h=e}finally{try{y||null==g.return||g.return()}finally{if(b)throw h}}s.properties=n=ew(m),d=Object.keys(n)}if("CollectionField"===s["x-component"]){var j=!0,C=!1,A=void 0;try{for(var T,E=f[Symbol.iterator]();!(j=(T=E.next()).done);j=!0)!function(){var e,r=T.value,u=null==(e=c[r])?void 0:e["x-component"];if(["Action.Container","AssociationField.Viewer","AssociationField.Selector","AssociationField.Nester","AssociationField.SubTable"].includes(u)){var s=d.find(function(e){return n[e]["x-component"]===u});s&&(c[r]["x-template-uid"]=n[s]["x-uid"],c[r]=t(n[s]||{},c[r],o,i,a,l),d=d.filter(function(e){return e!==s}))}}()}catch(e){C=!0,A=e}finally{try{j||null==E.return||E.return()}finally{if(C)throw A}}}if(/:configure.*Actions/.test(s["x-initializer"])){var F=!0,D=!1,I=void 0;try{for(var B,M=f[Symbol.iterator]();!(F=(B=M.next()).done);F=!0)!function(){var e=B.value;if("filterForm:configureActions"===s["x-initializer"]){var t,r,o,i,a=null==(i=c[e])?void 0:i["x-use-component-props"];if(a&&["useFilterBlockActionProps","useResetBlockActionProps"].includes(a)){var l=w.remove(d,function(e){var t,r=null==(t=n[e])?void 0:t["x-use-component-props"];return a===r});l.length>0&&(c[e]["x-template-uid"]=n[l[0]]["x-uid"])}}if((null==(t=c[e])?void 0:t["x-component"])&&(null==(o=c[e])||null==(r=o["x-settings"])?void 0:r.includes("actionSettings"))){var u=c[e]["x-settings"].split(":")[1],p=["bulkDelete","filter","refresh","delete","print","stepsFormNext","stepsFormPrevious","disassociate","MailSend","MailRefresh","MailAccountSetting","MailMarkAsRead","MailMarkAsUnRead"].find(function(e){return e===u});if(p){var f=w.remove(d,function(e){var t;return(null==(t=n[e])?void 0:t["x-settings"])==="actionSettings:".concat(p)});f.length>0&&(c[e]["x-template-uid"]=n[f[0]]["x-uid"])}}}()}catch(e){D=!0,I=e}finally{try{F||null==M.return||M.return()}finally{if(D)throw I}}}var R=!0,q=!1,N=void 0;try{for(var G,V=f[Symbol.iterator]();!(R=(G=V.next()).done);R=!0)!function(){var e=G.value;if(null==(t=s["x-initializer"])?void 0:t.includes(":configureColumns")){if(c[e]["x-component"]&&"fieldSettings:TableColumn"===c[e]["x-settings"]){var t,r,o,i=Object.values((null==(o=c[e])?void 0:o.properties)||{})[0],a=w.get(i,"x-collection-field");if(a){var l=null,u=w.remove(d,function(e){l=Object.values((null==(t=n[e])?void 0:t.properties)||{})[0];var t,r=w.get(l,"x-collection-field");return a===r});u.length>0&&(c[e]["x-template-uid"]=n[u[0]]["x-uid"],i["x-template-uid"]=null==l?void 0:l["x-uid"])}}if(null==(r=c[e]["x-initializer"])?void 0:r.includes(":configureItemActions")){var p=w.remove(d,function(e){var t,r;return null==(r=n[e])||null==(t=r["x-initializer"])?void 0:t.includes(":configureItemActions")});p.length>0&&(c[e]["x-template-uid"]=n[p[0]]["x-uid"])}}}()}catch(e){q=!0,N=e}finally{try{R||null==V.return||V.return()}finally{if(q)throw N}}if(/:configureFields/.test(p["x-initializer"])){var z=new Map;eO(s,z);var _=Array.from(z.values()),U=!0,J=!1,L=void 0;try{for(var K,W=f[Symbol.iterator]();!(U=(K=W.next()).done);U=!0){var $=K.value,H=new Map;eO(c[$],H);var X=!0,Q=!1,Y=void 0;try{for(var Z,ee=H.entries()[Symbol.iterator]();!(X=(Z=ee.next()).done);X=!0)!function(){var e=ed(Z.value,2),r=(e[0],e[1]),n=w.get(r.schema,"x-collection-field");if(n){var c=w.find(_,function(e){return e.schema["x-collection-field"]===n});c&&(z.delete(c.schema["x-uid"]),r.schema["x-template-uid"]=c.schema["x-uid"],r.schema=t(c.schema||{},r.schema,r.schema["x-template-root-uid"]||o,i,a,l))}}()}catch(e){Q=!0,Y=e}finally{try{X||null==ee.return||ee.return()}finally{if(Q)throw Y}}s.properties=n=ew(z),d=Object.keys(n)}}catch(e){J=!0,L=e}finally{try{U||null==W.return||W.return()}finally{if(J)throw L}}}if("DndContext"===r["x-decorator"]){var et=!0,er=!1,en=void 0;try{for(var eo,ei=f[Symbol.iterator]();!(et=(eo=ei.next()).done);et=!0)!function(){var e=eo.value,t=c[e]["x-settings"];if(c[e]["x-component"]&&["actionSettings:disassociate","actionSettings:delete"].includes(t)){var r=w.remove(d,function(e){var r;return(null==(r=n[e])?void 0:r["x-settings"])===t});r.length>0&&(c[e]["x-template-uid"]=n[r[0]]["x-uid"])}}()}catch(e){er=!0,en=e}finally{try{et||null==ei.return||ei.return()}finally{if(er)throw en}}}var el=w.difference(d,f);if(el.length>0){var ec=w.cloneDeep(w.pick(n,el)),eu=!0,es=!1,ep=void 0;try{for(var ef,ev=el[Symbol.iterator]();!(eu=(ef=ev.next()).done);eu=!0)!function(){var e=ef.value,r=ea(ec[e],!0,!1,o,l),n=r["x-uid"],u=w.findKey(c,function(e){return e["x-uid"]===n});u?c[u]=t(ec[e]||{},c[u],o,i,a,l):(r.name=e,c[e]=r)}()}catch(e){es=!0,ep=e}finally{try{eu||null==ev.return||ev.return()}finally{if(es)throw ep}}}for(var ey={},eb=Object.keys(c),eh=0;eh<eb.length;eh++){var ex=eb[eh];ey[ex]=t((null==n?void 0:n[ex])||{},null==c?void 0:c[ex],o,i,a,l),ey[ex]["x-template-root-uid"]&&(ey[ex]=e(ey[ex],i,a))}var eg=[];for(var eS in ey)if(ey[eS]["x-index"]){var eP,ej=ey[eS]["x-index"];eg.includes(ej)&&(ey[eS]["x-index"]=(eP=Math).max.apply(eP,em(eg))+1),eg.push(ey[eS]["x-index"])}return ey}return t(n||{},c,o,i,a,l)}return c})}(w.cloneDeep(r[a])||{},t,i,r,n,l);else for(var u in t.properties){var s=t.properties[u];t.properties[u]=e(s,r,n,o),null==t.properties[u]["x-component"]&&delete t.properties[u]}return eg(c),eS(c,n,o),!function e(t){var r=(null==t?void 0:t.properties)||{},n=!0,o=!1,i=void 0;try{for(var a,l=Object.keys(r)[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var c=a.value;if(null==t.properties[c]["x-component"]&&t.properties[c]["x-template-id"]&&!t.properties[c]["x-template-root-id"]&&function(e){if(!e["x-no-component"])return!0;var t=null==e?void 0:e.properties;return t&&Object.values(t).some(function(e){return null==e["x-component"]})}(t.properties[c])&&delete t.properties[c],(null==(m=r[c])?void 0:m["x-component-props"])===null&&delete r[c]["x-component-props"],(null==(v=r[c])?void 0:v["x-component"])==="Grid.Row"){var u=!1,s=Object.values((null==(y=r[c])?void 0:y.properties)||{}),p=!0,f=!1,d=void 0;try{for(var m,v,y,b,h=s[Symbol.iterator]();!(p=(b=h.next()).done);p=!0){var x=b.value;"Grid.Col"!==x["x-component"]||w.isEmpty(x.properties)||(u=!0)}}catch(e){f=!0,d=e}finally{try{p||null==h.return||h.return()}finally{if(f)throw d}}u||delete r[c]}e(r[c])}}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}}(c),c}(e,r.templateschemacache,r.templateInfos,r.savedSchemaUids);return r.pageBlocks[a["x-uid"]]=a,a}return e}),d=r.app.apiClient,m=r.pageBlocks,v=r.savedSchemaUids,y=function(e){var t=eb(m,e),r=function(e){if((null==e?void 0:e["x-virtual"])&&v.add(e["x-uid"]),null==e?void 0:e.properties)for(var t in e.properties)r(e.properties[t])};r(ey(t,e))},d.axios.interceptors.request.use((b=function(e){var t,r,n,o,i,a,l,c,u,s,p,f,v,b,h,x,g,S,k,O,w,P,j,C,A,T,E,F,D,I,B,M,R,q;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(N){switch(N.label){case 0:var G,V,z;if(!((null==(t=e.url)?void 0:t.includes("uiSchemas:patch"))||(null==(r=e.url)?void 0:r.includes("uiSchemas:initializeActionContext"))))return[3,8];G=ey(l=eb(m,a=null==(i=e.data)?void 0:i["x-uid"]),a),V=new Set,(z=function(e){if(e){if(e["x-virtual"])return void V.add(e["x-uid"]);if(e.properties)for(var t in e.properties)z(e.properties[t])}})(G),c=V,u=!0,s=!1,p=void 0,N.label=1;case 1:N.trys.push([1,6,7,8]),f=c[Symbol.iterator](),N.label=2;case 2:if(u=(v=f.next()).done)return[3,5];if(b=v.value,!(h=eh(l,b)))return[3,4];return x=ex(h.schema),[4,d.request({url:"/blockTemplates:saveSchema/".concat(h.insertTarget,"?position=").concat(h.insertPosition),method:"post",data:{schema:x}})];case 3:N.sent(),y(h.schema["x-uid"]),N.label=4;case 4:return u=!0,[3,2];case 5:return[3,8];case 6:return g=N.sent(),s=!0,p=g,[3,8];case 7:try{u||null==f.return||f.return()}finally{if(s)throw p}return[7];case 8:if(!(null==(n=e.url)?void 0:n.includes("uiSchemas:batchPatch")))return[3,16];S=e.data,k=!0,O=!1,w=void 0,N.label=9;case 9:N.trys.push([9,14,15,16]),P=S[Symbol.iterator](),N.label=10;case 10:if(k=(j=P.next()).done)return[3,13];if(!(A=eh(eb(m,(C=j.value)["x-uid"]),C["x-uid"])))return[3,12];return[4,d.request({url:"/blockTemplates:saveSchema/".concat(A.insertTarget,"?position=").concat(A.insertPosition),method:"post",data:{schema:ex(A.schema)}})];case 11:N.sent(),y(A.schema["x-uid"]),N.label=12;case 12:return k=!0,[3,10];case 13:return[3,16];case 14:return g=N.sent(),O=!0,w=g,[3,16];case 15:try{k||null==P.return||P.return()}finally{if(O)throw w}return[7];case 16:if(!(null==(o=e.url)?void 0:o.includes("uiSchemas:insertAdjacent")))return[3,20];if(F=e.url.split("/").pop(),D=null==(T=e.data)?void 0:T.wrap,I=null==(E=e.data)?void 0:E.schema,B=null==F?void 0:F.split("?")[0],M=I["x-uid"]||I,!(R=eh(eb(m,B),B,D)))return[3,18];return[4,d.request({url:"/blockTemplates:saveSchema/".concat(R.insertTarget,"?position=").concat(R.insertPosition),method:"post",data:{schema:ex(R.schema,[M,null==D?void 0:D["x-uid"]].filter(Boolean))}})];case 17:N.sent(),y(R.schema["x-uid"]),N.label=18;case 18:if(!((q=eh(eb(m,M),M,D))&&q.insertTarget))return[3,20];return[4,d.request({url:"/blockTemplates:saveSchema/".concat(q.insertTarget,"?position=").concat(q.insertPosition),method:"post",data:{schema:ex(q.schema,[M,null==D?void 0:D["x-uid"]].filter(Boolean))}})];case 19:N.sent(),y(q.schema["x-uid"]),D&&y(D["x-uid"]),N.label=20;case 20:return[2,e]}})},h=function(){var e=this,t=arguments;return new Promise(function(r,n){var o=b.apply(e,t);function i(e){eZ(o,r,n,i,a,"next",e)}function a(e){eZ(o,r,n,i,a,"throw",e)}i(void 0)})},function(e){return h.apply(this,arguments)})),r.app.addComponents({TemplateGridDecorator:eE}),r.app.addProviders([et]),i=!0,a=!1,l=void 0;try{for(c=r.injectInitializers[Symbol.iterator]();!(i=(s=c.next()).done);i=!0)p=s.value,r.app.schemaInitializerManager.addItem(p,"otherBlocks.templates",es)}catch(e){a=!0,l=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw l}}return(x=function(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(r,tn,0),x.get?x.get.call(r):x.value).call(r),r.app.pluginSettingsManager.add("block-templates",{title:'{{t("Block templates (deprecated)", { ns: "'.concat(u,'" })}}'),icon:"ProfileOutlined",sort:1e3}),r.app.pluginSettingsManager.add("block-templates.reference",{title:'{{t("Reference template")}}',Component:t.BlockTemplatesPane}),r.app.pluginSettingsManager.add("block-templates.inherited",{title:'{{t("Inherited template")}}',Component:z}),r.app.pluginSettingsManager.add("block-templates/inherited/:key",{title:!1,pluginKey:"block-templates",isTopLevel:!1,Component:J}),null==(o=r.app.pluginManager.get("mobile"))||null==(n=o.mobileRouter)||n.add("mobile.schema.blockTemplate",{path:"/block-templates/inherited/:key/:pageSchemaUid",Component:W}),[2]})})()}},{key:"isInBlockTemplateConfigPage",value:function(){var e,t=(null==(e=this.app.pluginManager.get("mobile"))?void 0:e.mobileBasename)+"/block-templates/inherited";return window.location.pathname.includes("admin/settings/block-templates/inherited")||window.location.pathname.includes(t)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(o.prototype,n),o}(te(t.Plugin)),ti=to}(),y}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@formily/json-schema"),require("react"),require("lodash"),require("@nocobase/plugin-mobile/client"),require("ahooks"),require("@nocobase/client"),require("react-router"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-template",["@formily/core","@formily/json-schema","react","lodash","@nocobase/plugin-mobile/client","ahooks","@nocobase/client","react-router","react-router-dom","@formily/react","@ant-design/icons","@nocobase/utils/client","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-block-template"]=t(require("@formily/core"),require("@formily/json-schema"),require("react"),require("lodash"),require("@nocobase/plugin-mobile/client"),require("ahooks"),require("@nocobase/client"),require("react-router"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("antd")):e["@nocobase/plugin-block-template"]=t(e["@formily/core"],e["@formily/json-schema"],e.react,e.lodash,e["@nocobase/plugin-mobile/client"],e.ahooks,e["@nocobase/client"],e["react-router"],e["react-router-dom"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/utils/client"],e.antd)}(self,function(e,t,r,n,o,i,a,l,c,u,s,p,f){return function(){"use strict";var d={482:function(e){e.exports=s},563:function(t){t.exports=e},625:function(e){e.exports=t},505:function(e){e.exports=u},772:function(e){e.exports=a},58:function(e){e.exports=o},584:function(e){e.exports=p},749:function(e){e.exports=i},721:function(e){e.exports=f},467:function(e){e.exports=n},156:function(e){e.exports=r},432:function(e){e.exports=l},128:function(e){e.exports=c}},m={};function v(e){var t=m[e];if(void 0!==t)return t.exports;var r=m[e]={exports:{}};return d[e](r,r.exports,v),r.exports}v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var r in t)v.o(t,r)&&!v.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var y={};return!function(){v.r(y),v.d(y,{PluginBlockTemplateClient:function(){return to},default:function(){return ti}});var e=v(625),t=v(772),r=v(156),n=v.n(r),o=JSON.parse('{"u2":"@nocobase/plugin-block-template"}');function i(){var e=(0,t.useApp)();return function(t){return e.i18n.t(t,{ns:[o.u2,"client"]})}}function a(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.u2,"', 'client'], nsMode: 'fallback' })}}")}var l=v(721),c=v(482),u="block-template",s={type:"object","x-component":"Action",title:'{{t("Add new", { ns: "'.concat(u,'" })}}'),"x-align":"right","x-component-props":{type:"primary",icon:"PlusOutlined",openMode:"drawer"},properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Add new", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormV2","x-use-decorator-props":function(){return{form:(0,r.useContext)(b)}},properties:{form:{type:"void",properties:{title:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},key:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},type:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},description:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:"Submit","x-component":"Action","x-use-component-props":"useCreateActionProps"}}}}}}},p=v(563),f=v(584);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(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.")}()}var b=(0,r.createContext)(null),h={name:"blockTemplates",filterTargetKey:"key",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:"{{t('Title')}}",required:!0,"x-component":"Input"}},{type:"string",name:"key",interface:"input",uiSchema:{type:"string",title:"{{t('Name')}}",required:!0,"x-component":"Input"}},{type:"string",name:"type",interface:"radioGroup",uiSchema:{type:"string",title:a("Type"),"x-component":"Radio.Group",enum:"{{ typeOptions }}"}},{type:"string",name:"description",interface:"textarea",uiSchema:{type:"string",title:"{{t('Description')}}","x-component":"Input.TextArea"}}]},x=v(128),g={type:"void",title:a("Edit"),"x-component":"Action.Link","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:a("Edit"),"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormProps",properties:{form:{type:"void",properties:{title:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},key:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-disabled":!0},type:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-disabled":!0},description:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:a("Submit"),"x-component":"Action","x-use-component-props":"useEditActionProps"}}}}}}},S={name:"bulkDestroySchema",type:"void","x-component":"Action","x-component-props":{openSize:"small",icon:"DeleteOutlined"},title:'{{t("Delete")}}',properties:{modal:{type:"void","x-component":"Action.Modal","x-decorator":"FormV2","x-use-decorator-props":function(){return{form:(0,r.useMemo)(function(){return(0,p.createForm)()},[])}},title:'{{t("Delete")}}',properties:{keepBlocks:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":a("Keep the created blocks?"),default:!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useBulkDestroyAction }}"}}}}}}}},k={type:"void",name:(0,f.uid)(),"x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:h.name,action:"list",params:{sort:"-createdAt"},showIndex:!0,dragSort:!1,rowKey:"key"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:20}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},bulkDestroySchema:S,addNew:{type:"void","x-component":function(){var e=m((0,r.useState)(!1),2),o=e[0],a=e[1],u=m((0,r.useState)(null),2),d=u[0],v=u[1],y=i();return n().createElement(t.ActionContextProvider,{value:{visible:o,setVisible:a}},n().createElement(l.Button,{icon:n().createElement(c.PlusOutlined,null),type:"primary",onClick:function(){v((0,p.createForm)({initialValues:{key:"t_".concat((0,f.uid)()),type:"Desktop"}})),a(!0)}},y("Add new")),n().createElement(b.Provider,{value:d},n().createElement(t.SchemaComponent,{schema:s})))}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:h.filterTargetKey,rowSelection:{type:"checkbox"}},properties:{title:{type:"void",title:'{{ t("Title") }}',"x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},key:{type:"void",title:'{{ t("Name") }}',"x-component":"TableV2.Column","x-component-props":{width:80},properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},type:{type:"void",title:a("Type"),"x-component":"TableV2.Column","x-component-props":{width:80},properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},description:{type:"void",title:'{{ t("Description") }}',"x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:a("Configure"),"x-component":function(){var e=(0,t.useFilterByTk)(),r=(0,t.useCollectionRecordData)(),o=i(),a="/admin/settings/block-templates/inherited/".concat(e);return"Mobile"===r.type&&(a="/m/block-templates/inherited/".concat(r.key,"/").concat(r.uid)),n().createElement(x.Link,{to:a},o("Configure"))}},editActionSchema:g,duplicate:{type:"void",title:'{{t("Duplicate", { ns: "'.concat(u,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Duplicate to new template", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input",required:!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDuplicateAction }}"}}}}}}}},delete:{type:"void",title:a("Delete"),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Delete", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal","x-component-props":{openSize:"small"},properties:{keepBlocks:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox",default:!0,"x-content":a("Keep the created blocks?")},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDeleteAction }}"}}}}}}}}}}}}}}}},O=v(505),w=v(467),P=v.n(w);function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function C(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var A=function(e){if(!e)return null;if("CustomRequestAction"===e["x-component"]&&(e["x-custom-request-id"]=e["x-custom-request-id"]||e["x-uid"]),e["x-uid"]=(0,f.uid)(),e.properties){var t=!0,r=!1,n=void 0;try{for(var o,i=Object.keys(e.properties)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;A(e.properties[a])}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}}return e};function T(){var e,n=l.App.useApp().message,o=(0,t.useAPIClient)(),i=(0,t.useCollectionRecordData)(),a=(0,t.useDataBlockResource)(),c=(0,t.useBlockRequestContext)().service,u=(0,t.useCollection)(),s=(0,O.useForm)(),p=(0,t.useActionContext)().setVisible,d=(e=(0,r.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return j(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],v=d[1];return{run:function(){var e;return(e=function(){var e,t,r,l,d,y;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(b){switch(b.label){case 0:if(m)return[2];return[4,s.submit()];case 1:if(b.sent(),v(!0),e=s.values,!u)throw Error("collection does not exist");return t=i.uid,[4,o.request({url:"uiSchemas:getJsonSchema/".concat(t)})];case 2:return r=b.sent().data,d=(l=A(P().cloneDeep(null==r?void 0:r.data)))["x-uid"],y="t_".concat((0,f.uid)()),[4,o.resource("uiSchemas").insert({values:{type:"void",name:y,"x-uid":"template-".concat(d),_isJSONSchemaObject:!0,properties:{template:l}}})];case 3:var h,x;return b.sent(),[4,a.create({values:(h=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},i),x=x={title:"".concat(e.title),key:y,uid:d},Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(x)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(x)).forEach(function(e){Object.defineProperty(h,e,Object.getOwnPropertyDescriptor(x,e))}),h)})];case 4:return b.sent(),[4,c.refresh()];case 5:return b.sent(),p(!1),v(!1),[4,s.reset()];case 6:return b.sent(),n.success("Duplicated!"),[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){C(i,n,o,a,l,"next",e)}function l(e){C(i,n,o,a,l,"throw",e)}a(void 0)})})()}}}function E(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function D(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var I=function(){var e=(0,t.useActionContext)().setVisible,r=l.App.useApp().message,n=(0,O.useForm)(),o=(0,t.useDataBlockResource)(),a=(0,t.useAPIClient)(),c=(0,t.useDataBlockRequest)().refresh,u=i();return{type:"primary",onClick:function(){var t;return(t=function(){var t,i,l,s,p;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(d){switch(d.label){case 0:return[4,n.submit()];case 1:return d.sent(),i=(t=n.values).key,l=(0,f.uid)(),s="Mobile"===t.type,p={type:"void",name:i,"x-uid":"template-".concat(l),_isJSONSchemaObject:!0,properties:{template:D(F({_isJSONSchemaObject:!0,version:"2.0",type:"void","x-component":"div"},s?{"x-component-props":{style:{padding:"10px",maxHeight:"100%",overflow:"scroll"}}}:{}),{properties:{blocks:{_isJSONSchemaObject:!0,version:"2.0",type:"void","x-decorator":"TemplateGridDecorator","x-component":"Grid","x-initializer":s?"mobile:addBlock":"page:addBlock","x-uid":(0,f.uid)(),"x-async":!1,"x-index":1,properties:{}}},"x-uid":l,"x-async":!0,"x-index":1})}},[4,o.create({values:D(F({},t),{uid:l})})];case 2:return d.sent(),[4,a.resource("uiSchemas").insert({values:p})];case 3:return d.sent(),n.reset(),c(),r.success(u("Saved successfully")),e(!1),n.values.key="t_".concat((0,f.uid)()),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){E(i,n,o,a,l,"next",e)}function l(e){E(i,n,o,a,l,"throw",e)}a(void 0)})})()}}};function B(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var M=function(){var e=(0,t.useActionContext)().setVisible,r=l.App.useApp().message,n=(0,O.useForm)(),o=(0,t.useDataBlockResource)(),a=(0,t.useCollection)(),c=(0,t.usePlugin)(to),u=i(),s=(0,t.useDataBlockRequest)().refresh;return{type:"primary",onClick:function(){var t;return(t=function(){var t;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return[4,n.submit()];case 1:return i.sent(),t=n.values,[4,o.update({values:t,filterByTk:t[a.filterTargetKey]})];case 2:return i.sent(),s(),r.success(u("Saved successfully")),c.templateInfos.set(t[a.filterTargetKey],t),e(!1),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){B(i,n,o,a,l,"next",e)}function l(e){B(i,n,o,a,l,"throw",e)}a(void 0)})})()}}};function R(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function q(){var e=l.App.useApp().message,r=(0,t.useCollectionRecordData)(),n=(0,t.useDataBlockResource)(),o=(0,t.useDataBlockRequest)(),a=o.data,c=o.refresh,u=o.run,s=(0,t.useCollection)(),p=i(),f=(0,O.useForm)();return{run:function(){var t;return(t=function(){var t,o,i,l,d,m,v;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(y){switch(y.label){case 0:if(!s)throw Error("collection does not exist");return[4,f.submit()];case 1:return y.sent(),l=f.values.keepBlocks,[4,n.destroy({filterByTk:r[s.filterTargetKey],removeSchema:!l})];case 2:return y.sent(),d=(null==a||null==(t=a.meta)?void 0:t.page)||1,m=(null==a||null==(o=a.meta)?void 0:o.pageSize)||20,d>(v=Math.max(Math.ceil((((null==a||null==(i=a.meta)?void 0:i.count)||0)-1)/m),1))?u({page:v,pageSize:m}):c(),e.success(p("Deleted successfully")),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){R(i,n,o,a,l,"next",e)}function l(e){R(i,n,o,a,l,"throw",e)}a(void 0)})})()}}}var N=function(){var e=(0,t.useCollectionRecordData)();return{form:(0,r.useMemo)(function(){return(0,p.createForm)({initialValues:e})},[e])}};function G(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var V=function(){var e=(0,t.useAPIClient)(),r=(0,t.useActionContext)().setVisible,n=(0,t.useDataBlockRequest)(),o=n.data,a=n.refresh,c=n.run,u=(0,O.useField)(),s=i(),p=(0,O.useForm)(),f=l.App.useApp().message,d=(0,t.useTableBlockProps)().onRowSelectionChange;return{run:function(){var t;return(t=function(){var t,n,i,l,m,v,y,b;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(h){switch(h.label){case 0:if(!(null==(m=null==(t=u.data)?void 0:t.selectedRowKeys)?void 0:m.length))return f.error(s("Please select the records you want to delete")),[2];return[4,e.request({method:"POST",url:"/blockTemplates:destroy",params:{filterByTk:m,removeSchema:!p.values.keepBlocks}})];case 1:return h.sent(),d([],[]),p.reset(),v=(null==o||null==(n=o.meta)?void 0:n.page)||1,y=(null==o||null==(i=o.meta)?void 0:i.pageSize)||20,v>(b=Math.max(Math.ceil((((null==o||null==(l=o.meta)?void 0:l.count)||0)-m.length)/y),1))?c({page:b,pageSize:y}):a(),r(!1),f.success(s("Deleted successfully")),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){G(i,n,o,a,l,"next",e)}function l(e){G(i,n,o,a,l,"throw",e)}a(void 0)})})()}}},z=function(){var e,r,o=(0,t.useSchemaComponentContext)(),a=i(),l=[{label:a("Desktop"),value:"Desktop"},{label:a("Mobile"),value:"Mobile"}];return n().createElement(t.ExtendCollectionsProvider,{collections:[h]},n().createElement(t.SchemaComponentContext.Provider,{value:(e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},o),r=r={designable:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e)},n().createElement(t.SchemaComponent,{schema:k,scope:{useCreateActionProps:I,useEditActionProps:M,useEditFormProps:N,useDeleteAction:q,useDuplicateAction:T,useBulkDestroyAction:V,typeOptions:l}})))},_=v(432),U=(0,r.createContext)({}),J=function(){var e,r=(0,_.useParams)(),o=l.theme.useToken().token,a=i(),c=(0,t.useRequest)({url:"blockTemplates:get/".concat(r.key)}),u=c.data,s=c.loading,p=((null==u?void 0:u.data)||{}).title;if(s)return n().createElement(l.Spin,null);var f=null==u||null==(e=u.data)?void 0:e.uid;return n().createElement(t.AllDataBlocksProvider,null,n().createElement("div",{style:{marginTop:-o.marginXXL,marginLeft:-o.marginLG,marginRight:-o.marginLG,padding:o.paddingLG,paddingTop:o.paddingMD,paddingBottom:o.paddingMD,background:o.colorBgContainer,display:"flex",alignItems:"center",justifyContent:"space-between"}},n().createElement(l.Breadcrumb,{items:[{title:n().createElement(x.Link,{to:"/admin/settings/block-templates"},a("Block template"))},{title:p}]})),n().createElement("div",{style:{marginTop:o.marginMD,position:"relative",zIndex:0}},n().createElement(U.Provider,{value:null==u?void 0:u.data},n().createElement(t.RemoteSchemaComponent,{uid:f}))))},L=v(58),K=v.n(L),W=function(){var e=(0,x.useParams)().key,o=(0,t.useRequest)({url:"blockTemplates:get/".concat(e)}),i=o.data,a=o.loading;return((0,r.useEffect)(function(){var e,t=document.querySelector(".ant-nb-mobile-tab-bar"),r=null==t||null==(e=t.style)?void 0:e.display;return t&&(t.style.display="none"),function(){var e=document.querySelector(".ant-nb-mobile-tab-bar");e&&(e.style.display=r)}},[]),a)?n().createElement(l.Spin,null):n().createElement(U.Provider,{value:null==i?void 0:i.data},n().createElement(L.MobilePage,null))},$=function(e){if(!e)return null;if(["Grid","Grid.Row","Grid.Col"].includes(e["x-component"])){var t=null,r=!0,n=!1,o=void 0;try{for(var i,a=Object.values(e.properties||{})[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=i.value;if(t=$(l))break}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}return t}return e},H=v(749);function X(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function Q(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){X(i,n,o,a,l,"next",e)}function l(e){X(i,n,o,a,l,"throw",e)}a(void 0)})}}function Y(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var Z=(0,r.createContext)({loading:!1,templates:[],handleTemplateClick:Q(function(){return Y(this,function(e){return[2]})})}),ee=function(){return(0,r.useContext)(Z)},et=function(e){var o,a=e.children,l=(0,t.useAPIClient)(),c=(0,t.usePlugin)(ti),u=(0,t.usePlugin)(K()),s=(0,t.useResource)("blockTemplates"),p=i(),f=window.location.pathname.startsWith(u.mobileBasename),d=(0,x.useLocation)(),m=n().useRef(d.pathname),v=(0,t.useCurrentUserContext)(),y=(0,t.useRequest)({url:"blockTemplates:list",method:"get",params:{filter:{configured:{$isTruly:!0},type:f?"Mobile":{$ne:"Mobile"}},paginate:!1}},{cacheKey:"blockTemplates",manual:!0}),b=y.data,h=y.loading,g=y.refresh;(0,r.useEffect)(function(){m.current.includes("/settings/block-templates/inherited")&&!d.pathname.includes("/settings/block-templates/inherited")&&g(),m.current=d.pathname},[d.pathname,g]),(0,r.useEffect)(function(){(null==v?void 0:v.data)&&g()},[null==v?void 0:v.data,g]);var S=(0,H.useMemoizedFn)((o=Q(function(e,t,r){var n,o,i,a,u,p,f,d,m,v,y,b,h,x,g,S,k,O,P,j;return Y(this,function(C){switch(C.label){case 0:return i=(n=e.item).uid,[4,l.request({url:"uiSchemas:getProperties/".concat(i)})];case 1:p=function(e,t,r){var n=null==e?void 0:e.properties;n=w.get(Object.values(n),"0.properties");var o=[];for(var i in n){var a=ea(n[i],!1,!0,void 0,t,r);a&&o.push($(a))}return o}(u=null==(a=C.sent().data)?void 0:a.data,n.key,t),c.setTemplateCache($(null==(o=u.properties)?void 0:o.blocks)),function(e){var t={},r=!0,n=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=i.value;w.merge(t,function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t["x-template-uid"]&&(r[t["x-template-uid"]]=t["x-uid"]),t.properties)for(var n in t.properties)e(t.properties[n],r);return r}(l))}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}var c=!0,u=!1,s=void 0;try{for(var p,f=e[Symbol.iterator]();!(c=(p=f.next()).done);c=!0){var d=p.value;!function e(t,r){var n,o=["x-uid","x-template-uid","x-template-root-uid","x-custom-request-id"];for(var i in t)!o.includes(i)&&(t[i]&&"string"==typeof t[i]&&(t[i]=r[t[i]]||t[i]),t[i]&&"object"==((n=t[i])&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&e(t[i],r))}(d,t)}}catch(e){u=!0,s=e}finally{try{c||null==f.return||f.return()}finally{if(u)throw s}}}(p),f=!0,d=!1,m=void 0;try{for(v=p[Symbol.iterator]();!(f=(y=v.next()).done);f=!0)b=y.value,null==r||r(b)}catch(e){d=!0,m=e}finally{try{f||null==v.return||v.return()}finally{if(d)throw m}}h=[],x=function(e){if(e["x-template-root-uid"]&&h.push({templateKey:n.key,templateBlockUid:e["x-template-root-uid"],blockUid:e["x-uid"]}),e.properties)for(var t in e.properties)x(e.properties[t])},g=!0,S=!1,k=void 0;try{for(O=p[Symbol.iterator]();!(g=(P=O.next()).done);g=!0)j=P.value,x(j)}catch(e){S=!0,k=e}finally{try{g||null==O.return||O.return()}finally{if(S)throw k}}return s.link({values:h}),[2]}})}),function(e,t,r){return o.apply(this,arguments)}));return(0,r.useEffect)(function(){var e;null==b||null==(e=b.data)||e.forEach(function(e){c.templateInfos.set(e.key,e)})},[null==b?void 0:b.data,c.templateInfos]),(0,r.useEffect)(function(){(0,t.registerInitializerMenusGenerator)("block_template",function(e){var t,r,n,o=e.collection,i=e.association,a=e.item,l=(e.index,e.field),u=e.componentName,s=e.dataSource,p=(e.keyPrefix,e.name),f=(null==o?void 0:o.name)||(null==a||null==(t=a.options)?void 0:t.name),d=s||(null==a||null==(r=a.options)?void 0:r.dataSource)||(null==o?void 0:o.dataSource),m=window.location.pathname.includes("/admin/workflow");if((null==u?void 0:u.startsWith("mobile-"))&&(u=u.replace("mobile-","")),c.isInBlockTemplateConfigPage()||m)return null;l&&(f=null==l?void 0:l.target);var v="details"===p||"ReadPrettyFormItem"===u,y=null==b||null==(n=b.data)?void 0:n.filter(function(e){return(e.componentType===u||p===e.menuName||v&&"details"===e.menuName)&&e.collection===f&&e.dataSource===d}).map(function(e){return{type:"item",name:e.key,item:e,title:e.title,schemaInsertor:function(e,t){var r=t.item,n=(t.fromOthersInPopup,t.name),a={dataSourceName:d};return i&&("editForm"===n||"currentRecord"===n)&&(a.association=i),l?(a.association="".concat(null==o?void 0:o.name,".").concat(l.name),a.associationType=l.type):a.collectionName=f,a.currentRecord="currentRecord"===n&&v,"editForm"===n&&(a.currentRecord=!0),S(r,a,e)}}});return(null==y?void 0:y.length)?y:null})},[null==b?void 0:b.data,c.isInBlockTemplateConfigPage,S,p,c]),n().createElement(Z.Provider,{value:{loading:h,templates:(null==b?void 0:b.data)||[],handleTemplateClick:S}},a)};function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function en(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||ei(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ei(e,t){if(e){if("string"==typeof e)return er(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return er(e,t)}}function ea(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0;if(n||(n=(0,f.uid)()),"Grid"===e["x-component"]||"Grid.Row"===e["x-component"]||"Grid.Col"===e["x-component"]){var a,l,c=w.cloneDeep((a=en({},e),l=l={"x-uid":(0,f.uid)(),properties:{}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a));for(var u in t&&(c["x-virtual"]=!0),"TemplateGridDecorator"===c["x-decorator"]&&delete c["x-decorator"],c["x-linkage-rules"]&&delete c["x-linkage-rules"],e.properties){var s=ea(e.properties[u],t,r,n,o,i);r&&(n=(0,f.uid)()),s&&(c.properties[u]=s)}return c}var p={"x-uid":"".concat(n,"-").concat(e["x-uid"]),"x-template-uid":e["x-uid"],properties:{}};for(var d in t&&(p["x-virtual"]=!0),e["x-settings"]&&(p["x-settings"]=e["x-settings"]),r&&(p["x-template-root-uid"]=e["x-uid"],p["x-uid"]=n,p["x-template-version"]="1.0"),el.forEach(function(t){w.hasIn(e,t)&&w.set(p,t,w.get(e,t))}),o&&(p["x-block-template-key"]=o),"CustomRequestAction"===e["x-component"]&&(p["x-custom-request-id"]=e["x-custom-request-id"]||e["x-uid"]),"Action"===e["x-component"]&&w.get(e,"x-action-settings.schemaUid")&&(p["x-action-settings"]={schemaUid:""}),e["x-component"]||(p["x-no-component"]=!0),w.get(e,"x-filter-targets")&&(p["x-filter-targets"]=e["x-filter-targets"]),e.properties)p.properties[d]=ea(e.properties[d],t,!1,n,o);return r&&i&&function(e,t){var r,n,o,i,a,l,c=t.collectionName,u=t.dataSourceName,s=t.association,p=e["x-decorator"];"DetailsBlockProvider"===p?(r=t.collectionName,n=t.dataSourceName,o=t.association,i=t.currentRecord,a=t.associationType,e["x-decorator-props"]={action:"list",collection:o?null:r,association:o,dataSource:n,readPretty:!0,params:{pageSize:1}},e["x-acl-action"]="".concat(o||r,":view"),e["x-settings"]="blockSettings:detailsWithPagination",e["x-use-decorator-props"]="useDetailsWithPaginationDecoratorProps",(i||"hasOne"===a||"belongsTo"===a)&&(e["x-acl-action"]="".concat(o||r,":get"),e["x-decorator-props"].action="get",e["x-settings"]="blockSettings:details",e["x-use-decorator-props"]="useDetailsDecoratorProps"),i&&(e["x-is-current"]=!0)):"FormBlockProvider"===p?ec(e,t):p&&(e["x-decorator-props"]={action:"list",collection:c,association:s,dataSource:u});if(e.properties&&(null==(l=e["x-decorator-props"])?void 0:l.association)){var f=function(e,t){var r=e["x-decorator"];if(("DetailsBlockProvider"===r||"FormBlockProvider"===r)&&!(null==(n=e["x-decorator-props"])?void 0:n.association)&&t){var n,o,i=e["x-settings"];("blockSettings:editForm"===i||"blockSettings:details"===i)&&(e["x-decorator-props"].association=t,e["x-is-current"]=!0,e["x-acl-action"]="".concat(t,":").concat(null==(o=e["x-acl-action"])?void 0:o.split(":")[1]))}var a=e["x-decorator-props"];if(!a||!a.collection||a.association){var l=(null==a?void 0:a.association)||t;e.properties&&Object.values(e.properties).forEach(function(e){f(e,l)})}};Object.values(e.properties).forEach(function(t){var r;f(t,null==(r=e["x-decorator-props"])?void 0:r.association)})}}(p,i),p}et.displayName="BlockTemplateMenusProvider";var el=["x-decorator","x-decorator-props.collection","x-decorator-props.association","x-decorator-props.dataSource","x-decorator-props.action","x-decorator-props.params","x-acl-action","x-settings","x-use-decorator-props","x-is-current"];function ec(e,t){var r=t.collectionName,n=t.dataSourceName,o=t.association;if(t.currentRecord){e["x-decorator-props"]={action:"get",collection:r,association:o,dataSource:n},e["x-data-templates"]={display:!1},e["x-acl-action"]="".concat(o||r,":update"),e["x-settings"]="blockSettings:editForm",e["x-use-decorator-props"]="useEditFormBlockDecoratorProps",e["x-is-current"]=!0;var i=Object.keys(e.properties)[0];if(i){var a=Object.keys(e.properties[i].properties).find(function(e){return"grid"!==e});if(a){w.set(e,"properties.['".concat(i,"'].x-use-component-props"),"useEditFormBlockProps"),w.set(e,"properties.['".concat(i,"'].properties.['").concat(a,"'].x-initializer"),"editForm:configureActions");var l,c=w.get(e,"properties.".concat(i,".properties.").concat(a,".properties"),{});for(var u in c)(null==(l=c[u]["x-settings"])?void 0:l.includes("createSubmit"))&&(c[u]["x-settings"]="actionSettings:updateSubmit","useStepsFormSubmitActionProps"!==c[u]["x-use-component-props"]&&(c[u]["x-use-component-props"]="useUpdateActionProps"))}}}else e["x-decorator-props"]={collection:r,association:o,dataSource:n}}var eu=function(e){var t=e.value,o=e.onChange,a=eo((0,r.useState)(t),2),c=a[0],u=a[1],s=(0,r.useRef)(""),p=(0,r.useRef)(!1),f=i();(0,r.useEffect)(function(){u(t)},[t]),(0,r.useEffect)(function(){var e,t=function(){s.current&&s.current.focus()},r=new IntersectionObserver(function(e){e.some(function(e){return e.isIntersecting})&&t()});return(null==(e=s.current)?void 0:e.input)&&r.observe(s.current.input),function(){r.disconnect()}},[]);var d=function(e){p.current||(o(e.target.value),u(e.target.value))},m=function(e){"compositionend"===e.type?(p.current=!1,d(e)):p.current=!0};return n().createElement("div",{onClick:function(e){return e.stopPropagation()}},n().createElement(l.Input,{ref:s,allowClear:!0,style:{padding:"4px 8px",boxShadow:"none",borderRadius:0},bordered:!1,placeholder:f("Search and select template"),value:c,onClick:function(e){e.stopPropagation()},onChange:d,onCompositionStart:m,onCompositionEnd:m,onCompositionUpdate:m}),n().createElement(l.Divider,{style:{margin:0}}))},es={name:"templates",Component:function(){var e,o=(0,t.useSchemaInitializer)().insert,a=(0,t.usePlugin)(ti),u=eo((0,r.useState)(""),2),s=u[0],p=u[1],f=i(),d=ee(),m=d.templates,v=d.handleTemplateClick,y=d.loading,b=null==m?void 0:m.filter(function(e){return!e.dataSource}).filter(function(e){return!s||e.title.toLowerCase().includes(s.toLowerCase())}),h=[{key:"search",label:n().createElement(eu,{value:s,onChange:function(e){p(e)}}),onClick:function(e){e.domEvent.stopPropagation()}}].concat(function(e){if(Array.isArray(e))return er(e)}(e=(null==b?void 0:b.length)?b.map(function(e){return en({label:e.title},e)}):[{key:"empty",style:{height:150},label:n().createElement("div",{onClick:function(e){return e.stopPropagation()}},n().createElement(l.Empty,{image:l.Empty.PRESENTED_IMAGE_SIMPLE,description:f("No data")}))}])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ei(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());(0,r.useEffect)(function(){null==m||m.forEach(function(e){a.templateInfos.set(e.key,e)})},[m,a.templateInfos]);var x=(0,H.useMemoizedFn)(function(e){v(e,{},o)});return y?n().createElement("div",null,n().createElement(c.LoadingOutlined,null)," ",f("Templates")):n().createElement(t.SchemaInitializerItem,{closeInitializerMenuWhenClick:!0,title:'{{t("Block template")}}',icon:n().createElement(c.CopyOutlined,{style:{marginRight:0}}),items:h,name:"templates",onClick:x})},title:'{{t("Block template")}}',icon:"TableOutlined",wrap:function(e){return e},useVisible:function(){return!1}};function ep(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ef(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function ed(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}(e,t)||ev(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 em(e){return function(e){if(Array.isArray(e))return ep(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ev(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ev(e,t){if(e){if("string"==typeof e)return ep(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ep(e,t)}}function ey(e,t){if(!e)return null;if(e["x-uid"]===t)return e;if(e.properties)for(var r in e.properties){var n=ey(e.properties[r],t);if(n)return n}return null}function eb(e,t){var r=function(e,t){if(e["x-uid"]===t)return!0;for(var n in e.properties)if(r(e.properties[n],t))return!0;return!1};for(var n in e)if(r(e[n],t))return e[n];return null}function eh(e,t,r){if(!e)return null;if(e["x-uid"]===t&&e["x-virtual"])return{schema:e,insertTarget:null,insertPosition:"afterBegin"};for(var n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++){var i=n[o],a=eh(i,t,r);if(a){var l=a.insertPosition,c=a.insertTarget;if(!e["x-virtual"]&&i["x-virtual"]){var u=function(e,t){for(var n=t+1;n<e.length;n++)if(!e[n]["x-virtual"]&&e[n]["x-uid"]!==(null==r?void 0:r["x-uid"]))return e[n]["x-uid"];return null}(n,o);u?(l="beforeBegin",c=u):(l="beforeEnd",c=e["x-uid"])}return{schema:e["x-virtual"]?e:a.schema,insertTarget:c,insertPosition:l}}}return null}function ex(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=function(e){if(r.includes(e["x-uid"]))return null;var t={type:e.type,name:e.name,"x-uid":e["x-uid"],"x-template-uid":e["x-template-uid"],"x-template-root-uid":e["x-template-root-uid"]};if(e["x-template-uid"]||(t=ef({},w.omit(e,["properties"]))),delete t["x-virtual"],e.properties)for(var o in t.properties={},e.properties){var i=n(e.properties[o]);i&&(t.properties[o]=i)}return t};return new e.Schema(n(t)).toJSON()}function eg(e){if((e["x-toolbar"]||e["x-designer"])&&e["x-template-uid"]){var t,r="".concat((null==(t=e["x-toolbar-props"])?void 0:t.toolbarClassName)||"");w.merge(e,{"x-toolbar-props":{toolbarClassName:"".concat(r.includes("nb-in-template")?r:"".concat(r," nb-in-template"))}})}if(e.properties)for(var n in e.properties)eg(e.properties[n])}function eS(e,t,r){if(e["x-block-template-key"]){var n;e["x-template-title"]=null==(n=t.get(e["x-block-template-key"]))?void 0:n.title}if(r.has(e["x-uid"])&&(delete e["x-virtual"],r.delete(e["x-uid"])),e.properties)for(var o in e.properties)eS(e.properties[o],t,r)}var ek=["Grid","Grid.Row","Grid.Col"];function eO(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0,o=e.properties||{},i=e["x-component"];ek.includes(i)&&(r=em(r).concat([{schema:e,type:i,key:n||""}]));var a=!0,l=!1,c=void 0;try{for(var u,s=Object.entries(o)[Symbol.iterator]();!(a=(u=s.next()).done);a=!0){var p=ed(u.value,2),f=p[0],d=p[1];if(d){var m=d["x-component"];ek.includes(m)?eO(d,t,r,f):d["x-uid"]&&t.set(d["x-uid"],{schema:d,path:r,key:f})}}}catch(e){l=!0,c=e}finally{try{a||null==s.return||s.return()}finally{if(l)throw c}}}function ew(e){var t={properties:{}},r=!0,n=!1,o=void 0;try{for(var i,a=e.entries()[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=ed(i.value,2),c=(l[0],l[1]),u=t,s=!0,p=!1,f=void 0;try{for(var d,m=c.path.slice(1)[Symbol.iterator]();!(s=(d=m.next()).done);s=!0){var v=d.value;u.properties||(u.properties={}),u.properties[v.key]||(u.properties[v.key]=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}(ef({},v.schema),{properties:{}})),u=u.properties[v.key]}}catch(e){p=!0,f=e}finally{try{s||null==m.return||m.return()}finally{if(p)throw f}}u.properties=u.properties||{},u.properties[c.key]=c.schema}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}return t.properties}function eP(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function ej(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eC(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var eA=function(e,t){for(var r={insertPosition:"beforeBegin",insertTarget:null},n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++)n[o]["x-uid"]===t&&(r.insertPosition="beforeBegin",o===n.length-1?(r.insertPosition="beforeEnd",r.insertTarget=e["x-uid"]):(r.insertPosition="beforeBegin",r.insertTarget=n[o+1]["x-uid"]));return r},eT=function(e){return e?e["x-template-root-uid"]?e:eT(e.parent):null},eE=(0,O.observer)(function(e){var o,i=(0,O.useFieldSchema)(),a=(0,O.useField)(),l=(0,H.useUpdate)(),c=(0,r.useRef)("block"),u=(0,r.useRef)(null==(o=$(i))?void 0:o["x-uid"]),s=(0,t.useAPIClient)(),f=(0,r.useContext)(U),d=(0,O.useForm)(),m=(0,r.useContext)(t.SchemaComponentOnChangeContext).onChange;(0,r.useEffect)(function(){var e=d.subscribe(function(e){var t=e.type,r=e.payload;"blockAdded"===t&&s.resource("blockTemplates").update({filter:{key:f.key},values:{collection:r.collection,dataSource:r.dataSource,componentType:r.componentType,menuName:r.menuName}})});return function(){d.unsubscribe(e)}},[d]),i["x-initializer-props"]={style:{display:c.current}};var v=(0,r.useCallback)(function(e){var t=0,r=function(n){if(n["x-toolbar"]||n["x-settings"]){var o,i;n["x-toolbar-props"]=(o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},n["x-toolbar-props"]),i=i={initializer:"block"===e&&void 0},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(i)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))}),o),t++}!(t>0)&&n.properties&&Object.keys(n.properties).forEach(function(e){r(n.properties[e])})};r(i)},[i]),y=(0,r.useCallback)(function(e){var t=e?"none":"block";t!==c.current&&(c.current=t,a.decoratorProps.style={display:t},v(t),a.form.clearFormGraph(),l())},[l,a,v]),b=(0,r.useCallback)(function(e){if(f&&f.configured!==e){var t,r={configured:e};e||(r.dataSource=null,r.collection=null,r.componentType=null,r.menuName=null),s.resource("blockTemplates").update({filter:{key:f.key},values:r}),f.configured=e,!e&&u.current?s.request({url:"/uiSchemas:remove/".concat(u.current)}):u.current=null==(t=$(i))?void 0:t["x-uid"]}},[s,f,i]),h=(0,r.useCallback)(function(){var e=Object.keys(i.properties||{}).length>0;y(e),b(e)},[i,y,b]),x=(0,r.useCallback)(function(){h(),null==m||m(i)},[i,h,m]);return(0,O.useFormEffects)(function(){(0,p.onFieldReact)("blocks.*.*",function(){h()})}),(0,r.useEffect)(function(){h()},[h]),n().createElement(t.SchemaComponentOnChangeContext.Provider,{value:{onChange:x}},e.children)});function eF(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function eD(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eI(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var eB=function(e,t){for(var r={insertPosition:"beforeBegin",insertTarget:null},n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++)n[o]["x-uid"]===t&&(r.insertPosition="beforeBegin",o===n.length-1?(r.insertPosition="beforeEnd",r.insertTarget=e["x-uid"]):(r.insertPosition="beforeBegin",r.insertTarget=n[o+1]["x-uid"]));return r},eM=function(e){var t=P().cloneDeep(e),r=function(e){var t,n;if(delete e["x-template-uid"],delete e["x-template-root-uid"],delete e["x-template-version"],delete e["x-block-template-key"],delete e["x-template-root-ref"],delete e["x-template-title"],delete e["x-virtual"],(null==(n=e["x-toolbar-props"])||null==(t=n.toolbarClassName)?void 0:t.includes("nb-in-template"))&&(e["x-toolbar-props"].toolbarClassName=e["x-toolbar-props"].toolbarClassName.replace("nb-in-template","")),e["x-uid"]&&(e["x-uid"]=(0,f.uid)()),e.properties)for(var o in e.properties)e.properties[o]["x-template-root-uid"]||r(e.properties[o])};return r(t),t},eR={name:"template-convertToNormalBlockSettingItem",title:a("Convert to normal block"),Component:function(){var r=(0,t.useDesignable)().refresh,o=i(),a=(0,t.useAPIClient)(),c=(0,O.useForm)(),u=(0,O.useField)(),s=(0,t.useFormBlockProps)().form,p=(0,O.useFieldSchema)(),d=l.App.useApp(),m=d.modal,v=d.message;a.resource("blockTemplates");var y={okText:o("Yes"),cancelText:o("No")};return n().createElement(t.SchemaSettingsItem,{title:o("Convert to normal block"),onClick:function(){m.confirm(eI(eD({title:o("Convert to normal block"),content:o("Are you sure you want to convert this template block to a normal block?")},y),{onOk:function(){var t;return(t=function(){var t,n,i,l,d;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(m){switch(m.label){case 0:return i=eM(p.toJSON()),l=eB(p.parent,p["x-uid"]),[4,a.request({url:"/uiSchemas:remove/".concat(p["x-uid"])})];case 1:return m.sent(),d=new e.Schema(i),[4,a.request({url:"/uiSchemas:insertAdjacent/".concat(l.insertTarget,"?position=").concat(l.insertPosition),method:"post",data:{schema:d}})];case 2:return m.sent(),p.toJSON=function(){return d.toJSON()},r({refreshParentSchema:!0}),u.componentProps=eI(eD({},u.componentProps),{key:(0,f.uid)()}),(null==(t=u.parent)?void 0:t.componentProps)&&(u.parent.componentProps=eI(eD({},u.parent.componentProps),{key:(0,f.uid)()})),u.decoratorProps=eI(eD({},u.decoratorProps),{key:(0,f.uid)()}),(null==(n=u.parent)?void 0:n.decoratorProps)&&(u.parent.decoratorProps=eI(eD({},u.parent.decoratorProps),{key:(0,f.uid)()})),c.reset(),null==s||s.reset(),c.clearFormGraph("*",!1),null==s||s.clearFormGraph("*",!1),v.success(o("Converted successfully"),.2),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){eF(i,n,o,a,l,"next",e)}function l(e){eF(i,n,o,a,l,"throw",e)}a(void 0)})})()}}))}},o("Convert to normal block"))},useVisible:function(){var e=(0,O.useFieldSchema)();return null==e?void 0:e["x-template-root-uid"]}},eq=function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,O.useFieldSchema)();return!!P().get(t,"x-template-uid")&&(e||!P().get(t,"x-template-root-uid"))},eN={name:"template-disabledDeleteItem",title:a("Delete"),Component:function(){var e=i();return n().createElement(n().Fragment,null,n().createElement(t.SchemaSettingsDivider,null),n().createElement(t.SchemaSettingsItem,{disabled:!0,title:e("Delete")},n().createElement(l.Space,null,e("Delete"),n().createElement(l.Tooltip,{title:e("This is part of a template, deletion is not allowed")},n().createElement(c.QuestionCircleOutlined,null)))))},useVisible:function(){return eq(!1)}},eG={name:"template-revertSettingItem",title:a("Revert to template"),Component:function(){var r=(0,t.useDesignable)(),o=r.refresh,a=r.remove,c=(0,t.usePlugin)(ti),u=i(),s=(0,t.useAPIClient)(),p=(0,O.useForm)(),d=(0,O.useField)(),m=(0,t.useFormBlockProps)().form,v=(0,O.useFieldSchema)(),y=l.App.useApp(),b=y.modal,h=y.message;return n().createElement(n().Fragment,null,n().createElement(t.SchemaSettingsDivider,null),n().createElement(t.SchemaSettingsItem,{title:u("Revert to template"),onClick:function(){b.confirm(eC(ej({title:u("Revert to template"),content:u("Are you sure you want to revert all changes from the template?")},confirm),{onOk:function(){var t;return(t=function(){var t,r,n,i,l,y,b,x,g,S,k,O,w,j,C,A,T;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(E){switch(E.label){case 0:return i=P().get(v,"x-template-uid"),[4,s.request({url:"/uiSchemas:getJsonSchema/".concat(i)})];case 1:if(!(null==(l=null==(t=E.sent().data)?void 0:t.data)?void 0:l["x-uid"]))return a(null,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}),o({refreshParentSchema:!0}),p.reset(),p.clearFormGraph(),null==m||m.clearFormGraph(),h.success(u("Reset successfully"),.2),[2];(b=(y=eT(v))===v)?c.setTemplateCache(l):(null==(x=v["x-settings"])?void 0:x.includes("updateSubmit"))&&(l["x-settings"]="actionSettings:updateSubmit",l["x-use-component-props"]="useUpdateActionProps"),v["x-filter-targets"]&&(l["x-filter-targets"]=v["x-filter-targets"]),(g=ea(l,!1,b,null==y?void 0:y["x-uid"],null==y?void 0:y["x-block-template-key"]))["x-index"]=v["x-index"],S=!0,k=!1,O=void 0;try{for(w=el[Symbol.iterator]();!(S=(j=w.next()).done);S=!0)C=j.value,P().hasIn(v,C)&&P().set(g,C,P().get(v,C))}catch(e){k=!0,O=e}finally{try{S||null==w.return||w.return()}finally{if(k)throw O}}return"FormBlockProvider"===v["x-decorator"]&&"useEditFormBlockDecoratorProps"===v["x-use-decorator-props"]&&ec(g,{collectionName:v["x-decorator-props"].collection,dataSourceName:v["x-decorator-props"].dataSource,association:v["x-decorator-props"].association,currentRecord:!0}),A=eA(v.parent,v["x-uid"]),[4,s.request({url:"/uiSchemas:remove/".concat(v["x-uid"])})];case 2:return E.sent(),(T=new e.Schema(g)).name=v.name,[4,s.request({url:"/uiSchemas:insertAdjacent/".concat(A.insertTarget,"?position=").concat(A.insertPosition),method:"post",data:{schema:T}})];case 3:return E.sent(),v.toJSON=function(){if(T["x-template-root-uid"]||(null==(e=v.parent)?void 0:e["x-template-root-uid"]))t=T.toJSON();else{var e,t;t=P().merge(l,T.toJSON())}return eg(t),eS(t,c.templateInfos,c.savedSchemaUids),t},o({refreshParentSchema:!0}),d.componentProps=eC(ej({},l["x-component-props"]),{key:(0,f.uid)()}),(null==(r=d.parent)?void 0:r.componentProps)&&(d.parent.componentProps=eC(ej({},d.parent.componentProps),{key:(0,f.uid)()})),d.decoratorProps=eC(ej({},d.decoratorProps,l["x-decorator-props"]),{key:(0,f.uid)()}),(null==(n=d.parent)?void 0:n.decoratorProps)&&(d.parent.decoratorProps=eC(ej({},d.parent.decoratorProps),{key:(0,f.uid)()})),p.reset(),null==m||m.reset(),p.clearFormGraph("*",!1),null==m||m.clearFormGraph("*",!1),h.success(u("Reset successfully"),.2),[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){eP(i,n,o,a,l,"next",e)}function l(e){eP(i,n,o,a,l,"throw",e)}a(void 0)})})()}}))}},u("Revert to template")))},useVisible:function(){var e=(0,O.useFieldSchema)();return eq()&&"settings:stepsFormStepTitleSettings"!==e["x-settings"]}};function eV(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ez(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function e_(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){ez(i,n,o,a,l,"next",e)}function l(e){ez(i,n,o,a,l,"throw",e)}a(void 0)})}}function eU(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){eU(e,t,r[t])})}return e}function eL(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function eK(e){return function(e){if(Array.isArray(e))return eV(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return eV(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eV(e,t)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eW(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var e$={TableBlockProvider:["Table","table"],FormBlockProvider:["FormItem","form"],DetailsBlockProvider:["Details","details"],"List.Decorator":["List","list"],"GridCard.Decorator":["GridCard","gridCard"],CalendarBlockProvider:["Calendar","calendar"],GanttBlockProvider:["Gantt","gantt"],KanbanBlockProvider:["Kanban","kanban"],FilterFormBlockProvider:["FilterFormItem","filterForm"],"AssociationFilter.Provider":["FilterCollapse","filterCollapse"]};function eH(e,t){return eX.apply(this,arguments)}function eX(){return(eX=e_(function(e,t){var r,n,o,i,a,l;return eW(this,function(c){switch(c.label){case 0:if("BlockTemplate"===e["x-component"]&&(n=null==(r=e["x-component-props"])?void 0:r.templateId)&&t.getTemplateById(n))return[2,!0];if(!e.properties)return[3,4];for(i in o=[],e.properties)o.push(i);a=0,c.label=1;case 1:if(!(a<o.length))return[3,4];return l=o[a],[4,eH(e.properties[l],t)];case 2:if(c.sent())return[2,!0];c.label=3;case 3:return a++,[3,1];case 4:return[2]}})})).apply(this,arguments)}var eQ=function(){var e=(0,x.useLocation)(),t=(0,O.useFieldSchema)();return(0,r.useMemo)(function(){if(!t||t["x-template-uid"])return!1;var r=e.pathname.startsWith("/admin/")||e.pathname.startsWith("/page/"),n=!e.pathname.includes("/popups/"),o=!e.pathname.startsWith("/admin/settings/"),i=!e.pathname.startsWith("/admin/workflow/workflows/"),a=!e.pathname.startsWith("/block-templates/inherited/");return r&&n&&o&&i&&a},[e.pathname,t])},eY={name:"saveAsTemplateSetting",Component:function(){var e,r=i(),o=(0,O.useFieldSchema)(),a=(0,O.useField)(),c=(0,t.useDesignable)().refresh,u=(0,O.useForm)(),s=(0,t.useAPIClient)(),p=(0,t.useResource)("blockTemplates"),d=(0,f.uid)(),m=l.App.useApp().message,v=(0,t.usePlugin)(to),y=ee().templates,b=(0,x.useLocation)(),h=(0,t.useSchemaSettings)().template,g=(0,t.useSchemaTemplateManager)();return n().createElement(t.SchemaSettingsModalItem,{title:r("Save as inherited template"),schema:{type:"object",title:r("Save as inherited template"),properties:{title:{type:"string","x-decorator":"FormItem",title:r("Title"),required:!0,"x-component":"Input"},key:{type:"string","x-decorator":"FormItem",title:r("Name"),"x-component":"Input","x-validator":"uid",required:!0,"x-value":"t_".concat((0,f.uid)()),description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},description:{type:"string","x-decorator":"FormItem",title:r("Description"),"x-component":"Input.TextArea"}}},onSubmit:(e=e_(function(e){var t,n,i,l,x,S,k,O,w,j,C,A,T,E,F,D,I,B,M;return eW(this,function(R){switch(R.label){case 0:var q,N,G;if(t=e.title,n=e.key,i=e.description,O=b.pathname.startsWith("/page/")?"Mobile":"Desktop",w=(0,f.uid)(),j="Mobile"===O,q=o.toJSON(),N={},(G=function(e,t){if(!e["x-template-root-uid"]&&(t=t||{},P().merge(t,P().omit(e,["x-uid","properties"])),t["x-uid"]=(0,f.uid)(),e.properties))for(var r in e.properties){var n,o;!e.properties[r]["x-template-root-uid"]&&(P().set(t,"properties.['".concat(r,"']"),{}),G(e.properties[r],t.properties[r]),"array"===e.type&&(null==(o=t.properties)||null==(n=o[r])?void 0:n.name)&&P().set(t,"properties.['".concat(r,"'].name"),r))}})(q,N),C=N,A=h)return[3,2];return[4,eH(C,g)];case 1:A=R.sent(),R.label=2;case 2:if(A)return m.error(r("This block is using some reference templates, please convert to duplicate template first.")),[2];return T={type:"void",name:n,"x-uid":"template-".concat(w),_isJSONSchemaObject:!0,properties:{template:eL(eJ({_isJSONSchemaObject:!0,version:"2.0",type:"void","x-component":"div"},j?{"x-component-props":{style:{padding:"10px",maxHeight:"100%",overflow:"scroll"}}}:{}),{properties:{blocks:{_isJSONSchemaObject:!0,version:"2.0",type:"void","x-decorator":"TemplateGridDecorator","x-component":"Grid","x-initializer":j?"mobile:addBlock":"page:addBlock","x-uid":d,"x-async":!1,"x-index":1,properties:{}}},"x-uid":w,"x-async":!0,"x-index":1})}},E=e$[o["x-decorator"]],F={title:t,key:n,type:O,description:i,uid:w,configured:!0,collection:null==(l=o["x-decorator-props"])?void 0:l.collection,dataSource:null==(x=o["x-decorator-props"])?void 0:x.dataSource,componentType:E[0],menuName:E[1]},[4,s.resource("blockTemplates").create({values:F})];case 3:return R.sent(),y.push(F),v.templateInfos.set(n,F),[4,s.resource("uiSchemas").insert({values:T})];case 4:return R.sent(),v.setTemplateCache(C),[4,s.request({url:"/uiSchemas:insertAdjacent/".concat(d,"?position=beforeEnd"),method:"POST",data:{schema:C,wrap:{name:(0,f.uid)(),type:"void","x-component":"Grid.Row","x-index":1,properties:eU({},(0,f.uid)(),{type:"void","x-component":"Grid.Col","x-index":1})}}})];case 5:return R.sent(),D=o.toJSON(),I=function(e,t){if(t&&(e["x-block-template-key"]=n,e["x-template-uid"]=t["x-uid"],t.properties))for(var r in t.properties)I(e.properties[r],t.properties[r])},B=["x-uid","version","x-template-uid","x-block-template-key","x-template-root-uid"].concat(eK(el)),M=function(e){var t=Object.keys(e),r=[eJ({},P().reduce(t,function(e,t){return e[t]=null,e},{}),P().pick(e,B))];if(e.properties)for(var n in e.properties)r.push.apply(r,eK(M(e.properties[n])));return r},D["x-template-root-uid"]=C["x-uid"],D["x-block-template-key"]=n,D["x-index"]=o["x-index"],I(D,C),[4,s.request({url:"/uiSchemas:batchPatch",method:"POST",data:M(D)})];case 6:return R.sent(),[4,p.link({values:{templateKey:n,templateBlockUid:C["x-uid"],blockUid:o["x-uid"]}})];case 7:return R.sent(),o.toJSON=function(){return eg(D),eS(D,v.templateInfos,v.savedSchemaUids),D},c({refreshParentSchema:!0}),a.componentProps=eL(eJ({},C["x-component-props"]),{key:(0,f.uid)()}),(null==(S=a.parent)?void 0:S.componentProps)&&(a.parent.componentProps=eL(eJ({},a.parent.componentProps),{key:(0,f.uid)()})),a.decoratorProps=eL(eJ({},a.decoratorProps,C["x-decorator-props"]),{key:(0,f.uid)()}),(null==(k=a.parent)?void 0:k.decoratorProps)&&(a.parent.decoratorProps=eL(eJ({},a.parent.decoratorProps),{key:(0,f.uid)()})),u.reset(),u.clearFormGraph("*",!1),m.success(r("Save as template successfully")),[2]}})}),function(t){return e.apply(this,arguments)})})},useVisible:function(){var e=eQ(),r=(0,t.useSchemaSettings)().template;return e&&!r}};function eZ(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var e0=function(e,r,n){if(e.Component===t.SchemaSettingsTemplate||e.Component===t.SchemaSettingsFormItemTemplate){var o=e.useVisible||function(){return!0};if(e.useVisible=function(){return!eq()&&o()},(null==r?void 0:r.type)==="divider"){var i=r.useVisible||function(){return!0};r.useVisible=function(){return!eq()&&i()}}if((null==n?void 0:n.type)==="divider"){var a=n.useVisible||function(){return!0};n.useVisible=function(){return!eq()&&a()}}}},e1=function(e,t){if("delete"===e.name||"remove"===e.name||"SchemaSettingDeleteItem"===e.name){var r=e.useVisible||function(){return!0};e.useVisible=function(){return!eq(!1)&&r()},(null==t?void 0:t.type)==="divider"&&(t.useVisible=function(){return!eq(!1)&&r()})}var n=e.items||e.children;if(n)for(var o=0;o<n.length;o++)e1(n[o],n[o-1])},e2=function(e,r){var n=["ChartV2BlockInitializer","WorkflowTodo.Initializer","ApprovalBlock.BlockInitializer"],o=!0,i=!1,a=void 0;try{for(var l,c=e[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)!function(){var e=l.value,o=r.schemaInitializerManager.get(e);if(["page:addBlock","mobile:addBlock"].includes(e)){var i,a=null==o||null==(i=o.items)?void 0:i.find(function(e){return"otherBlocks"===e.name});if(a){var c=(null==a?void 0:a.useVisible)||function(){return!0};a.useVisible=function(){var e=(0,t.usePlugin)(to);return c()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}}if(o&&o.items){var u=!0,s=!1,p=void 0;try{for(var f,d=o.items[Symbol.iterator]();!(u=(f=d.next()).done);u=!0){var m=f.value,v=!0,y=!1,b=void 0;try{for(var h,x=(m.children||[])[Symbol.iterator]();!(v=(h=x.next()).done);v=!0)!function(){var e=h.value;if(n.includes(e.Component)){var r=e.useVisible||function(){return!0};e.useVisible=function(){var e=(0,t.usePlugin)(to);return r()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}}()}catch(e){y=!0,b=e}finally{try{v||null==x.return||x.return()}finally{if(y)throw b}}}}catch(e){s=!0,p=e}finally{try{u||null==d.return||d.return()}finally{if(s)throw p}}}}()}catch(e){i=!0,a=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw a}}},e3=function(e){if(e.Component===t.SchemaSettingsConnectDataBlocks){var r=e.useVisible||function(){return!0};e.useVisible=function(){var e=(0,t.usePlugin)(to);return r()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}};function e4(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function e6(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){e4(i,n,o,a,l,"next",e)}function l(e){e4(i,n,o,a,l,"throw",e)}a(void 0)})}}function e5(e,t,r){return(e5=tt()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&e9(o,r.prototype),o}).apply(null,arguments)}function e8(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function e7(e){return(e7=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e9(e,t){return(e9=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(e){var t="function"==typeof Map?new Map:void 0;return(te=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,r)}function r(){return e5(e,arguments,e7(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e9(r,e)})(e)}function tt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tt=function(){return!!e})()}function tr(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var tn=new WeakMap,to=function(r){var n;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function o(){var e,r,n;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return r=o,n=arguments,r=e7(r),e8(e=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tt()?Reflect.construct(r,n||[],e7(this).constructor):r.apply(this,n)),"templateInfos",new Map),e8(e,"templateschemacache",{}),e8(e,"pageBlocks",{}),e8(e,"savedSchemaUids",new Set),e8(e,"injectInitializers",["page:addBlock","popup:common:addBlock","popup:addNew:addBlock","mobile:addBlock","mobile:popup:common:addBlock"]),e8(e,"setTemplateCache",function(t){t&&(e.templateschemacache[t["x-uid"]]=t)}),e8(e,"clearTemplateCache",function(t){delete e.templateschemacache[t]}),function(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}(e,tn,{writable:!0,value:function(){var r=setInterval(function(){if(!e.app.loading){clearInterval(r),e2(e.injectInitializers,e.app);var n=e.app.schemaSettingsManager.getAll();for(var o in n)!function(r){var n=e.app.schemaSettingsManager.get(r);if(n&&!r.startsWith("fieldSettings:component:")){for(var o=0;o<n.items.length;o++)e0(n.items[o],n.items[o-1],n.items[o+1]),e3(n.items[o]),e1(n.items[o],n.items[o-1]);var i=n.items.findIndex(function(e,t){var r=n.items[t+1];return"divider"===e.type&&((null==r?void 0:r.name)==="delete"||(null==r?void 0:r.name)==="remove")});-1===i||n.items.find(function(e){return"template-revertSettingItem"===e.name})?(n.add("template-revertSettingItem",eG),n.add("template-convertToNormalBlockSettingItem",eR)):n.items.splice(i,0,eG,eR),n.add("template-disabledDeleteItem",eN)}if(["blockSettings:calendar","blockSettings:createForm","blockSettings:details","blockSettings:detailsWithPagination","blockSettings:stepsForm","blockSettings:filterCollapse","blockSettings:filterForm","blockSettings:gantt","blockSettings:gridCard","blockSettings:kanban","blockSettings:list","blockSettings:table","blockSettings:tree","ReadPrettyFormSettings","GanttBlockSettings","FormV1Settings","FormSettings","FormItemSettings","FormDetailsSettings"].includes(r)){var a,l,c=n.items.findIndex(function(e){return e.Component===t.SchemaSettingsTemplate||e.Component===t.SchemaSettingsFormItemTemplate});-1!==c&&n.items.splice(c+1,0,(a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){e8(e,t,r[t])})}return e}({},eY),l=l={sort:n.items[c].sort},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a))}}(o)}},1e3)}}),e}return o.prototype=Object.create(r&&r.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),r&&e9(o,r),n=[{key:"afterAdd",value:function(){return e6(function(){return tr(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return e6(function(){return tr(this,function(e){return[2]})})()}},{key:"load",value:function(){var r=this;return e6(function(){var n,o,i,a,l,c,s,p;return tr(this,function(f){var d,m,v,y,b,h,x;e.Schema.registerPatches(function(e){if(e["x-template-infos"]){for(var t in e["x-template-infos"]){var n=e["x-template-infos"][t];r.templateInfos.set(t,n)}delete e["x-template-infos"]}if(e["x-template-schemas"]){for(var o in e["x-template-schemas"]){var i=e["x-template-schemas"][o];r.templateschemacache[o]=i}delete e["x-template-schemas"]}if(e["x-template-root-uid"]&&(e.version||e["x-template-root-ref"])){var a=function e(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,i=t["x-uid"],a=t["x-template-root-uid"],l=t["x-block-template-key"],c=t;if(a)c=function t(r,n,o,i,a,l){return r.properties&&!n.properties&&(n.properties={}),w.mergeWith(r,n,function(n,c,u,s,p){if(null==c)return n;if("default"===u&&"actionSettings:filter"===s["x-settings"])return c||n;if(w.isObject(c)){if(w.isArray(c))return c||n;if("properties"===u){var f=Object.keys(c),d=Object.keys(n||{});if(ek.includes(p["x-component"])&&ek.includes(s["x-component"])){var m=new Map,v=new Map;eO(s,m),eO(p,v);var y=!0,b=!1,h=void 0;try{for(var x,g=v.entries()[Symbol.iterator]();!(y=(x=g.next()).done);y=!0){var S=ed(x.value,2),k=(S[0],S[1]);if(k.schema["x-template-uid"]){var O=m.get(k.schema["x-template-uid"]);if(O){var P=t(O.schema||{},k.schema,k.schema["x-template-root-uid"]||o,i,a,l);k.path[k.path.length-1].schema.properties[k.key]=P,k.schema=P,m.delete(k.schema["x-template-uid"])}}}}catch(e){b=!0,h=e}finally{try{y||null==g.return||g.return()}finally{if(b)throw h}}s.properties=n=ew(m),d=Object.keys(n)}if("CollectionField"===s["x-component"]){var j=!0,C=!1,A=void 0;try{for(var T,E=f[Symbol.iterator]();!(j=(T=E.next()).done);j=!0)!function(){var e,r=T.value,u=null==(e=c[r])?void 0:e["x-component"];if(["Action.Container","AssociationField.Viewer","AssociationField.Selector","AssociationField.Nester","AssociationField.SubTable"].includes(u)){var s=d.find(function(e){return n[e]["x-component"]===u});s&&(c[r]["x-template-uid"]=n[s]["x-uid"],c[r]=t(n[s]||{},c[r],o,i,a,l),d=d.filter(function(e){return e!==s}))}}()}catch(e){C=!0,A=e}finally{try{j||null==E.return||E.return()}finally{if(C)throw A}}}if(/:configure.*Actions/.test(s["x-initializer"])){var F=!0,D=!1,I=void 0;try{for(var B,M=f[Symbol.iterator]();!(F=(B=M.next()).done);F=!0)!function(){var e=B.value;if("filterForm:configureActions"===s["x-initializer"]){var t,r,o,i,a=null==(i=c[e])?void 0:i["x-use-component-props"];if(a&&["useFilterBlockActionProps","useResetBlockActionProps"].includes(a)){var l=w.remove(d,function(e){var t,r=null==(t=n[e])?void 0:t["x-use-component-props"];return a===r});l.length>0&&(c[e]["x-template-uid"]=n[l[0]]["x-uid"])}}if((null==(t=c[e])?void 0:t["x-component"])&&(null==(o=c[e])||null==(r=o["x-settings"])?void 0:r.includes("actionSettings"))){var u=c[e]["x-settings"].split(":")[1],p=["bulkDelete","filter","refresh","delete","print","stepsFormNext","stepsFormPrevious","disassociate","MailSend","MailRefresh","MailAccountSetting","MailMarkAsRead","MailMarkAsUnRead"].find(function(e){return e===u});if(p){var f=w.remove(d,function(e){var t;return(null==(t=n[e])?void 0:t["x-settings"])==="actionSettings:".concat(p)});f.length>0&&(c[e]["x-template-uid"]=n[f[0]]["x-uid"])}}}()}catch(e){D=!0,I=e}finally{try{F||null==M.return||M.return()}finally{if(D)throw I}}}var R=!0,q=!1,N=void 0;try{for(var G,V=f[Symbol.iterator]();!(R=(G=V.next()).done);R=!0)!function(){var e=G.value;if(null==(t=s["x-initializer"])?void 0:t.includes(":configureColumns")){if(c[e]["x-component"]&&"fieldSettings:TableColumn"===c[e]["x-settings"]){var t,r,o,i=Object.values((null==(o=c[e])?void 0:o.properties)||{})[0],a=w.get(i,"x-collection-field");if(a){var l=null,u=w.remove(d,function(e){l=Object.values((null==(t=n[e])?void 0:t.properties)||{})[0];var t,r=w.get(l,"x-collection-field");return a===r});u.length>0&&(c[e]["x-template-uid"]=n[u[0]]["x-uid"],i["x-template-uid"]=null==l?void 0:l["x-uid"])}}if(null==(r=c[e]["x-initializer"])?void 0:r.includes(":configureItemActions")){var p=w.remove(d,function(e){var t,r;return null==(r=n[e])||null==(t=r["x-initializer"])?void 0:t.includes(":configureItemActions")});p.length>0&&(c[e]["x-template-uid"]=n[p[0]]["x-uid"])}}}()}catch(e){q=!0,N=e}finally{try{R||null==V.return||V.return()}finally{if(q)throw N}}if(/:configureFields/.test(p["x-initializer"])){var z=new Map;eO(s,z);var _=Array.from(z.values()),U=!0,J=!1,L=void 0;try{for(var K,W=f[Symbol.iterator]();!(U=(K=W.next()).done);U=!0){var $=K.value,H=new Map;eO(c[$],H);var X=!0,Q=!1,Y=void 0;try{for(var Z,ee=H.entries()[Symbol.iterator]();!(X=(Z=ee.next()).done);X=!0)!function(){var e=ed(Z.value,2),r=(e[0],e[1]),n=w.get(r.schema,"x-collection-field");if(n){var c=w.find(_,function(e){return e.schema["x-collection-field"]===n});c&&(z.delete(c.schema["x-uid"]),r.schema["x-template-uid"]=c.schema["x-uid"],r.schema=t(c.schema||{},r.schema,r.schema["x-template-root-uid"]||o,i,a,l))}}()}catch(e){Q=!0,Y=e}finally{try{X||null==ee.return||ee.return()}finally{if(Q)throw Y}}s.properties=n=ew(z),d=Object.keys(n)}}catch(e){J=!0,L=e}finally{try{U||null==W.return||W.return()}finally{if(J)throw L}}}if("DndContext"===r["x-decorator"]){var et=!0,er=!1,en=void 0;try{for(var eo,ei=f[Symbol.iterator]();!(et=(eo=ei.next()).done);et=!0)!function(){var e=eo.value,t=c[e]["x-settings"];if(c[e]["x-component"]&&["actionSettings:disassociate","actionSettings:delete"].includes(t)){var r=w.remove(d,function(e){var r;return(null==(r=n[e])?void 0:r["x-settings"])===t});r.length>0&&(c[e]["x-template-uid"]=n[r[0]]["x-uid"])}}()}catch(e){er=!0,en=e}finally{try{et||null==ei.return||ei.return()}finally{if(er)throw en}}}var el=w.difference(d,f);if(el.length>0){var ec=w.cloneDeep(w.pick(n,el)),eu=!0,es=!1,ep=void 0;try{for(var ef,ev=el[Symbol.iterator]();!(eu=(ef=ev.next()).done);eu=!0)!function(){var e=ef.value,r=ea(ec[e],!0,!1,o,l),n=r["x-uid"],u=w.findKey(c,function(e){return e["x-uid"]===n});u?c[u]=t(ec[e]||{},c[u],o,i,a,l):(r.name=e,c[e]=r)}()}catch(e){es=!0,ep=e}finally{try{eu||null==ev.return||ev.return()}finally{if(es)throw ep}}}for(var ey={},eb=Object.keys(c),eh=0;eh<eb.length;eh++){var ex=eb[eh];ey[ex]=t((null==n?void 0:n[ex])||{},null==c?void 0:c[ex],o,i,a,l),ey[ex]["x-template-root-uid"]&&(ey[ex]=e(ey[ex],i,a))}var eg=[];for(var eS in ey)if(ey[eS]["x-index"]){var eP,ej=ey[eS]["x-index"];eg.includes(ej)&&(ey[eS]["x-index"]=(eP=Math).max.apply(eP,em(eg))+1),eg.push(ey[eS]["x-index"])}return ey}return t(n||{},c,o,i,a,l)}return c})}(w.cloneDeep(r[a])||{},t,i,r,n,l);else for(var u in t.properties){var s=t.properties[u];t.properties[u]=e(s,r,n,o),null==t.properties[u]["x-component"]&&delete t.properties[u]}return eg(c),eS(c,n,o),!function e(t){var r=(null==t?void 0:t.properties)||{},n=!0,o=!1,i=void 0;try{for(var a,l=Object.keys(r)[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var c=a.value;if(null==t.properties[c]["x-component"]&&t.properties[c]["x-template-id"]&&!t.properties[c]["x-template-root-id"]&&function(e){if(!e["x-no-component"])return!0;var t=null==e?void 0:e.properties;return t&&Object.values(t).some(function(e){return null==e["x-component"]})}(t.properties[c])&&delete t.properties[c],(null==(m=r[c])?void 0:m["x-component-props"])===null&&delete r[c]["x-component-props"],(null==(v=r[c])?void 0:v["x-component"])==="Grid.Row"){var u=!1,s=Object.values((null==(y=r[c])?void 0:y.properties)||{}),p=!0,f=!1,d=void 0;try{for(var m,v,y,b,h=s[Symbol.iterator]();!(p=(b=h.next()).done);p=!0){var x=b.value;"Grid.Col"!==x["x-component"]||w.isEmpty(x.properties)||(u=!0)}}catch(e){f=!0,d=e}finally{try{p||null==h.return||h.return()}finally{if(f)throw d}}u||delete r[c]}e(r[c])}}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}}(c),c}(e,r.templateschemacache,r.templateInfos,r.savedSchemaUids);return r.pageBlocks[a["x-uid"]]=a,a}return e}),d=r.app.apiClient,m=r.pageBlocks,v=r.savedSchemaUids,y=function(e){var t=eb(m,e),r=function(e){if((null==e?void 0:e["x-virtual"])&&v.add(e["x-uid"]),null==e?void 0:e.properties)for(var t in e.properties)r(e.properties[t])};r(ey(t,e))},d.axios.interceptors.request.use((b=function(e){var t,r,n,o,i,a,l,c,u,s,p,f,v,b,h,x,g,S,k,O,w,P,j,C,A,T,E,F,D,I,B,M,R,q;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(N){switch(N.label){case 0:var G,V,z;if(!((null==(t=e.url)?void 0:t.includes("uiSchemas:patch"))||(null==(r=e.url)?void 0:r.includes("uiSchemas:initializeActionContext"))))return[3,8];G=ey(l=eb(m,a=null==(i=e.data)?void 0:i["x-uid"]),a),V=new Set,(z=function(e){if(e){if(e["x-virtual"])return void V.add(e["x-uid"]);if(e.properties)for(var t in e.properties)z(e.properties[t])}})(G),c=V,u=!0,s=!1,p=void 0,N.label=1;case 1:N.trys.push([1,6,7,8]),f=c[Symbol.iterator](),N.label=2;case 2:if(u=(v=f.next()).done)return[3,5];if(b=v.value,!(h=eh(l,b)))return[3,4];return x=ex(h.schema),[4,d.request({url:"/blockTemplates:saveSchema/".concat(h.insertTarget,"?position=").concat(h.insertPosition),method:"post",data:{schema:x}})];case 3:N.sent(),y(h.schema["x-uid"]),N.label=4;case 4:return u=!0,[3,2];case 5:return[3,8];case 6:return g=N.sent(),s=!0,p=g,[3,8];case 7:try{u||null==f.return||f.return()}finally{if(s)throw p}return[7];case 8:if(!(null==(n=e.url)?void 0:n.includes("uiSchemas:batchPatch")))return[3,16];S=e.data,k=!0,O=!1,w=void 0,N.label=9;case 9:N.trys.push([9,14,15,16]),P=S[Symbol.iterator](),N.label=10;case 10:if(k=(j=P.next()).done)return[3,13];if(!(A=eh(eb(m,(C=j.value)["x-uid"]),C["x-uid"])))return[3,12];return[4,d.request({url:"/blockTemplates:saveSchema/".concat(A.insertTarget,"?position=").concat(A.insertPosition),method:"post",data:{schema:ex(A.schema)}})];case 11:N.sent(),y(A.schema["x-uid"]),N.label=12;case 12:return k=!0,[3,10];case 13:return[3,16];case 14:return g=N.sent(),O=!0,w=g,[3,16];case 15:try{k||null==P.return||P.return()}finally{if(O)throw w}return[7];case 16:if(!(null==(o=e.url)?void 0:o.includes("uiSchemas:insertAdjacent")))return[3,20];if(F=e.url.split("/").pop(),D=null==(T=e.data)?void 0:T.wrap,I=null==(E=e.data)?void 0:E.schema,B=null==F?void 0:F.split("?")[0],M=I["x-uid"]||I,!(R=eh(eb(m,B),B,D)))return[3,18];return[4,d.request({url:"/blockTemplates:saveSchema/".concat(R.insertTarget,"?position=").concat(R.insertPosition),method:"post",data:{schema:ex(R.schema,[M,null==D?void 0:D["x-uid"]].filter(Boolean))}})];case 17:N.sent(),y(R.schema["x-uid"]),N.label=18;case 18:if(!((q=eh(eb(m,M),M,D))&&q.insertTarget))return[3,20];return[4,d.request({url:"/blockTemplates:saveSchema/".concat(q.insertTarget,"?position=").concat(q.insertPosition),method:"post",data:{schema:ex(q.schema,[M,null==D?void 0:D["x-uid"]].filter(Boolean))}})];case 19:N.sent(),y(q.schema["x-uid"]),D&&y(D["x-uid"]),N.label=20;case 20:return[2,e]}})},h=function(){var e=this,t=arguments;return new Promise(function(r,n){var o=b.apply(e,t);function i(e){eZ(o,r,n,i,a,"next",e)}function a(e){eZ(o,r,n,i,a,"throw",e)}i(void 0)})},function(e){return h.apply(this,arguments)})),r.app.addComponents({TemplateGridDecorator:eE}),r.app.addProviders([et]),i=!0,a=!1,l=void 0;try{for(c=r.injectInitializers[Symbol.iterator]();!(i=(s=c.next()).done);i=!0)p=s.value,r.app.schemaInitializerManager.addItem(p,"otherBlocks.templates",es)}catch(e){a=!0,l=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw l}}return(x=function(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(r,tn,0),x.get?x.get.call(r):x.value).call(r),r.app.pluginSettingsManager.add("block-templates",{title:'{{t("Block templates (deprecated)", { ns: "'.concat(u,'" })}}'),icon:"ProfileOutlined",sort:1e3}),r.app.pluginSettingsManager.add("block-templates.reference",{title:'{{t("Reference template")}}',Component:t.BlockTemplatesPane}),r.app.pluginSettingsManager.add("block-templates.inherited",{title:'{{t("Inherited template")}}',Component:z}),r.app.pluginSettingsManager.add("block-templates/inherited/:key",{title:!1,pluginKey:"block-templates",isTopLevel:!1,Component:J}),null==(o=r.app.pluginManager.get("mobile"))||null==(n=o.mobileRouter)||n.add("mobile.schema.blockTemplate",{path:"/block-templates/inherited/:key/:pageSchemaUid",Component:W}),[2]})})()}},{key:"isInBlockTemplateConfigPage",value:function(){var e,t=(null==(e=this.app.pluginManager.get("mobile"))?void 0:e.mobileBasename)+"/block-templates/inherited";return window.location.pathname.includes("admin/settings/block-templates/inherited")||window.location.pathname.includes(t)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(o.prototype,n),o}(te(t.Plugin)),ti=to}(),y}()});
@@ -9,22 +9,22 @@
9
9
 
10
10
  module.exports = {
11
11
  "@formily/json-schema": "2.3.7",
12
- "@nocobase/client": "2.0.0-alpha.3",
13
- "@nocobase/plugin-mobile": "2.0.0-alpha.3",
12
+ "@nocobase/client": "2.0.0-alpha.5",
13
+ "@nocobase/plugin-mobile": "2.0.0-alpha.5",
14
14
  "lodash": "4.17.21",
15
- "@nocobase/server": "2.0.0-alpha.3",
15
+ "@nocobase/server": "2.0.0-alpha.5",
16
16
  "react": "18.2.0",
17
17
  "antd": "5.24.2",
18
18
  "@ant-design/icons": "5.6.1",
19
19
  "@formily/core": "2.3.7",
20
- "@nocobase/utils": "2.0.0-alpha.3",
20
+ "@nocobase/utils": "2.0.0-alpha.5",
21
21
  "ahooks": "3.7.8",
22
22
  "react-router-dom": "6.30.1",
23
23
  "react-router": "6.30.1",
24
24
  "@formily/react": "2.3.7",
25
25
  "axios": "1.7.7",
26
- "@nocobase/actions": "2.0.0-alpha.3",
27
- "@nocobase/database": "2.0.0-alpha.3",
28
- "@nocobase/plugin-ui-schema-storage": "2.0.0-alpha.3",
26
+ "@nocobase/actions": "2.0.0-alpha.5",
27
+ "@nocobase/database": "2.0.0-alpha.5",
28
+ "@nocobase/plugin-ui-schema-storage": "2.0.0-alpha.5",
29
29
  "sequelize": "6.35.2"
30
30
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "区块:模板(已废弃)",
5
5
  "description": "Create and manage block templates for reuse on pages.",
6
6
  "description.zh-CN": "创建和管理区块模板,用于在页面中重复使用。",
7
- "version": "2.0.0-alpha.3",
7
+ "version": "2.0.0-alpha.5",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/block-template",
@@ -19,5 +19,5 @@
19
19
  "Block",
20
20
  "Template"
21
21
  ],
22
- "gitHead": "8efc23aa78058d871e98a91419f3c4a61762cc15"
22
+ "gitHead": "943e035bbec27f9ecfe8ce8857955945f20976f3"
23
23
  }