@nocobase/plugin-block-iframe 2.1.0-alpha.1 → 2.1.0-alpha.10

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/README.md CHANGED
@@ -1,17 +1,24 @@
1
1
  # NocoBase
2
2
 
3
3
  <video width="100%" controls>
4
- <source src="https://static-docs.nocobase.com/NocoBase0510.mp4" type="video/mp4">
4
+ <source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
5
5
  </video>
6
6
 
7
+ <p align="center">
8
+ <a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
9
+ <a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability&#0045;first&#0044;&#0032;open&#0045;source&#0032;no&#0045;code&#0032;platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
10
+ </p>
7
11
 
8
12
  ## What is NocoBase
9
13
 
10
- NocoBase is a scalability-first, open-source no-code development platform.
11
- Instead of investing years of time and millions of dollars in research and development, deploy NocoBase in a few minutes and you'll have a private, controllable, and extremely scalable no-code development platform!
14
+ NocoBase is the most extensible AI-powered no-code platform.
15
+ Total control. Infinite extensibility. AI collaboration.
16
+ Enable your team to adapt quickly and cut costs dramatically.
17
+ No years of development. No millions wasted.
18
+ Deploy NocoBase in minutes — and take control of everything.
12
19
 
13
20
  Homepage:
14
- https://www.nocobase.com/
21
+ https://www.nocobase.com/
15
22
 
16
23
  Online Demo:
17
24
  https://demo.nocobase.com/new
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
19
26
  Documents:
20
27
  https://docs.nocobase.com/
21
28
 
22
- Commericial license & plugins:
23
- https://www.nocobase.com/en/commercial
29
+ Forum:
30
+ https://forum.nocobase.com/
24
31
 
25
- License agreement:
26
- https://www.nocobase.com/en/agreement
32
+ Use Cases:
33
+ https://www.nocobase.com/en/blog/tags/customer-stories
27
34
 
35
+ ## Release Notes
28
36
 
