@nocobase/plugin-block-iframe 2.0.0-alpha.57 → 2.0.0-alpha.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@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,o.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("@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,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.0.0-alpha.57",
13
+ "@nocobase/client": "2.0.0-alpha.59",
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.0.0-alpha.57",
20
- "@nocobase/test": "2.0.0-alpha.57",
21
- "@nocobase/flow-engine": "2.0.0-alpha.57",
19
+ "@nocobase/server": "2.0.0-alpha.59",
20
+ "@nocobase/test": "2.0.0-alpha.59",
21
+ "@nocobase/flow-engine": "2.0.0-alpha.59",
22
22
  "@emotion/css": "11.13.0",
23
- "@nocobase/actions": "2.0.0-alpha.57",
24
- "@nocobase/database": "2.0.0-alpha.57"
23
+ "@nocobase/actions": "2.0.0-alpha.59",
24
+ "@nocobase/database": "2.0.0-alpha.59"
25
25
  };
package/package.json CHANGED
@@ -6,7 +6,7 @@
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.0.0-alpha.57",
9
+ "version": "2.0.0-alpha.59",
10
10
  "license": "AGPL-3.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.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": "b9ec8bc83fd86a9cadfc4fb2f87a4e015061b289",
31
+ "gitHead": "ca9fca2a826b17735c6287bebf877b2da9a00e24",
32
32
  "keywords": [
33
33
  "Blocks"
34
34
  ]