29
- ## Contact Us:
30
- hello@nocobase.com
37
+ Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
38
+
39
+ ## Distinctive features
40
+
41
+ ### 1. Data model-driven, not form/table–driven
42
+
43
+ Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
44
+
45
+ - UI and data structure are fully decoupled
46
+ - Multiple blocks and actions can be created for the same table or record in any quantity or form
47
+ - Supports the main database, external databases, and third-party APIs as data sources
48
+
49
+ ![model](https://static-docs.nocobase.com/model.png)
50
+
51
+ ### 2. AI employees, integrated into your business systems
52
+ Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
53
+
54
+ - Define AI employees for roles such as translator, analyst, researcher, or assistant
55
+ - Seamless AI–human collaboration in interfaces and workflows
56
+ - Ensure AI usage is secure, transparent, and customizable for your business needs
57
+
58
+ ![AI-employee](https://static-docs.nocobase.com/ai-employee-home.png)
59
+
60
+ ### 3. What you see is what you get, incredibly easy to use
61
+
62
+ While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
63
+
64
+ - One-click switch between usage mode and configuration mode
65
+ - Pages serve as a canvas to arrange blocks and actions, similar to Notion
66
+ - Configuration mode is designed for ordinary users, not just programmers
67
+
68
+ ![wysiwyg](https://static-docs.nocobase.com/wysiwyg.gif)
69
+
70
+ ### 4. Everything is a plugin, designed for extension
71
+ Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
72
+
73
+ - All functionalities are plugins, similar to WordPress
74
+ - Plugins are ready to use upon installation
75
+ - Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
76
+
77
+ ![plugins](https://static-docs.nocobase.com/plugins.png)
78
+
79
+ ## Installation
80
+
81
+ NocoBase supports three installation methods:
82
+
83
+ - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
84
+
85
+ Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
86
+
87
+ - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
88
+
89
+ The business code of the project is completely independent and supports low-code development.
90
+
91
+ - <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
92
+
93
+ If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
94
+
95
+ ## How NocoBase works
96
+
97
+ <video width="100%" controls>
98
+ <source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
99
+ </video>
@@ -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/shared"),require("@nocobase/client"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@formily/react"),require("@ant-design/icons"),require("@emotion/css"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-iframe",["@formily/shared","@nocobase/client","@formily/antd-v5","react","@nocobase/flow-engine","@formily/react","@ant-design/icons","@emotion/css","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-block-iframe"]=t(require("@formily/shared"),require("@nocobase/client"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@formily/react"),require("@ant-design/icons"),require("@emotion/css"),require("antd"),require("react-i18next")):e["@nocobase/plugin-block-iframe"]=t(e["@formily/shared"],e["@nocobase/client"],e["@formily/antd-v5"],e.react,e["@nocobase/flow-engine"],e["@formily/react"],e["@ant-design/icons"],e["@emotion/css"],e.antd,e["react-i18next"])}(self,function(e,t,r,n,o,l,a,i,c,u){return function(){"use strict";var s={753:function(e){var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;e.exports=!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==n.join(""))return!1;var o={};if("abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},o)).join(""))return!1;return!0}catch(e){return!1}}()?function(e,o){for(var l,a,i=function(e){if(null==e)throw TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in l=Object(arguments[c]))r.call(l,u)&&(i[u]=l[u]);if(t){a=t(l);for(var s=0;s<a.length;s++)n.call(l,a[s])&&(i[a[s]]=l[a[s]])}}return i}:Object.assign},482:function(e){e.exports=a},964:function(e){e.exports=i},632:function(e){e.exports=r},505:function(e){e.exports=l},875:function(t){t.exports=e},772:function(e){e.exports=t},667:function(e){e.exports=o},721:function(e){e.exports=c},156:function(e){e.exports=n},238:function(e){e.exports=u}},p={};function m(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={exports:{}};return s[e](r,r.exports,m),r.exports}m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},m.d=function(e,t){for(var r in t)m.o(t,r)&&!m.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},m.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};return!function(){m.r(d),m.d(d,{PluginBlockIframeClient:function(){return el},default:function(){return ea}});var e=m(772),t=m(156),r=m.n(t),n=m(632),o=m(505),l=m(721),a=m(238),i=m(753),c=m.n(i),u=({url:e,allowFullScreen:t,position:n,display:o,height:l,width:a,overflow:i,styles:u,onLoad:s,onMouseOver:p,onMouseOut:m,scrolling:d,id:f,frameBorder:h,ariaHidden:y,sandbox:b,allow:g,className:v,title:w,ariaLabel:O,ariaLabelledby:x,name:E,target:P,loading:j,importance:S,referrerpolicy:I,allowpaymentrequest:k,src:C,key:M})=>{let T=c()({src:C||e,target:P||null,style:{position:n||null,display:o||"initial",overflow:i||null},scrolling:d||null,allowpaymentrequest:k||null,importance:S||null,sandbox:b&&[...b].join(" ")||null,loading:j||null,styles:u||null,name:E||null,className:v||null,allowFullScreen:"allowFullScreen",referrerpolicy:I||null,title:w||null,allow:g||null,id:f||null,"aria-labelledby":x||null,"aria-hidden":y||null,"aria-label":O||null,width:a||null,height:l||null,onLoad:s||null,onMouseOver:p||null,onMouseOut:m||null,key:M||"iframe"}),R=Object.create(null);for(let e of Object.keys(T))null!=T[e]&&(R[e]=T[e]);for(let e of Object.keys(R.style))null==R.style[e]&&delete R.style[e];if(R.styles)for(let e of Object.keys(R.styles))R.styles.hasOwnProperty(e)&&(R.style[e]=R.styles[e]),Object.keys(R.styles).pop()==e&&delete R.styles;if(t)if("allow"in R){let e=R.allow.replace("fullscreen","");R.allow=`fullscreen ${e.trim()}`.trim()}else R.allow="fullscreen";return h>=0&&!R.style.hasOwnProperty("border")&&(R.style.border=h),r().createElement("iframe",Object.assign({},R))},s=m(875);function p(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){p(l,n,o,a,i,"next",e)}function i(e){p(l,n,o,a,i,"throw",e)}a(void 0)})}}function h(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 y(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];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}}}}function b(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 g(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function v(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}var w=(0,o.observer)(function(n){var i,c=n.url,s=n.htmlId,p=n.mode,m=void 0===p?"url":p,d=n.height,f=(n.html,n.params),h=n.engine,y=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(n,["url","htmlId","mode","height","html","params","engine"]),w=(0,o.useField)(),O=(0,a.useTranslation)().t,x=l.theme.useToken().token,E=(0,e.useBlockHeight)()||d,P=(0,e.useVariables)(),j=(0,e.useLocalVariables)(),S=(0,e.useCompile)(),I=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(s)},{refreshDeps:[s,w.data],ready:"html"===m&&!!s}),k=I.loading,C=I.data,M=(0,e.useParseURLAndParams)().parseURLAndParams,T=(i=(0,t.useState)(null),function(e){if(Array.isArray(e))return e}(i)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw n}}return l}}(i,2)||function(e,t){if(e){if("string"==typeof e)return b(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 b(e,t)}}(i,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.")}()),R=T[0],D=T[1];return((0,t.useEffect)(function(){var t,r;(t=function(){var t;return function(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];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(r){switch(r.label){case 0:if("html"!==m)return[3,2];return[4,(0,e.getRenderContent)(h,C,S(P),S(j),function(e){return e})];case 1:if(void 0===(t=r.sent()))return[2];return D("data:text/html;charset=utf-8,"+encodeURIComponent(t)),[3,5];case 2:return r.trys.push([2,4,,5]),[4,M(c,f||[])];case 3:return D(r.sent()),[3,5];case 4:return console.error("Error fetching target URL:",r.sent()),D("fallback-url"),[3,5];case 5:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,o){var l=t.apply(e,r);function a(e){g(l,n,o,a,i,"next",e)}function i(e){g(l,n,o,a,i,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})()},[C,m,c,P,j,f]),("url"!==m||c)&&("html"!==m||s))?k&&!R?r().createElement("div",{style:{height:v(E)?"".concat(E,"px"):E||"60vh",marginBottom:x.padding,border:0}},r().createElement(l.Spin,null)):r().createElement(u,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}({url:R,width:"100%",display:"block",position:"relative",styles:{height:v(E)?"".concat(E,"px"):E||"60vh",marginBottom:"24px",border:0}},y)):r().createElement(l.Card,{style:{marginBottom:x.padding,height:v(E)?"".concat(E,"px"):E}},O("Please fill in the iframe URL"))},{displayName:"Iframe"});w.Designer=function(){var t,n,l=(0,o.useField)(),i=(0,o.useFieldSchema)(),c=(0,a.useTranslation)().t,u=(0,e.useDesignable)().dn,p=(0,e.useAPIClient)(),m=i["x-component-props"]||{},d=m.mode,b=m.url,g=m.htmlId,v=m.height,w=void 0===v?"60vh":v;m.engine;var O=(t=f(function(e){var t,r,n,o,l,a,i,c;return y(this,function(u){switch(u.label){case 0:var s,m;if(t={values:{html:e}},!g)return[3,2];return[4,null==(r=(n=p.resource("iframeHtml")).update)?void 0:r.call(n,(s=h({},t),m=m={filterByTk:g},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(m)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(m)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(m,e))}),s))];case 1:return[2,(null==(l=u.sent().data)||null==(o=l.data)?void 0:o[0])||{id:g}];case 2:return[4,null==(a=(i=p.resource("iframeHtml")).create)?void 0:a.call(i,t)];case 3:return[2,null==(c=u.sent().data)?void 0:c.data];case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),x=(n=f(function(e){var t,r,n,o,a,c,p;return y(this,function(m){switch(m.label){case 0:if(t=e.mode,r=e.url,n=e.html,o=e.height,a=e.engine,(c=i["x-component-props"]||{}).mode=t,c.height=o,c.url=r,c.engine=a||"string","html"!==t)return[3,2];return[4,O(n)];case 1:p=m.sent(),c.htmlId=p.id,m.label=2;case 2:return i["x-component-props"]=c,l.componentProps=h({},c),l.data={v:(0,s.uid)()},u.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":c}}),[2]}})}),function(e){return n.apply(this,arguments)}),E=(0,e.useFormBlockContext)().form,P=(0,e.useRecord)(),j=(0,e.useVariableOptions)({collectionField:{uiSchema:i},form:E,record:P,uiSchema:i,noDisabled:!0});return r().createElement(e.GeneralSchemaDesigner,null,r().createElement(e.SchemaSettingsModalItem,{title:c("Edit iframe"),asyncGetInitialValues:f(function(){var e,t,r,n,o;return y(this,function(l){switch(l.label){case 0:if(e={mode:d,url:b,height:w},!g)return[3,2];return[4,null==(t=(r=p.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:g})];case 1:o=l.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",l.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:c("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:c("URL")},{value:"html",label:c("HTML")}]},url:{title:c("URL"),type:"string","x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:j},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",enum:[{value:"string",label:c("String template")},{value:"handlebars",label:c("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:c("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:j,style:{minHeight:"200px"}},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},height:{title:c("Height"),type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},onSubmit:x}),r().createElement(e.SchemaSettingsDivider,null),r().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))};var O=m(482),x=function(){var t,n,o=(0,e.useSchemaInitializer)().insert,l=(0,e.useSchemaInitializerItem)();return r().createElement(e.SchemaInitializerItem,(t=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}({},l),n=n={icon:r().createElement(O.PicRightOutlined,null),onClick:function(){o({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},E=function(t){return r().createElement(e.SchemaComponentOptions,{components:{Iframe:w,IframeBlockInitializer:x,ArrayItems:n.ArrayItems}},t.children)};function P(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function j(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){P(l,n,o,a,i,"next",e)}function i(e){P(l,n,o,a,i,"throw",e)}a(void 0)})}}function S(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 I(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 k(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];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 C=function(t){return r().createElement(e.FlagProvider,{collectionField:!0},t.children)},M=function(e){var t=e.type,n=(0,a.useTranslation)(),o=n.t,i=n.i18n,c={autoplay:o("Controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is disabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a NotAllowedError DOMException. The autoplay attribute on <audio> and <video> elements will be ignored."),camera:o("Controls whether the current document is allowed to use video input devices. When this policy is disabled, the Promise returned by getUserMedia() will reject with a NotAllowedError DOMException."),"document-domain":o("Controls whether the current document is allowed to set document.domain. When this policy is disabled, attempting to set document.domain will fail and cause a SecurityError DOMException to be thrown."),"encrypted-media":o("Controls whether the current document is allowed to use the Encrypted Media Extensions API (EME). When this policy is disabled, the Promise returned by Navigator.requestMediaKeySystemAccess() will reject with a SecurityError DOMException."),fullscreen:o("Controls whether the current document is allowed to use Element.requestFullscreen(). When this policy is disabled, the returned Promise rejects with a TypeError."),geolocation:o("Controls whether the current document is allowed to use the Geolocation Interface. When this policy is disabled, calls to getCurrentPosition() and watchPosition() will cause those functions callbacks to be invoked with a GeolocationPositionError code of PERMISSION_DENIED."),microphone:o("Controls whether the current document is allowed to use audio input devices. When this policy is disabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError DOMException."),midi:o("Controls whether the current document is allowed to use the Web MIDI API. When this policy is disabled, the Promise returned by Navigator.requestMIDIAccess() will reject with a SecurityError DOMException."),payment:o("Controls whether the current document is allowed to use the Payment Request API. When this policy is enabled, the PaymentRequest() constructor will throw a SecurityError DOMException.")}[t];return r().createElement("span",null,t," ",r().createElement(l.Tooltip,{zIndex:9999,title:r().createElement("span",null,c," ",r().createElement("a",{href:"https://developer.mozilla.org/".concat("zh-CN"===i.language?"zh-CN":"en-US","/docs/Web/HTTP/Reference/Headers/Permissions-Policy/").concat(t),target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},r().createElement(O.QuestionCircleOutlined,null)))},T=function(){var e=(0,a.useTranslation)(),t=e.t,n="zh-CN"===e.i18n.language?"https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe#allow":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow";return r().createElement("span",null,t("Specifies a Permissions Policy for the <iframe>. The policy defines what features are available to the <iframe> (for example, access to the microphone, camera, battery, web-share, etc.) based on the origin of the request.")," ",r().createElement("a",{href:n,target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},R={items:[{name:"EditIframe",type:"modal",useComponentProps:function(){var t,n,i,c=(0,o.useField)(),u=(0,o.useFieldSchema)(),p=(0,a.useTranslation)(),m=p.t,d=p.i18n,f=(0,e.useDesignable)().dn,h=(0,e.useAPIClient)(),y=u["x-component-props"]||{},b=y.mode,g=y.url,v=y.params,w=y.htmlId,O=y.height,x=void 0===O?"60vh":O,E=y.engine,P=y.allow,R=(t=j(function(e){var t,r,n,o,l,a,i,c;return k(this,function(u){switch(u.label){case 0:if(t={values:{html:e}},!w)return[3,2];return[4,null==(r=(n=h.resource("iframeHtml")).update)?void 0:r.call(n,I(S({},t),{filterByTk:w}))];case 1:return[2,(null==(l=u.sent().data)||null==(o=l.data)?void 0:o[0])||{id:w}];case 2:return[4,null==(a=(i=h.resource("iframeHtml")).create)?void 0:a.call(i,t)];case 3:return[2,null==(c=u.sent().data)?void 0:c.data];case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),D=(0,e.useURLAndHTMLSchema)(),q=D.urlSchema,A=D.paramsSchema,B=(n=j(function(e){var t,r,n,o,l,a,i,p,m;return k(this,function(d){switch(d.label){case 0:if(t=e.mode,r=e.url,n=e.html,o=e.height,l=e.params,a=e.engine,i=e.allow,(p=u["x-component-props"]||{}).mode=t,p.height=o,p.engine=a||"string",p.params=l,p.url=r,p.allow=i,"html"!==t)return[3,2];return[4,R(n)];case 1:m=d.sent(),p.htmlId=m.id,d.label=2;case 2:return u["x-component-props"]=p,c.componentProps=S({},p),c.data={v:(0,s.uid)()},f.emit("patch",{schema:{"x-uid":u["x-uid"],"x-component-props":p}}),[2]}})}),function(e){return n.apply(this,arguments)}),F=r().createElement(r().Fragment,null,r().createElement("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra"},m("Syntax references"),":")," ",r().createElement("a",{href:"https://".concat("zh-CN"===d.language?"docs-cn":"docs",".nocobase.com/handbook/template-handlebars"),target:"_blank",rel:"noreferrer"},"Handlebars.js"));return{title:m("Edit iframe"),asyncGetInitialValues:j(function(){var e,t,r,n,o;return k(this,function(l){switch(l.label){case 0:if(e={mode:b,url:g,height:x,engine:E,params:v,allow:P},!w)return[3,2];return[4,null==(t=(r=h.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:w})];case 1:o=l.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",l.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:m("Edit iframe"),properties:{container:{type:"void","x-component":C,properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:m("URL")},{value:"html",label:m("HTML")}]},url:I(S({},q),{required:!0}),allow:{title:"Allow",type:"string","x-decorator":"FormItem","x-component":function(e){return r().createElement(l.Select,I(S({},e),{allowClear:!0,options:[{value:"autoplay",label:r().createElement(M,{type:"autoplay"})},{value:"camera",label:r().createElement(M,{type:"camera"})},{value:"document-domain",label:r().createElement(M,{type:"document-domain"})},{value:"encrypted-media",label:r().createElement(M,{type:"encrypted-media"})},{value:"fullscreen",label:r().createElement(M,{type:"fullscreen"})},{value:"geolocation",label:r().createElement(M,{type:"geolocation"})},{value:"microphone",label:r().createElement(M,{type:"microphone"})},{value:"midi",label:r().createElement(M,{type:"midi"})},{value:"payment",label:r().createElement(M,{type:"payment"})}]}))},description:r().createElement(T,null)},params:A,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:m("String template")},{value:"handlebars",label:m("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:m("html"),type:"string","x-decorator":"FormItem","x-component":(i=e.Variable.RawTextArea,function(t){var n=(0,o.useFieldSchema)(),l=(0,e.useFormBlockContext)().form,a=(0,e.useRecord)(),c=(0,e.useVariableOptions)({collectionField:{uiSchema:n},form:l,record:a,uiSchema:n,noDisabled:!0});return r().createElement(i,I(S({},t),{scope:c}))}),"x-component-props":{rows:10},required:!0,description:F,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},function(e){"handlebars"===e.form.values.engine?e.description=F:e.description=null}]}}}}},onSubmit:B,noRecord:!0,width:600}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"blockLinkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,a.useTranslation)().t)("Block Linkage rules"),category:e.LinkageRuleCategory.block}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},D=new e.SchemaSettings(S({name:"iframeBlockSchemaSettings"},R)),q=new e.SchemaSettings(S({name:"blockSettings:iframe"},R)),A=m(667),B=m(964);function F(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 N(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function H(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){N(l,n,o,a,i,"next",e)}function i(e){N(l,n,o,a,i,"throw",e)}a(void 0)})}}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(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 W(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 _(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(G=function(){return!!e})()}function V(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];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}}}}function $(){var e,t,r=(e=["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n & > .ant-space-item:nth-child(2) {\n width: 100%;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return $=function(){return r},r}var K=function(t){var n=t.value,o=t.onChange,l=(0,A.useFlowContext)();return r().createElement(e.CodeEditor,W(z({},t),{language:"html",value:n,onChange:o,RightExtra:function(e){var t=e.viewRef;return r().createElement(A.FlowContextSelector,{onChange:function(e){if(e){var r=t.current;if(r){var n=r.state.selection.main,o=n.from,l=n.to,a=o+e.length;r.dispatch({changes:{from:o,to:l,insert:e},selection:{anchor:a},scrollIntoView:!0}),r.focus()}}},metaTree:function(){return l.getPropertyMetaTree()}})}}))},Q=(0,A.observer)(function(n){var o,a=n.url,i=n.htmlId,c=n.mode,s=void 0===c?"url":c,p=n.html,m=n.params,d=n.height,f=_(n,["url","htmlId","mode","html","params","height"]),h=l.theme.useToken().token,y=(0,e.useCompile)(),b=(0,A.useFlowContext)(),g=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(i)},{refreshDeps:[i,p],ready:"html"===s&&!!i}),v=g.loading,w=g.data,O=(o=(0,t.useState)(null),function(e){if(Array.isArray(e))return e}(o)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw n}}return l}}(o,2)||function(e,t){if(e){if("string"==typeof e)return F(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 F(e,t)}}(o,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.")}()),x=O[0],E=O[1];return((0,t.useEffect)(function(){var t,r=!0;return(t=H(function(t){var n,o,l;return V(this,function(i){switch(i.label){case 0:if("html"!==s)return[3,5];if(!t)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,b.liquid.renderWithFullContext(t,b)];case 2:if(void 0===(n=y(i.sent())))return[2];return o="data:text/html;charset=utf-8,"+encodeURIComponent(n),r&&E(o),[3,4];case 3:return console.error(i.sent()),[3,4];case 4:return[3,6];case 5:try{l=(0,e.joinUrlSearch)(a,m),console.log(l),r&&E(l)}catch(e){console.error("Error fetching target URL:",e),r&&E("fallback-url")}i.label=6;case 6:return[2]}})}),function(e){return t.apply(this,arguments)})(w),function(){r=!1}},[w,s,a,m,p,i]),console.log(x),v&&!x)?r().createElement("div",{style:{height:d||"60vh",marginBottom:h.padding,border:0}},r().createElement(l.Spin,null)):r().createElement(u,z({url:x,width:"100%",display:"block",position:"relative",styles:{height:d||"60vh",marginBottom:"24px",border:0}},f))},{displayName:"Iframe"}),J=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=L(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,G()?Reflect.construct(e,t||[],L(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&U(n,e),t=[{key:"render",value:function(){var e=this.props,t=e.url,n=e.htmlId,o=e.mode,a=void 0===o?"url":o;e.html,e.params,_(e,["url","htmlId","mode","html","params"]);var i=this.context.themeToken,c=this.context.t;return("url"!==a||t)&&("html"!==a||n)?r().createElement(Q,this.props):r().createElement(l.Card,{style:{marginBottom:i.padding}},c("Please fill in the iframe URL"))}}],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)}}(n.prototype,t),n}(e.BlockModel),X=function(){var e=(0,a.useTranslation)(),t=e.t,n="zh-CN"===e.i18n.language?"https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe#allow":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow";return r().createElement("span",null,t("Specifies a Permissions Policy for the <iframe>. The policy defines what features are available to the <iframe> (for example, access to the microphone, camera, battery, web-share, etc.) based on the origin of the request."),r().createElement("a",{href:n,target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},Y=function(e){var t=e.type,n=(0,a.useTranslation)(),o=n.t,i=n.i18n,c={autoplay:o("Controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is disabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a NotAllowedError DOMException. The autoplay attribute on <audio> and <video> elements will be ignored."),camera:o("Controls whether the current document is allowed to use video input devices. When this policy is disabled, the Promise returned by getUserMedia() will reject with a NotAllowedError DOMException."),"document-domain":o("Controls whether the current document is allowed to set document.domain. When this policy is disabled, attempting to set document.domain will fail and cause a SecurityError DOMException to be thrown."),"encrypted-media":o("Controls whether the current document is allowed to use the Encrypted Media Extensions API (EME). When this policy is disabled, the Promise returned by Navigator.requestMediaKeySystemAccess() will reject with a SecurityError DOMException."),fullscreen:o("Controls whether the current document is allowed to use Element.requestFullscreen(). When this policy is disabled, the returned Promise rejects with a TypeError."),geolocation:o("Controls whether the current document is allowed to use the Geolocation Interface. When this policy is disabled, calls to getCurrentPosition() and watchPosition() will cause those functions callbacks to be invoked with a GeolocationPositionError code of PERMISSION_DENIED."),microphone:o("Controls whether the current document is allowed to use audio input devices. When this policy is disabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError DOMException."),midi:o("Controls whether the current document is allowed to use the Web MIDI API. When this policy is disabled, the Promise returned by Navigator.requestMIDIAccess() will reject with a SecurityError DOMException."),payment:o("Controls whether the current document is allowed to use the Payment Request API. When this policy is enabled, the PaymentRequest() constructor will throw a SecurityError DOMException.")}[t];return r().createElement("span",null,t,r().createElement(l.Tooltip,{zIndex:9999,title:r().createElement("span",null,c,r().createElement("a",{href:"https://developer.mozilla.org/".concat("zh-CN"===i.language?"zh-CN":"en-US","/docs/Web/HTTP/Reference/Headers/Permissions-Policy/").concat(t),target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},r().createElement(O.QuestionCircleOutlined,null)))};function Z(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function ee(e,t,r){return(ee=eo()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&er(o,r.prototype),o}).apply(null,arguments)}J.registerFlow({key:"cardSettings",title:(0,A.escapeT)("Block settings",{ns:"block-iframe"}),steps:{linkageRules:{use:"blockLinkageRules"}}}),J.registerFlow({key:"iframeBlockSettings",title:(0,A.escapeT)("Iframe block setting",{ns:"block-iframe"}),steps:{editIframe:{title:(0,A.escapeT)("Edit iframe",{ns:"block-iframe"}),uiSchema:function(t){var n=t.t;return{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:n("URL")},{value:"html",label:n("HTML")}]},url:{title:n("URL"),type:"string","x-decorator":"FormItem","x-component":e.TextAreaWithContextSelector,description:n("Do not concatenate search params in the URL"),required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},allow:{title:"Allow",type:"string","x-decorator":"FormItem","x-component":function(e){return r().createElement(l.Select,W(z({},e),{allowClear:!0,options:[{value:"autoplay",label:r().createElement(Y,{type:"autoplay"})},{value:"camera",label:r().createElement(Y,{type:"camera"})},{value:"document-domain",label:r().createElement(Y,{type:"document-domain"})},{value:"encrypted-media",label:r().createElement(Y,{type:"encrypted-media"})},{value:"fullscreen",label:r().createElement(Y,{type:"fullscreen"})},{value:"geolocation",label:r().createElement(Y,{type:"geolocation"})},{value:"microphone",label:r().createElement(Y,{type:"microphone"})},{value:"midi",label:r().createElement(Y,{type:"midi"})},{value:"payment",label:r().createElement(Y,{type:"payment"})}]}))},description:r().createElement(X,null)},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Search parameters")}}',items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%",width:"100%"},className:(0,B.css)($())},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":e.TextAreaWithContextSelector,"x-component-props":{placeholder:'{{t("Value")}}',useTypedConstant:!0,changeOnSelect:!0,rows:1,style:{width:"100%"}}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},html:{title:n("html"),type:"string","x-decorator":"FormItem","x-component":K,"x-component-props":{minHeight:"320px",theme:"light",enableLinter:!0},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},required:!0},height:{title:n("Height"),type:"string","x-decorator":"FormItem","x-component":l.InputNumber,"x-component-props":{addonAfter:"px"},"x-validator":[{minimum:40}]}}},useRawParams:function(e){return"html"===e.model.props.model},beforeParamsSave:function(e,t){return H(function(){var r,n,o,l,a;return V(this,function(i){switch(i.label){case 0:var c;if(r=t.mode,n=t.html,o=t.htmlId,c=H(function(t){var r,n,l,a,i,c,u;return V(this,function(s){switch(s.label){case 0:if(r={values:{html:t}},!o)return[3,2];return[4,null==(n=(l=e.api.resource("iframeHtml")).update)?void 0:n.call(l,W(z({},r),{filterByTk:o}))];case 1:return[2,(null==(i=s.sent().data)||null==(a=i.data)?void 0:a[0])||{id:o}];case 2:return[4,null==(c=(u=e.api.resource("iframeHtml")).create)?void 0:c.call(u,r)];case 3:return[2,s.sent().data];case 4:return[2]}})}),"html"!==r)return[3,2];return[4,function(e){return c.apply(this,arguments)}(n)];case 1:a=i.sent(),e.model.setStepParams("iframeBlockSettings","editIframe",{htmlId:(null==(l=a.data)?void 0:l.id)||(null==a?void 0:a.id)}),i.label=2;case 2:return[2]}})})()},handler:function(e,t){return H(function(){var r,n,o,l,a,i,c;return V(this,function(u){return r=t.mode,n=t.url,o=t.html,l=t.params,a=t.allow,i=t.htmlId,c=t.height,e.model.setProps({mode:r,url:n,html:o,params:l,allow:a,htmlId:i,height:c}),[2]})})()}}}}),J.define({label:(0,A.escapeT)("Iframe")});function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e,t){return(er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function en(e){var t="function"==typeof Map?new Map:void 0;return(en=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 ee(e,arguments,et(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),er(r,e)})(e)}function eo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eo=function(){return!!e})()}var el=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=et(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,eo()?Reflect.construct(e,t||[],et(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&er(r,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){var e,r,n,o;return function(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];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(l){return t.app.schemaSettingsManager.add(D),t.app.schemaSettingsManager.add(q),t.app.use(E),null==(e=t.app.schemaInitializerManager.get("page:addBlock"))||e.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(r=t.app.schemaInitializerManager.get("popup:addNew:addBlock"))||r.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(n=t.app.schemaInitializerManager.get("popup:common:addBlock"))||n.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(o=t.app.schemaInitializerManager.get("RecordFormBlockInitializers"))||o.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.flowEngine.registerModels({IframeBlockModel:J}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){Z(l,n,o,a,i,"next",e)}function i(e){Z(l,n,o,a,i,"throw",e)}a(void 0)})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(en(e.Plugin)),ea=el}(),d}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-iframe",["react-i18next","@emotion/css","@formily/antd-v5","@formily/shared","react","antd","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-block-iframe"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-block-iframe"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/antd-v5"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n,o,l,a,i,c,u){return function(){"use strict";var s,p={911:function(e){var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;e.exports=!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==n.join(""))return!1;var o={};if("abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},o)).join(""))return!1;return!0}catch(e){return!1}}()?function(e,o){for(var l,a,i=function(e){if(null==e)throw TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in l=Object(arguments[c]))r.call(l,u)&&(i[u]=l[u]);if(t){a=t(l);for(var s=0;s<a.length;s++)n.call(l,a[s])&&(i[a[s]]=l[a[s]])}}return i}:Object.assign},375:function(e){e.exports=c},477:function(e){e.exports=t},418:function(e){e.exports=r},230:function(e){e.exports=i},166:function(e){e.exports=n},342:function(e){e.exports=a},694:function(e){e.exports=u},59:function(e){e.exports=l},155:function(e){e.exports=o},953:function(t){t.exports=e}},m={};function f(e){var t=m[e];if(void 0!==t)return t.exports;var r=m[e]={exports:{}};return p[e](r,r.exports,f),r.exports}f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(d=f.g.location+"");var d,h=f.g.document;if(!d&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(d=h.currentScript.src),!d)){var y=h.getElementsByTagName("script");if(y.length)for(var b=y.length-1;b>-1&&(!d||!/^http(s?):/.test(d));)d=y[b--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");f.p=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var v={};return"/"!==(s=window.__webpack_public_path__||"/").charAt(s.length-1)&&(s+="/"),f.p=s+"static/plugins/@nocobase/plugin-block-iframe/dist/client/",!function(){f.r(v),f.d(v,{PluginBlockIframeClient:function(){return el},default:function(){return ea}});var e=f(342),t=f(155),r=f.n(t),n=f(418),o=f(230),l=f(59),a=f(953),i=f(911),c=f.n(i),u=({url:e,allowFullScreen:t,position:n,display:o,height:l,width:a,overflow:i,styles:u,onLoad:s,onMouseOver:p,onMouseOut:m,scrolling:f,id:d,frameBorder:h,ariaHidden:y,sandbox:b,allow:v,className:g,title:w,ariaLabel:O,ariaLabelledby:x,name:E,target:j,loading:P,importance:I,referrerpolicy:S,allowpaymentrequest:k,src:C,key:M})=>{let T=c()({src:C||e,target:j||null,style:{position:n||null,display:o||"initial",overflow:i||null},scrolling:f||null,allowpaymentrequest:k||null,importance:I||null,sandbox:b&&[...b].join(" ")||null,loading:P||null,styles:u||null,name:E||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:S||null,title:w||null,allow:v||null,id:d||null,"aria-labelledby":x||null,"aria-hidden":y||null,"aria-label":O||null,width:a||null,height:l||null,onLoad:s||null,onMouseOver:p||null,onMouseOut:m||null,key:M||"iframe"}),R=Object.create(null);for(let e of Object.keys(T))null!=T[e]&&(R[e]=T[e]);for(let e of Object.keys(R.style))null==R.style[e]&&delete R.style[e];if(R.styles)for(let e of Object.keys(R.styles))R.styles.hasOwnProperty(e)&&(R.style[e]=R.styles[e]),Object.keys(R.styles).pop()==e&&delete R.styles;if(t)if("allow"in R){let e=R.allow.replace("fullscreen","");R.allow=`fullscreen ${e.trim()}`.trim()}else R.allow="fullscreen";return h>=0&&!R.style.hasOwnProperty("border")&&(R.style.border=h),r().createElement("iframe",Object.assign({},R))},s=f(166);function p(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){p(l,n,o,a,i,"next",e)}function i(e){p(l,n,o,a,i,"throw",e)}a(void 0)})}}function d(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 h(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,n=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function y(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 b(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function g(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}var w=(0,o.observer)(function(n){var i,c=n.url,s=n.htmlId,p=n.mode,m=void 0===p?"url":p,f=n.height,d=(n.html,n.params),h=n.engine,v=function(e,t){if(null==e)return{};var r,n,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}(n,["url","htmlId","mode","height","html","params","engine"]),w=(0,o.useField)(),O=(0,a.useTranslation)().t,x=l.theme.useToken().token,E=(0,e.useBlockHeight)()||f,j=(0,e.useVariables)(),P=(0,e.useLocalVariables)(),I=(0,e.useCompile)(),S=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(s)},{refreshDeps:[s,w.data],ready:"html"===m&&!!s}),k=S.loading,C=S.data,M=(0,e.useParseURLAndParams)().parseURLAndParams,T=function(e){if(Array.isArray(e))return e}(i=(0,t.useState)(null))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],l=!0,a=!1;try{for(n=n.call(e);!(l=(t=n.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==n.return||n.return()}finally{if(a)throw r}}return o}}(i)||function(e){if(e){if("string"==typeof e)return y(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y(e,2)}}(i)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),R=T[0],D=T[1];return((0,t.useEffect)(function(){var t;(t=function(){var t;return function(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,n=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:if("html"!==m)return[3,2];return[4,(0,e.getRenderContent)(h,C,I(j),I(P),function(e){return e})];case 1:if(void 0===(t=r.sent()))return[2];return D("data:text/html;charset=utf-8,"+encodeURIComponent(t)),[3,5];case 2:return r.trys.push([2,4,,5]),[4,M(c,d||[])];case 3:return D(r.sent()),[3,5];case 4:return console.error("Error fetching target URL:",r.sent()),D("fallback-url"),[3,5];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var l=t.apply(e,r);function a(e){b(l,n,o,a,i,"next",e)}function i(e){b(l,n,o,a,i,"throw",e)}a(void 0)})})()},[C,m,c,j,P,d]),("url"!==m||c)&&("html"!==m||s))?k&&!R?r().createElement("div",{style:{height:g(E)?"".concat(E,"px"):E||"60vh",marginBottom:x.padding,border:0}},r().createElement(l.Spin,null)):r().createElement(u,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}({url:R,width:"100%",display:"block",position:"relative",styles:{height:g(E)?"".concat(E,"px"):E||"60vh",marginBottom:"24px",border:0}},v)):r().createElement(l.Card,{style:{marginBottom:x.padding,height:g(E)?"".concat(E,"px"):E}},O("Please fill in the iframe URL"))},{displayName:"Iframe"});w.Designer=function(){var t=(0,o.useField)(),n=(0,o.useFieldSchema)(),l=(0,a.useTranslation)().t,i=(0,e.useDesignable)().dn,c=(0,e.useAPIClient)(),u=n["x-component-props"]||{},p=u.mode,f=u.url,y=u.htmlId,b=u.height,v=void 0===b?"60vh":b;u.engine;var g=(0,e.useFormBlockContext)().form,w=(0,e.useRecord)(),O=(0,e.useVariableOptions)({collectionField:{uiSchema:n},form:g,record:w,uiSchema:n,noDisabled:!0});return r().createElement(e.GeneralSchemaDesigner,null,r().createElement(e.SchemaSettingsModalItem,{title:l("Edit iframe"),asyncGetInitialValues:function(){return m(function(){var e,t,r,n,o;return h(this,function(l){switch(l.label){case 0:if(e={mode:p,url:f,height:v},!y)return[3,2];return[4,null==(t=(r=c.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:y})];case 1:o=l.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",l.label=2;case 2:return[2,e]}})})()},schema:{type:"object",title:l("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:l("URL")},{value:"html",label:l("HTML")}]},url:{title:l("URL"),type:"string","x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:O},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",enum:[{value:"string",label:l("String template")},{value:"handlebars",label:l("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:l("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:O,style:{minHeight:"200px"}},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},height:{title:l("Height"),type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},onSubmit:function(e){var r=e.mode,o=e.url,l=e.html,a=e.height,u=e.engine;return m(function(){var e,p;return h(this,function(f){switch(f.label){case 0:if((e=n["x-component-props"]||{}).mode=r,e.height=a,e.url=o,e.engine=u||"string","html"!==r)return[3,2];return[4,m(function(){var e,t,r,n,o,a,i,u;return h(this,function(s){switch(s.label){case 0:var p,m;if(e={values:{html:l}},!y)return[3,2];return[4,null==(t=(r=c.resource("iframeHtml")).update)?void 0:t.call(r,(p=d({},e),m=m={filterByTk:y},Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(m)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(m)).forEach(function(e){Object.defineProperty(p,e,Object.getOwnPropertyDescriptor(m,e))}),p))];case 1:return[2,(null==(o=s.sent().data)||null==(n=o.data)?void 0:n[0])||{id:y}];case 2:return[4,null==(a=(i=c.resource("iframeHtml")).create)?void 0:a.call(i,e)];case 3:return[2,null==(u=s.sent().data)?void 0:u.data];case 4:return[2]}})})()];case 1:p=f.sent(),e.htmlId=p.id,f.label=2;case 2:return n["x-component-props"]=e,t.componentProps=d({},e),t.data={v:(0,s.uid)()},i.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":e}}),[2]}})})()}}),r().createElement(e.SchemaSettingsDivider,null),r().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))};var O=f(375),x=function(){var t,n,o=(0,e.useSchemaInitializer)().insert,l=(0,e.useSchemaInitializerItem)();return r().createElement(e.SchemaInitializerItem,(t=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}({},l),n=n={icon:r().createElement(O.PicRightOutlined,null),onClick:function(){o({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},E=function(t){return r().createElement(e.SchemaComponentOptions,{components:{Iframe:w,IframeBlockInitializer:x,ArrayItems:n.ArrayItems}},t.children)};function j(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function P(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){j(l,n,o,a,i,"next",e)}function i(e){j(l,n,o,a,i,"throw",e)}a(void 0)})}}function I(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 S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function k(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,n=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var C=function(t){return r().createElement(e.FlagProvider,{collectionField:!0},t.children)},M=function(e){var t=e.type,n=(0,a.useTranslation)(),o=n.t,i=n.i18n,c={autoplay:o("Controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is disabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a NotAllowedError DOMException. The autoplay attribute on <audio> and <video> elements will be ignored."),camera:o("Controls whether the current document is allowed to use video input devices. When this policy is disabled, the Promise returned by getUserMedia() will reject with a NotAllowedError DOMException."),"document-domain":o("Controls whether the current document is allowed to set document.domain. When this policy is disabled, attempting to set document.domain will fail and cause a SecurityError DOMException to be thrown."),"encrypted-media":o("Controls whether the current document is allowed to use the Encrypted Media Extensions API (EME). When this policy is disabled, the Promise returned by Navigator.requestMediaKeySystemAccess() will reject with a SecurityError DOMException."),fullscreen:o("Controls whether the current document is allowed to use Element.requestFullscreen(). When this policy is disabled, the returned Promise rejects with a TypeError."),geolocation:o("Controls whether the current document is allowed to use the Geolocation Interface. When this policy is disabled, calls to getCurrentPosition() and watchPosition() will cause those functions callbacks to be invoked with a GeolocationPositionError code of PERMISSION_DENIED."),microphone:o("Controls whether the current document is allowed to use audio input devices. When this policy is disabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError DOMException."),midi:o("Controls whether the current document is allowed to use the Web MIDI API. When this policy is disabled, the Promise returned by Navigator.requestMIDIAccess() will reject with a SecurityError DOMException."),payment:o("Controls whether the current document is allowed to use the Payment Request API. When this policy is enabled, the PaymentRequest() constructor will throw a SecurityError DOMException.")}[t];return r().createElement("span",null,t," ",r().createElement(l.Tooltip,{zIndex:9999,title:r().createElement("span",null,c," ",r().createElement("a",{href:"https://developer.mozilla.org/".concat("zh-CN"===i.language?"zh-CN":"en-US","/docs/Web/HTTP/Reference/Headers/Permissions-Policy/").concat(t),target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},r().createElement(O.QuestionCircleOutlined,null)))},T=function(){var e=(0,a.useTranslation)(),t=e.t,n="zh-CN"===e.i18n.language?"https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe#allow":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow";return r().createElement("span",null,t("Specifies a Permissions Policy for the <iframe>. The policy defines what features are available to the <iframe> (for example, access to the microphone, camera, battery, web-share, etc.) based on the origin of the request.")," ",r().createElement("a",{href:n,target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},R={items:[{name:"EditIframe",type:"modal",useComponentProps:function(){var t,n=(0,o.useField)(),i=(0,o.useFieldSchema)(),c=(0,a.useTranslation)(),u=c.t,p=c.i18n,m=(0,e.useDesignable)().dn,f=(0,e.useAPIClient)(),d=i["x-component-props"]||{},h=d.mode,y=d.url,b=d.params,v=d.htmlId,g=d.height,w=void 0===g?"60vh":g,O=d.engine,x=d.allow,E=(0,e.useURLAndHTMLSchema)(),j=E.urlSchema,R=E.paramsSchema,D=r().createElement(r().Fragment,null,r().createElement("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra"},u("Syntax references"),":")," ",r().createElement("a",{href:"https://".concat("zh-CN"===p.language?"docs-cn":"docs",".nocobase.com/handbook/template-handlebars"),target:"_blank",rel:"noreferrer"},"Handlebars.js"));return{title:u("Edit iframe"),asyncGetInitialValues:function(){return P(function(){var e,t,r,n,o;return k(this,function(l){switch(l.label){case 0:if(e={mode:h,url:y,height:w,engine:O,params:b,allow:x},!v)return[3,2];return[4,null==(t=(r=f.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:v})];case 1:o=l.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",l.label=2;case 2:return[2,e]}})})()},schema:{type:"object",title:u("Edit iframe"),properties:{container:{type:"void","x-component":C,properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:u("URL")},{value:"html",label:u("HTML")}]},url:S(I({},j),{required:!0}),allow:{title:"Allow",type:"string","x-decorator":"FormItem","x-component":function(e){return r().createElement(l.Select,S(I({},e),{allowClear:!0,options:[{value:"autoplay",label:r().createElement(M,{type:"autoplay"})},{value:"camera",label:r().createElement(M,{type:"camera"})},{value:"document-domain",label:r().createElement(M,{type:"document-domain"})},{value:"encrypted-media",label:r().createElement(M,{type:"encrypted-media"})},{value:"fullscreen",label:r().createElement(M,{type:"fullscreen"})},{value:"geolocation",label:r().createElement(M,{type:"geolocation"})},{value:"microphone",label:r().createElement(M,{type:"microphone"})},{value:"midi",label:r().createElement(M,{type:"midi"})},{value:"payment",label:r().createElement(M,{type:"payment"})}]}))},description:r().createElement(T,null)},params:R,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:u("String template")},{value:"handlebars",label:u("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:u("html"),type:"string","x-decorator":"FormItem","x-component":(t=e.Variable.RawTextArea,function(n){var l=(0,o.useFieldSchema)(),a=(0,e.useFormBlockContext)().form,i=(0,e.useRecord)(),c=(0,e.useVariableOptions)({collectionField:{uiSchema:l},form:a,record:i,uiSchema:l,noDisabled:!0});return r().createElement(t,S(I({},n),{scope:c}))}),"x-component-props":{rows:10},required:!0,description:D,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},function(e){"handlebars"===e.form.values.engine?e.description=D:e.description=null}]}}}}},ModalContextProvider:function(t){return r().createElement(e.VariableScope,{scopeId:null==i?void 0:i["x-uid"],type:"iframeBlock"},t.children)},onSubmit:function(e){var t=e.mode,r=e.url,o=e.html,l=e.height,a=e.params,c=e.engine,u=e.allow;return P(function(){var e,p;return k(this,function(d){switch(d.label){case 0:if((e=i["x-component-props"]||{}).mode=t,e.height=l,e.engine=c||"string",e.params=a,e.url=r,e.allow=u,"html"!==t)return[3,2];return[4,P(function(){var e,t,r,n,l,a,i,c;return k(this,function(u){switch(u.label){case 0:if(e={values:{html:o}},!v)return[3,2];return[4,null==(t=(r=f.resource("iframeHtml")).update)?void 0:t.call(r,S(I({},e),{filterByTk:v}))];case 1:return[2,(null==(l=u.sent().data)||null==(n=l.data)?void 0:n[0])||{id:v}];case 2:return[4,null==(a=(i=f.resource("iframeHtml")).create)?void 0:a.call(i,e)];case 3:return[2,null==(c=u.sent().data)?void 0:c.data];case 4:return[2]}})})()];case 1:p=d.sent(),e.htmlId=p.id,d.label=2;case 2:return i["x-component-props"]=e,n.componentProps=I({},e),n.data={v:(0,s.uid)()},m.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":e}}),[2]}})})()},noRecord:!0,width:600}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"blockLinkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,a.useTranslation)().t)("Block Linkage rules"),category:e.LinkageRuleCategory.block}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},D=new e.SchemaSettings(I({name:"iframeBlockSchemaSettings"},R)),q=new e.SchemaSettings(I({name:"blockSettings:iframe"},R)),A=f(694),B=f(477);function F(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 N(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function H(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){N(l,n,o,a,i,"next",e)}function i(e){N(l,n,o,a,i,"throw",e)}a(void 0)})}}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(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 _(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function W(e,t){if(null==e)return{};var r,n,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(G=function(){return!!e})()}function $(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,n=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function V(){var e,t,r=(e=["\n & > .ant-space-item:first-child,\n & > .ant-space-item:last-child {\n flex-shrink: 0;\n }\n & > .ant-space-item:nth-child(2) {\n width: 100%;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return V=function(){return r},r}var K=function(t){var n=t.value,o=t.onChange,l=(0,A.useFlowContext)();return r().createElement(e.CodeEditor,_(z({},t),{language:"html",value:n,onChange:o,RightExtra:function(e){var t=e.viewRef;return r().createElement(A.FlowContextSelector,{onChange:function(e){if(e){var r=t.current;if(r){var n=r.state.selection.main,o=n.from,l=n.to,a=o+e.length;r.dispatch({changes:{from:o,to:l,insert:e},selection:{anchor:a},scrollIntoView:!0}),r.focus()}}},metaTree:function(){return l.getPropertyMetaTree()}})}}))},Q=(0,A.observer)(function(n){var o,a=n.url,i=n.htmlId,c=n.mode,s=void 0===c?"url":c,p=n.html,m=n.params,f=n.heightMode,d=W(n,["url","htmlId","mode","html","params","heightMode"]);l.theme.useToken().token;var h=(0,e.useCompile)(),y=(0,A.useFlowContext)(),b=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(i)},{refreshDeps:[i,p],ready:"html"===s&&!!i}),v=b.loading,g=b.data,w=function(e){if(Array.isArray(e))return e}(o=(0,t.useState)(null))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],l=!0,a=!1;try{for(n=n.call(e);!(l=(t=n.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==n.return||n.return()}finally{if(a)throw r}}return o}}(o)||function(e){if(e){if("string"==typeof e)return F(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return F(e,2)}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),O=w[0],x=w[1];return((0,t.useEffect)(function(){var t=!0;return H(function(){var r,n,o;return $(this,function(l){switch(l.label){case 0:if("html"!==s)return[3,5];if(!g)return[2];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,y.liquid.renderWithFullContext(g,y)];case 2:if(void 0===(r=h(l.sent())))return[2];return n="data:text/html;charset=utf-8,"+encodeURIComponent(r),t&&x(n),[3,4];case 3:return console.error(l.sent()),[3,4];case 4:return[3,6];case 5:try{o=(0,e.joinUrlSearch)(a,m),t&&x(o)}catch(e){console.error("Error fetching target URL:",e),t&&x("fallback-url")}l.label=6;case 6:return[2]}})})(),function(){t=!1}},[g,s,a,m,p,i]),v&&!O)?r().createElement("div",{style:{height:"defaultHeight"===f?"60vh":"100%",border:0}},r().createElement(l.Spin,null)):r().createElement(u,z({url:O,width:"100%",display:"block",position:"relative",styles:{height:"defaultHeight"===f?"60vh":"100%",border:0}},d))},{displayName:"Iframe"}),J=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=L(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,G()?Reflect.construct(e,t||[],L(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&U(n,e),t=[{key:"renderComponent",value:function(){var e=this.props,t=e.url,n=e.htmlId,o=e.mode,a=void 0===o?"url":o;e.html,e.params,W(e,["url","htmlId","mode","html","params"]);var i=this.decoratorProps.heightMode,c=this.context.themeToken,u=this.context.t;return("url"!==a||t)&&("html"!==a||n)?r().createElement(Q,_(z({},this.props),{heightMode:i})):r().createElement(l.Card,{style:{marginBottom:c.padding}},u("Please fill in the iframe URL"))}}],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)}}(n.prototype,t),n}(e.BlockModel),X=function(){var e=(0,a.useTranslation)(),t=e.t,n="zh-CN"===e.i18n.language?"https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe#allow":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow";return r().createElement("span",null,t("Specifies a Permissions Policy for the <iframe>. The policy defines what features are available to the <iframe> (for example, access to the microphone, camera, battery, web-share, etc.) based on the origin of the request."),r().createElement("a",{href:n,target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},Y=function(e){var t=e.type,n=(0,a.useTranslation)(),o=n.t,i=n.i18n,c={autoplay:o("Controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is disabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a NotAllowedError DOMException. The autoplay attribute on <audio> and <video> elements will be ignored."),camera:o("Controls whether the current document is allowed to use video input devices. When this policy is disabled, the Promise returned by getUserMedia() will reject with a NotAllowedError DOMException."),"document-domain":o("Controls whether the current document is allowed to set document.domain. When this policy is disabled, attempting to set document.domain will fail and cause a SecurityError DOMException to be thrown."),"encrypted-media":o("Controls whether the current document is allowed to use the Encrypted Media Extensions API (EME). When this policy is disabled, the Promise returned by Navigator.requestMediaKeySystemAccess() will reject with a SecurityError DOMException."),fullscreen:o("Controls whether the current document is allowed to use Element.requestFullscreen(). When this policy is disabled, the returned Promise rejects with a TypeError."),geolocation:o("Controls whether the current document is allowed to use the Geolocation Interface. When this policy is disabled, calls to getCurrentPosition() and watchPosition() will cause those functions callbacks to be invoked with a GeolocationPositionError code of PERMISSION_DENIED."),microphone:o("Controls whether the current document is allowed to use audio input devices. When this policy is disabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError DOMException."),midi:o("Controls whether the current document is allowed to use the Web MIDI API. When this policy is disabled, the Promise returned by Navigator.requestMIDIAccess() will reject with a SecurityError DOMException."),payment:o("Controls whether the current document is allowed to use the Payment Request API. When this policy is enabled, the PaymentRequest() constructor will throw a SecurityError DOMException.")}[t];return r().createElement("span",null,t,r().createElement(l.Tooltip,{zIndex:9999,title:r().createElement("span",null,c,r().createElement("a",{href:"https://developer.mozilla.org/".concat("zh-CN"===i.language?"zh-CN":"en-US","/docs/Web/HTTP/Reference/Headers/Permissions-Policy/").concat(t),target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},r().createElement(O.QuestionCircleOutlined,null)))};function Z(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function ee(e,t,r){return(ee=eo()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&er(o,r.prototype),o}).apply(null,arguments)}J.registerFlow({key:"iframeBlockSettings",title:(0,A.escapeT)("Iframe block setting",{ns:"block-iframe"}),steps:{editIframe:{title:(0,A.escapeT)("Edit iframe",{ns:"block-iframe"}),uiSchema:function(t){var n=t.t;return{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:n("URL")},{value:"html",label:n("HTML")}]},url:{title:n("URL"),type:"string","x-decorator":"FormItem","x-component":e.TextAreaWithContextSelector,description:n("Do not concatenate search params in the URL"),required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},allow:{title:"Allow",type:"string","x-decorator":"FormItem","x-component":function(e){return r().createElement(l.Select,_(z({},e),{allowClear:!0,options:[{value:"autoplay",label:r().createElement(Y,{type:"autoplay"})},{value:"camera",label:r().createElement(Y,{type:"camera"})},{value:"document-domain",label:r().createElement(Y,{type:"document-domain"})},{value:"encrypted-media",label:r().createElement(Y,{type:"encrypted-media"})},{value:"fullscreen",label:r().createElement(Y,{type:"fullscreen"})},{value:"geolocation",label:r().createElement(Y,{type:"geolocation"})},{value:"microphone",label:r().createElement(Y,{type:"microphone"})},{value:"midi",label:r().createElement(Y,{type:"midi"})},{value:"payment",label:r().createElement(Y,{type:"payment"})}]}))},description:r().createElement(X,null)},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:'{{t("Search parameters")}}',items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{style:{flexWrap:"nowrap",maxWidth:"100%",width:"100%"},className:(0,B.css)(V())},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":e.TextAreaWithContextSelector,"x-component-props":{placeholder:'{{t("Value")}}',useTypedConstant:!0,changeOnSelect:!0,rows:1,style:{width:"100%"}}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},html:{title:n("html"),type:"string","x-decorator":"FormItem","x-component":K,"x-component-props":{minHeight:"320px",theme:"light",enableLinter:!0},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},required:!0},height:{title:n("Height"),type:"string","x-decorator":"FormItem","x-component":l.InputNumber,"x-component-props":{addonAfter:"px"},"x-validator":[{minimum:40}]}}},useRawParams:function(e){return"html"===e.model.props.model},beforeParamsSave:function(e,t){return H(function(){var r,n,o,l,a;return $(this,function(i){switch(i.label){case 0:if(r=t.mode,n=t.html,o=t.htmlId,"html"!==r)return[3,2];return[4,H(function(){var t,r,l,a,i,c,u;return $(this,function(s){switch(s.label){case 0:if(t={values:{html:n}},!o)return[3,2];return[4,null==(r=(l=e.api.resource("iframeHtml")).update)?void 0:r.call(l,_(z({},t),{filterByTk:o}))];case 1:return[2,(null==(i=s.sent().data)||null==(a=i.data)?void 0:a[0])||{id:o}];case 2:return[4,null==(c=(u=e.api.resource("iframeHtml")).create)?void 0:c.call(u,t)];case 3:return[2,s.sent().data];case 4:return[2]}})})()];case 1:a=i.sent(),e.model.setStepParams("iframeBlockSettings","editIframe",{htmlId:(null==(l=a.data)?void 0:l.id)||(null==a?void 0:a.id)}),i.label=2;case 2:return[2]}})})()},handler:function(e,t){return H(function(){var r,n,o,l,a,i,c;return $(this,function(u){return r=t.mode,n=t.url,o=t.html,l=t.params,a=t.allow,i=t.htmlId,c=t.height,e.model.setProps({mode:r,url:n,html:o,params:l,allow:a,htmlId:i,height:c}),[2]})})()}}}}),J.define({label:(0,A.escapeT)("Iframe")});function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e,t){return(er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function en(e){var t="function"==typeof Map?new Map:void 0;return(en=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 ee(e,arguments,et(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),er(r,e)})(e)}function eo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eo=function(){return!!e})()}var el=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=et(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eo()?Reflect.construct(e,t||[],et(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&er(r,e),t=[{key:"load",value:function(){var e;return(e=function(){var e,t,r,n;return function(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,n=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(o){return this.app.schemaSettingsManager.add(D),this.app.schemaSettingsManager.add(q),this.app.use(E),null==(e=this.app.schemaInitializerManager.get("page:addBlock"))||e.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(t=this.app.schemaInitializerManager.get("popup:addNew:addBlock"))||t.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(r=this.app.schemaInitializerManager.get("popup:common:addBlock"))||r.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(n=this.app.schemaInitializerManager.get("RecordFormBlockInitializers"))||n.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.flowEngine.registerModels({IframeBlockModel:J}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){Z(l,n,o,a,i,"next",e)}function i(e){Z(l,n,o,a,i,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(en(e.Plugin)),ea=el}(),v}()});
@@ -9,5 +9,5 @@
9
9
  import React from 'react';
10
10
  import { BlockModel } from '@nocobase/client';
11
11
  export declare class IframeBlockModel extends BlockModel {
12
- render(): React.JSX.Element;
12
+ renderComponent(): React.JSX.Element;
13
13
  }
@@ -10,16 +10,16 @@
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.7",
12
12
  "@formily/shared": "2.3.7",
13
- "@nocobase/client": "2.1.0-alpha.1",
13
+ "@nocobase/client": "2.1.0-alpha.10",
14
14
  "react": "18.2.0",
15
15
  "react-i18next": "11.18.6",
16
16
  "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
18
  "@formily/antd-v5": "1.2.3",
19
- "@nocobase/server": "2.1.0-alpha.1",
20
- "@nocobase/test": "2.1.0-alpha.1",
21
- "@nocobase/flow-engine": "2.1.0-alpha.1",
19
+ "@nocobase/server": "2.1.0-alpha.10",
20
+ "@nocobase/test": "2.1.0-alpha.10",
21
+ "@nocobase/flow-engine": "2.1.0-alpha.10",
22
22
  "@emotion/css": "11.13.0",
23
- "@nocobase/actions": "2.1.0-alpha.1",
24
- "@nocobase/database": "2.1.0-alpha.1"
23
+ "@nocobase/actions": "2.1.0-alpha.10",
24
+ "@nocobase/database": "2.1.0-alpha.10"
25
25
  };
package/package.json CHANGED
@@ -6,8 +6,8 @@
6
6
  "description": "Create an iframe block on the page to embed and display external web pages or content.",
7
7
  "description.ru-RU": "Создавайте iframe-блоки и управляйте ими на странице для встраивания и отображения внешних веб-страниц или контента.",
8
8
  "description.zh-CN": "在页面上创建和管理iframe,用于嵌入和展示外部网页或内容。",
9
- "version": "2.1.0-alpha.1",
10
- "license": "AGPL-3.0",
9
+ "version": "2.1.0-alpha.10",
10
+ "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/block-iframe",
13
13
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/block-iframe",
@@ -28,7 +28,7 @@
28
28
  "@nocobase/server": "2.x",
29
29
  "@nocobase/test": "2.x"
30
30
  },
31
- "gitHead": "d27baf21569643d6fa83f882233f4e90eb5b89f1",
31
+ "gitHead": "ce790d46c0a5768ca9618c7d0d77ab8300de75c8",
32
32
  "keywords": [
33
33
  "Blocks"
34
34
  ]